diff options
| -rw-r--r-- | .cargo/config.toml | 13 | ||||
| -rw-r--r-- | .github/workflows/rust-unused-dependencies.yml | 2 | ||||
| -rw-r--r-- | BuildInstructions.md | 2 | ||||
| -rw-r--r-- | Cargo.lock | 17 | ||||
| -rwxr-xr-x | env.sh | 6 | ||||
| -rw-r--r-- | talpid-core/Cargo.toml | 4 | ||||
| -rw-r--r-- | talpid-core/build.rs | 38 |
7 files changed, 45 insertions, 37 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index b58e89798b..faaee0f0c2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -6,3 +6,16 @@ rustflags = ["-Ctarget-feature=+crt-static"] [target.aarch64-pc-windows-msvc] rustflags = ["-Ctarget-feature=+crt-static"] + +[target.x86_64-unknown-linux-gnu.mnl] +rustc-link-lib = ["mnl"] +rustc-link-search = ["native=dist-assets/binaries/x86_64-unknown-linux-gnu"] +[target.aarch64-unknown-linux-gnu.mnl] +rustc-link-lib = ["mnl"] +rustc-link-search = ["native=dist-assets/binaries/aarch64-unknown-linux-gnu"] +[target.x86_64-unknown-linux-gnu.nftnl] +rustc-link-lib = ["nftnl", "mnl"] +rustc-link-search = ["native=dist-assets/binaries/x86_64-unknown-linux-gnu"] +[target.aarch64-unknown-linux-gnu.nftnl] +rustc-link-lib = ["nftnl", "mnl"] +rustc-link-search = ["native=dist-assets/binaries/aarch64-unknown-linux-gnu"] diff --git a/.github/workflows/rust-unused-dependencies.yml b/.github/workflows/rust-unused-dependencies.yml index b710f34220..d11fa6fa23 100644 --- a/.github/workflows/rust-unused-dependencies.yml +++ b/.github/workflows/rust-unused-dependencies.yml @@ -59,7 +59,7 @@ jobs: - name: Check for unused dependencies shell: bash - run: source env.sh && cargo udeps --workspace + run: cargo udeps --workspace cargo-udeps-android: needs: prepare-containers diff --git a/BuildInstructions.md b/BuildInstructions.md index dfbf764f67..3947de3530 100644 --- a/BuildInstructions.md +++ b/BuildInstructions.md @@ -257,7 +257,7 @@ On Linux, you may also have to specify `USE_SYSTEM_FPM=true` to generate the deb This section is for building the system service individually. -1. Source `env.sh` to set the default environment variables: +1. On macOS, source `env.sh` to set the default environment variables: ```bash source env.sh ``` diff --git a/Cargo.lock b/Cargo.lock index c16e83be5a..e8d80dcd57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2941,9 +2941,9 @@ dependencies = [ [[package]] name = "mnl" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a5469630da93e1813bb257964c0ccee3b26b6879dd858039ddec35cc8681ed" +checksum = "f15c13b46a48d07ffae279f54a43ebfb0badee28a59a32aacdddc67effa2c4db" dependencies = [ "libc", "log", @@ -2952,9 +2952,9 @@ dependencies = [ [[package]] name = "mnl-sys" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9750685b201e1ecfaaf7aa5d0387829170fa565989cc481b49080aa155f70457" +checksum = "a0f3c607af12ed53f3cade8ee7adeced5533800abc0b07f5b6bdc7081d1e0d4c" dependencies = [ "libc", "pkg-config", @@ -3510,9 +3510,9 @@ dependencies = [ [[package]] name = "nftnl" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a7491dd91b71643f65546389f25506da70723d1f1ec8c8d6d20444d1c23f27" +checksum = "be089a98a3f53ef44cd2359d074b421d6ab7f42b117d586c5adb36bdeb82b01b" dependencies = [ "bitflags 2.9.0", "log", @@ -3521,12 +3521,13 @@ dependencies = [ [[package]] name = "nftnl-sys" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b193f2c2a70e6421534c3f3b75eaaed4e4b9df45281b3d94f5bc8c32fb346cbb" +checksum = "38d8e4f1cfbbeb744087d1f22debb590266417eb0a2e8a171800ae3694bdac81" dependencies = [ "cfg-if", "libc", + "mnl-sys", "pkg-config", ] @@ -9,10 +9,6 @@ source "$SCRIPT_DIR/scripts/utils/host" ENV_TARGET=${1:-$HOST} case "$ENV_TARGET" in - *linux*) - export LIBMNL_LIB_DIR="$SCRIPT_DIR/dist-assets/binaries/$ENV_TARGET" - export LIBNFTNL_LIB_DIR="$SCRIPT_DIR/dist-assets/binaries/$ENV_TARGET" - ;; x86_64-*-darwin*) export MACOSX_DEPLOYMENT_TARGET="10.12" @@ -31,6 +27,8 @@ case "$ENV_TARGET" in export SDKROOT fi ;; + *linux*) + ;; *windows*) ;; *) diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index e7ba36d5e8..b46c6e05c8 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -43,8 +43,8 @@ jnix = { version = "0.5.1", features = ["derive"] } nix = { workspace = true, features = ["mount"] } inotify = "0.10" resolv-conf = "0.7" -nftnl = { version = "0.7.0", features = ["nftnl-1-1-0"] } -mnl = { version = "0.2.2", features = ["mnl-1-0-4"] } +nftnl = { version = "0.8.0", features = ["nftnl-1-1-0"] } +mnl = { version = "0.2.3", features = ["mnl-1-0-4"] } which = { version = "4.0", default-features = false } talpid-dbus = { path = "../talpid-dbus" } diff --git a/talpid-core/build.rs b/talpid-core/build.rs index d591cefb81..97b0f14766 100644 --- a/talpid-core/build.rs +++ b/talpid-core/build.rs @@ -1,7 +1,24 @@ +fn main() { + generate_grpc_code(); + #[cfg(windows)] + win::main(); +} + +fn generate_grpc_code() { + tonic_build::compile_protos("../talpid-openvpn-plugin/proto/openvpn_plugin.proto").unwrap(); +} + #[cfg(windows)] mod win { use std::{env, path::PathBuf}; + pub fn main() { + const WINFW_DIR_VAR: &str = "WINFW_LIB_DIR"; + declare_library(WINFW_DIR_VAR, WINFW_BUILD_DIR, "winfw"); + let lib_dir = manifest_dir().join("../build/lib").join(target()); + println!("cargo::rustc-link-search={}", &lib_dir.display()); + } + pub static WINFW_BUILD_DIR: &str = "..\\windows\\winfw\\bin"; pub fn default_windows_build_artifact_dir(build_dir: &str) -> PathBuf { @@ -47,24 +64,3 @@ mod win { .expect("CARGO_MANIFEST_DIR env var not set") } } - -#[cfg(windows)] -fn main() { - generate_grpc_code(); - - use crate::win::*; - - const WINFW_DIR_VAR: &str = "WINFW_LIB_DIR"; - declare_library(WINFW_DIR_VAR, WINFW_BUILD_DIR, "winfw"); - let lib_dir = manifest_dir().join("../build/lib").join(target()); - println!("cargo::rustc-link-search={}", &lib_dir.display()); -} - -#[cfg(not(windows))] -fn main() { - generate_grpc_code() -} - -fn generate_grpc_code() { - tonic_build::compile_protos("../talpid-openvpn-plugin/proto/openvpn_plugin.proto").unwrap(); -} |
