Skip to content

Commit

Permalink
Merge branch 'improve-reproducibility-android'
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Jan 24, 2025
2 parents ecd86f7 + ef51904 commit a1571df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 3 additions & 0 deletions android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ echo " You have built:"
echo ""
echo " $PRODUCT_VERSION"
echo ""
echo " Build checksums:"
md5sum ../dist/MullvadVPN-"$PRODUCT_VERSION"* | sed 's/^/ /'
echo ""
echo "**********************************"
12 changes: 2 additions & 10 deletions wireguard-go-rs/libwg/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,16 @@ export CGO_ENABLED := 1

default: $(DESTDIR)/libwg.so

GOBUILDARCH := $(NDK_GO_ARCH_MAP_$(shell uname -m))
GOBUILDOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
GOBUILDVERSION := 1.21.3
# TODO: Add checksum?
GOBUILDTARBALL := https://go.dev/dl/go$(GOBUILDVERSION).$(GOBUILDOS)-$(GOBUILDARCH).tar.gz
GOBUILDVERSION_NEEDED := go version go$(GOBUILDVERSION) $(GOBUILDOS)/$(GOBUILDARCH)


$(DESTDIR)/libwg.so:
mkdir -p $(DESTDIR)
# Build libmaybenot
make --directory wireguard-go libmaybenot.a LIBDEST="$(DESTDIR)" TARGET="$(TARGET)" CARGO_TARGET_DIR="$(CARGO_TARGET_DIR)"
# Build wireguard-go
go get -tags "linux android daita"
chmod -fR +w "$(GOPATH)/pkg/mod"
go build -tags "linux android daita" -ldflags="-X main.socketDirectory=/data/data/$(ANDROID_PACKAGE_NAME)/cache/wireguard" -v -o "$@" -buildmode c-shared -buildvcs=false
# The `-buildid=` and `-trimpath` flags are needed to make the build reproducible.
go build -tags "linux android daita" -ldflags="-buildid= -X main.socketDirectory=/data/data/$(ANDROID_PACKAGE_NAME)/cache/wireguard" -v -o "$@" -buildmode c-shared -buildvcs=false -trimpath
rm -f $(DESTDIR)/libwg.h


clean:
rm -f $(DESTDIR)/libwg.so

0 comments on commit a1571df

Please sign in to comment.