Skip to content

Commit

Permalink
Reproducible Builds for libhysteria2.so (2dust#4249)
Browse files Browse the repository at this point in the history
* Patch Go use 600296

* -buildvcs=false for libhysteria2

* fix if

* fixup! Build and cache libhysteria2.so (2dust#4226)
  • Loading branch information
UjuiUjuMandan authored and j2rong4cn committed Jan 13, 2025
1 parent b1653f2 commit 99fe62e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion libhysteria2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 99fe62e

Please sign in to comment.