logo

overlay

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

go-0.20171003.ebuild (1808B)


  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//0./}"
  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="bootstrap"
  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/go1.4/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/go1.4/pkg/*.a
  20. /usr/lib/go1.4/src/debug/elf/testdata/*
  21. /usr/lib/go1.4/src/debug/dwarf/testdata/*
  22. /usr/lib/go1.4/src/runtime/race/*.syso
  23. "
  24. S="${WORKDIR}/go"
  25. src_prepare() {
  26. sed -i -e 's/"-Werror",//g' src/cmd/dist/build.c
  27. default
  28. }
  29. src_compile() {
  30. export GOROOT_FINAL="${EPREFIX}/usr/lib/go1.4"
  31. export GOROOT="$(pwd)"
  32. export GOBIN="${GOROOT}/bin"
  33. export CGO_ENABLED=0
  34. tc-export CC
  35. cd src
  36. ./make.bash || die "build failed"
  37. }
  38. src_install() {
  39. dodir /usr/lib/go1.4
  40. exeinto /usr/lib/go1.4/bin
  41. doexe bin/*
  42. insinto /usr/lib/go1.4
  43. doins -r lib pkg src
  44. fperms -R +x /usr/lib/go1.4/pkg/tool
  45. }
  46. pkg_postinst() {
  47. # If the go tool sees a package file timestamped older than a dependancy it
  48. # will rebuild that file. So, in order to stop go from rebuilding lots of
  49. # packages for every build we need to fix the timestamps. The compiler and
  50. # linker are also checked - so we need to fix them too.
  51. ebegin "fixing timestamps to avoid unnecessary rebuilds"
  52. tref="usr/lib/go1.4/pkg/*/runtime.a"
  53. find "${EROOT}/usr/lib/go1.4" -type f \
  54. -exec touch -r "${EROOT}/${tref}" {} \;
  55. eend $?
  56. }