diff options
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 34 | ||||
-rw-r--r-- | make.bash | 88 | ||||
-rw-r--r-- | make.bash.patch | 46 |
4 files changed, 74 insertions, 102 deletions
@@ -1,6 +1,6 @@ pkgbase = psiphon-tunnel-core-git pkgdesc = Psiphon Tunnelling Proxy - pkgver = 2.0.20.r3554.9efdd083 + pkgver = 2.0.27.r3653.6826fe87 pkgrel = 1 epoch = 3 url = https://github.com/Psiphon-Labs/psiphon-tunnel-core @@ -15,10 +15,12 @@ pkgbase = psiphon-tunnel-core-git source = git+https://github.com/Psiphon-Labs/psiphon-tunnel-core.git source = psiphon.conf source = psiphon.service - source = make.bash + source = make.bash.patch + source = https://storage.googleapis.com/golang/go1.17.13.linux-amd64.tar.gz sha256sums = SKIP sha256sums = c2c414831ad29bdeecd00313c473fbaa448f4750e70df1c10e863870bde179aa sha256sums = d0227e69cac62480951e9c83747d43fccd7bdd18224652428ab20369b84173aa - sha256sums = 73ead204b4f0aa4f0a5f5ed174257b10dbb6f7430c5abacc450ea000adfd12da + sha256sums = 681e9b7e8f32061028061a80c9663f11e2e8d396478c7067706e5ae3db121dc2 + sha256sums = 4cdd2bc664724dc7db94ad51b503512c5ae7220951cac568120f64f8e94399fc pkgname = psiphon-tunnel-core-git @@ -21,7 +21,8 @@ _pkgname=psiphon-tunnel-core pkgname="$_pkgname-git" -pkgver=2.0.20.r3554.9efdd083 +GOVERSION=go1.17.13 +pkgver=2.0.27.r3653.6826fe87 pkgrel=1 epoch=3 pkgdesc='Psiphon Tunnelling Proxy' @@ -33,12 +34,14 @@ depends=('glibc') source=("git+$url.git" "psiphon.conf" "psiphon.service" - "make.bash") + "make.bash.patch" + "https://storage.googleapis.com/golang/${GOVERSION}.linux-amd64.tar.gz") backup=('etc/psiphon.conf' 'usr/lib/systemd/user/psiphon.service') sha256sums=('SKIP' - 'c2c414831ad29bdeecd00313c473fbaa448f4750e70df1c10e863870bde179aa' - 'd0227e69cac62480951e9c83747d43fccd7bdd18224652428ab20369b84173aa' - '73ead204b4f0aa4f0a5f5ed174257b10dbb6f7430c5abacc450ea000adfd12da') + 'c2c414831ad29bdeecd00313c473fbaa448f4750e70df1c10e863870bde179aa' + 'd0227e69cac62480951e9c83747d43fccd7bdd18224652428ab20369b84173aa' + '681e9b7e8f32061028061a80c9663f11e2e8d396478c7067706e5ae3db121dc2' + '4cdd2bc664724dc7db94ad51b503512c5ae7220951cac568120f64f8e94399fc') pkgver() { cd $_pkgname @@ -48,18 +51,27 @@ pkgver() { printf "%s.r%s.%s" "$TAG" "$REVISION" "$COMMIT" } +prepare(){ + cd "$srcdir/${_pkgname}" + patch --strip=1 --input=../make.bash.patch +} + +# This follows the docker file in https://github.com/Psiphon-Labs/psiphon-tunnel-core/blob/master/ConsoleClient/Dockerfile build() { + cw=$(pwd) + export GOPATH=$cw/home/go + mkdir -p $GOPATH + export GOROOT=$cw/go + mkdir -p $GOROOT + export PATH=$GOROOT/bin:$GOPATH/bin:$PATH + export CGO_ENABLED=1 - export GOPATH=$(pwd) + go get -u github.com/pwaller/goupx mkdir -p "${GOPATH}/src/github.com/Psiphon-Labs" - - ln -sf "../../../$_pkgname/" "src/github.com/Psiphon-Labs/psiphon-tunnel-core" - - cp "$srcdir/make.bash" "$_pkgname/ConsoleClient/" + ln -sf "../../../../../$_pkgname/" "${GOPATH}/src/github.com/Psiphon-Labs/psiphon-tunnel-core" cd "$_pkgname/ConsoleClient" - ./make.bash linux } diff --git a/make.bash b/make.bash deleted file mode 100644 index b25cc13a8692..000000000000 --- a/make.bash +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash - -set -e -u -x - -if [ ! -f make.bash ]; then - echo "make.bash must be run from $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient" - exit 1 -fi - -# $2, if specified, is go build tags -if [ -z ${2+x} ]; then BUILD_TAGS=""; else BUILD_TAGS="$2"; fi - -# At this time, we don't support modules -export GO111MODULE=off - -EXE_BASENAME="psiphon-tunnel-core" - -prepare_build () { - BUILDINFOFILE="${EXE_BASENAME}_buildinfo.txt" - BUILDDATE=$(date --iso-8601=seconds) - BUILDREPO=$(git config --get remote.origin.url) - BUILDREV=$(git rev-parse --short HEAD) - GOVERSION=$(go version | perl -ne '/go version (.*?) / && print $1') - - # see DEPENDENCIES comment in MobileLibrary/Android/make.bash - DEPENDENCIES=$(echo -n "{" && GOOS=$1 go list -tags "${BUILD_TAGS}" -f '{{range $dep := .Deps}}{{printf "%s\n" $dep}}{{end}}' | GOOS=$1 xargs go list -tags "${BUILD_TAGS}" -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | xargs -I pkg bash -c 'cd $GOPATH/src/$0 && if echo -n "$0" | grep -vEq "^github.com/Psiphon-Labs/psiphon-tunnel-core/" ; then echo -n "\"$0\":\"$(git rev-parse --short HEAD)\"," ; fi' pkg | sed 's/,$//' | tr -d '\n' && echo -n "}") - - MY_LDFLAGS="\ - -s \ - -w \ - -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/buildinfo.buildDate=$BUILDDATE \ - -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/buildinfo.buildRepo=$BUILDREPO \ - -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/buildinfo.buildRev=$BUILDREV \ - -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/buildinfo.goVersion=$GOVERSION \ - -X github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/buildinfo.dependencies=$DEPENDENCIES \ - " - echo -e "${BUILDDATE}\n${BUILDREPO}\n${BUILDREV}\n" > $BUILDINFOFILE - - echo "Variables for ldflags:" - echo " Build date: ${BUILDDATE}" - echo " Build repo: ${BUILDREPO}" - echo " Build revision: ${BUILDREV}" - echo " Go version: ${GOVERSION}" - echo " Dependencies: ${DEPENDENCIES}" - echo "" - - -} - -if [ ! -d bin ]; then - mkdir bin -fi - - -build_for_linux () { - prepare_build linux - - echo "...Building linux-x86_64" - GOOS=linux GOARCH=amd64 go build -v -x -ldflags "$MY_LDFLAGS" -tags "${BUILD_TAGS}" \ - -trimpath -buildmode=pie -ldflags "-linkmode external -extldflags \"${LDFLAGS}\"" \ - -gcflags=-trimpath=${PWD} -asmflags=-trimpath=${PWD} \ - -o bin/linux/${EXE_BASENAME}-x86_64 - RETVAL=$? - if [ $RETVAL != 0 ]; then - echo "....go failed, exiting" - exit $RETVAL - fi - unset RETVAL - -} - -TARGET=$1 -case $TARGET in - linux) - echo "..Building for Linux" - build_for_linux - exit $? - - ;; - *) - echo "..invalid target" - exit 1 - - ;; - -esac - -echo "Done" diff --git a/make.bash.patch b/make.bash.patch new file mode 100644 index 000000000000..c60099207f01 --- /dev/null +++ b/make.bash.patch @@ -0,0 +1,46 @@ +diff --git a/ConsoleClient/make.bash b/ConsoleClient/make.bash +index 5bcc9fd7..2ab3d7f9 100755 +--- a/ConsoleClient/make.bash ++++ b/ConsoleClient/make.bash +@@ -87,25 +87,6 @@ build_for_windows () { + build_for_linux () { + prepare_build linux + +- echo "...Building linux-i686" +- # TODO: is "CFLAGS=-m32" required? +- CFLAGS=-m32 GOOS=linux GOARCH=386 go build -v -x -ldflags "$LDFLAGS" -tags "${BUILD_TAGS}" -o bin/linux/${EXE_BASENAME}-i686 +- RETVAL=$? +- if [ $RETVAL != 0 ]; then +- echo ".....gox failed, exiting" +- exit $RETVAL +- fi +- unset RETVAL +- +- echo "....UPX packaging output" +- goupx --best bin/linux/${EXE_BASENAME}-i686 +- RETVAL=$? +- if [ $RETVAL != 0 ]; then +- echo ".....goupx failed, exiting" +- exit $RETVAL +- fi +- unset RETVAL +- + echo "...Building linux-x86_64" + GOOS=linux GOARCH=amd64 go build -v -x -ldflags "$LDFLAGS" -tags "${BUILD_TAGS}" -o bin/linux/${EXE_BASENAME}-x86_64 + RETVAL=$? +@@ -114,15 +95,6 @@ build_for_linux () { + exit $RETVAL + fi + unset RETVAL +- +- echo "....UPX packaging output" +- goupx --best bin/linux/${EXE_BASENAME}-x86_64 +- RETVAL=$? +- if [ $RETVAL != 0 ]; then +- echo ".....goupx failed, exiting" +- exit $RETVAL +- fi +- unset RETVAL + } + + build_for_osx () { |