From b4c2aa4f33970ea2c862e0f7e57f01564bc63002 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 16 Mar 2023 00:22:55 +0000 Subject: gentoo auto-resync : 16:03:2023 - 00:22:55 --- dev-lang/Manifest.gz | Bin 19843 -> 19843 bytes dev-lang/go/Manifest | 8 +- dev-lang/go/go-1.19.5.ebuild | 201 ----------------------------------------- dev-lang/go/go-1.19.6.ebuild | 2 +- dev-lang/go/go-1.19.7.ebuild | 208 +++++++++++++++++++++++++++++++++++++++++++ dev-lang/go/go-1.20.2.ebuild | 204 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 418 insertions(+), 205 deletions(-) delete mode 100644 dev-lang/go/go-1.19.5.ebuild create mode 100644 dev-lang/go/go-1.19.7.ebuild create mode 100644 dev-lang/go/go-1.20.2.ebuild (limited to 'dev-lang') diff --git a/dev-lang/Manifest.gz b/dev-lang/Manifest.gz index 908dd28ef296..98a267991d86 100644 Binary files a/dev-lang/Manifest.gz and b/dev-lang/Manifest.gz differ diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest index b60ebc034f7b..c0cc9a8bd422 100644 --- a/dev-lang/go/Manifest +++ b/dev-lang/go/Manifest @@ -1,9 +1,11 @@ AUX go-sets.conf 313 BLAKE2B 03e94776e317d34b72bfb8385b8b0dfa6a599a6086e4d0c9214e7b49293768947c21d9afb323ffcc7fd85ba0af72d9cb243dbb571eee9eb81de9400fd5f5e79c SHA512 7d01b98bc8d1b609183682dd942bd4c9fa757a98243c7de3cf6c497c7bc20b8cdbe59dd669ce4bb11f914a0e9b6d100e65cea2dffd99f38be50b18e0ecf66315 -DIST go1.19.5.src.tar.gz 26545858 BLAKE2B da4d77fdcde28bc6e27ddbe013bed4c02cbb17db878ff0d935051daaf7277e2cdfe30d0e6917d4ec2df62ded08117815f2eb12830cef48056f56188ac5eb92fb SHA512 26754f2a4870d0a5484162b626dad5109a33c116675898c84de46155659dadeff2b3fa9ea3dd0c7da8d23c8ff0974cfe42bdd07484e6f784617de3a577b3c883 DIST go1.19.6.src.tar.gz 26549360 BLAKE2B cbf17c3dc744aec67b440718488e6acdcf6385bce2654584c273995bb72871642488ad3ea972c6ba07914028a778341d27904402647deab879bd1bbc08b3dd8d SHA512 f817ea6bcd83b60d9bf2ae9d0afdaa21651ac6cf5a32c260f40a691cd0ccce556ec9a483e10fa1a5dc244d6ea512407f5dae9c99ac004393b196a80284e63977 +DIST go1.19.7.src.tar.gz 26550385 BLAKE2B 282e9e62bd78a7678cfbf18d0134a766e1aa283f9304def537c9feaf9deca406a5ffe775050b17a916143466824067bb26431fb5ae3cc42cdf7131971f474af3 SHA512 e6f0df2d381a424cf43e8ea0306a58a46a96464cff4665ca3da73f713d4f039687a6c9659cef577000b1fadca7c1a2114fac34ffb2017d6335f537ac235de823 DIST go1.20.1.src.tar.gz 26172675 BLAKE2B d6daccbebfe3dc014675499ad319eb9a6ae1382feaa42e7fe80d2e4a49bd7b3eccc3144f7cbd18c7c478e557d0e512eb1030d654a894929803838f192d551214 SHA512 57453419fafac8af10f4037b0162326555aab0e87cd1d246d5e977246c075a0504c23022d5c14bfcae9ca1c3250652ddd7c6fcf2209a926525e5f7d0d40ab52d -EBUILD go-1.19.5.ebuild 5054 BLAKE2B d8ae0f910b26fb09c6b35f7ac3ba012a7bd855e5db5c1a590c4d571d3510b3f84d9869b7634b296075d85666a53bb565fd2c39f1a95bd733c9bb709b9a6469fa SHA512 810931a32380752fcf4d218e32cefe5756a29fca8b53349662ec3d85ae863ace4d34d7e2405219b489cdca80e4ce85d3bf63cdb51d28cbf354a75bcc8bff85ff -EBUILD go-1.19.6.ebuild 5234 BLAKE2B 0f22f352bd08fd9bf42884746b9e73ada984fb3a1019e8e8a04bedc68ad38b1d1ac7d655180328faa7b36aba7ec4e36dd0ae7b4775f6f3aff001d3602e48b965 SHA512 29b2bfef16d3b8fe8af6215d4ec276f70a3081424d385abb3d7bb82a17bd705ddc5b62c255ef6e2642d4a56343b887e4ffe7ef294e2c8fd7ae20ffa3b56f5e55 +DIST go1.20.2.src.tar.gz 26178725 BLAKE2B 2c896bab60d301b7a01df48a20e16726c50cd1df528092022a33ab11c543c8c5c7e54c6235ccc776de74ead08aaf7496a016b829fa51f96ae2b32beeafb44cb2 SHA512 ba8f894b1baa6b3c1bdaafa113feff8d16c25d91f8e44bd4e7ffb46d7b329309290f27385804399baa9834691290a209fc7a193b24fd197ea11a16ce4a1b9d39 +EBUILD go-1.19.6.ebuild 5233 BLAKE2B 86b49ba0ccc71624134e67f3e97db2b58460835459080228ccaa6a6b043123bc4592cf8ac180d8e67eebfe0b6aaef0bd48c5e9358246099c20668181301b7842 SHA512 10577e3953f04e5998acce259355643455dab7e67bd42efa5fbc4d2aeb91d0807acdb3c59813f2d69acb853e7f6d6d2fcb3cb72e2ec9834dec5ccc6f6a50a7ba +EBUILD go-1.19.7.ebuild 5238 BLAKE2B 9474a897fd3bfdffaebe01b5b0b7ad5b5c1debf5796f874df293773850217b0224f9806c2fb2b5b5c5c57b36b9c60562558e3f8ebc25b8526fe7a2d008371aaa SHA512 3ddf84e3ed971fed853dddb14e1832e5907d97cd88e7f2732b8cc868b5258357af49b897c71db39f17d79ca263a749cabfac5005ee361d6a5df35900e28f33d5 EBUILD go-1.20.1.ebuild 5137 BLAKE2B 65b652825d854dd1306058fb1696d59bcf0161d9d986be037b70446a41df8b6bdaa0ca8ac4c776a5aaf4aa3c800914138bf0a3e7cb6d1588f1dc553a11436e19 SHA512 56c9ed026879b9992344416a56e3891eea77f3eae901f9497e3eb72053fbf132bf51d6d344f51a5d2c60138eae4aef8fcc619e9f1802f97e80b431afc0eec7e6 +EBUILD go-1.20.2.ebuild 5140 BLAKE2B 6901fcd675e6dbef883a62c6ade4c87629f3cb794c025ca5bd5b7d6399d43c3cee26a93ea22f9681e2c77eceb5ba89b6bbcc6b752ac088092cd492aab4d74010 SHA512 bd128289404d2fbc9a8312d02c1bd3dddd0fbb4fffd3c51e04214ec747502b18314edacefa596c9fcf3d33933e9925912719df5e5e4651369d1c578733053026 EBUILD go-9999.ebuild 4798 BLAKE2B 50daca174e8bc89f747432e96bc7d66e6c7dd50320d0b4c97754bb90267d62b700d34c250a892fdf60c907fa5eb881dd7adb3e64eba7ceb240740bd90c399f83 SHA512 051671c9a99efe554f9ed66423a20d053546ba68fdbf8a900e4ef0a365622bf8fcc976c678e393ade4a5475e01ccc53668d61d98e1b976e69de030662498273a MISC metadata.xml 590 BLAKE2B 56da63bdc350df5c6ef3b511a386627f4020f655027ca88da6a83ecb09581d3c3055c836eb8fe98a383412b3d431a77a9935ad753fe2d8392afa37cd613c15b0 SHA512 5d78adbae30c3a805194567bbb1af2ad59b78487819e7841a040d2a4d5db02f5b5d1d58f7cfc7a37f39e5e9bcf332dda4d336456e33e36c33caef792ac45d48b diff --git a/dev-lang/go/go-1.19.5.ebuild b/dev-lang/go/go-1.19.5.ebuild deleted file mode 100644 index 49682294b92f..000000000000 --- a/dev-lang/go/go-1.19.5.ebuild +++ /dev/null @@ -1,201 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -export CBUILD=${CBUILD:-${CHOST}} -export CTARGET=${CTARGET:-${CHOST}} - -MY_PV=${PV/_/} - -inherit toolchain-funcs - -case ${PV} in -*9999*) - EGIT_REPO_URI="https://github.com/golang/go.git" - inherit git-r3 - ;; -*) - SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz " - S="${WORKDIR}"/go - case ${PV} in - *_beta*|*_rc*) ;; - *) - KEYWORDS="-* amd64 arm arm64 ~loong ~mips ppc64 ~riscv ~s390 x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris" - ;; - esac -esac - -DESCRIPTION="A concurrent garbage collected and typesafe programming language" -HOMEPAGE="https://go.dev" - -LICENSE="BSD" -SLOT="0/${PV}" -IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2" - -BDEPEND="|| ( - dev-lang/go - dev-lang/go-bootstrap )" - -# the *.syso files have writable/executable stacks -QA_EXECSTACK='*.syso' - -# Do not complain about CFLAGS, etc, since Go doesn't use them. -QA_FLAGS_IGNORED='.*' - -# The tools in /usr/lib/go should not cause the multilib-strict check to fail. -QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" - -# This package triggers "unrecognized elf file(s)" notices on riscv. -# https://bugs.gentoo.org/794046 -QA_PREBUILT='.*' - -# Do not strip this package. Stripping is unsupported upstream and may -# fail. -RESTRICT+=" strip" - -DOCS=( - CONTRIBUTING.md - PATENTS - README.md - SECURITY.md -) - -go_arch() { - # By chance most portage arch names match Go - local tc_arch=$(tc-arch $@) - case "${tc_arch}" in - x86) echo 386;; - x64-*) echo amd64;; - loong) echo loong64;; - mips) if use abi_mips_o32; then - [[ $(tc-endian $@) = big ]] && echo mips || echo mipsle - elif use abi_mips_n64; then - [[ $(tc-endian $@) = big ]] && echo mips64 || echo mips64le - fi ;; - ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; - riscv) echo riscv64 ;; - s390) echo s390x ;; - *) echo "${tc_arch}";; - esac -} - -go_arm() { - case "${1:-${CHOST}}" in - armv5*) echo 5;; - armv6*) echo 6;; - armv7*) echo 7;; - *) - die "unknown GOARM for ${1:-${CHOST}}" - ;; - esac -} - -go_os() { - case "${1:-${CHOST}}" in - *-linux*) echo linux;; - *-darwin*) echo darwin;; - *-freebsd*) echo freebsd;; - *-netbsd*) echo netbsd;; - *-openbsd*) echo openbsd;; - *-solaris*) echo solaris;; - *-cygwin*|*-interix*|*-winnt*) - echo windows - ;; - *) - die "unknown GOOS for ${1:-${CHOST}}" - ;; - esac -} - -go_tuple() { - echo "$(go_os $@)_$(go_arch $@)" -} - -go_cross_compile() { - [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] -} - -src_compile() { - if has_version -b dev-lang/go; then - export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go" - elif has_version -b dev-lang/go-bootstrap; then - export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap" - else - eerror "Go cannot be built without go or go-bootstrap installed" - die "Should not be here, please report a bug" - fi - - export GOROOT_FINAL="${EPREFIX}"/usr/lib/go - export GOROOT="${PWD}" - export GOBIN="${GOROOT}/bin" - - # Go's build script does not use BUILD/HOST/TARGET consistently. :( - export GOHOSTARCH=$(go_arch ${CBUILD}) - export GOHOSTOS=$(go_os ${CBUILD}) - export CC=$(tc-getBUILD_CC) - - export GOARCH=$(go_arch) - export GOOS=$(go_os) - export CC_FOR_TARGET=$(tc-getCC) - export CXX_FOR_TARGET=$(tc-getCXX) - use arm && export GOARM=$(go_arm) - use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat') - - cd src - bash -x ./make.bash || die "build failed" -} - -src_test() { - go_cross_compile && return 0 - - cd src - PATH="${GOBIN}:${PATH}" \ - ./run.bash -no-rebuild || die "tests failed" - cd .. - rm -fr pkg/*_race || die - rm -fr pkg/obj/go-build || die -} - -src_install() { - # There is a known issue which requires the source tree to be installed [1]. - # Once this is fixed, we can consider using the doc use flag to control - # installing the doc and src directories. - # The use of cp is deliberate in order to retain permissions - # [1] https://golang.org/issue/2775 - dodir /usr/lib/go - cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go - einstalldocs - - # testdata directories are not needed on the installed system - rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print) - - local bin_path - if go_cross_compile; then - bin_path="bin/$(go_tuple)" - else - bin_path=bin - fi - local f x - for x in ${bin_path}/*; do - f=${x##*/} - dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} - done - - # install the @golang-rebuild set for Portage - insinto /usr/share/portage/config/sets - newins "${FILESDIR}"/go-sets.conf go.conf -} - -pkg_postinst() { - [[ -z ${REPLACING_VERSIONS} ]] && return - elog "After ${CATEGORY}/${PN} is updated it is recommended to rebuild" - elog "all packages compiled with previous versions of ${CATEGORY}/${PN}" - elog "due to the static linking nature of go." - elog "If this is not done, the packages compiled with the older" - elog "version of the compiler will not be updated until they are" - elog "updated individually, which could mean they will have" - elog "vulnerabilities." - elog "Run 'emerge @golang-rebuild' to rebuild all 'go' packages" - elog "See https://bugs.gentoo.org/752153 for more info" -} diff --git a/dev-lang/go/go-1.19.6.ebuild b/dev-lang/go/go-1.19.6.ebuild index 4ab185035ed1..b6862ea87040 100644 --- a/dev-lang/go/go-1.19.6.ebuild +++ b/dev-lang/go/go-1.19.6.ebuild @@ -21,7 +21,7 @@ case ${PV} in case ${PV} in *_beta*|*_rc*) ;; *) - KEYWORDS="-* amd64 arm ~arm64 ~loong ~mips ppc64 ~riscv ~s390 x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris" + KEYWORDS="-* amd64 arm arm64 ~loong ~mips ppc64 ~riscv ~s390 x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris" ;; esac esac diff --git a/dev-lang/go/go-1.19.7.ebuild b/dev-lang/go/go-1.19.7.ebuild new file mode 100644 index 000000000000..a2bcdf56316c --- /dev/null +++ b/dev-lang/go/go-1.19.7.ebuild @@ -0,0 +1,208 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +export CBUILD=${CBUILD:-${CHOST}} +export CTARGET=${CTARGET:-${CHOST}} + +MY_PV=${PV/_/} + +inherit toolchain-funcs + +case ${PV} in +*9999*) + EGIT_REPO_URI="https://github.com/golang/go.git" + inherit git-r3 + ;; +*) + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz " + S="${WORKDIR}"/go + case ${PV} in + *_beta*|*_rc*) ;; + *) + KEYWORDS="-* ~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris" + ;; + esac +esac + +DESCRIPTION="A concurrent garbage collected and typesafe programming language" +HOMEPAGE="https://go.dev" + +LICENSE="BSD" +SLOT="0/${PV}" +IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2" + +RDEPEND=" +arm? ( sys-devel/binutils[gold] ) +arm64? ( sys-devel/binutils[gold] )" +BDEPEND="|| ( + dev-lang/go + dev-lang/go-bootstrap )" + +# the *.syso files have writable/executable stacks +QA_EXECSTACK='*.syso' + +# Do not complain about CFLAGS, etc, since Go doesn't use them. +QA_FLAGS_IGNORED='.*' + +# The tools in /usr/lib/go should not cause the multilib-strict check to fail. +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" + +# This package triggers "unrecognized elf file(s)" notices on riscv. +# https://bugs.gentoo.org/794046 +QA_PREBUILT='.*' + +# Do not strip this package. Stripping is unsupported upstream and may +# fail. +RESTRICT+=" strip" + +DOCS=( + CONTRIBUTING.md + PATENTS + README.md + SECURITY.md +) + +go_arch() { + # By chance most portage arch names match Go + local tc_arch=$(tc-arch $@) + case "${tc_arch}" in + x86) echo 386;; + x64-*) echo amd64;; + loong) echo loong64;; + mips) if use abi_mips_o32; then + [[ $(tc-endian $@) = big ]] && echo mips || echo mipsle + elif use abi_mips_n64; then + [[ $(tc-endian $@) = big ]] && echo mips64 || echo mips64le + fi ;; + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; + riscv) echo riscv64 ;; + s390) echo s390x ;; + *) echo "${tc_arch}";; + esac +} + +go_arm() { + case "${1:-${CHOST}}" in + armv5*) echo 5;; + armv6*) echo 6;; + armv7*) echo 7;; + *) + die "unknown GOARM for ${1:-${CHOST}}" + ;; + esac +} + +go_os() { + case "${1:-${CHOST}}" in + *-linux*) echo linux;; + *-darwin*) echo darwin;; + *-freebsd*) echo freebsd;; + *-netbsd*) echo netbsd;; + *-openbsd*) echo openbsd;; + *-solaris*) echo solaris;; + *-cygwin*|*-interix*|*-winnt*) + echo windows + ;; + *) + die "unknown GOOS for ${1:-${CHOST}}" + ;; + esac +} + +go_tuple() { + echo "$(go_os $@)_$(go_arch $@)" +} + +go_cross_compile() { + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] +} + +src_compile() { + if has_version -b dev-lang/go; then + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go" + elif has_version -b dev-lang/go-bootstrap; then + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap" + else + eerror "Go cannot be built without go or go-bootstrap installed" + die "Should not be here, please report a bug" + fi + + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go + export GOROOT="${PWD}" + export GOBIN="${GOROOT}/bin" + + # Go's build script does not use BUILD/HOST/TARGET consistently. :( + export GOHOSTARCH=$(go_arch ${CBUILD}) + export GOHOSTOS=$(go_os ${CBUILD}) + export CC=$(tc-getBUILD_CC) + + export GOARCH=$(go_arch) + export GOOS=$(go_os) + export CC_FOR_TARGET=$(tc-getCC) + export CXX_FOR_TARGET=$(tc-getCXX) + use arm && export GOARM=$(go_arm) + use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat') + + cd src + bash -x ./make.bash || die "build failed" +} + +src_test() { + go_cross_compile && return 0 + + cd src + + # https://github.com/golang/go/issues/42005 + rm cmd/link/internal/ld/fallocate_test.go || true + + PATH="${GOBIN}:${PATH}" \ + ./run.bash -no-rebuild || die "tests failed" + cd .. + rm -fr pkg/*_race || die + rm -fr pkg/obj/go-build || die +} + +src_install() { + # There is a known issue which requires the source tree to be installed [1]. + # Once this is fixed, we can consider using the doc use flag to control + # installing the doc and src directories. + # The use of cp is deliberate in order to retain permissions + # [1] https://golang.org/issue/2775 + dodir /usr/lib/go + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go + einstalldocs + + # testdata directories are not needed on the installed system + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print) + + local bin_path + if go_cross_compile; then + bin_path="bin/$(go_tuple)" + else + bin_path=bin + fi + local f x + for x in ${bin_path}/*; do + f=${x##*/} + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} + done + + # install the @golang-rebuild set for Portage + insinto /usr/share/portage/config/sets + newins "${FILESDIR}"/go-sets.conf go.conf +} + +pkg_postinst() { + [[ -z ${REPLACING_VERSIONS} ]] && return + elog "After ${CATEGORY}/${PN} is updated it is recommended to rebuild" + elog "all packages compiled with previous versions of ${CATEGORY}/${PN}" + elog "due to the static linking nature of go." + elog "If this is not done, the packages compiled with the older" + elog "version of the compiler will not be updated until they are" + elog "updated individually, which could mean they will have" + elog "vulnerabilities." + elog "Run 'emerge @golang-rebuild' to rebuild all 'go' packages" + elog "See https://bugs.gentoo.org/752153 for more info" +} diff --git a/dev-lang/go/go-1.20.2.ebuild b/dev-lang/go/go-1.20.2.ebuild new file mode 100644 index 000000000000..8b8dd50b5ebd --- /dev/null +++ b/dev-lang/go/go-1.20.2.ebuild @@ -0,0 +1,204 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +export CBUILD=${CBUILD:-${CHOST}} +export CTARGET=${CTARGET:-${CHOST}} + +MY_PV=${PV/_/} + +inherit toolchain-funcs + +case ${PV} in +*9999*) + EGIT_REPO_URI="https://github.com/golang/go.git" + inherit git-r3 + ;; +*) + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz " + S="${WORKDIR}"/go + case ${PV} in + *_beta*|*_rc*) ;; + *) + KEYWORDS="-* ~amd64 ~arm ~arm64 ~loong ~mips ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris" + ;; + esac +esac + +DESCRIPTION="A concurrent garbage collected and typesafe programming language" +HOMEPAGE="https://go.dev" + +LICENSE="BSD" +SLOT="0/${PV}" +IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2" + +RDEPEND=" +arm? ( sys-devel/binutils[gold] ) +arm64? ( sys-devel/binutils[gold] )" +BDEPEND="|| ( + dev-lang/go + dev-lang/go-bootstrap )" + +# the *.syso files have writable/executable stacks +QA_EXECSTACK='*.syso' + +# Do not complain about CFLAGS, etc, since Go doesn't use them. +QA_FLAGS_IGNORED='.*' + +# The tools in /usr/lib/go should not cause the multilib-strict check to fail. +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" + +# This package triggers "unrecognized elf file(s)" notices on riscv. +# https://bugs.gentoo.org/794046 +QA_PREBUILT='.*' + +# Do not strip this package. Stripping is unsupported upstream and may +# fail. +RESTRICT+=" strip" + +DOCS=( + CONTRIBUTING.md + PATENTS + README.md + SECURITY.md +) + +go_arch() { + # By chance most portage arch names match Go + local tc_arch=$(tc-arch $@) + case "${tc_arch}" in + x86) echo 386;; + x64-*) echo amd64;; + loong) echo loong64;; + mips) if use abi_mips_o32; then + [[ $(tc-endian $@) = big ]] && echo mips || echo mipsle + elif use abi_mips_n64; then + [[ $(tc-endian $@) = big ]] && echo mips64 || echo mips64le + fi ;; + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; + riscv) echo riscv64 ;; + s390) echo s390x ;; + *) echo "${tc_arch}";; + esac +} + +go_arm() { + case "${1:-${CHOST}}" in + armv5*) echo 5;; + armv6*) echo 6;; + armv7*) echo 7;; + *) + die "unknown GOARM for ${1:-${CHOST}}" + ;; + esac +} + +go_os() { + case "${1:-${CHOST}}" in + *-linux*) echo linux;; + *-darwin*) echo darwin;; + *-freebsd*) echo freebsd;; + *-netbsd*) echo netbsd;; + *-openbsd*) echo openbsd;; + *-solaris*) echo solaris;; + *-cygwin*|*-interix*|*-winnt*) + echo windows + ;; + *) + die "unknown GOOS for ${1:-${CHOST}}" + ;; + esac +} + +go_tuple() { + echo "$(go_os $@)_$(go_arch $@)" +} + +go_cross_compile() { + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] +} + +src_compile() { + if has_version -b dev-lang/go; then + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go" + elif has_version -b dev-lang/go-bootstrap; then + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap" + else + eerror "Go cannot be built without go or go-bootstrap installed" + die "Should not be here, please report a bug" + fi + + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go + export GOROOT="${PWD}" + export GOBIN="${GOROOT}/bin" + + # Go's build script does not use BUILD/HOST/TARGET consistently. :( + export GOHOSTARCH=$(go_arch ${CBUILD}) + export GOHOSTOS=$(go_os ${CBUILD}) + export CC=$(tc-getBUILD_CC) + + export GOARCH=$(go_arch) + export GOOS=$(go_os) + export CC_FOR_TARGET=$(tc-getCC) + export CXX_FOR_TARGET=$(tc-getCXX) + use arm && export GOARM=$(go_arm) + use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat') + + cd src + bash -x ./make.bash || die "build failed" +} + +src_test() { + go_cross_compile && return 0 + + cd src + PATH="${GOBIN}:${PATH}" \ + ./run.bash -no-rebuild || die "tests failed" + cd .. + rm -fr pkg/*_race || die + rm -fr pkg/obj/go-build || die +} + +src_install() { + # There is a known issue which requires the source tree to be installed [1]. + # Once this is fixed, we can consider using the doc use flag to control + # installing the doc and src directories. + # The use of cp is deliberate in order to retain permissions + # [1] https://golang.org/issue/2775 + dodir /usr/lib/go + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go + einstalldocs + + # testdata directories are not needed on the installed system + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print) + + local bin_path + if go_cross_compile; then + bin_path="bin/$(go_tuple)" + else + bin_path=bin + fi + local f x + for x in ${bin_path}/*; do + f=${x##*/} + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} + done + + # install the @golang-rebuild set for Portage + insinto /usr/share/portage/config/sets + newins "${FILESDIR}"/go-sets.conf go.conf +} + +pkg_postinst() { + [[ -z ${REPLACING_VERSIONS} ]] && return + elog "After ${CATEGORY}/${PN} is updated it is recommended to rebuild" + elog "all packages compiled with previous versions of ${CATEGORY}/${PN}" + elog "due to the static linking nature of go." + elog "If this is not done, the packages compiled with the older" + elog "version of the compiler will not be updated until they are" + elog "updated individually, which could mean they will have" + elog "vulnerabilities." + elog "Run 'emerge @golang-rebuild' to rebuild all 'go' packages" + elog "See https://bugs.gentoo.org/752153 for more info" +} -- cgit v1.2.3