mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-18 19:01:28 +02:00
mantle: build kola
Add support for cgo to the go eclass and start building kola!
This commit is contained in:
parent
052c439c52
commit
074f533f93
@ -9,7 +9,7 @@ COREOS_GO_PACKAGE="github.com/coreos/mantle"
|
|||||||
if [[ "${PV}" == 9999 ]]; then
|
if [[ "${PV}" == 9999 ]]; then
|
||||||
KEYWORDS="~amd64"
|
KEYWORDS="~amd64"
|
||||||
else
|
else
|
||||||
CROS_WORKON_COMMIT="a1a810b88e4fca2c320a31a740796eaffecab57f"
|
CROS_WORKON_COMMIT="444fecccb109b5a90765cb1b79311fb10dd5c5e5"
|
||||||
KEYWORDS="amd64"
|
KEYWORDS="amd64"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -21,5 +21,7 @@ LICENSE="Apache-2"
|
|||||||
SLOT="0"
|
SLOT="0"
|
||||||
|
|
||||||
src_compile() {
|
src_compile() {
|
||||||
go_build "${COREOS_GO_PACKAGE}"/cmd/plume
|
for cmd in kola plume; do
|
||||||
|
go_build "${COREOS_GO_PACKAGE}/cmd/${cmd}"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
[[ ${EAPI} != "5" ]] && die "Only EAPI=5 is supported"
|
[[ ${EAPI} != "5" ]] && die "Only EAPI=5 is supported"
|
||||||
|
|
||||||
inherit multiprocessing
|
inherit flag-o-matic multiprocessing toolchain-funcs
|
||||||
|
|
||||||
DEPEND="dev-lang/go"
|
DEPEND="dev-lang/go"
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ go_build() {
|
|||||||
local package_name="$1"
|
local package_name="$1"
|
||||||
local binary_name="${package_name##*/}"
|
local binary_name="${package_name##*/}"
|
||||||
|
|
||||||
# TODO: handle cgo, cross-compiling, etc etc...
|
go build -x -p "$(makeopts_jobs)" \
|
||||||
CGO_ENABLED=0 go build -x -p "$(makeopts_jobs)" \
|
-ldflags "-extldflags '${LDFLAGS}'" \
|
||||||
-o "${GOPATH}/bin/${binary_name}" "${package_name}" \
|
-o "${GOPATH}/bin/${binary_name}" "${package_name}" \
|
||||||
|| die "go build failed"
|
|| die "go build failed"
|
||||||
}
|
}
|
||||||
@ -44,6 +44,19 @@ coreos-go_src_prepare() {
|
|||||||
local package_path="${GOPATH}/src/${COREOS_GO_PACKAGE}"
|
local package_path="${GOPATH}/src/${COREOS_GO_PACKAGE}"
|
||||||
mkdir -p "${package_path%/*}" || die
|
mkdir -p "${package_path%/*}" || die
|
||||||
ln -sT "${S}" "${package_path}" || die
|
ln -sT "${S}" "${package_path}" || die
|
||||||
|
|
||||||
|
# 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}"
|
||||||
}
|
}
|
||||||
|
|
||||||
coreos-go_src_compile() {
|
coreos-go_src_compile() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user