#!/usr/bin/env bash set -eu ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" HELPER_DIR="${ROOT_DIR}/tunnel-helper" BUNDLED_DIR="${ROOT_DIR}/src-tauri/bundled" TARGET="${1:-}" if [ -z "${TARGET}" ]; then echo "usage: build-tunnel-helper.sh " exit 1 fi case "${TARGET}" in i686-pc-windows-msvc) OUTPUT_DIR="${BUNDLED_DIR}/windows-x86" OUTPUT_NAME="nexavpn-tunnel-helper.exe" ;; aarch64-apple-darwin) OUTPUT_DIR="${BUNDLED_DIR}/macos-arm64" OUTPUT_NAME="nexavpn-tunnel-helper" ;; *) echo "unsupported target: ${TARGET}" exit 1 ;; esac mkdir -p "${OUTPUT_DIR}" cargo build --manifest-path "${HELPER_DIR}/Cargo.toml" --release --target "${TARGET}" cp "${HELPER_DIR}/target/${TARGET}/release/${OUTPUT_NAME}" "${OUTPUT_DIR}/${OUTPUT_NAME}" echo "Bundled ${OUTPUT_NAME} into ${OUTPUT_DIR}"