app-editors/gummi: drop base.eclass and fix whitespace
[gentoo.git] / dev-lang / go / go-1.4.2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 export CTARGET=${CTARGET:-${CHOST}}
8
9 inherit eutils toolchain-funcs
10
11 if [[ ${PV} = 9999 ]]; then
12         EGIT_REPO_URI="git://github.com/golang/go.git"
13         inherit git-r3
14 else
15         SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz"
16         # Upstream only supports go on amd64, arm and x86 architectures.
17         KEYWORDS="-* amd64 arm x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos ~x64-solaris"
18 fi
19
20 DESCRIPTION="A concurrent garbage collected and typesafe programming language"
21 HOMEPAGE="http://www.golang.org"
22
23 LICENSE="BSD"
24 SLOT="0"
25 IUSE=""
26
27 DEPEND=""
28 RDEPEND=""
29
30 # These test data objects have writable/executable stacks.
31 QA_EXECSTACK="
32         usr/lib/go/src/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj
33         usr/lib/go/src/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj"
34
35         REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*"
36
37 # The tools in /usr/lib/go should not cause the multilib-strict check to fail.
38 QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
39
40 # The go language uses *.a files which are _NOT_ libraries and should not be
41 # stripped.
42 STRIP_MASK="/usr/lib/go/pkg/linux*/*.a /usr/lib/go/pkg/freebsd*/*.a /usr/lib/go/pkg/darwin*/*.a"
43
44 if [[ ${PV} != 9999 ]]; then
45         S="${WORKDIR}"/go
46 fi
47
48 src_prepare()
49 {
50         if [[ ${PV} != 9999 ]]; then
51                 sed -i -e 's#"-Werror",##g' src/cmd/dist/build.c ||
52                         die "sed failed"
53         fi
54         epatch_user
55 }
56
57 src_compile()
58 {
59         export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
60         export GOROOT="$(pwd)"
61         export GOBIN="${GOROOT}/bin"
62         if [[ $CTARGET = armv5* ]]
63         then
64                 export GOARM=5
65         fi
66         tc-export CC
67
68         cd src
69         ./make.bash || die "build failed"
70 }
71
72 src_test()
73 {
74         cd src
75         PATH="${GOBIN}:${PATH}" \
76                 ./run.bash --no-rebuild --banner || die "tests failed"
77 }
78
79 src_install()
80 {
81         dobin bin/*
82         dodoc AUTHORS CONTRIBUTORS PATENTS README
83
84         dodir /usr/lib/go
85         insinto /usr/lib/go
86
87         # There is a known issue which requires the source tree to be installed [1].
88         # Once this is fixed, we can consider using the doc use flag to control
89         # installing the doc and src directories.
90         # [1] https://golang.org/issue/2775
91         doins -r doc include lib pkg src
92         fperms -R +x /usr/lib/go/pkg/tool
93 }
94
95 pkg_preinst()
96 {
97         has_version '<dev-lang/go-1.4' &&
98                 export had_support_files=true ||
99                 export had_support_files=false
100 }
101
102 pkg_postinst()
103 {
104         # If the go tool sees a package file timestamped older than a dependancy it
105         # will rebuild that file.  So, in order to stop go from rebuilding lots of
106         # packages for every build we need to fix the timestamps.  The compiler and
107         # linker are also checked - so we need to fix them too.
108         ebegin "fixing timestamps to avoid unnecessary rebuilds"
109         tref="usr/lib/go/pkg/*/runtime.a"
110         find "${EROOT}"usr/lib/go -type f \
111                 -exec touch -r "${EROOT}"${tref} {} \;
112         eend $?
113
114         if [[ ${PV} != 9999 && -n ${REPLACING_VERSIONS} &&
115                 ${REPLACING_VERSIONS} != ${PV} ]]; then
116                 elog "Release notes are located at http://golang.org/doc/go1.4"
117         fi
118
119         if $had_support_files; then
120                 ewarn
121                 ewarn "All editor support, IDE support, shell completion"
122                 ewarn "support, etc has been removed from the go package"
123                 ewarn "upstream."
124                 ewarn "For more information on which support is available, see"
125                 ewarn "the following URL:"
126                 ewarn "https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins"
127         fi
128 }