summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2024-11-18 11:25:17 +0100
committerDavid Lönnhager <david.l@mullvad.net>2024-11-18 11:25:17 +0100
commit13762774687abf4d68c17e36d1cbb105b0a098d2 (patch)
treee1b52113391f504bae1651e2c89932f3d160f584
parent244d006277094a7b74f9e404cb897722111a654d (diff)
parentda5b98aa3d225090057bb9bb811b6d4c08b23f84 (diff)
downloadmullvadvpn-13762774687abf4d68c17e36d1cbb105b0a098d2.tar.xz
mullvadvpn-13762774687abf4d68c17e36d1cbb105b0a098d2.zip
Merge branch 'remove-build-sh-nseventforwarder'
-rw-r--r--desktop/packages/nseventforwarder/build.sh49
-rw-r--r--desktop/packages/nseventforwarder/package.json4
2 files changed, 2 insertions, 51 deletions
diff --git a/desktop/packages/nseventforwarder/build.sh b/desktop/packages/nseventforwarder/build.sh
deleted file mode 100644
index 0b72762132..0000000000
--- a/desktop/packages/nseventforwarder/build.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env bash
-
-set -eu
-
-# Parse arguments
-while [[ "$#" -gt 0 ]]; do
- case $1 in
- --target)
- TARGET_TRIPLE="$2"
- shift
- shift
- ;;
- *)
- echo "Unknown parameter: $1"
- exit 1
- ;;
- esac
-done
-
-# Fail if TARGET_TRIPLE is not set
-if [[ -z ${TARGET_TRIPLE-} ]]; then
- echo "The variable TARGET_TRIPLE is not set."
- echo "Set it using the --target flag"
- echo "Available targets: aarch64-apple-darwin, x86_64-apple-darwin"
- exit 1
-fi
-
-# Map the target to an output folder (where the dylib / node binary will end up).
-# This is neon-convention.
-case "$TARGET_TRIPLE" in
- aarch64-apple-darwin) PLATFORM_DIR_NAME=darwin-arm64;;
- x86_64-apple-darwin) PLATFORM_DIR_NAME=darwin-x64;;
- *)
- echo "Unknown target: $TARGET_TRIPLE"
- echo "Available targets: aarch64-apple-darwin, x86_64-apple-darwin"
- exit 1
- ;;
-esac
-
-if [[ "$(uname -s)" == "Darwin" ]]; then
- # We rely (heavily) on a pre-defined CARGO_TARGET_DIR, so don't let any user override it
- unset CARGO_TARGET_DIR
- npm run cargo-build -- --release --target "$TARGET_TRIPLE"
- # Copy the neon library to the correct dists folder, which is what node will
- # pick up when loading the library at runtime.
- PLATFORM_DIR="dist/$PLATFORM_DIR_NAME"
- mkdir -p $PLATFORM_DIR
- cp "target/$TARGET_TRIPLE/release/libnseventforwarder.dylib" "$PLATFORM_DIR/index.node"
-fi
diff --git a/desktop/packages/nseventforwarder/package.json b/desktop/packages/nseventforwarder/package.json
index 1cd9985747..2114e920c5 100644
--- a/desktop/packages/nseventforwarder/package.json
+++ b/desktop/packages/nseventforwarder/package.json
@@ -8,8 +8,8 @@
"scripts": {
"cargo-build": "tsc && cargo build",
"build-debug": "npm run cargo-build && cp target/debug/libnseventforwarder.dylib target/debug/index.node",
- "build-arm": "bash ./build.sh --target aarch64-apple-darwin",
- "build-x86": "bash ./build.sh --target x86_64-apple-darwin",
+ "build-arm": "npm run cargo-build -- --release --target aarch64-apple-darwin && mkdir -p dist/darwin-arm64 && cp target/aarch64-apple-darwin/release/libnseventforwarder.dylib dist/darwin-arm64/index.node",
+ "build-x86": "npm run cargo-build -- --release --target x86_64-apple-darwin && mkdir -p dist/darwin-x64 && cp target/x86_64-apple-darwin/release/libnseventforwarder.dylib dist/darwin-x64/index.node",
"lint": "eslint .",
"lint-fix": "eslint --fix ."
},