Re: [gentoo-dev] golang-build.eclass updates
On Wed, Jul 22, 2015 at 05:19:11PM -0500, William Hubbs wrote: > All, > > after some testing, i decided that the eclass should make both the > golibdir and the prefixed version of it available with functions. > > The reason for this is that the prefixed golibdir should be part of > GOPATH when building packages. > > The functions are get_golibdir and get_golibdir_gopath. > > Here's the updated patch. > > William > This is committed. However, I have thought of another variation I will be looking into today and posting. I believe I can separate out some base functions into their own eclass to allow them to be used with Go packages that use build systems besides the go commands. William signature.asc Description: Digital signature
Re: [gentoo-dev] golang-build.eclass updates
On Thu, Jul 23, 2015 at 12:37:59AM +0200, Manuel Rüger wrote: > On 23.07.2015 00:19, William Hubbs wrote: > > All, > > > > after some testing, i decided that the eclass should make both the > > golibdir and the prefixed version of it available with functions. > > > > The reason for this is that the prefixed golibdir should be part of > > GOPATH when building packages. > > > > The functions are get_golibdir and get_golibdir_gopath. > > > > Here's the updated patch. > > > > William > > > > Have you tested this with FEATURES="multilib-strict"? > > I guess you need $(get_libdir) from multilib eclass to set the correct > libpath. > > Manuel > > No, because Go has its own way of separating architecture/os specific packages. /usr/lib/go is the standard Go library and /usr/lib/go-gentoo will hold third party Go packages. Under them, there are src directories and directories named ${GOOS}_${GOARCH} which store the packages for the specific OS/ARCH. William signature.asc Description: Digital signature
Re: [gentoo-dev] golang-build.eclass updates
On 23.07.2015 00:19, William Hubbs wrote: > All, > > after some testing, i decided that the eclass should make both the > golibdir and the prefixed version of it available with functions. > > The reason for this is that the prefixed golibdir should be part of > GOPATH when building packages. > > The functions are get_golibdir and get_golibdir_gopath. > > Here's the updated patch. > > William > Have you tested this with FEATURES="multilib-strict"? I guess you need $(get_libdir) from multilib eclass to set the correct libpath. Manuel signature.asc Description: OpenPGP digital signature
Re: [gentoo-dev] golang-build.eclass updates
All, after some testing, i decided that the eclass should make both the golibdir and the prefixed version of it available with functions. The reason for this is that the prefixed golibdir should be part of GOPATH when building packages. The functions are get_golibdir and get_golibdir_gopath. Here's the updated patch. William Index: golang-build.eclass === RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v retrieving revision 1.4 diff -u -B -r1.4 golang-build.eclass --- golang-build.eclass 6 Jul 2015 16:48:21 - 1.4 +++ golang-build.eclass 22 Jul 2015 22:05:03 - @@ -48,11 +48,40 @@ return 0 } +# @FUNCTION: get_golibdir +# @DESCRIPTION: +# Return the non-prefixed library directory where Go packages +# should be installed +get_golibdir() { + echo /usr/lib/go-gentoo +} + +# @FUNCTION: get_golibdir +# @DESCRIPTION: +# Return the library directory where Go packages should be installed +# This is the prefixed version which should be included in GOPATH +get_golibdir_gopath() { + echo "${EPREFIX}$(get_golibdir)" +} + +# @FUNCTION: golang_install_pkgs +# @DESCRIPTION: +# Install Go packages. +# This function assumes that $cwd is a Go workspace. +golang_install_pkgs() { + debug-print-function ${FUNCNAME} "$@" + + _golang-build_setup + insinto "$(get_golibdir)" + insopts -m0644 -p # preserve timestamps for bug 551486 + doins -r pkg src +} + golang-build_src_compile() { debug-print-function ${FUNCNAME} "$@" _golang-build_setup - set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ + set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ go build -v -work -x "${EGO_PN}" echo "$@" "$@" || die @@ -62,20 +91,18 @@ debug-print-function ${FUNCNAME} "$@" _golang-build_setup - set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ + set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ go install -v -work -x "${EGO_PN}" echo "$@" "$@" || die - insinto /usr/lib/go-gentoo - insopts -m0644 -p # preserve timestamps for bug 551486 - doins -r pkg src + golang_install_pkgs } golang-build_src_test() { debug-print-function ${FUNCNAME} "$@" _golang-build_setup - set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ + set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \ go test -v -work -x "${EGO_PN}" echo "$@" "$@" || die signature.asc Description: Digital signature
Re: [gentoo-dev] golang-build.eclass updates
On Wed, Jul 22, 2015 at 7:36 PM, William Hubbs wrote: > Let me know what you think. I tried to use your eclass recently, but it failed with this error: * Call stack: *ebuild.sh, line 765: Called __ebuild_main 'compile' * phase-functions.sh, line 968: Called __dyn_compile * phase-functions.sh, line 447: Called die * The specific snippet of code: * die "The source directory '${S}' doesn't exist" Do you have any minimal examples of how to use the eclass? I've been experimenting with a syncthing package, but that's a bit different from the go-text or go-crypto packages you've converted so far. Cheers, Dirkjan
Re: [gentoo-dev] golang-build.eclass updates
unsubscribe On Thu, Jul 23, 2015 at 3:36 AM, William Hubbs wrote: > All, > > the following backward compatible update makes the go package path > visible to ebuilds and separates the code that installs Go packages into > its own function which can be called by ebuilds. > > Let me know what you think. > > William > >
[gentoo-dev] golang-build.eclass updates
All, the following backward compatible update makes the go package path visible to ebuilds and separates the code that installs Go packages into its own function which can be called by ebuilds. Let me know what you think. William Index: golang-build.eclass === RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v retrieving revision 1.4 diff -u -B -r1.4 golang-build.eclass --- golang-build.eclass 6 Jul 2015 16:48:21 - 1.4 +++ golang-build.eclass 22 Jul 2015 17:13:43 - @@ -48,11 +48,40 @@ return 0 } +# @FUNCTION: _get_golibdir +# @INTERNAL +# @DESCRIPTION: +# Return the non-prefixed library directory where Go packages +# should be installed +_get_golibdir() { + echo /usr/lib/go-gentoo +} + +# @FUNCTION: get_golibdir +# @DESCRIPTION: +# Return the library directory where Go packages should be installed +get_golibdir() { + echo "${EPREFIX}$(_get_golibdir)" +} + +# @FUNCTION: golang_install_pkgs +# @DESCRIPTION: +# Install Go packages. +# This function assumes that $cwd is a Go workspace. +golang_install_pkgs() { + debug-print-function ${FUNCNAME} "$@" + + _golang-build_setup + insinto "$(_get_golibdir)" + insopts -m0644 -p # preserve timestamps for bug 551486 + doins -r pkg src +} + golang-build_src_compile() { debug-print-function ${FUNCNAME} "$@" _golang-build_setup - set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ + set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir)" \ go build -v -work -x "${EGO_PN}" echo "$@" "$@" || die @@ -62,20 +91,18 @@ debug-print-function ${FUNCNAME} "$@" _golang-build_setup - set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ + set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir)" \ go install -v -work -x "${EGO_PN}" echo "$@" "$@" || die - insinto /usr/lib/go-gentoo - insopts -m0644 -p # preserve timestamps for bug 551486 - doins -r pkg src + golang_install_pkgs } golang-build_src_test() { debug-print-function ${FUNCNAME} "$@" _golang-build_setup - set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \ + set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir)" \ go test -v -work -x "${EGO_PN}" echo "$@" "$@" || die signature.asc Description: Digital signature