Merge pull request #1257 from glevand/for-merge-1

eclass/coreos-go: Updates for arm64
This commit is contained in:
Michael Marineau 2015-05-14 16:57:30 -07:00
commit fc85964d0c
3 changed files with 22 additions and 15 deletions

View File

@ -1,21 +1,21 @@
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=4
EAPI=5
CROS_WORKON_PROJECT="coreos/sdnotify-proxy"
CROS_WORKON_LOCALNAME="sdnotify-proxy"
CROS_WORKON_REPO="git://github.com"
COREOS_GO_PACKAGE="github.com/coreos/sdnotify-proxy"
inherit coreos-go cros-workon
if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64"
KEYWORDS="~amd64 ~arm64"
else
CROS_WORKON_COMMIT="f516129af110fd4a51bd5ea2654f4dc8dd02e5c4"
KEYWORDS="amd64"
KEYWORDS="amd64 arm64"
fi
inherit cros-workon
DESCRIPTION="fleet"
DESCRIPTION="sdnotify-proxy"
HOMEPAGE="https://github.com/coreos/sdnotify-proxy"
SRC_URI=""
@ -26,10 +26,10 @@ IUSE=""
DEPEND=">=dev-lang/go-1.3"
src_compile() {
./build
go_build "${COREOS_GO_PACKAGE}"
}
src_install() {
exeinto /usr/libexec
doexe ${S}/bin/sdnotify-proxy
doexe ${GOBIN}/sdnotify-proxy
}

View File

@ -9,41 +9,48 @@
# @DESCRIPTION:
# Name of the Go package unpacked to ${S}, this is required.
[[ ${EAPI} != "5" ]] && die "Only EAPI=5 is supported"
[[ ${EAPI} != "5" ]] && die "${ECLASS}: Only EAPI=5 is supported"
inherit flag-o-matic multiprocessing toolchain-funcs
DEPEND="dev-lang/go"
# @FUNCTION: go_get_arch
# @USAGE: export GOARCH=$(go_get_arch)
go_get_arch() {
echo ${ARCH}
}
# @FUNCTION: go_build
# @USAGE: <package-name> [<binary-name>]
go_build() {
debug-print-function ${FUNCNAME} "$@"
[[ $# -eq 0 || $# -gt 2 ]] && die "go_install: incorrect # of arguments"
[[ $# -eq 0 || $# -gt 2 ]] && die "${ECLASS}: go_install: incorrect # of arguments"
local package_name="$1"
local binary_name="${package_name##*/}"
go build -x -p "$(makeopts_jobs)" \
-ldflags "-extldflags '${LDFLAGS}'" \
-o "${GOPATH}/bin/${binary_name}" "${package_name}" \
|| die "go build failed"
|| die "${ECLASS}: go build failed"
}
coreos-go_src_prepare() {
debug-print-function ${FUNCNAME} "$@"
export GOARCH=$(go_get_arch)
export GOPATH="${WORKDIR}/gopath"
export GOBIN="${GOPATH}/bin"
mkdir -p "${GOBIN}" || die
mkdir -p "${GOBIN}" || die "${ECLASS}: bad path: ${GOBIN}"
if [[ -z "${COREOS_GO_PACKAGE}" ]]; then
die "COREOS_GO_PACKAGE must be defined by the ebuild"
die "${ECLASS}: COREOS_GO_PACKAGE must be defined by the ebuild"
fi
local package_path="${GOPATH}/src/${COREOS_GO_PACKAGE}"
mkdir -p "${package_path%/*}" || die
ln -sT "${S}" "${package_path}" || die
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.