mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-23 15:31:05 +02:00
Merge pull request #2159 from marineam/go-slot
Slotted Go: The Happening
This commit is contained in:
commit
074ea45273
@ -3,17 +3,20 @@
|
||||
# $Id$
|
||||
|
||||
EAPI=5
|
||||
EGO_PN="github.com/docker/${PN}"
|
||||
COREOS_GO_PACKAGE="${EGO_PN}"
|
||||
|
||||
GITHUB_URI="github.com/docker/${PN}"
|
||||
COREOS_GO_PACKAGE="${GITHUB_URI}"
|
||||
COREOS_GO_VERSION="go1.6"
|
||||
|
||||
if [[ ${PV} == *9999 ]]; then
|
||||
inherit golang-vcs
|
||||
EGIT_REPO_URI="https://${GITHUB_URI}.git"
|
||||
inherit git-r3
|
||||
else
|
||||
MY_PV="${PV/_/-}"
|
||||
EGIT_COMMIT="v${MY_PV}"
|
||||
SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
|
||||
KEYWORDS="amd64 arm64"
|
||||
inherit golang-vcs-snapshot
|
||||
inherit vcs-snapshot
|
||||
fi
|
||||
|
||||
inherit coreos-go
|
||||
@ -29,20 +32,11 @@ DEPEND=""
|
||||
RDEPEND="app-emulation/runc
|
||||
seccomp? ( sys-libs/libseccomp )"
|
||||
|
||||
S=${WORKDIR}/${P}/src/${EGO_PN}
|
||||
|
||||
src_compile() {
|
||||
export GOARCH=$(go_get_arch)
|
||||
export CGO_ENABLED=1
|
||||
export CC=$(tc-getCC)
|
||||
export CXX=$(tc-getCXX)
|
||||
|
||||
local options=( $(usex seccomp "seccomp") )
|
||||
export GOPATH="${WORKDIR}/${P}" # ${PWD}/vendor
|
||||
LDFLAGS= emake GIT_COMMIT="$EGIT_COMMIT" BUILDTAGS="${options[@]}"
|
||||
local options=( $(usev seccomp) )
|
||||
LDFLAGS= emake GIT_COMMIT="$EGIT_COMMIT" BUILDTAGS="${options[*]}"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
dobin bin/containerd* bin/ctr
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ EAPI=5
|
||||
CROS_WORKON_PROJECT="coreos/docker"
|
||||
CROS_WORKON_LOCALNAME="docker"
|
||||
CROS_WORKON_REPO="git://github.com"
|
||||
COREOS_GO_VERSION="go1.6"
|
||||
|
||||
if [[ ${PV} == *9999 ]]; then
|
||||
DOCKER_GITCOMMIT="unknown"
|
||||
@ -17,7 +18,7 @@ else
|
||||
KEYWORDS="amd64 arm64"
|
||||
fi
|
||||
|
||||
inherit bash-completion-r1 eutils linux-info multilib systemd udev user cros-workon
|
||||
inherit bash-completion-r1 eutils linux-info multilib systemd udev user cros-workon coreos-go-depend
|
||||
|
||||
DESCRIPTION="Docker complements kernel namespacing with a high-level API which operates at the process level"
|
||||
HOMEPAGE="https://dockerproject.org"
|
||||
@ -43,8 +44,6 @@ CDEPEND="
|
||||
DEPEND="
|
||||
${CDEPEND}
|
||||
|
||||
dev-lang/go:=
|
||||
|
||||
btrfs? (
|
||||
>=sys-fs/btrfs-progs-3.16.1
|
||||
)
|
||||
@ -205,20 +204,11 @@ src_prepare() {
|
||||
rm --recursive --force .git
|
||||
}
|
||||
|
||||
go_get_arch() {
|
||||
echo ${ARCH}
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# if we treat them right, Docker's build scripts will set up a
|
||||
# reasonable GOPATH for us
|
||||
export AUTO_GOPATH=1
|
||||
|
||||
# setup CFLAGS and LDFLAGS for separate build target
|
||||
# see https://github.com/tianon/docker-overlay/pull/10
|
||||
export CGO_CFLAGS="-I${ROOT}/usr/include"
|
||||
export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
|
||||
|
||||
# if we're building from a zip, we need the GITCOMMIT value
|
||||
[ "$DOCKER_GITCOMMIT" ] && export DOCKER_GITCOMMIT
|
||||
|
||||
@ -262,10 +252,7 @@ src_compile() {
|
||||
unset DOCKER_EXPERIMENTAL
|
||||
fi
|
||||
|
||||
export GOARCH=$(go_get_arch)
|
||||
export CGO_ENABLED=1
|
||||
export CC=$(tc-getCC)
|
||||
export CXX=$(tc-getCXX)
|
||||
go_export
|
||||
|
||||
# verbose building
|
||||
export BUILDFLAGS="-x -v"
|
||||
|
@ -8,7 +8,7 @@ AUTOTOOLS_AUTORECONF=yes
|
||||
AUTOTOOLS_IN_SOURCE_BUILD=yes
|
||||
|
||||
inherit autotools-utils flag-o-matic systemd toolchain-funcs multilib
|
||||
inherit cros-workon
|
||||
inherit cros-workon coreos-go-depend
|
||||
|
||||
CROS_WORKON_PROJECT="coreos/rkt"
|
||||
CROS_WORKON_LOCALNAME="rkt"
|
||||
@ -47,8 +47,7 @@ REQUIRED_USE="|| ( rkt_stage1_coreos rkt_stage1_fly rkt_stage1_host rkt_stage1_s
|
||||
|
||||
COMMON_DEPEND="sys-apps/acl
|
||||
tpm? ( app-crypt/trousers )"
|
||||
DEPEND="|| ( ~dev-lang/go-1.4.3:= >=dev-lang/go-1.5.3:= )
|
||||
app-arch/cpio
|
||||
DEPEND="app-arch/cpio
|
||||
sys-fs/squashfs-tools
|
||||
dev-perl/Capture-Tiny
|
||||
rkt_stage1_src? (
|
||||
@ -113,18 +112,7 @@ src_configure() {
|
||||
myeconfargs+=( --with-stage1-flavors="${STAGE1FLAVORS}" )
|
||||
myeconfargs+=( --with-stage1-default-location="${STAGE1INSTALLDIR}/stage1-${STAGE1FIRST}.aci" )
|
||||
|
||||
# Go's 6l linker does not support PIE, disable so cgo binaries
|
||||
# which use 6l+gcc for linking can be built correctly.
|
||||
if gcc-specs-pie; then
|
||||
append-ldflags -nopie
|
||||
fi
|
||||
|
||||
export CC=$(tc-getCC)
|
||||
export CGO_ENABLED=1
|
||||
export CGO_CFLAGS="${CFLAGS}"
|
||||
export CGO_CPPFLAGS="${CPPFLAGS}"
|
||||
export CGO_CXXFLAGS="${CXXFLAGS}"
|
||||
export CGO_LDFLAGS="${LDFLAGS}"
|
||||
go_export
|
||||
export BUILDDIR
|
||||
export V=1
|
||||
|
||||
|
@ -6,11 +6,12 @@ EAPI=5
|
||||
|
||||
GITHUB_URI="github.com/opencontainers/runc"
|
||||
COREOS_GO_PACKAGE="${GITHUB_URI}"
|
||||
COREOS_GO_VERSION="go1.6"
|
||||
# the commit of runc that docker uses.
|
||||
# see https://github.com/docker/docker/blob/v1.12.0/Dockerfile#L236
|
||||
COMMIT_ID="cc29e3dded8e27ba8f65738f40d251c885030a28"
|
||||
|
||||
inherit eutils multilib coreos-go vcs-snapshot
|
||||
inherit eutils flag-o-matic coreos-go-depend vcs-snapshot
|
||||
|
||||
DESCRIPTION="runc container cli tools"
|
||||
HOMEPAGE="http://runc.io"
|
||||
@ -30,29 +31,18 @@ RDEPEND="
|
||||
|
||||
src_prepare() {
|
||||
epatch "${FILESDIR}/0001-Makefile-do-not-install-dependencies-of-target.patch"
|
||||
# Work around https://github.com/golang/go/issues/14669
|
||||
# Remove after updating to go1.7
|
||||
filter-flags -O*
|
||||
|
||||
go_export
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
# fix up cross-compiling variables
|
||||
export GOARCH=$(go_get_arch)
|
||||
export CGO_ENABLED=1
|
||||
export CC=$(tc-getCC)
|
||||
export CXX=$(tc-getCXX)
|
||||
|
||||
# Taken from app-emulation/docker-1.7.0-r1
|
||||
export CGO_CFLAGS="-I${ROOT}/usr/include"
|
||||
export CGO_LDFLAGS="-L${ROOT}/usr/$(get_libdir)"
|
||||
|
||||
# Setup GOPATH so things build
|
||||
rm -rf .gopath
|
||||
mkdir -p .gopath/src/"$(dirname "${GITHUB_URI}")"
|
||||
ln -sf ../../../.. .gopath/src/"${GITHUB_URI}"
|
||||
export GOPATH="${PWD}/.gopath:${PWD}/vendor"
|
||||
|
||||
# build up optional flags
|
||||
local options=(
|
||||
$(usex apparmor 'apparmor')
|
||||
$(usex seccomp 'seccomp')
|
||||
$(usev apparmor)
|
||||
$(usev seccomp)
|
||||
)
|
||||
|
||||
emake BUILDTAGS="${options[*]}"
|
||||
|
1
sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/Manifest
vendored
Normal file
1
sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/Manifest
vendored
Normal file
@ -0,0 +1 @@
|
||||
DIST eselect-go-0.1.0.tar.gz 104232 SHA256 541de8bc7b77d93f070f907f17760bb30dc3fa8244216d565fcdfb58ab04381b SHA512 b7e9bf07bc7026115d639ed893c54332d63cd2d7a46a6f3b2f8a6748658dfb82f09e875def8bf9abecfb1e39f054ef194b39b0c415ac9ce69ea03332125d4c1f WHIRLPOOL 77996759041eea27f169eadab48f122e55ec11886e851d583ebdd0cf667500d7ca45a62a9edfb99400cc69cbd936887ddface15e7c81d2b301ba111c53123a6a
|
36
sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/eselect-go-0.1.0.ebuild
vendored
Normal file
36
sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/eselect-go-0.1.0.ebuild
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=6
|
||||
|
||||
DESCRIPTION="Eselect module for managing multiple Go versions"
|
||||
HOMEPAGE="https://github.com/coreos/eselect-go"
|
||||
SRC_URI="${HOMEPAGE}/releases/download/v${PV}/${P}.tar.gz"
|
||||
# Note for future releases: the tarball was generated via `make dist` and
|
||||
# uploaded to GitHub so there is no need for initializing autotools here.
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm64"
|
||||
IUSE="test"
|
||||
|
||||
DEPEND="test? ( dev-libs/glib )"
|
||||
RDEPEND="app-admin/eselect
|
||||
!dev-lang/go:0"
|
||||
|
||||
src_configure() {
|
||||
# Go is installed to /usr/lib, not /usr/lib64
|
||||
econf --libdir=/usr/lib
|
||||
}
|
||||
|
||||
src_install() {
|
||||
keepdir /etc/env.d/go
|
||||
default
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
if has_version 'dev-lang/go'; then
|
||||
eselect go update --if-unset
|
||||
fi
|
||||
}
|
9
sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/metadata.xml
vendored
Normal file
9
sdk_container/src/third_party/coreos-overlay/app-eselect/eselect-go/metadata.xml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<longdescription lang="en">
|
||||
This tool is intended for use in the CoreOS SDK in order to support
|
||||
packages or architectures that cannot upgrade to the same Go version
|
||||
all at the same time. Gentoo doesn't support this use case.
|
||||
</longdescription>
|
||||
</pkgmetadata>
|
@ -43,7 +43,7 @@ RDEPEND="${RDEPEND}
|
||||
dev-lang/nasm
|
||||
dev-lang/swig
|
||||
dev-lang/yasm
|
||||
dev-lang/go
|
||||
dev-lang/go:1.6
|
||||
dev-lang/go-bootstrap
|
||||
dev-libs/dbus-glib
|
||||
>=dev-libs/glib-2.26.1
|
||||
|
@ -1,3 +1,3 @@
|
||||
DIST go1.4.3.src.tar.gz 10875170 SHA256 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959 SHA512 12bade4bce9aa4b34e2b9495ae65a1fc6a2449b3a43bc4de85c8b87ba223c2f999b2f37c1e2fe1188d8521118b5e5357d27afb8b85c0b8ebb4503d4125d25273 WHIRLPOOL 1a869385e63343bc54a950ca965a4d11ca072e6551d1189ef4e2e4da2a488a1ef70b59296d65af0c061f63606b78f73399f25040e02132e56a00189f1aae20e3
|
||||
DIST go1.5.4.src.tar.gz 12059752 SHA256 002acabce7ddc140d0d55891f9d4fcfbdd806b9332fb8b110c91bc91afb0bc93 SHA512 bff8ad4e792fb92c382327d080f2383e623d39d474317d9b3132167707ced99b7b4866c9ab315b6479eb75891d146b3d71dc0f5a4e81a509090b3205684409ed WHIRLPOOL cd14fc92e513a1ef0882c0dfb28526fa5f8044b99935c7e022b9ca0c10190c8f8a8fb3cb251db280168cfbc00a2a2f25761dfac9b274aa37d2d66bb03360da6f
|
||||
DIST go1.6.3.src.tar.gz 12617426 SHA256 6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00 SHA512 43e9b01220788112a185500bd53f091e7a0023a790092f428e2f40fc1a334dd148558b99d2a1c871b8cc79ad7d2d87a092b93eee7b5a27c2ee675c494de35306 WHIRLPOOL 0a22dc08b89ddfaccf1e871037e7ad6cdbf36f914de527011813d57a2d857478278202314b185e26aa905cb135d13cbea490d03337b42148c6fc2ef93a8cd9fe
|
||||
DIST go1.7.src.tar.gz 14091954 SHA256 72680c16ba0891fcf2ccf46d0f809e4ecf47bbf889f5d884ccb54c5e9a17e1c0 SHA512 a9cd1279927ca50e083dcf6d5a4bcb3bff6a156b3555608334a41be9613b5002dd71caafa472aae6210b01a6cdbd6aa6a55b8882a8e4bda68a5ffd10a3ae1d14 WHIRLPOOL 77121f84e04e7266f46934c9350f7fe216aa8376fb9ac06602a4b7bf16ed6b3595dbbffc7289b5223e47a9e52980f381183bdeddf34b858d21bb0918a94d7e4e
|
||||
|
@ -1,121 +0,0 @@
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/dev-lang/go/go-1.4.2.ebuild,v 1.3 2015/04/08 12:57:46 zlogene Exp $
|
||||
|
||||
EAPI=5
|
||||
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
|
||||
inherit eutils toolchain-funcs
|
||||
|
||||
if [[ ${PV} = 9999 ]]; then
|
||||
EGIT_REPO_URI="git://github.com/golang/go.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz"
|
||||
# Upstream only supports go on amd64, arm and x86 architectures.
|
||||
KEYWORDS="-* amd64 ~arm x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos"
|
||||
fi
|
||||
|
||||
DESCRIPTION="A concurrent garbage collected and typesafe programming language"
|
||||
HOMEPAGE="http://www.golang.org"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0"
|
||||
IUSE=""
|
||||
|
||||
DEPEND=""
|
||||
RDEPEND=""
|
||||
|
||||
# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
|
||||
QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
|
||||
|
||||
# The go language uses *.a files which are _NOT_ libraries and should not be
|
||||
# stripped.
|
||||
STRIP_MASK="/usr/lib/go/pkg/linux*/*.a /usr/lib/go/pkg/freebsd*/*.a /usr/lib/go/pkg/darwin*/*.a"
|
||||
|
||||
if [[ ${PV} != 9999 ]]; then
|
||||
S="${WORKDIR}"/go
|
||||
fi
|
||||
|
||||
src_prepare()
|
||||
{
|
||||
if [[ ${PV} != 9999 ]]; then
|
||||
sed -i -e 's#"-Werror",##g' src/cmd/dist/build.c ||
|
||||
die "sed failed"
|
||||
fi
|
||||
epatch_user
|
||||
}
|
||||
|
||||
src_compile()
|
||||
{
|
||||
export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
|
||||
export GOROOT="$(pwd)"
|
||||
export GOBIN="${GOROOT}/bin"
|
||||
if [[ $CTARGET = armv5* ]]
|
||||
then
|
||||
export GOARM=5
|
||||
fi
|
||||
tc-export CC
|
||||
|
||||
cd src
|
||||
./make.bash || die "build failed"
|
||||
}
|
||||
|
||||
src_test()
|
||||
{
|
||||
cd src
|
||||
PATH="${GOBIN}:${PATH}" \
|
||||
./run.bash --no-rebuild --banner || die "tests failed"
|
||||
}
|
||||
|
||||
src_install()
|
||||
{
|
||||
dobin bin/*
|
||||
dodoc AUTHORS CONTRIBUTORS PATENTS README
|
||||
|
||||
dodir /usr/lib/go
|
||||
insinto /usr/lib/go
|
||||
|
||||
# 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.
|
||||
# [1] https://golang.org/issue/2775
|
||||
doins -r doc include lib pkg src
|
||||
fperms -R +x /usr/lib/go/pkg/tool
|
||||
}
|
||||
|
||||
pkg_preinst()
|
||||
{
|
||||
has_version '<dev-lang/go-1.4' &&
|
||||
export had_support_files=true ||
|
||||
export had_support_files=false
|
||||
}
|
||||
|
||||
pkg_postinst()
|
||||
{
|
||||
# If the go tool sees a package file timestamped older than a dependancy it
|
||||
# will rebuild that file. So, in order to stop go from rebuilding lots of
|
||||
# packages for every build we need to fix the timestamps. The compiler and
|
||||
# linker are also checked - so we need to fix them too.
|
||||
ebegin "fixing timestamps to avoid unnecessary rebuilds"
|
||||
tref="usr/lib/go/pkg/*/runtime.a"
|
||||
find "${EROOT}"usr/lib/go -type f \
|
||||
-exec touch -r "${EROOT}"${tref} {} \;
|
||||
eend $?
|
||||
|
||||
if [[ ${PV} != 9999 && -n ${REPLACING_VERSIONS} &&
|
||||
${REPLACING_VERSIONS} != ${PV} ]]; then
|
||||
elog "Release notes are located at http://golang.org/doc/go1.4"
|
||||
fi
|
||||
|
||||
if $had_support_files; then
|
||||
ewarn
|
||||
ewarn "All editor support, IDE support, shell completion"
|
||||
ewarn "support, etc has been removed from the go package"
|
||||
ewarn "upstream."
|
||||
ewarn "For more information on which support is available, see"
|
||||
ewarn "the following URL:"
|
||||
ewarn "https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins"
|
||||
fi
|
||||
}
|
@ -1,227 +0,0 @@
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=5
|
||||
|
||||
export CBUILD=${CBUILD:-${CHOST}}
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
|
||||
inherit eutils toolchain-funcs
|
||||
|
||||
if [[ ${PV} = 9999 ]]; then
|
||||
EGIT_REPO_URI="git://github.com/golang/go.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz"
|
||||
# arm64 only works when cross-compiling in the SDK
|
||||
KEYWORDS="-* amd64 ~arm arm64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos"
|
||||
fi
|
||||
|
||||
DESCRIPTION="A concurrent garbage collected and typesafe programming language"
|
||||
HOMEPAGE="http://www.golang.org"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0/${PV}"
|
||||
IUSE="cros_host arm64-extras"
|
||||
|
||||
# can't build go without go
|
||||
DEPEND=">=dev-lang/go-bootstrap-1.5.3"
|
||||
RDEPEND=""
|
||||
|
||||
# These test data objects have writable/executable stacks.
|
||||
QA_EXECSTACK="usr/lib/go/src/debug/elf/testdata/*.obj"
|
||||
|
||||
# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
|
||||
QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
|
||||
|
||||
# The go language uses *.a files which are _NOT_ libraries and should not be
|
||||
# stripped. The test data objects should also be left alone and unstripped.
|
||||
STRIP_MASK="/usr/lib/go/pkg/*.a
|
||||
/usr/lib/go/src/debug/elf/testdata/*
|
||||
/usr/lib/go/src/debug/dwarf/testdata/*
|
||||
/usr/lib/go/src/runtime/race/*.syso"
|
||||
|
||||
if use cros_host && use arm64-extras; then
|
||||
STRIP_MASK+="/usr/lib/go/pkg/tool/linux_arm64/*"
|
||||
fi
|
||||
|
||||
if [[ ${PV} != 9999 ]]; then
|
||||
S="${WORKDIR}"/go
|
||||
fi
|
||||
|
||||
go_arch()
|
||||
{
|
||||
# By chance most portage arch names match Go
|
||||
local portage_arch=$(tc-arch $@)
|
||||
case "${portage_arch}" in
|
||||
x86) echo 386;;
|
||||
x64-*) echo amd64;;
|
||||
*) echo "${portage_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) ]]
|
||||
}
|
||||
|
||||
pkg_pretend()
|
||||
{
|
||||
# make.bash does not understand cross-compiling a cross-compiler
|
||||
if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
|
||||
die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare()
|
||||
{
|
||||
epatch_user
|
||||
}
|
||||
|
||||
src_compile()
|
||||
{
|
||||
export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go-bootstrap
|
||||
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 GOOS=$(go_os)
|
||||
|
||||
cd src
|
||||
|
||||
# Build the target support first.
|
||||
if use cros_host && use arm64-extras; then
|
||||
export GOARCH="arm64"
|
||||
export CC_FOR_TARGET="aarch64-cros-linux-gnu-gcc"
|
||||
export CXX_FOR_TARGET="aarch64-cros-linux-gnu-g++"
|
||||
ebegin "Building for GOARCH=${GOARCH}..."
|
||||
./make.bash --no-clean --no-test
|
||||
eend $? "Build for GOARCH=${GOARCH} failed." || die
|
||||
fi
|
||||
|
||||
# Build the host last to get the correct settings in the go environment.
|
||||
export GOARCH=$(go_arch)
|
||||
export CC_FOR_TARGET=$(tc-getCC)
|
||||
export CXX_FOR_TARGET=$(tc-getCXX)
|
||||
if [[ ${ARCH} == arm ]]; then
|
||||
export GOARM=$(go_arm)
|
||||
fi
|
||||
ebegin "Building for GOARCH=${GOARCH}..."
|
||||
./make.bash --no-clean --no-test
|
||||
eend $? "Build for GOARCH=${GOARCH} failed." || die
|
||||
}
|
||||
|
||||
src_test()
|
||||
{
|
||||
go_cross_compile && return 0
|
||||
|
||||
cd src
|
||||
PATH="${GOBIN}:${PATH}" \
|
||||
./run.bash -no-rebuild || die "tests failed"
|
||||
}
|
||||
|
||||
src_install()
|
||||
{
|
||||
local bin_path="${GOBIN}"
|
||||
if go_cross_compile; then
|
||||
bin_path="${GOBIN}/$(go_tuple)"
|
||||
fi
|
||||
dobin "${bin_path}"/go "${bin_path}"/gofmt
|
||||
dodoc AUTHORS CONTRIBUTORS PATENTS README.md
|
||||
|
||||
dodir /usr/lib/go /usr/lib/go/pkg /usr/lib/go/pkg/tool
|
||||
insinto /usr/lib/go
|
||||
|
||||
# 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.
|
||||
# [1] https://golang.org/issue/2775
|
||||
doins -r doc lib src
|
||||
|
||||
# Selectively install pkg directory to exclude the bootstrap build
|
||||
insinto /usr/lib/go/pkg
|
||||
doins -r pkg/include "pkg/$(go_tuple)"
|
||||
insinto /usr/lib/go/pkg/tool
|
||||
doins -r "pkg/tool/$(go_tuple)"
|
||||
fperms -R +x /usr/lib/go/pkg/tool
|
||||
|
||||
if use cros_host && use arm64-extras; then
|
||||
insinto /usr/lib/go/pkg
|
||||
doins -r pkg/linux_arm64
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst()
|
||||
{
|
||||
has_version '<dev-lang/go-1.4' &&
|
||||
export had_support_files=true ||
|
||||
export had_support_files=false
|
||||
}
|
||||
|
||||
pkg_postinst()
|
||||
{
|
||||
# If the go tool sees a package file timestamped older than a dependancy it
|
||||
# will rebuild that file. So, in order to stop go from rebuilding lots of
|
||||
# packages for every build we need to fix the timestamps. The compiler and
|
||||
# linker are also checked - so we need to fix them too.
|
||||
ebegin "fixing timestamps to avoid unnecessary rebuilds"
|
||||
tref="usr/lib/go/pkg/*/runtime.a"
|
||||
find "${EROOT}"usr/lib/go -type f \
|
||||
-exec touch -r "${EROOT}"${tref} {} \;
|
||||
eend $?
|
||||
|
||||
if [[ ${PV} != 9999 && -n ${REPLACING_VERSIONS} &&
|
||||
${REPLACING_VERSIONS} != ${PV} ]]; then
|
||||
elog "Release notes are located at http://golang.org/doc/go${PV}"
|
||||
fi
|
||||
|
||||
if $had_support_files; then
|
||||
ewarn
|
||||
ewarn "All editor support, IDE support, shell completion"
|
||||
ewarn "support, etc has been removed from the go package"
|
||||
ewarn "upstream."
|
||||
ewarn "For more information on which support is available, see"
|
||||
ewarn "the following URL:"
|
||||
ewarn "https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins"
|
||||
fi
|
||||
}
|
9
sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r2.ebuild
vendored
Normal file
9
sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.5.4-r2.ebuild
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=6
|
||||
|
||||
inherit coreos-go-lang
|
||||
|
||||
KEYWORDS="-* amd64 arm64"
|
9
sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.6.3-r1.ebuild
vendored
Normal file
9
sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.6.3-r1.ebuild
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=6
|
||||
|
||||
inherit coreos-go-lang
|
||||
|
||||
KEYWORDS="-* amd64 arm64"
|
@ -1 +0,0 @@
|
||||
go-9999.ebuild
|
9
sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild
vendored
Normal file
9
sdk_container/src/third_party/coreos-overlay/dev-lang/go/go-1.7.ebuild
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=6
|
||||
|
||||
inherit coreos-go-lang
|
||||
|
||||
KEYWORDS="-* ~amd64 ~arm64"
|
@ -1,227 +0,0 @@
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=5
|
||||
|
||||
export CBUILD=${CBUILD:-${CHOST}}
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
|
||||
inherit eutils toolchain-funcs
|
||||
|
||||
if [[ ${PV} = 9999 ]]; then
|
||||
EGIT_REPO_URI="git://github.com/golang/go.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz"
|
||||
# arm64 only works when cross-compiling in the SDK
|
||||
KEYWORDS="-* amd64 ~arm arm64 ~x86 ~amd64-fbsd ~x86-fbsd ~x64-macos ~x86-macos"
|
||||
fi
|
||||
|
||||
DESCRIPTION="A concurrent garbage collected and typesafe programming language"
|
||||
HOMEPAGE="http://www.golang.org"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="0/${PV}"
|
||||
IUSE="cros_host arm64-extras"
|
||||
|
||||
# can't build go without go
|
||||
DEPEND=">=dev-lang/go-bootstrap-1.5.3"
|
||||
RDEPEND=""
|
||||
|
||||
# These test data objects have writable/executable stacks.
|
||||
QA_EXECSTACK="usr/lib/go/src/debug/elf/testdata/*.obj"
|
||||
|
||||
# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
|
||||
QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
|
||||
|
||||
# The go language uses *.a files which are _NOT_ libraries and should not be
|
||||
# stripped. The test data objects should also be left alone and unstripped.
|
||||
STRIP_MASK="/usr/lib/go/pkg/*.a
|
||||
/usr/lib/go/src/debug/elf/testdata/*
|
||||
/usr/lib/go/src/debug/dwarf/testdata/*
|
||||
/usr/lib/go/src/runtime/race/*.syso"
|
||||
|
||||
if use cros_host && use arm64-extras; then
|
||||
STRIP_MASK+="/usr/lib/go/pkg/tool/linux_arm64/*"
|
||||
fi
|
||||
|
||||
if [[ ${PV} != 9999 ]]; then
|
||||
S="${WORKDIR}"/go
|
||||
fi
|
||||
|
||||
go_arch()
|
||||
{
|
||||
# By chance most portage arch names match Go
|
||||
local portage_arch=$(tc-arch $@)
|
||||
case "${portage_arch}" in
|
||||
x86) echo 386;;
|
||||
x64-*) echo amd64;;
|
||||
*) echo "${portage_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) ]]
|
||||
}
|
||||
|
||||
pkg_pretend()
|
||||
{
|
||||
# make.bash does not understand cross-compiling a cross-compiler
|
||||
if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
|
||||
die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare()
|
||||
{
|
||||
epatch_user
|
||||
}
|
||||
|
||||
src_compile()
|
||||
{
|
||||
export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go-bootstrap
|
||||
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 GOOS=$(go_os)
|
||||
|
||||
cd src
|
||||
|
||||
# Build the target support first.
|
||||
if use cros_host && use arm64-extras; then
|
||||
export GOARCH="arm64"
|
||||
export CC_FOR_TARGET="aarch64-cros-linux-gnu-gcc"
|
||||
export CXX_FOR_TARGET="aarch64-cros-linux-gnu-g++"
|
||||
ebegin "Building for GOARCH=${GOARCH}..."
|
||||
./make.bash --no-clean --no-test
|
||||
eend $? "Build for GOARCH=${GOARCH} failed." || die
|
||||
fi
|
||||
|
||||
# Build the host last to get the correct settings in the go environment.
|
||||
export GOARCH=$(go_arch)
|
||||
export CC_FOR_TARGET=$(tc-getCC)
|
||||
export CXX_FOR_TARGET=$(tc-getCXX)
|
||||
if [[ ${ARCH} == arm ]]; then
|
||||
export GOARM=$(go_arm)
|
||||
fi
|
||||
ebegin "Building for GOARCH=${GOARCH}..."
|
||||
./make.bash --no-clean --no-test
|
||||
eend $? "Build for GOARCH=${GOARCH} failed." || die
|
||||
}
|
||||
|
||||
src_test()
|
||||
{
|
||||
go_cross_compile && return 0
|
||||
|
||||
cd src
|
||||
PATH="${GOBIN}:${PATH}" \
|
||||
./run.bash -no-rebuild || die "tests failed"
|
||||
}
|
||||
|
||||
src_install()
|
||||
{
|
||||
local bin_path="${GOBIN}"
|
||||
if go_cross_compile; then
|
||||
bin_path="${GOBIN}/$(go_tuple)"
|
||||
fi
|
||||
dobin "${bin_path}"/go "${bin_path}"/gofmt
|
||||
dodoc AUTHORS CONTRIBUTORS PATENTS README.md
|
||||
|
||||
dodir /usr/lib/go /usr/lib/go/pkg /usr/lib/go/pkg/tool
|
||||
insinto /usr/lib/go
|
||||
|
||||
# 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.
|
||||
# [1] https://golang.org/issue/2775
|
||||
doins -r doc lib src
|
||||
|
||||
# Selectively install pkg directory to exclude the bootstrap build
|
||||
insinto /usr/lib/go/pkg
|
||||
doins -r pkg/include "pkg/$(go_tuple)"
|
||||
insinto /usr/lib/go/pkg/tool
|
||||
doins -r "pkg/tool/$(go_tuple)"
|
||||
fperms -R +x /usr/lib/go/pkg/tool
|
||||
|
||||
if use cros_host && use arm64-extras; then
|
||||
insinto /usr/lib/go/pkg
|
||||
doins -r pkg/linux_arm64
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_preinst()
|
||||
{
|
||||
has_version '<dev-lang/go-1.4' &&
|
||||
export had_support_files=true ||
|
||||
export had_support_files=false
|
||||
}
|
||||
|
||||
pkg_postinst()
|
||||
{
|
||||
# If the go tool sees a package file timestamped older than a dependancy it
|
||||
# will rebuild that file. So, in order to stop go from rebuilding lots of
|
||||
# packages for every build we need to fix the timestamps. The compiler and
|
||||
# linker are also checked - so we need to fix them too.
|
||||
ebegin "fixing timestamps to avoid unnecessary rebuilds"
|
||||
tref="usr/lib/go/pkg/*/runtime.a"
|
||||
find "${EROOT}"usr/lib/go -type f \
|
||||
-exec touch -r "${EROOT}"${tref} {} \;
|
||||
eend $?
|
||||
|
||||
if [[ ${PV} != 9999 && -n ${REPLACING_VERSIONS} &&
|
||||
${REPLACING_VERSIONS} != ${PV} ]]; then
|
||||
elog "Release notes are located at http://golang.org/doc/go${PV}"
|
||||
fi
|
||||
|
||||
if $had_support_files; then
|
||||
ewarn
|
||||
ewarn "All editor support, IDE support, shell completion"
|
||||
ewarn "support, etc has been removed from the go package"
|
||||
ewarn "upstream."
|
||||
ewarn "For more information on which support is available, see"
|
||||
ewarn "the following URL:"
|
||||
ewarn "https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins"
|
||||
fi
|
||||
}
|
30
sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-depend.eclass
vendored
Normal file
30
sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-depend.eclass
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
# @ECLASS: coreos-go-depend.eclass
|
||||
# @BLURB: Minimal Go eclass for simply depending on Go.
|
||||
|
||||
# @ECLASS-VARIABLE: COREOS_GO_VERSION
|
||||
# @DESCRIPTION:
|
||||
# This variable specifies the version of Go to use. If ommitted the
|
||||
# default value below will be used.
|
||||
#
|
||||
# Example:
|
||||
# @CODE
|
||||
# COREOS_GO_VERSION=go1.5
|
||||
# @CODE
|
||||
export COREOS_GO_VERSION="${COREOS_GO_VERSION:-go1.6}"
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
5|6) ;;
|
||||
*) die "Unsupported EAPI=${EAPI} for ${ECLASS}"
|
||||
esac
|
||||
|
||||
inherit coreos-go-utils
|
||||
|
||||
# Set a use flag to indicate what version of Go is being used ensure
|
||||
# the package gets rebuilt when the version changes.
|
||||
IUSE="+go_version_${COREOS_GO_VERSION//./_}"
|
||||
REQUIRED_USE="go_version_${COREOS_GO_VERSION//./_}"
|
||||
DEPEND="dev-lang/go:${COREOS_GO_VERSION#go}="
|
123
sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-lang.eclass
vendored
Normal file
123
sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-lang.eclass
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
# @ECLASS: coreos-go-lang.eclass
|
||||
# @BLURB: Common functionality for building Go itself
|
||||
# @DESCRIPTION:
|
||||
# Only dev-lang/go ebuilds should inherit this eclass.
|
||||
#
|
||||
# Native (${CHOST} == ${CTARGET}):
|
||||
#
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
6) ;;
|
||||
*) die "Unsupported EAPI=${EAPI} for ${ECLASS}"
|
||||
esac
|
||||
|
||||
inherit coreos-go-utils toolchain-funcs versionator
|
||||
|
||||
export CBUILD=${CBUILD:-${CHOST}}
|
||||
export CTARGET=${CTARGET:-${CHOST}}
|
||||
|
||||
# Determine the main SLOT we will be using, e.g.: PV=1.5.3 SLOT=1.5
|
||||
GOSLOT="$(get_version_component_range 1-2)"
|
||||
|
||||
DESCRIPTION="A concurrent garbage collected and typesafe programming language"
|
||||
HOMEPAGE="http://www.golang.org"
|
||||
SRC_URI="https://storage.googleapis.com/golang/go${PV}.src.tar.gz"
|
||||
|
||||
LICENSE="BSD"
|
||||
SLOT="${GOSLOT}/${PV}"
|
||||
IUSE=""
|
||||
|
||||
RDEPEND="app-eselect/eselect-go"
|
||||
DEPEND="${RDEPEND}
|
||||
>=dev-lang/go-bootstrap-1.5.3"
|
||||
|
||||
# These test data objects have writable/executable stacks.
|
||||
QA_EXECSTACK="usr/lib/go${GOSLOT}/src/debug/elf/testdata/*.obj"
|
||||
|
||||
# Similarly, test data is never executed so don't check link dependencies.
|
||||
REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*"
|
||||
|
||||
# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
|
||||
QA_MULTILIB_PATHS="usr/lib/go${GOSLOT}/pkg/tool/.*/.*"
|
||||
|
||||
# The go language uses *.a files which are _NOT_ libraries and should not be
|
||||
# stripped. The test data objects should also be left alone and unstripped.
|
||||
STRIP_MASK="*.a /usr/lib/go${GOSLOT}/src/*"
|
||||
|
||||
S="${WORKDIR}/go"
|
||||
|
||||
coreos-go-lang_pkg_pretend() {
|
||||
# make.bash does not understand cross-compiling a cross-compiler
|
||||
if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
|
||||
die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
|
||||
fi
|
||||
}
|
||||
|
||||
coreos-go-lang_src_compile() {
|
||||
export GOROOT_BOOTSTRAP="${EPREFIX}/usr/lib/go-bootstrap"
|
||||
export GOROOT_FINAL="${EPREFIX}/usr/lib/go${GOSLOT}"
|
||||
export GOROOT="${S}"
|
||||
export GOBIN="${GOROOT}/bin"
|
||||
|
||||
# Go's build script does not use BUILD/HOST/TARGET consistently. :(
|
||||
go_export
|
||||
export GOHOSTARCH=$(go_arch ${CBUILD})
|
||||
export GOHOSTOS=$(go_os ${CBUILD})
|
||||
export CC_FOR_TARGET=$(tc-getCC)
|
||||
export CXX_FOR_TARGET=$(tc-getCXX)
|
||||
# Must be set *after* calling tc-getCC
|
||||
export CC=$(tc-getBUILD_CC)
|
||||
|
||||
cd src
|
||||
./make.bash || die "build failed"
|
||||
}
|
||||
|
||||
coreos-go-lang_src_test() {
|
||||
go_cross_compile && return 0
|
||||
|
||||
cd src
|
||||
PATH="${GOBIN}:${PATH}" \
|
||||
./run.bash -no-rebuild || die "tests failed"
|
||||
}
|
||||
|
||||
coreos-go-lang_src_install() {
|
||||
exeinto "/usr/lib/go${GOSLOT}/bin"
|
||||
if go_cross_compile; then
|
||||
doexe "${GOBIN}/$(go_tuple)/"{go,gofmt}
|
||||
else
|
||||
doexe "${GOBIN}/"{go,gofmt}
|
||||
fi
|
||||
dosym "../lib/go${GOSLOT}/bin/go" "/usr/bin/go${GOSLOT}"
|
||||
dosym "../lib/go${GOSLOT}/bin/gofmt" "/usr/bin/gofmt${GOSLOT}"
|
||||
|
||||
exeinto "/usr/lib/go${GOSLOT}/pkg/tool/$(go_tuple)"
|
||||
doexe "pkg/tool/$(go_tuple)/"*
|
||||
|
||||
insopts -m0644 -p # preserve timestamps
|
||||
insinto "/usr/lib/go${GOSLOT}"
|
||||
doins -r doc lib src
|
||||
insinto "/usr/lib/go${GOSLOT}/pkg"
|
||||
doins -r "pkg/include" "pkg/$(go_tuple)"
|
||||
|
||||
dodoc AUTHORS CONTRIBUTORS PATENTS README.md
|
||||
}
|
||||
|
||||
eselect_go_update() {
|
||||
if [[ -z "$(eselect go show)" || ! -f "${EROOT}usr/bin/$(eselect go show)" ]]; then
|
||||
eselect go update
|
||||
fi
|
||||
}
|
||||
|
||||
coreos-go-lang_pkg_postinst() {
|
||||
eselect_go_update
|
||||
}
|
||||
|
||||
coreos-go-lang_pkg_postrm() {
|
||||
eselect_go_update
|
||||
}
|
||||
|
||||
EXPORT_FUNCTIONS pkg_pretend src_compile src_test src_install pkg_postinst pkg_postrm
|
119
sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-utils.eclass
vendored
Normal file
119
sdk_container/src/third_party/coreos-overlay/eclass/coreos-go-utils.eclass
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
# Copyright 2016 CoreOS, Inc.
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
# @ECLASS: coreos-go-utils.eclass
|
||||
# @BLURB: Utility functions for Go
|
||||
# @DESCRIPTION:
|
||||
# A utility eclass for functions needed when building both Go itself
|
||||
# and packages that depend on it. It does not set any metadata.
|
||||
|
||||
case "${EAPI:-0}" in
|
||||
5|6) ;;
|
||||
*) die "Unsupported EAPI=${EAPI} for ${ECLASS}"
|
||||
esac
|
||||
|
||||
inherit flag-o-matic toolchain-funcs
|
||||
|
||||
# @FUNCTION: go_arch
|
||||
# @USAGE: [chost]
|
||||
# @DESCRIPTION:
|
||||
# export GOARCH=$(go_arch $CHOST)
|
||||
go_arch() {
|
||||
# By chance most portage arch names match Go
|
||||
local portage_arch=$(tc-arch "${1:-${CHOST}}")
|
||||
local endian=$(tc-endian "${1:-${CHOST}}")
|
||||
case "${portage_arch}" in
|
||||
x86) echo 386;;
|
||||
x64-*) echo amd64;;
|
||||
ppc64)
|
||||
[[ "${endian}" = big ]] && echo ppc64 || echo ppc64le ;;
|
||||
*) echo "${portage_arch}";;
|
||||
esac
|
||||
}
|
||||
|
||||
# @FUNCTION: go_arm
|
||||
# @USAGE: [chost]
|
||||
# @DESCRIPTION:
|
||||
# export GOARM=$(go_arm $CHOST)
|
||||
go_arm() {
|
||||
case "${1:-${CHOST}}" in
|
||||
armv5*) echo 5;;
|
||||
armv6*) echo 6;;
|
||||
armv7*) echo 7;;
|
||||
*)
|
||||
die "unknown GOARM for ${1:-${CHOST}}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# @FUNCTION: go_os
|
||||
# @USAGE: [chost]
|
||||
# @DESCRIPTION:
|
||||
# export GOOS=$(go_os $CHOST)
|
||||
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
|
||||
}
|
||||
|
||||
# @FUNCTION: go_export
|
||||
# @USAGE: [chost]
|
||||
# @DESCRIPTION:
|
||||
# Export GOARCH, GOOS, GOARM, CC, CXX, and CGO_* environment variables.
|
||||
go_export() {
|
||||
export GOARCH=$(go_arch "$@")
|
||||
export GOOS=$(go_os "$@")
|
||||
if [[ "${GOARCH}" == "arm" ]]; then
|
||||
export GOARM=$(go_arm "$@")
|
||||
fi
|
||||
|
||||
# Go's 6l linker does not support PIE, disable so cgo binaries
|
||||
# which use 6l+gcc for linking can be built correctly.
|
||||
if gcc-specs-pie; then
|
||||
append-ldflags -nopie
|
||||
fi
|
||||
|
||||
export CC=$(tc-getCC)
|
||||
export CXX=$(tc-getCXX)
|
||||
export CGO_ENABLED=${CGO_ENABLED:-1}
|
||||
export CGO_CFLAGS="${CFLAGS}"
|
||||
export CGO_CPPFLAGS="${CPPFLAGS}"
|
||||
export CGO_CXXFLAGS="${CXXFLAGS}"
|
||||
export CGO_LDFLAGS="${LDFLAGS}"
|
||||
|
||||
# Ensure the `go` wrapper calls the version we expect
|
||||
export EGO="${COREOS_GO_VERSION}"
|
||||
}
|
||||
|
||||
# @FUNCTION: go_tuple
|
||||
# @USAGE: [chost]
|
||||
# @DESCRIPTION:
|
||||
# The uniqe string defining a Go target, as used in directory names.
|
||||
# e.g. linux_amd64 for x86_64-pc-linux-gnu
|
||||
go_tuple()
|
||||
{
|
||||
echo "$(go_os $@)_$(go_arch $@)"
|
||||
}
|
||||
|
||||
# @FUNCTION: go_cross_compile
|
||||
# @USAGE: [chost]
|
||||
# @DESCRIPTION:
|
||||
# Check if Go consideres compiling for $CHOST as cross-compilation.
|
||||
# Since Go's target tuples are smaller than GCC's Go may not consider
|
||||
# itself as a cross-compiler even if the GCC it is using for cgo is.
|
||||
go_cross_compile()
|
||||
{
|
||||
[[ $(go_tuple ${CBUILD:-${CHOST}}) != $(go_tuple $@) ]]
|
||||
}
|
@ -6,28 +6,31 @@
|
||||
# @BLURB: utility functions for building Go binaries
|
||||
|
||||
# @ECLASS-VARIABLE: COREOS_GO_PACKAGE
|
||||
# @REQUIRED
|
||||
# @DESCRIPTION:
|
||||
# Name of the Go package unpacked to ${S}, this is required.
|
||||
# Name of the Go package unpacked to ${S}.
|
||||
#
|
||||
# Example:
|
||||
# @CODE
|
||||
# COREOS_GO_PACKAGE="github.com/coreos/mantle"
|
||||
# @CODE
|
||||
|
||||
[[ ${EAPI} != "5" ]] && die "${ECLASS}: Only EAPI=5 is supported"
|
||||
# @ECLASS-VARIABLE: COREOS_GO_VERSION
|
||||
# @DESCRIPTION:
|
||||
# This variable specifies the version of Go to use. If ommitted the
|
||||
# default value from coreos-go-depend.eclass will be used.
|
||||
#
|
||||
# Example:
|
||||
# @CODE
|
||||
# COREOS_GO_VERSION=go1.5
|
||||
# @CODE
|
||||
|
||||
inherit flag-o-matic multiprocessing toolchain-funcs
|
||||
case "${EAPI:-0}" in
|
||||
5|6) ;;
|
||||
*) die "Unsupported EAPI=${EAPI} for ${ECLASS}"
|
||||
esac
|
||||
|
||||
DEPEND="dev-lang/go:="
|
||||
|
||||
# @FUNCTION: go_get_arch
|
||||
# @USAGE: export GOARCH=$(go_get_arch)
|
||||
go_get_arch() {
|
||||
# By chance most portage arch names match Go
|
||||
local portage_arch=$(tc-arch ${CHOST})
|
||||
case "${portage_arch}" in
|
||||
x86) echo 386;;
|
||||
x64-*) echo amd64;;
|
||||
ppc64)
|
||||
[[ "$(tc-endian)" = big ]] && echo ppc64 || echo ppc64le ;;
|
||||
*) echo "${portage_arch}";;
|
||||
esac
|
||||
}
|
||||
inherit coreos-go-depend multiprocessing
|
||||
|
||||
# @FUNCTION: go_build
|
||||
# @USAGE: <package-name> [<binary-name>]
|
||||
@ -38,10 +41,10 @@ go_build() {
|
||||
local package_name="$1"
|
||||
local binary_name="${package_name##*/}"
|
||||
|
||||
ebegin "go build ${package_name}"
|
||||
debug-print $(go env)
|
||||
ebegin "${EGO} build ${package_name}"
|
||||
debug-print EGO=${EGO} $(${EGO} env)
|
||||
|
||||
go build -v \
|
||||
${EGO} build -v \
|
||||
-p "$(makeopts_jobs)" \
|
||||
-ldflags "${GO_LDFLAGS} -extldflags '${LDFLAGS}'" \
|
||||
-o "${GOBIN}/${binary_name}" \
|
||||
@ -55,7 +58,7 @@ go_build() {
|
||||
coreos-go_src_prepare() {
|
||||
debug-print-function ${FUNCNAME} "$@"
|
||||
|
||||
export GOARCH=$(go_get_arch)
|
||||
go_export
|
||||
export GOPATH="${WORKDIR}/gopath"
|
||||
export GOBIN="${GOPATH}/bin"
|
||||
|
||||
@ -68,19 +71,6 @@ coreos-go_src_prepare() {
|
||||
local package_path="${GOPATH}/src/${COREOS_GO_PACKAGE}"
|
||||
mkdir -p "${package_path%/*}" || die "${ECLASS}: bad path: ${package_path%/*}"
|
||||
ln -sT "${S}" "${package_path}" || die "${ECLASS}: bad path: ${S}"
|
||||
|
||||
# Go's 6l linker does not support PIE, disable so cgo binaries
|
||||
# which use 6l+gcc for linking can be built correctly.
|
||||
if gcc-specs-pie; then
|
||||
append-ldflags -nopie
|
||||
fi
|
||||
|
||||
export CC=$(tc-getCC)
|
||||
export CGO_ENABLED=${CGO_ENABLED:-1}
|
||||
export CGO_CFLAGS="${CFLAGS}"
|
||||
export CGO_CPPFLAGS="${CPPFLAGS}"
|
||||
export CGO_CXXFLAGS="${CXXFLAGS}"
|
||||
export CGO_LDFLAGS="${LDFLAGS}"
|
||||
}
|
||||
|
||||
coreos-go_src_compile() {
|
||||
|
@ -15,6 +15,10 @@ USE_EXPAND_HIDDEN="${USE_EXPAND_HIDDEN} CROS_WORKON_TREE"
|
||||
USE_EXPAND="${USE_EXPAND} ETCD_PROTOCOLS"
|
||||
ETCD_PROTOCOLS="1 2"
|
||||
|
||||
# Use go_version_* flags to indicate which major version was used.
|
||||
# For now this is only informational and set by coreos-go.eclass
|
||||
USE_EXPAND="${USE_EXPAND} GO_VERSION"
|
||||
|
||||
# Extra use flags for CoreOS SDK
|
||||
USE="${USE} cros_host expat -introspection -cups -tcpd -berkdb"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user