Browse Source

Remove duplication of golang setup

android-5
Fredrik Fornwall 9 years ago
parent
commit
f6a562876b
  1. 18
      build-package.sh
  2. 20
      packages/asciinema/build.sh
  3. 20
      packages/golang/build.sh

18
build-package.sh

@ -545,6 +545,24 @@ termux_step_create_debscripts () {
} }
termux_setup_golang () { termux_setup_golang () {
export GOOS=android
export CGO_ENABLED=1
export GO_LDFLAGS="-extldflags=-pie"
if [ "$TERMUX_ARCH" = "arm" ]; then
export GOARCH=arm
export GOARM=7
elif [ "$TERMUX_ARCH" = "i686" ]; then
export GOARCH=386
export GO386=sse2
elif [ "$TERMUX_ARCH" = "aarch64" ]; then
export GOARCH=arm64
elif [ "$TERMUX_ARCH" = "x86_64" ]; then
export GOARCH=amd64
else
echo "ERROR: Unsupported arch: $TERMUX_ARCH"
exit 1
fi
local TERMUX_GO_VERSION=go1.6beta1 local TERMUX_GO_VERSION=go1.6beta1
local TERMUX_GO_PLATFORM=linux-amd64 local TERMUX_GO_PLATFORM=linux-amd64
test `uname` = "Darwin" && TERMUX_GO_PLATFORM=darwin-amd64 test `uname` = "Darwin" && TERMUX_GO_PLATFORM=darwin-amd64

20
packages/asciinema/build.sh

@ -7,24 +7,7 @@ TERMUX_PKG_FOLDERNAME=asciinema-${TERMUX_PKG_VERSION}
TERMUX_PKG_BUILD_IN_SRC=yes TERMUX_PKG_BUILD_IN_SRC=yes
termux_step_make () { termux_step_make () {
export GOOS=android termux_setup_golang
export GO_LDFLAGS="-extldflags=-pie"
export CGO_ENABLED=1
if [ "$TERMUX_ARCH" = "arm" ]; then
export GOARCH=arm
export GOARM=7
elif [ "$TERMUX_ARCH" = "i686" ]; then
export GOARCH=386
export GO386=sse2
elif [ "$TERMUX_ARCH" = "aarch64" ]; then
export GOARCH=arm64
elif [ "$TERMUX_ARCH" = "x86_64" ]; then
export GOARCH=amd64
else
echo "ERROR: Unsupported arch: $TERMUX_ARCH"
exit 1
fi
export GOPATH=$TERMUX_PKG_TMPDIR export GOPATH=$TERMUX_PKG_TMPDIR
cd $GOPATH cd $GOPATH
mkdir -p src/github.com/asciinema/asciinema/ mkdir -p src/github.com/asciinema/asciinema/
@ -33,7 +16,6 @@ termux_step_make () {
termux_step_make_install () { termux_step_make_install () {
cd $GOPATH/src/github.com/asciinema/asciinema cd $GOPATH/src/github.com/asciinema/asciinema
termux_setup_golang
PREFIX=$TERMUX_PREFIX make build PREFIX=$TERMUX_PREFIX make build
PREFIX=$TERMUX_PREFIX make install PREFIX=$TERMUX_PREFIX make install
} }

20
packages/golang/build.sh

@ -8,31 +8,13 @@ TERMUX_PKG_FOLDERNAME=go
TERMUX_PKG_KEEP_STATIC_LIBRARIES=true TERMUX_PKG_KEEP_STATIC_LIBRARIES=true
termux_step_make_install () { termux_step_make_install () {
export GOOS=android termux_setup_golang
export CGO_ENABLED=1
if [ "$TERMUX_ARCH" = "arm" ]; then
export GOARCH=arm
export GOARM=7
elif [ "$TERMUX_ARCH" = "i686" ]; then
export GOARCH=386
export GO386=sse2
elif [ "$TERMUX_ARCH" = "aarch64" ]; then
export GOARCH=arm64
elif [ "$TERMUX_ARCH" = "x86_64" ]; then
export GOARCH=amd64
else
echo "ERROR: Unsupported arch: $TERMUX_ARCH"
exit 1
fi
TERMUX_GOLANG_DIRNAME=${GOOS}_$GOARCH TERMUX_GOLANG_DIRNAME=${GOOS}_$GOARCH
TERMUX_GODIR=$TERMUX_PREFIX/lib/go TERMUX_GODIR=$TERMUX_PREFIX/lib/go
rm -Rf $TERMUX_GODIR rm -Rf $TERMUX_GODIR
mkdir -p $TERMUX_GODIR/{src,pkg/tool/$TERMUX_GOLANG_DIRNAME,pkg/include,pkg/${TERMUX_GOLANG_DIRNAME}_shared} mkdir -p $TERMUX_GODIR/{src,pkg/tool/$TERMUX_GOLANG_DIRNAME,pkg/include,pkg/${TERMUX_GOLANG_DIRNAME}_shared}
termux_setup_golang
cd $TERMUX_PKG_SRCDIR/src cd $TERMUX_PKG_SRCDIR/src
env CC_FOR_TARGET=$CC \ env CC_FOR_TARGET=$CC \
CXX_FOR_TARGET=$CXX \ CXX_FOR_TARGET=$CXX \

Loading…
Cancel
Save