set Go env vars in environment
This way, a template can overwrite do_build but still have good defaults for GOPATH, GOARCH and GOARM.
This commit is contained in:
parent
92c77a10ec
commit
a62f407007
3 changed files with 14 additions and 21 deletions
|
@ -3,22 +3,13 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
do_build() {
|
do_build() {
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
|
||||||
armv6*) export GOARCH=arm; export GOARM=6;;
|
|
||||||
armv7*) export GOARCH=arm; export GOARM=7;;
|
|
||||||
i686*) export GOARCH=386;;
|
|
||||||
x86_64*) export GOARCH=amd64;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
export GOPATH="$(mktemp -d --tmpdir="${wrksrc}")"
|
|
||||||
|
|
||||||
if [[ "${go_get}" != "yes" ]]; then
|
if [[ "${go_get}" != "yes" ]]; then
|
||||||
local path="${GOPATH}/src/${go_import_path}"
|
local path="${GOPATH}/src/${go_import_path}"
|
||||||
mkdir -p "$(dirname ${path})"
|
mkdir -p "$(dirname ${path})"
|
||||||
ln -fs $PWD "${path}"
|
ln -fs $PWD "${path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
go get -d -v "${go_import_path}"
|
go get -d "${go_import_path}"
|
||||||
go build -x "${go_import_path}"
|
go build -x "${go_import_path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,12 @@ if [ "$CROSS_BUILD" ]; then
|
||||||
hostmakedepends+=" go-cross-linux"
|
hostmakedepends+=" go-cross-linux"
|
||||||
fi
|
fi
|
||||||
nostrip=yes
|
nostrip=yes
|
||||||
|
|
||||||
|
case "$XBPS_TARGET_MACHINE" in
|
||||||
|
armv6*) export GOARCH=arm; export GOARM=6;;
|
||||||
|
armv7*) export GOARCH=arm; export GOARM=7;;
|
||||||
|
i686*) export GOARCH=386;;
|
||||||
|
x86_64*) export GOARCH=amd64;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
export GOPATH="${wrksrc}/_build-${pkgname}-xbps"
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
pkgname=syncthing
|
pkgname=syncthing
|
||||||
version=0.10.23
|
version=0.10.23
|
||||||
revision=1
|
revision=1
|
||||||
hostmakedepends="go>=1.3"
|
build_style=go
|
||||||
if [ "$CROSS_BUILD" ]; then
|
go_import_path="github.com/syncthing/syncthing"
|
||||||
hostmakedepends+=" go-cross-linux"
|
|
||||||
fi
|
|
||||||
short_desc="Open Source Continuous File Synchronization"
|
short_desc="Open Source Continuous File Synchronization"
|
||||||
maintainer="Duncan Overbruck <mail@duncano.de>"
|
maintainer="Duncan Overbruck <mail@duncano.de>"
|
||||||
license="GPL-3"
|
license="GPL-3"
|
||||||
|
@ -14,13 +12,8 @@ distfiles="https://github.com/syncthing/${pkgname}/archive/v${version}.tar.gz"
|
||||||
checksum=c8c829191620e2268209c3da19b4b58b3568aaf859d9be84b161da26454fb54a
|
checksum=c8c829191620e2268209c3da19b4b58b3568aaf859d9be84b161da26454fb54a
|
||||||
|
|
||||||
do_build() {
|
do_build() {
|
||||||
case "$XBPS_TARGET_MACHINE" in
|
goarch="${GOARCH}"
|
||||||
arm*) goarch=arm;;
|
unset GOARCH
|
||||||
i686*) goarch=386;;
|
|
||||||
x86_64*) goarch=amd64;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
export GOPATH="${PWD}/gopath"
|
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
mkdir -p $GOPATH/src/github.com/syncthing
|
mkdir -p $GOPATH/src/github.com/syncthing
|
||||||
ln -s $PWD $GOPATH/src/github.com/syncthing/${pkgname}
|
ln -s $PWD $GOPATH/src/github.com/syncthing/${pkgname}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue