From 79d5f60af539613454b1176ee63d19a3ceee5eb0 Mon Sep 17 00:00:00 2001 From: Markus Pettersson Date: Thu, 16 Apr 2026 10:14:17 +0200 Subject: [PATCH] Remove env.sh Set MACOSX_DEPLOYMENT_TARGET in the cargo build script of the mullvad-daemon crate. Rustc already shells out to xcrun to figure out the system SDKROOT, so no need to do that manually. --- .github/workflows/rustdoc.yml | 1 - BuildInstructions.md | 5 ----- build.sh | 1 - ci/cargo-ci.sh | 6 ------ env.sh | 38 ----------------------------------- mullvad-daemon/build.rs | 9 +++++++++ 6 files changed, 9 insertions(+), 51 deletions(-) delete mode 100755 env.sh diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index bdf496692e83..e780f9f92372 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -9,7 +9,6 @@ on: - "rust-toolchain.toml" - "rustfmt.toml" - "ci/cargo-ci.sh" - - "env.sh" workflow_dispatch: inputs: diff --git a/BuildInstructions.md b/BuildInstructions.md index dc79e88182fa..9bf2f2eda981 100644 --- a/BuildInstructions.md +++ b/BuildInstructions.md @@ -290,11 +290,6 @@ TARGETS="riscv64gc-unknown-linux-gnu" ./build.sh --daemon-only --optimize This section is for building the system service individually. -1. On macOS, source `env.sh` to set the default environment variables: - ```bash - source env.sh - ``` - 1. On Windows, build the C++ libraries: ```bash ./build-windows-modules.sh diff --git a/build.sh b/build.sh index 81c32dc926dc..b83995acbbf2 100755 --- a/build.sh +++ b/build.sh @@ -370,7 +370,6 @@ if [[ "$(uname -s)" == "MINGW"* ]]; then fi for t in "${TARGETS[@]:-""}"; do - source env.sh "$t" build "$t" done diff --git a/ci/cargo-ci.sh b/ci/cargo-ci.sh index 925700bd3634..920dfa2bada1 100755 --- a/ci/cargo-ci.sh +++ b/ci/cargo-ci.sh @@ -2,12 +2,6 @@ set -eux -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Explicitly pass empty first argument, otherwise this script will pass on its arguments in a `source` invocation. -# shellcheck disable=SC1091 -source "$SCRIPT_DIR/../env.sh" "" - # Hard deny on all warnings when running in CI export RUSTFLAGS="--deny warnings" diff --git a/env.sh b/env.sh deleted file mode 100755 index ccab7b560d19..000000000000 --- a/env.sh +++ /dev/null @@ -1,38 +0,0 @@ -# shellcheck shell=bash -# -# Sourcing this file should set up the environment to build the app - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -source "$SCRIPT_DIR/scripts/utils/host" - -ENV_TARGET=${1:-$HOST} - -case "$ENV_TARGET" in - x86_64-*-darwin*) - export MACOSX_DEPLOYMENT_TARGET="10.12" - - if [[ $HOST != "$ENV_TARGET" ]]; then - # Required for building daemon - SDKROOT=$(xcrun --show-sdk-path) - export SDKROOT - fi - ;; - aarch64-*-darwin*) - export MACOSX_DEPLOYMENT_TARGET="11.0" - - if [[ $HOST != "$ENV_TARGET" ]]; then - # Required for building daemon - SDKROOT=$(xcrun --show-sdk-path) - export SDKROOT - fi - ;; - *linux*) - ;; - *windows*) - ;; - *) - echo "Unknown target \"$ENV_TARGET\"" >&2 - exit 1 - ;; -esac diff --git a/mullvad-daemon/build.rs b/mullvad-daemon/build.rs index f0790dddca6f..e8723d8fb3c2 100644 --- a/mullvad-daemon/build.rs +++ b/mullvad-daemon/build.rs @@ -39,6 +39,15 @@ fn main() { if matches!(target_os(), Os::Windows | Os::Macos) { println!(r#"cargo::rustc-cfg=in_app_upgrade"#); } + + if matches!(target_os(), Os::Macos) { + // Set the minimum version of macOS on which mullvad-daemon can run. + if cfg!(target_arch = "x86_64") { + println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.12"); + } else if cfg!(target_arch = "aarch64") { + println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=11.0"); + } + } } fn commit_date() -> String {