logo

overlay

My (experimental) gentoo overlay

go-bootstrap-20171003.ebuild (1819B)


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