logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

go-1.4_p20171003.ebuild (1939B)


  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit toolchain-funcs
  5. MY_PV="${PV//1.4_p/}"
  6. DESCRIPTION="Boostrap Go from C (useful for musl libc)"
  7. HOMEPAGE="https://golang.org/doc/install/source"
  8. SRC_URI="https://dl.google.com/go/go1.4-bootstrap-${MY_PV}.tar.gz"
  9. LICENSE="BSD"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE=""
  13. DEPEND=""
  14. RDEPEND=""
  15. # The go tools should not cause the multilib-strict check to fail.
  16. QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
  17. # The go language uses *.a files which are _NOT_ libraries and should not be
  18. # stripped. The test data objects should also be left alone and unstripped.
  19. STRIP_MASK="/usr/lib/go/pkg/*/*.a
  20. /usr/lib/go/src/debug/elf/testdata/*
  21. /usr/lib/go/src/debug/dwarf/testdata/*
  22. /usr/lib/go/src/runtime/race/*.syso
  23. "
  24. S="${WORKDIR}/go"
  25. DOCS=( AUTHORS CONTRIBUTORS PATENTS README )
  26. src_prepare() {
  27. sed -i -e 's/"-Werror",//g' src/cmd/dist/build.c || die
  28. default
  29. }
  30. src_compile() {
  31. export GOROOT_FINAL="${EPREFIX}/usr/lib/go"
  32. export GOROOT="$(pwd)"
  33. export GOBIN="${GOROOT}/bin"
  34. export CGO_ENABLED=0
  35. tc-export CC
  36. cd src
  37. ./make.bash || die "build failed"
  38. }
  39. src_test() {
  40. cd src
  41. PATH="${GOBIN}:${PATH}" \
  42. ./run.bash --no-rebuild --banner || die "tests failed"
  43. }
  44. src_install() {
  45. einstalldocs
  46. insinto /usr/lib/go
  47. doins -r doc include lib pkg src
  48. fperms -R +x /usr/lib/go/pkg/tool
  49. exeinto /usr/lib/go/bin
  50. doexe bin/*
  51. }
  52. pkg_postinst() {
  53. # If the go tool sees a package file timestamped older than a dependancy it
  54. # will rebuild that file. So, in order to stop go from rebuilding lots of
  55. # packages for every build we need to fix the timestamps. The compiler and
  56. # linker are also checked - so we need to fix them too.
  57. ebegin "fixing timestamps to avoid unnecessary rebuilds"
  58. tref="usr/lib/go/pkg/*/runtime.a"
  59. find "${EROOT}/usr/lib/go" -type f \
  60. -exec touch -r "${EROOT}/"${tref} {} \;
  61. eend $?
  62. }