From e0c8ece9b54beb64910a78c862f0fa72eebba322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=A1=A0=E1=A0=B5=E1=A1=A0=E1=A1=B3=20=E1=A1=A0=E1=A0=B5?= =?UTF-8?q?=E1=A1=A0=20=E1=A0=AE=E1=A0=A0=E1=A0=A8=E1=A1=A9=E1=A0=8B?= =?UTF-8?q?=E1=A0=A0=E1=A0=A8?= <125150101+UjuiUjuMandan@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:38:47 +0900 Subject: [PATCH] Reproducible Builds for libhysteria2.so (#4249) * Patch Go use 600296 * -buildvcs=false for libhysteria2 * fix if * fixup! Build and cache libhysteria2.so (#4226) --- .github/workflows/build.yml | 9 ++++++++- libhysteria2.sh | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dd1f402..bbcf4188 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,7 +95,14 @@ jobs: if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true' uses: actions/setup-go@v5 with: - go-mod-file: 'AndroidLibXrayLite/go.mod' + go-version-file: 'AndroidLibXrayLite/go.mod' + + - name: Patch Go use 600296 + if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true' + #https://go-review.googlesource.com/c/go/+/600296 + run: | + cd "$(go env GOROOT)" + curl "https://go-review.googlesource.com/changes/go~600296/revisions/5/patch" | base64 -d | patch --verbose -p 1 - name: Build libhysteria2 if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true' diff --git a/libhysteria2.sh b/libhysteria2.sh index 5c0d6fd0..b2a72117 100644 --- a/libhysteria2.sh +++ b/libhysteria2.sh @@ -14,7 +14,7 @@ for target in "${targets[@]}"; do echo "Building for ${abi} with ${ndk_target} (${goarch})" - CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/${ndk_target}-clang" CGO_ENABLED=1 CGO_LDFLAGS="-Wl,-z,max-page-size=16384" GOOS=android GOARCH=$goarch go build -o libs/$abi/libhysteria2.so -trimpath -ldflags "-s -w -buildid=" ./app + CC="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/${ndk_target}-clang" CGO_ENABLED=1 CGO_LDFLAGS="-Wl,-z,max-page-size=16384" GOOS=android GOARCH=$goarch go build -o libs/$abi/libhysteria2.so -trimpath -ldflags "-s -w -buildid=" -buildvcs=false ./app echo "Built libhysteria2.so for ${abi}" done