mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-03 20:47:38 +03:00
feat: add android build
This commit is contained in:
parent
7ae977866a
commit
a28234a21a
4 changed files with 37 additions and 2 deletions
9
.github/workflows/master.yml
vendored
9
.github/workflows/master.yml
vendored
|
@ -26,7 +26,16 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- uses: nttld/setup-ndk@v1
|
||||||
|
id: setup-ndk
|
||||||
|
with:
|
||||||
|
ndk-version: r25b
|
||||||
|
add-to-path: false
|
||||||
|
local-cache: true
|
||||||
|
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
|
env:
|
||||||
|
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||||
run: |
|
run: |
|
||||||
export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",")
|
export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",")
|
||||||
python hyperbole.py build -r
|
python hyperbole.py build -r
|
||||||
|
|
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
|
@ -26,7 +26,16 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- uses: nttld/setup-ndk@v1
|
||||||
|
id: setup-ndk
|
||||||
|
with:
|
||||||
|
ndk-version: r25b
|
||||||
|
add-to-path: false
|
||||||
|
local-cache: true
|
||||||
|
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
|
env:
|
||||||
|
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||||
run: |
|
run: |
|
||||||
export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",")
|
export HY_APP_PLATFORMS=$(sed 's/\r$//' platforms.txt | awk '!/^#/ && !/^$/' | paste -sd ",")
|
||||||
python hyperbole.py build -r
|
python hyperbole.py build -r
|
||||||
|
|
15
hyperbole.py
15
hyperbole.py
|
@ -168,7 +168,6 @@ def get_app_platforms():
|
||||||
result.append((parts[0], parts[1]))
|
result.append((parts[0], parts[1]))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def cmd_build(pprof=False, release=False):
|
def cmd_build(pprof=False, release=False):
|
||||||
if not check_build_env():
|
if not check_build_env():
|
||||||
return
|
return
|
||||||
|
@ -204,13 +203,25 @@ def cmd_build(pprof=False, release=False):
|
||||||
out_name += ".exe"
|
out_name += ".exe"
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env["CGO_ENABLED"] = "0"
|
|
||||||
env["GOOS"] = os_name
|
env["GOOS"] = os_name
|
||||||
if arch in ARCH_ALIASES:
|
if arch in ARCH_ALIASES:
|
||||||
for k, v in ARCH_ALIASES[arch].items():
|
for k, v in ARCH_ALIASES[arch].items():
|
||||||
env[k] = v
|
env[k] = v
|
||||||
else:
|
else:
|
||||||
env["GOARCH"] = arch
|
env["GOARCH"] = arch
|
||||||
|
if os_name == "android":
|
||||||
|
env["CGO_ENABLED"] = "1"
|
||||||
|
ANDROID_NDK_HOME = os.environ.get("ANDROID_NDK_HOME") + "/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||||
|
if arch == "arm64" :
|
||||||
|
env["CC"] = ANDROID_NDK_HOME + "/aarch64-linux-android33-clang"
|
||||||
|
if arch == "armv7" :
|
||||||
|
env["CC"] = ANDROID_NDK_HOME + "/armv7a-linux-androideabi33-clang"
|
||||||
|
if arch == "386" :
|
||||||
|
env["CC"] = ANDROID_NDK_HOME + "/i686-linux-android33-clang"
|
||||||
|
if arch == "amd64" :
|
||||||
|
env["CC"] = ANDROID_NDK_HOME + "/x86_64-linux-android33-clang"
|
||||||
|
else:
|
||||||
|
env["CGO_ENABLED"] = "0"
|
||||||
|
|
||||||
plat_ldflags = ldflags.copy()
|
plat_ldflags = ldflags.copy()
|
||||||
plat_ldflags.append("-X")
|
plat_ldflags.append("-X")
|
||||||
|
|
|
@ -28,3 +28,9 @@ freebsd/amd64-avx
|
||||||
freebsd/386
|
freebsd/386
|
||||||
freebsd/arm
|
freebsd/arm
|
||||||
freebsd/arm64
|
freebsd/arm64
|
||||||
|
|
||||||
|
# Android
|
||||||
|
android/386
|
||||||
|
android/amd64
|
||||||
|
android/armv7
|
||||||
|
android/arm64
|
Loading…
Add table
Add a link
Reference in a new issue