mirror of
https://github.com/2dust/v2rayNG.git
synced 2025-06-28 12:19:52 +00:00
parent
f0de5275b9
commit
eef6e60dbb
4 changed files with 29 additions and 41 deletions
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
|
@ -21,47 +21,41 @@ jobs:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
fetch-depth: '0'
|
fetch-depth: '0'
|
||||||
|
|
||||||
|
- name: Setup Android SDK
|
||||||
|
uses: android-actions/setup-android@v3
|
||||||
|
with:
|
||||||
|
log-accepted-android-sdk-licenses: false
|
||||||
|
cmdline-tools-version: '12266719'
|
||||||
|
packages: 'platforms;android-35 build-tools;35.0.0 platform-tools'
|
||||||
|
|
||||||
|
- name: Install NDK
|
||||||
|
run: |
|
||||||
|
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \
|
||||||
|
--channel=3 \
|
||||||
|
--install "ndk;29.0.13113456"
|
||||||
|
echo "NDK_HOME=$ANDROID_HOME/ndk/29.0.13113456" >> $GITHUB_ENV
|
||||||
|
sed -i '10i\
|
||||||
|
\
|
||||||
|
ndkVersion = "29.0.13113456"' ${{ github.workspace }}/V2rayNG/app/build.gradle.kts
|
||||||
|
|
||||||
- name: Restore cached libtun2socks
|
- name: Restore cached libtun2socks
|
||||||
id: cache-libtun2socks-restore
|
id: cache-libtun2socks-restore
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/libs
|
path: ${{ github.workspace }}/libs
|
||||||
key: libtun2socks-${{ runner.os }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }}
|
key: libtun2socks-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }}
|
||||||
|
|
||||||
- name: Setup Android NDK
|
|
||||||
uses: nttld/setup-ndk@v1
|
|
||||||
id: setup-ndk
|
|
||||||
# Same version as https://gitlab.com/fdroid/fdroiddata/metadata/com.v2ray.ang.yml
|
|
||||||
with:
|
|
||||||
ndk-version: r27
|
|
||||||
add-to-path: true
|
|
||||||
link-to-sdk: true
|
|
||||||
local-cache: true
|
|
||||||
|
|
||||||
- name: Restore Android Symlinks
|
|
||||||
run: |
|
|
||||||
directory="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
|
||||||
find "$directory" -type l | while read link; do
|
|
||||||
current_target=$(readlink "$link")
|
|
||||||
new_target="$directory/$(basename "$current_target")"
|
|
||||||
ln -sf "$new_target" "$link"
|
|
||||||
echo "Changed $(basename "$link") from $current_target to $new_target"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Build libtun2socks
|
- name: Build libtun2socks
|
||||||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
|
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
bash compile-tun2socks.sh
|
bash compile-tun2socks.sh
|
||||||
tar -xvzf libtun2socks.so.tgz
|
|
||||||
env:
|
|
||||||
NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
|
||||||
|
|
||||||
- name: Save libtun2socks
|
- name: Save libtun2socks
|
||||||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
|
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/libs
|
path: ${{ github.workspace }}/libs
|
||||||
key: libtun2socks-${{ runner.os }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }}
|
key: libtun2socks-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/badvpn/HEAD') }}-${{ hashFiles('.git/modules/libancillary/HEAD') }}
|
||||||
|
|
||||||
- name: Copy libtun2socks
|
- name: Copy libtun2socks
|
||||||
run: |
|
run: |
|
||||||
|
@ -88,27 +82,26 @@ jobs:
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/hysteria/libs
|
path: ${{ github.workspace }}/hysteria/libs
|
||||||
key: libhysteria2-${{ runner.os }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}
|
key: libhysteria2-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}
|
||||||
|
|
||||||
- name: Setup Golang
|
- name: Setup Golang
|
||||||
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
|
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: 'AndroidLibXrayLite/go.mod'
|
go-version-file: 'AndroidLibXrayLite/go.mod'
|
||||||
|
cache: false
|
||||||
|
|
||||||
- name: Build libhysteria2
|
- name: Build libhysteria2
|
||||||
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
|
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
bash libhysteria2.sh
|
bash libhysteria2.sh
|
||||||
env:
|
|
||||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
|
||||||
|
|
||||||
- name: Save libhysteria2
|
- name: Save libhysteria2
|
||||||
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
|
if: steps.cache-libhysteria2-restore.outputs.cache-hit != 'true'
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/hysteria/libs
|
path: ${{ github.workspace }}/hysteria/libs
|
||||||
key: libhysteria2-${{ runner.os }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}
|
key: libhysteria2-${{ runner.os }}-${{ env.NDK_HOME }}-${{ hashFiles('.git/modules/hysteria/HEAD') }}-${{ hashFiles('libhysteria2.sh') }}
|
||||||
|
|
||||||
- name: Copy libhysteria2
|
- name: Copy libhysteria2
|
||||||
run: |
|
run: |
|
||||||
|
@ -120,9 +113,6 @@ jobs:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
|
||||||
- name: Setup Android environment
|
|
||||||
uses: android-actions/setup-android@v3
|
|
||||||
|
|
||||||
- name: Decode Keystore
|
- name: Decode Keystore
|
||||||
uses: timheuer/base64-to-file@v1
|
uses: timheuer/base64-to-file@v1
|
||||||
id: android_keystore
|
id: android_keystore
|
||||||
|
@ -133,11 +123,10 @@ jobs:
|
||||||
- name: Build APK
|
- name: Build APK
|
||||||
run: |
|
run: |
|
||||||
cd ${{ github.workspace }}/V2rayNG
|
cd ${{ github.workspace }}/V2rayNG
|
||||||
|
echo "sdk.dir=${ANDROID_HOME}" > local.properties
|
||||||
chmod 755 gradlew
|
chmod 755 gradlew
|
||||||
./gradlew licenseFdroidReleaseReport
|
./gradlew licenseFdroidReleaseReport
|
||||||
./gradlew assembleRelease -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
|
./gradlew assembleRelease -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
|
||||||
env:
|
|
||||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
|
||||||
|
|
||||||
- name: Upload arm64-v8a APK
|
- name: Upload arm64-v8a APK
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|
|
@ -23,11 +23,10 @@ $NDK_HOME/ndk-build \
|
||||||
NDK_PROJECT_PATH=. \
|
NDK_PROJECT_PATH=. \
|
||||||
APP_BUILD_SCRIPT=./tun2socks.mk \
|
APP_BUILD_SCRIPT=./tun2socks.mk \
|
||||||
APP_ABI=all \
|
APP_ABI=all \
|
||||||
APP_PLATFORM=android-19 \
|
APP_PLATFORM=android-21 \
|
||||||
NDK_LIBS_OUT=$TMPDIR/libs \
|
NDK_LIBS_OUT=$TMPDIR/libs \
|
||||||
NDK_OUT=$TMPDIR/tmp \
|
NDK_OUT=$TMPDIR/tmp \
|
||||||
APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -j4 \
|
APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -j4
|
||||||
LOCAL_LDFLAGS=-Wl,--build-id=none
|
cp -r $TMPDIR/libs $__dir/
|
||||||
tar cvfz $__dir/libtun2socks.so.tgz libs
|
|
||||||
popd
|
popd
|
||||||
rm -rf $TMPDIR
|
rm -rf $TMPDIR
|
||||||
|
|
|
@ -14,7 +14,7 @@ for target in "${targets[@]}"; do
|
||||||
|
|
||||||
echo "Building for ${abi} with ${ndk_target} (${goarch})"
|
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=" -buildvcs=false ./app
|
CC="${NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/${ndk_target}-clang" CGO_ENABLED=1 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}"
|
echo "Built libhysteria2.so for ${abi}"
|
||||||
done
|
done
|
||||||
|
|
|
@ -37,7 +37,6 @@ LOCAL_CFLAGS += -DNDEBUG -DANDROID
|
||||||
LOCAL_CFLAGS += -I
|
LOCAL_CFLAGS += -I
|
||||||
LOCAL_STATIC_LIBRARIES := libancillary
|
LOCAL_STATIC_LIBRARIES := libancillary
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/badvpn/libancillary \
|
|
||||||
$(LOCAL_PATH)/badvpn/lwip/src/include/ipv4 \
|
$(LOCAL_PATH)/badvpn/lwip/src/include/ipv4 \
|
||||||
$(LOCAL_PATH)/badvpn/lwip/src/include/ipv6 \
|
$(LOCAL_PATH)/badvpn/lwip/src/include/ipv6 \
|
||||||
$(LOCAL_PATH)/badvpn/lwip/src/include \
|
$(LOCAL_PATH)/badvpn/lwip/src/include \
|
||||||
|
@ -110,6 +109,7 @@ TUN2SOCKS_SOURCES := \
|
||||||
socks_udp_client/SocksUdpClient.c
|
socks_udp_client/SocksUdpClient.c
|
||||||
LOCAL_MODULE := tun2socks
|
LOCAL_MODULE := tun2socks
|
||||||
LOCAL_LDLIBS := -ldl -llog
|
LOCAL_LDLIBS := -ldl -llog
|
||||||
|
LOCAL_LDFLAGS=-Wl,--build-id=none
|
||||||
LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES))
|
LOCAL_SRC_FILES := $(addprefix badvpn/, $(TUN2SOCKS_SOURCES))
|
||||||
LOCAL_BUILD_SCRIPT := BUILD_EXECUTABLE
|
LOCAL_BUILD_SCRIPT := BUILD_EXECUTABLE
|
||||||
LOCAL_MAKEFILE := $(local-makefile)
|
LOCAL_MAKEFILE := $(local-makefile)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue