diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 55 |
1 files changed, 25 insertions, 30 deletions
@@ -19,13 +19,13 @@ _pkgname=psiphon-tunnel-core pkgname="$_pkgname-git" -pkgver=2.0.10.r3020.a9bed696 +pkgver=2.0.14.r3347.8a2f672e pkgrel=1 pkgdesc='Psiphon Tunnelling Proxy' arch=('x86_64') url="https://github.com/Psiphon-Labs/psiphon-tunnel-core" license=('GPL') -makedepends=('go-pie' 'perl') +makedepends=('go-pie' 'perl' 'docker') depends=('glibc') source=("git+$url.git" "psiphon.conf" @@ -43,40 +43,35 @@ pkgver() { printf "%s.r%s.%s" "$TAG" "$REVISION" "$COMMIT" } -build() { - cd "$_pkgname/ConsoleClient" +prepare(){ + if ! groups ${USER} | grep &>/dev/null '\bdocker\b'; then + >&2 echo "The user ${USER} does not belong to the docker group. Please add it." + exit 1 + fi - # This errors but seems to fix building - go get || true - - # Copied from the README file - 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') - DEPENDENCIES=$(echo -n "{" && go list -f '{{range $dep := .Deps}}{{printf "%s\n" $dep}}{{end}}' | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | xargs -I pkg bash -c 'cd $GOPATH/src/pkg && echo -n "\"pkg\":\"$(git rev-parse --short HEAD)\","' | sed 's/,$/}/') - - LDFLAGS="\ --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 \ --s -w -" + if ! systemctl is-active docker | grep &>/dev/null '\bactive\b'; then + >&2 echo "Docker service is not started. Please start it." + exit 1 + fi +} - # TODO: Figure out how to do the stripping? - # https://wiki.archlinux.org/index.php/Go_package_guidelines#Flags_and_build_options +build() { + cd "$_pkgname/ConsoleClient" - go build \ - -trimpath \ - -ldflags "$LDFLAGS" \ - -o $_pkgname . + docker build --no-cache=true -t psiclient . + docker images + cd .. && \ + docker run \ + --rm \ + -v $PWD:/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \ + psiclient \ + /bin/bash -c './make.bash linux' \ + ; cd - } package() { - cd "$_pkgname/ConsoleClient" - install -Dm755 $_pkgname "$pkgdir"/usr/bin/$_pkgname + cd "$_pkgname/ConsoleClient/bin/linux/" + install -Dm755 ${_pkgname}-x86_64 "$pkgdir"/usr/bin/$_pkgname install -Dm644 "$srcdir/psiphon.conf" "$pkgdir/etc/psiphon.conf" install -Dm644 "$srcdir/psiphon.service" "$pkgdir/usr/lib/systemd/user/psiphon.service" } |