diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 12e5db0..318bc71 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -112,10 +112,12 @@ jobs: - TARGET: x86_64-pc-windows-msvc OS: windows-latest ARTIFACT_NAME: windows-x86_64 - - TARGET: aarch64-pc-windows-msvc OS: windows-latest ARTIFACT_NAME: windows-arm64 + - TARGET: i686-pc-windows-msvc + OS: windows-latest + ARTIFACT_NAME: windows-i686 - TARGET: x86_64-unknown-freebsd OS: ubuntu-22.04 @@ -229,12 +231,13 @@ jobs: # windows is the only OS using a different convention for executable file name if [[ $OS =~ ^windows.*$ && $TARGET =~ ^x86_64.*$ ]]; then SUFFIX=.exe - cp easytier/third_party/Packet.dll ./artifacts/objects/ - cp easytier/third_party/wintun.dll ./artifacts/objects/ + cp easytier/third_party/*.dll ./artifacts/objects/ + elif [[ $OS =~ ^windows.*$ && $TARGET =~ ^i686.*$ ]]; then + SUFFIX=.exe + cp easytier/third_party/i686/*.dll ./artifacts/objects/ elif [[ $OS =~ ^windows.*$ && $TARGET =~ ^aarch64.*$ ]]; then SUFFIX=.exe - cp easytier/third_party/arm64/Packet.dll ./artifacts/objects/ - cp easytier/third_party/arm64/wintun.dll ./artifacts/objects/ + cp easytier/third_party/arm64/*.dll ./artifacts/objects/ fi if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then TAG=$GITHUB_REF_NAME @@ -276,7 +279,6 @@ jobs: if: needs.build.result != 'success' run: exit 1 - magisk_build: needs: - pre_job diff --git a/.github/workflows/gui.yml b/.github/workflows/gui.yml index 06d8418..0045a8a 100644 --- a/.github/workflows/gui.yml +++ b/.github/workflows/gui.yml @@ -63,6 +63,11 @@ jobs: GUI_TARGET: aarch64-pc-windows-msvc ARTIFACT_NAME: windows-arm64 + - TARGET: i686-pc-windows-msvc + OS: windows-latest + GUI_TARGET: i686-pc-windows-msvc + ARTIFACT_NAME: windows-i686 + runs-on: ${{ matrix.OS }} env: NAME: easytier @@ -179,6 +184,8 @@ jobs: run: | if [[ $GUI_TARGET =~ ^aarch64.*$ ]]; then cp ./easytier/third_party/arm64/*.dll ./easytier-gui/src-tauri/ + elif [[ $GUI_TARGET =~ ^i686.*$ ]]; then + cp ./easytier/third_party/i686/*.dll ./easytier-gui/src-tauri/ else cp ./easytier/third_party/*.dll ./easytier-gui/src-tauri/ fi diff --git a/Cargo.lock b/Cargo.lock index a8e38f4..23ccdd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1969,6 +1969,7 @@ dependencies = [ "tabled", "tachyonix", "thiserror 1.0.63", + "thunk-rs", "time", "timedmap", "tokio", @@ -8151,6 +8152,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "thunk-rs" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cbc000e786a7ea2cfa3a85ef77cf86bfdadeaa2b215ec4751df66442fa4632a" + [[package]] name = "tiff" version = "0.9.1" diff --git a/Cargo.toml b/Cargo.toml index be854f6..1f73dc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,5 @@ panic = "unwind" panic = "abort" lto = true codegen-units = 1 +opt-level = 'z' +strip = true diff --git a/easytier-gui/src-tauri/Cargo.toml b/easytier-gui/src-tauri/Cargo.toml index e52ef88..80259ef 100644 --- a/easytier-gui/src-tauri/Cargo.toml +++ b/easytier-gui/src-tauri/Cargo.toml @@ -14,6 +14,13 @@ crate-type = ["staticlib", "cdylib", "rlib"] [build-dependencies] tauri-build = { version = "2.0.0-rc", features = [] } +# enable thunk-rs when compiling for x86_64 or i686 windows +[target.x86_64-pc-windows-msvc.build-dependencies] +thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } + +[target.i686-pc-windows-msvc.build-dependencies] +thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } + [dependencies] # wry 0.47 may crash on android, see https://github.com/EasyTier/EasyTier/issues/527 tauri = { version = "=2.0.6", features = [ diff --git a/easytier-gui/src-tauri/build.rs b/easytier-gui/src-tauri/build.rs index 158c051..e8fc4ec 100644 --- a/easytier-gui/src-tauri/build.rs +++ b/easytier-gui/src-tauri/build.rs @@ -1,3 +1,9 @@ fn main() { + // enable thunk-rs when target os is windows and arch is x86_64 or i686 + #[cfg(target_os = "windows")] + if !std::env::var("TARGET").unwrap_or_default().contains("aarch64"){ + thunk::thunk(); + } + tauri_build::build(); } diff --git a/easytier-web/Cargo.toml b/easytier-web/Cargo.toml index e2a7b3e..2049157 100644 --- a/easytier-web/Cargo.toml +++ b/easytier-web/Cargo.toml @@ -63,4 +63,11 @@ chrono = { version = "0.4.37", features = ["serde"] } [features] default = [] -embed = ["dep:axum-embed"] \ No newline at end of file +embed = ["dep:axum-embed"] + +# enable thunk-rs when compiling for x86_64 or i686 windows +[target.x86_64-pc-windows-msvc.build-dependencies] +thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } + +[target.i686-pc-windows-msvc.build-dependencies] +thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } diff --git a/easytier-web/build.rs b/easytier-web/build.rs new file mode 100644 index 0000000..037ff6b --- /dev/null +++ b/easytier-web/build.rs @@ -0,0 +1,7 @@ +fn main() { + // enable thunk-rs when target os is windows and arch is x86_64 or i686 + #[cfg(target_os = "windows")] + if !std::env::var("TARGET").unwrap_or_default().contains("aarch64"){ + thunk::thunk(); + } +} diff --git a/easytier/Cargo.toml b/easytier/Cargo.toml index f932c44..c7f217f 100644 --- a/easytier/Cargo.toml +++ b/easytier/Cargo.toml @@ -251,6 +251,13 @@ prost-reflect-build = { version = "0.14.0" } reqwest = { version = "0.12.12", features = ["blocking"] } zip = "0.6.6" +# enable thunk-rs when compiling for x86_64 or i686 windows +[target.x86_64-pc-windows-msvc.build-dependencies] +thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } + +[target.i686-pc-windows-msvc.build-dependencies] +thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] } + [dev-dependencies] serial_test = "3.0.0" diff --git a/easytier/build.rs b/easytier/build.rs index 39e0621..271a17d 100644 --- a/easytier/build.rs +++ b/easytier/build.rs @@ -71,6 +71,8 @@ impl WindowsBuild { if target.contains("x86_64") { println!("cargo:rustc-link-search=native=easytier/third_party/"); + } else if target.contains("i686") { + println!("cargo:rustc-link-search=native=easytier/third_party/i686/"); } else if target.contains("aarch64") { println!("cargo:rustc-link-search=native=easytier/third_party/arm64/"); } @@ -125,6 +127,12 @@ fn check_locale() { } fn main() -> Result<(), Box> { + // enable thunk-rs when target os is windows and arch is x86_64 or i686 + #[cfg(target_os = "windows")] + if !std::env::var("TARGET").unwrap_or_default().contains("aarch64"){ + thunk::thunk(); + } + #[cfg(target_os = "windows")] WindowsBuild::check_for_win(); diff --git a/easytier/third_party/i686/Packet.dll b/easytier/third_party/i686/Packet.dll new file mode 100644 index 0000000..aef7f05 Binary files /dev/null and b/easytier/third_party/i686/Packet.dll differ diff --git a/easytier/third_party/i686/Packet.lib b/easytier/third_party/i686/Packet.lib new file mode 100644 index 0000000..23d2cfc Binary files /dev/null and b/easytier/third_party/i686/Packet.lib differ diff --git a/easytier/third_party/i686/wintun.dll b/easytier/third_party/i686/wintun.dll new file mode 100644 index 0000000..2ab97db Binary files /dev/null and b/easytier/third_party/i686/wintun.dll differ