diff --git a/.github/workflows/lint-rs.yml b/.github/workflows/lint-rs.yml index 8f54de5..9149c99 100644 --- a/.github/workflows/lint-rs.yml +++ b/.github/workflows/lint-rs.yml @@ -79,7 +79,7 @@ jobs: if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then pnpm run build:linux-x64 elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then - pnpm run build:aarch64 + pnpm run build:mac-aarch64 elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then pnpm run build:win-x64 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 246ad3f..5db244c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,19 +50,19 @@ jobs: arch: "aarch64" target: "aarch64-apple-darwin" pkg_target: "latest-macos-arm64" - nodecar_script: "build:aarch64" + nodecar_script: "build:mac-aarch64" - platform: "macos-latest" args: "--target x86_64-apple-darwin" arch: "x86_64" target: "x86_64-apple-darwin" pkg_target: "latest-macos-x64" - nodecar_script: "build:x86_64" + nodecar_script: "build:mac-x86_64" - platform: "macos-latest" args: "--target universal-apple-darwin" arch: "aarch64" - target: "aarch64-apple-darwin,x86_64-apple-darwin" + target: "aarch64-apple-darwin" pkg_target: "universal" - nodecar_script: "build:universal" + nodecar_script: "build:mac-universal" - platform: "ubuntu-20.04" args: "--target x86_64-unknown-linux-gnu" arch: "x86_64" diff --git a/.github/workflows/rolling-release.yml b/.github/workflows/rolling-release.yml index 185ef84..a6a1c16 100644 --- a/.github/workflows/rolling-release.yml +++ b/.github/workflows/rolling-release.yml @@ -49,19 +49,19 @@ jobs: arch: "aarch64" target: "aarch64-apple-darwin" pkg_target: "latest-macos-arm64" - nodecar_script: "build:aarch64" + nodecar_script: "build:mac-aarch64" - platform: "macos-latest" args: "--target x86_64-apple-darwin" arch: "x86_64" target: "x86_64-apple-darwin" pkg_target: "latest-macos-x64" - nodecar_script: "build:x86_64" + nodecar_script: "build:mac-x86_64" - platform: "macos-latest" args: "--target universal-apple-darwin" arch: "aarch64" target: "aarch64-apple-darwin,x86_64-apple-darwin" pkg_target: "universal" - nodecar_script: "build:universal" + nodecar_script: "build:mac-universal" - platform: "ubuntu-20.04" args: "--target x86_64-unknown-linux-gnu" arch: "x86_64" diff --git a/.vscode/settings.json b/.vscode/settings.json index bd8ef23..ab66d4b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ + "appindicator", "applescript", "autoconfig", "autologin", @@ -22,7 +23,11 @@ "idletime", "KHTML", "launchservices", + "libayatana", + "librsvg", + "libwebkit", "mountpoint", + "msvc", "msys", "Mullvad", "nodecar", diff --git a/nodecar/copy-binary.sh b/nodecar/copy-binary.sh new file mode 100755 index 0000000..f125dc7 --- /dev/null +++ b/nodecar/copy-binary.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Determine file extension based on platform +if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" || "$OSTYPE" == "cygwin" ]]; then + EXT=".exe" +else + EXT="" +fi + +# If architecture provided in the command line, use it to rename the binary in TARGET_TRIPLE +if [ -n "$1" ]; then + TARGET_TRIPLE="$1" +else + RUST_INFO=$(rustc -vV) + TARGET_TRIPLE=$(echo "$RUST_INFO" | grep -o 'host: [^ ]*' | cut -d' ' -f2) +fi + +# Check if target triple was found +if [ -z "$TARGET_TRIPLE" ]; then + echo "Failed to determine platform target triple" >&2 + exit 1 +fi + +# Copy the file +cp "dist/nodecar${EXT}" "../src-tauri/binaries/nodecar-${TARGET_TRIPLE}${EXT}" \ No newline at end of file diff --git a/nodecar/package.json b/nodecar/package.json index aa619e7..cd8e204 100644 --- a/nodecar/package.json +++ b/nodecar/package.json @@ -7,14 +7,15 @@ "watch": "nodemon --exec ts-node --esm ./src/index.ts --watch src", "dev": "node --loader ts-node/esm ./src/index.ts", "start": "node --loader ts-node/esm ./src/index.ts", - "build": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar", - "build:aarch64": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar", - "build:x86_64": "tsc && pkg ./dist/index.js --targets latest-macos-x64 --output dist/nodecar", - "build:universal": "pnpm build:aarch64 && pnpm build:x86_64", - "build:linux-x64": "tsc && pkg ./dist/index.js --targets latest-linux-x64 --output dist/nodecar", - "build:linux-arm64": "tsc && pkg ./dist/index.js --targets latest-linux-arm64 --output dist/nodecar", - "build:win-x64": "tsc && pkg ./dist/index.js --targets latest-win-x64 --output dist/nodecar", - "build:win-arm64": "tsc && pkg ./dist/index.js --targets latest-win-arm64 --output dist/nodecar" + "rename-binary": "sh ./rename-binary.sh", + "build": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar && pnpm rename-binary", + "build:mac-aarch64": "tsc && pkg ./dist/index.js --targets latest-macos-arm64 --output dist/nodecar && pnpm rename-binary", + "build:mac-x86_64": "tsc && pkg ./dist/index.js --targets latest-macos-x64 --output dist/nodecar && pnpm rename-binary", + "build:mac-universal": "pnpm build:mac-aarch64 && pnpm rename-binary && pnpm build:mac-x86_64 && pnpm rename-binary x86_64-apple-darwin", + "build:linux-x64": "tsc && pkg ./dist/index.js --targets latest-linux-x64 --output dist/nodecar && pnpm rename-binary", + "build:linux-arm64": "tsc && pkg ./dist/index.js --targets latest-linux-arm64 --output dist/nodecar && pnpm rename-binary", + "build:win-x64": "tsc && pkg ./dist/index.js --targets latest-win-x64 --output dist/nodecar && pnpm rename-binary", + "build:win-arm64": "tsc && pkg ./dist/index.js --targets latest-win-arm64 --output dist/nodecar && pnpm rename-binary" }, "keywords": [], "author": "", diff --git a/rename-binary.sh b/rename-binary.sh deleted file mode 100755 index 1327312..0000000 --- a/rename-binary.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# Determine file extension based on platform -if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" || "$OSTYPE" == "cygwin" ]]; then - EXT=".exe" -else - EXT="" -fi - -# Get Rust target triple -RUST_INFO=$(rustc -vV) -TARGET_TRIPLE=$(echo "$RUST_INFO" | grep -o 'host: [^ ]*' | cut -d' ' -f2) - -# Check if target triple was found -if [ -z "$TARGET_TRIPLE" ]; then - echo "Failed to determine platform target triple" >&2 - exit 1 -fi - -# Rename the file -mv "nodecar/dist/nodecar${EXT}" "src-tauri/binaries/nodecar-${TARGET_TRIPLE}${EXT}" \ No newline at end of file