mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-06 16:01:29 +00:00
add more targets
This commit is contained in:
1 parent
53741ae5de
commit
761fdb2de4
9 files changed
+131
-131
No files matched your search
+33
-34
@@ -5,13 +5,21 @@ on: [push, pull_request]
|
||||
jobs:
|
||||
build-bin-cross:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-pc-windows-gnu
|
||||
target:
|
||||
- aarch64-unknown-linux-gnu
|
||||
- aarch64-unknown-linux-musl
|
||||
- arm-unknown-linux-gnueabi
|
||||
- arm-unknown-linux-musleabi
|
||||
- i686-unknown-linux-gnu
|
||||
- i686-unknown-linux-musl
|
||||
# - mips-unknown-linux-gnu
|
||||
- x86_64-pc-windows-gnu
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
@@ -28,14 +36,9 @@ jobs:
|
||||
with:
|
||||
rust-version: nightly
|
||||
|
||||
- name: install docker
|
||||
run: |
|
||||
curl -fsSL https://get.docker.com | sudo bash
|
||||
|
||||
- name: install deps
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: |
|
||||
sudo apt update && sudo apt install make -y
|
||||
sudo apt update && sudo apt install llvm-dev libclang-dev clang libssl-dev pkg-config protobuf-compiler make -y
|
||||
|
||||
- name: install cross
|
||||
run: |
|
||||
@@ -43,28 +46,40 @@ jobs:
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
make ${{ matrix.target }}
|
||||
make gen
|
||||
cross build --target ${{ matrix.target }} -p leaf-bin --release
|
||||
|
||||
- name: rename and compress artifacts
|
||||
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/leaf.exe leaf-${{ matrix.target }}.exe
|
||||
# upx --brute leaf-${{ matrix.target }}
|
||||
|
||||
- name: rename and compress artifacts
|
||||
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
||||
|
||||
- name: upload assets
|
||||
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: leaf-${{ matrix.target }}.exe
|
||||
path: leaf-${{ matrix.target }}.exe
|
||||
|
||||
- name: upload assets
|
||||
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: leaf-${{ matrix.target }}
|
||||
path: leaf-${{ matrix.target }}
|
||||
|
||||
build-bin-local:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
os: [macos-latest]
|
||||
include:
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -74,10 +89,6 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
# - name: update submodule
|
||||
# run: |
|
||||
# git submodule init && git submodule update
|
||||
|
||||
- name: show last commit
|
||||
run: |
|
||||
git show --summary
|
||||
@@ -92,19 +103,14 @@ jobs:
|
||||
run: |
|
||||
brew update && brew install llvm protobuf upx
|
||||
|
||||
- name: install llvm
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: |
|
||||
sudo apt update && sudo apt install llvm-dev libclang-dev clang libssl-dev pkg-config protobuf-compiler upx -y
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
make gen
|
||||
cargo build --release --target ${{ matrix.target }} -p leaf-bin
|
||||
|
||||
- name: rename and compress artifacts
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
||||
# upx --brute leaf-${{ matrix.target }}
|
||||
|
||||
- name: upload assets
|
||||
uses: actions/upload-artifact@v2
|
||||
@@ -121,10 +127,6 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
# - name: update submodule
|
||||
# run: |
|
||||
# git submodule init && git submodule update
|
||||
|
||||
- name: show last commit
|
||||
run: |
|
||||
git show --summary
|
||||
@@ -134,10 +136,6 @@ jobs:
|
||||
xcodebuild -version
|
||||
xcrun --sdk iphoneos --show-sdk-path
|
||||
|
||||
# - name: build openssl
|
||||
# run: |
|
||||
# ./misc/build_ios_openssl.sh
|
||||
|
||||
- name: install rust
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
@@ -153,6 +151,7 @@ jobs:
|
||||
- name: build
|
||||
run: |
|
||||
# OPENSSL_DIR=/tmp/openssl-ios64 cargo lipo --release -p leaf-mobile --targets aarch64-apple-ios
|
||||
make gen
|
||||
cargo lipo --release -p leaf-mobile --targets aarch64-apple-ios
|
||||
|
||||
- name: generate header
|
||||
|
||||
@@ -9,12 +9,19 @@ jobs:
|
||||
build-bin-cross:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-pc-windows-gnu
|
||||
target:
|
||||
- aarch64-unknown-linux-gnu
|
||||
- aarch64-unknown-linux-musl
|
||||
- arm-unknown-linux-gnueabi
|
||||
- arm-unknown-linux-musleabi
|
||||
- i686-unknown-linux-gnu
|
||||
- i686-unknown-linux-musl
|
||||
# - mips-unknown-linux-gnu
|
||||
- x86_64-pc-windows-gnu
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
@@ -31,14 +38,9 @@ jobs:
|
||||
with:
|
||||
rust-version: nightly
|
||||
|
||||
- name: install docker
|
||||
run: |
|
||||
curl -fsSL https://get.docker.com | sudo bash
|
||||
|
||||
- name: install deps
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: |
|
||||
sudo apt update && sudo apt install make -y
|
||||
sudo apt update && sudo apt install llvm-dev libclang-dev clang libssl-dev pkg-config protobuf-compiler make -y
|
||||
|
||||
- name: install cross
|
||||
run: |
|
||||
@@ -46,28 +48,40 @@ jobs:
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
make ${{ matrix.target }}
|
||||
make gen
|
||||
cross build --target ${{ matrix.target }} -p leaf-bin --release
|
||||
|
||||
- name: rename and compress artifacts
|
||||
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/leaf.exe leaf-${{ matrix.target }}.exe
|
||||
# upx --brute leaf-${{ matrix.target }}
|
||||
|
||||
- name: rename and compress artifacts
|
||||
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
||||
|
||||
- name: upload assets
|
||||
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: leaf-${{ matrix.target }}.exe
|
||||
path: leaf-${{ matrix.target }}.exe
|
||||
|
||||
- name: upload assets
|
||||
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: leaf-${{ matrix.target }}
|
||||
path: leaf-${{ matrix.target }}
|
||||
|
||||
build-bin-local:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
os: [macos-latest]
|
||||
include:
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -77,10 +91,6 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
# - name: update submodule
|
||||
# run: |
|
||||
# git submodule init && git submodule update
|
||||
|
||||
- name: show last commit
|
||||
run: |
|
||||
git show --summary
|
||||
@@ -95,19 +105,14 @@ jobs:
|
||||
run: |
|
||||
brew update && brew install llvm protobuf upx
|
||||
|
||||
- name: install llvm
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
run: |
|
||||
sudo apt update && sudo apt install llvm-dev libclang-dev clang libssl-dev pkg-config protobuf-compiler upx -y
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
make gen
|
||||
cargo build --release --target ${{ matrix.target }} -p leaf-bin
|
||||
|
||||
- name: rename and compress artifacts
|
||||
run: |
|
||||
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
||||
# upx --brute leaf-${{ matrix.target }}
|
||||
|
||||
- name: upload assets
|
||||
uses: actions/upload-artifact@v2
|
||||
@@ -124,10 +129,6 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
# - name: update submodule
|
||||
# run: |
|
||||
# git submodule init && git submodule update
|
||||
|
||||
- name: show last commit
|
||||
run: |
|
||||
git show --summary
|
||||
@@ -137,10 +138,6 @@ jobs:
|
||||
xcodebuild -version
|
||||
xcrun --sdk iphoneos --show-sdk-path
|
||||
|
||||
# - name: build openssl
|
||||
# run: |
|
||||
# ./misc/build_ios_openssl.sh
|
||||
|
||||
- name: install rust
|
||||
uses: hecrj/setup-rust-action@v1
|
||||
with:
|
||||
@@ -156,6 +153,7 @@ jobs:
|
||||
- name: build
|
||||
run: |
|
||||
# OPENSSL_DIR=/tmp/openssl-ios64 cargo lipo --release -p leaf-mobile --targets aarch64-apple-ios
|
||||
make gen
|
||||
cargo lipo --release -p leaf-mobile --targets aarch64-apple-ios
|
||||
|
||||
- name: generate header
|
||||
@@ -215,8 +213,16 @@ jobs:
|
||||
matrix:
|
||||
target:
|
||||
- x86_64-apple-darwin
|
||||
- x86_64-unknown-linux-gnu
|
||||
- aarch64-unknown-linux-gnu
|
||||
- aarch64-unknown-linux-musl
|
||||
- arm-unknown-linux-gnueabi
|
||||
- arm-unknown-linux-musleabi
|
||||
- i686-unknown-linux-gnu
|
||||
- i686-unknown-linux-musl
|
||||
# - mips-unknown-linux-gnu
|
||||
- x86_64-pc-windows-gnu
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
|
||||
steps:
|
||||
- name: download upload url
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
image = "custom/cross:aarch64-unknown-linux-gnu"
|
||||
@@ -1,11 +1,3 @@
|
||||
aarch64-unknown-linux-gnu:
|
||||
docker build -t custom/cross:aarch64-unknown-linux-gnu - < docker/Dockerfile.aarch64-unknown-linux-gnu
|
||||
cross build --target aarch64-unknown-linux-gnu -p leaf-bin
|
||||
|
||||
x86_64-pc-windows-gnu:
|
||||
docker build -t custom/cross:x86_64-pc-windows-gnu - < docker/Dockerfile.x86_64-pc-windows-gnu
|
||||
cross build --target x86_64-pc-windows-gnu -p leaf-bin --release
|
||||
|
||||
ios:
|
||||
cargo lipo -p leaf-mobile --release --targets aarch64-apple-ios && cp target/universal/release/libleaf.a /tmp/ && cbindgen leaf-mobile/src/lib.rs -l c > /tmp/leaf.h
|
||||
|
||||
@@ -17,3 +9,8 @@ local:
|
||||
|
||||
local-dev:
|
||||
cargo build -p leaf-bin
|
||||
|
||||
# Force a re-generation of protobuf files and C bindings.
|
||||
gen:
|
||||
touch leaf/build.rs
|
||||
PROTO_GEN=1 BINDINGS_GEN=1 cargo build -p leaf
|
||||
@@ -1,4 +0,0 @@
|
||||
FROM rustembedded/cross:aarch64-unknown-linux-gnu-0.2.1
|
||||
|
||||
RUN apt update && \
|
||||
apt install llvm-dev libclang-dev clang libssl-dev pkg-config upx curl unzip -y
|
||||
@@ -1,4 +0,0 @@
|
||||
FROM rustembedded/cross:x86_64-pc-windows-gnu-0.2.1
|
||||
|
||||
RUN apt update && \
|
||||
apt install llvm-dev libclang-dev clang libssl-dev pkg-config upx curl unzip -y
|
||||
+45
-42
@@ -48,50 +48,53 @@ fn main() {
|
||||
.warnings(false)
|
||||
.flag_if_supported("-Wno-everything")
|
||||
.compile("liblwip.a");
|
||||
|
||||
println!("cargo:rustc-link-lib=lwip");
|
||||
println!("cargo:rerun-if-changed=src/proxy/tun/netstack/wrapper.h");
|
||||
println!("cargo:include=src/proxy/tun/netstack/lwip/include");
|
||||
|
||||
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||
let os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("src/proxy/tun/netstack/wrapper.h")
|
||||
.clang_arg("-I./src/proxy/tun/netstack/lwip/include")
|
||||
.clang_arg("-I./src/proxy/tun/netstack/lwip/custom")
|
||||
.clang_arg("-Wno-everything")
|
||||
.layout_tests(false)
|
||||
.clang_arg(if arch == "aarch64" && os == "ios" {
|
||||
// https://github.com/rust-lang/rust-bindgen/issues/1211
|
||||
"--target=arm64-apple-ios"
|
||||
} else {
|
||||
""
|
||||
})
|
||||
.clang_arg(if arch == "aarch64" && os == "ios" {
|
||||
// sdk path find by `xcrun --sdk iphoneos --show-sdk-path`
|
||||
let output = Command::new("xcrun")
|
||||
.arg("--sdk")
|
||||
.arg("iphoneos")
|
||||
.arg("--show-sdk-path")
|
||||
.output()
|
||||
.expect("failed to execute xcrun");
|
||||
let inc_path =
|
||||
Path::new(String::from_utf8_lossy(&output.stdout).trim()).join("usr/include");
|
||||
format!("-I{}", inc_path.to_str().expect("invalid include path"))
|
||||
} else {
|
||||
"".to_string()
|
||||
})
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
|
||||
// trigger manually via env var
|
||||
if let Ok(_) = env::var("BINDINGS_GEN") {
|
||||
if os == "ios" || os == "linux" || os == "macos" {
|
||||
println!("cargo:rustc-link-lib=lwip");
|
||||
// println!("cargo:rerun-if-changed=src/proxy/tun/netstack/wrapper.h");
|
||||
println!("cargo:include=src/proxy/tun/netstack/lwip/include");
|
||||
|
||||
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||
let os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("src/proxy/tun/netstack/wrapper.h")
|
||||
.clang_arg("-I./src/proxy/tun/netstack/lwip/include")
|
||||
.clang_arg("-I./src/proxy/tun/netstack/lwip/custom")
|
||||
.clang_arg("-Wno-everything")
|
||||
.layout_tests(false)
|
||||
.clang_arg(if arch == "aarch64" && os == "ios" {
|
||||
// https://github.com/rust-lang/rust-bindgen/issues/1211
|
||||
"--target=arm64-apple-ios"
|
||||
} else {
|
||||
""
|
||||
})
|
||||
.clang_arg(if arch == "aarch64" && os == "ios" {
|
||||
// sdk path find by `xcrun --sdk iphoneos --show-sdk-path`
|
||||
let output = Command::new("xcrun")
|
||||
.arg("--sdk")
|
||||
.arg("iphoneos")
|
||||
.arg("--show-sdk-path")
|
||||
.output()
|
||||
.expect("failed to execute xcrun");
|
||||
let inc_path = Path::new(String::from_utf8_lossy(&output.stdout).trim())
|
||||
.join("usr/include");
|
||||
format!("-I{}", inc_path.to_str().expect("invalid include path"))
|
||||
} else {
|
||||
"".to_string()
|
||||
})
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
let out_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(_) = env::var("PROTO_GEN") {
|
||||
// println!("cargo:rerun-if-changed=src/config/internal/config.proto");
|
||||
protoc_rust::Codegen::new()
|
||||
|
||||
Submodule leaf/src/proxy/tun/netstack/lwip updated: e40b87644c...d20eaab2f6.
@@ -5,4 +5,9 @@
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::all)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
// Note the bindings are generated on the host OS when cross compiling,
|
||||
// this shouldn't be problematic since we only use lwip functions from
|
||||
// the bindings. We should have the bindings automatically generated
|
||||
// for each target at compile time, but I couldn't find a way to make
|
||||
// bindgen work with cross.
|
||||
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/bindings.rs"));
|
||||
Reference in new issue
Block a user