passforios/gopenpgp_build.sh

29 lines
1 KiB
Bash
Raw Normal View History

2019-06-06 18:07:39 +02:00
#!/bin/bash
2019-08-19 23:40:17 +02:00
set -euox pipefail
2019-06-06 18:07:39 +02:00
2019-08-19 23:40:17 +02:00
export GOPATH="$(pwd)/go"
export PATH="$PATH:$GOPATH/bin"
2019-06-06 18:07:39 +02:00
PACKAGE_PATH="github.com/mssun/gopenpgp"
GOPENPGP_REVISION="gnu-dummy"
OUTPUT_PATH="$GOPATH/dist"
mkdir -p "$GOPATH"
2020-07-25 00:34:31 -07:00
go get golang.org/x/mobile/cmd/gomobile || true
( cd "$GOPATH/src/golang.org/x/mobile/cmd/gomobile" && git checkout 0df4eb2385467a487d418c6358313e9e838256ae )
GO111MODULE=on go get golang.org/x/mobile/cmd/gomobile@0df4eb2385467a487d418c6358313e9e838256ae || true
GO111MODULE=on go get golang.org/x/mobile/cmd/gobind@0df4eb2385467a487d418c6358313e9e838256ae || true
go get -u "$PACKAGE_PATH" || true
2019-06-06 18:07:39 +02:00
mkdir -p "$GOPATH/src/github.com/ProtonMail"
2020-07-25 00:34:31 -07:00
ln -f -s "$GOPATH/src/$PACKAGE_PATH" "$GOPATH/src/github.com/ProtonMail/gopenpgp"
2019-06-06 18:07:39 +02:00
2019-11-08 21:17:53 +01:00
( cd "$GOPATH/src/$PACKAGE_PATH" && git checkout "$GOPENPGP_REVISION" && GO111MODULE=on go mod vendor )
2019-06-06 18:07:39 +02:00
2019-08-19 23:40:17 +02:00
mkdir -p "$OUTPUT_PATH"
2020-04-12 18:24:03 -07:00
"$GOPATH/bin/gomobile" bind -v -ldflags="-s -w" -target ios -o "${OUTPUT_PATH}/Crypto.framework" \
2019-08-19 23:40:17 +02:00
"$PACKAGE_PATH"/{crypto,armor,constants,models,subtle}