🍎 Add macOS packaging + cross-platform build system
🔄 Unified build pipeline for Linux/macOS from Linux hosts
This commit is contained in:
parent
f402ff04ab
commit
0c43dc5a76
6 changed files with 951 additions and 18 deletions
47
build.sh
Executable file
47
build.sh
Executable file
|
@ -0,0 +1,47 @@
|
|||
#!/bin/zsh
|
||||
set -e # Exit on any error
|
||||
|
||||
log() {
|
||||
echo "🔨 $1"
|
||||
}
|
||||
|
||||
error() {
|
||||
echo "❌ $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Build Relay component
|
||||
log "Building Relay..."
|
||||
(cd ../Relay && ./build.sh) || error "Relay build failed"
|
||||
|
||||
# Setup extras directory
|
||||
log "Setting up extras directory..."
|
||||
mkdir -p extras/linux extras/macos
|
||||
cp ../Relay/dist/relay-x86_64-unknown-linux-gnu ./extras/linux/relay || error "Failed to copy Linux relay"
|
||||
cp ../Relay/dist/relay-x86_64-apple-darwin ./extras/macos/relay || error "Failed to copy macOS relay"
|
||||
|
||||
# Clean previous builds
|
||||
log "Cleaning previous builds..."
|
||||
rm -rf dist
|
||||
|
||||
# Build Linux version
|
||||
log "Building Linux version..."
|
||||
bun run build:linux || error "Linux build failed"
|
||||
npm install || error "npm install failed"
|
||||
|
||||
# Build macOS version using Docker
|
||||
log "Building macOS version..."
|
||||
docker run --rm -it \
|
||||
-v "${PWD}:/project" \
|
||||
-v "${HOME}/.ssh:/root/.ssh" \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
electronuserland/builder \
|
||||
/bin/bash -c "npm install && npm run build:mac" || error "macOS build failed"
|
||||
|
||||
# Output paths
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
log "Build complete! 🎉"
|
||||
echo "📦 Build artifacts:"
|
||||
echo "🐧 Linux AppImage: ./dist/Eve-${VERSION}.AppImage"
|
||||
echo "🐧 Linux Flatpak: ./dist/Eve-${VERSION}.flatpak"
|
||||
echo "🍎 macOS ZIP: ./dist/Eve-${VERSION}-mac.zip"
|
|
@ -16,6 +16,15 @@ linux:
|
|||
flatpak:
|
||||
runtimeVersion: "24.08"
|
||||
license: "LICENSE"
|
||||
mac:
|
||||
category: Network
|
||||
target:
|
||||
- zip
|
||||
entitlementsInherit: build/entitlements.mac.plist
|
||||
notarize: false
|
||||
extraFiles:
|
||||
- from: extras/macos/relay
|
||||
to: Resources/macos/eve-relay
|
||||
directories:
|
||||
buildResources: build
|
||||
files:
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build": "tsc && electron-vite build",
|
||||
"build:mac": "npm run build && ./node_modules/.bin/electron-rebuild -p darwin -a x64 && electron-builder --mac",
|
||||
"build:linux": "bun run build && electron-builder --linux",
|
||||
"start": "electron-vite preview",
|
||||
"dev": "electron-vite dev",
|
||||
|
|
|
@ -7,10 +7,16 @@ import os from "node:os";
|
|||
|
||||
const relay = new RelayManager();
|
||||
|
||||
ipcMain.handle("relay:writeSeed", (_, ...args: any) => {
|
||||
ipcMain.handle("relay:writeSeed", async (_, ...args: any) => {
|
||||
if (!args[0]) throw new Error("No seed provided");
|
||||
const seed = args[0] as string;
|
||||
const configPath = path.join(os.homedir(), ".config", "arx", "Eve");
|
||||
let configPath: string;
|
||||
if (process.platform === "darwin") {
|
||||
configPath = path.join(app.getPath("userData"), "arx", "Eve");
|
||||
} else {
|
||||
configPath = path.join(os.homedir(), ".config", "arx", "Eve");
|
||||
}
|
||||
|
||||
const seedPath = path.join(configPath, "ccn.seed");
|
||||
fs.mkdirSync(configPath, { recursive: true });
|
||||
fs.writeFileSync(seedPath, seed);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { spawn, ChildProcess } from "child_process";
|
|||
import { join } from "path";
|
||||
import { is } from "@electron-toolkit/utils";
|
||||
|
||||
type PackageEnvironment = "flatpak" | "appimage" | "system" | "dev";
|
||||
type PackageEnvironment = "flatpak" | "appimage" | "system" | "mac" | "dev";
|
||||
|
||||
export class RelayManager {
|
||||
private process: ChildProcess | null;
|
||||
|
@ -50,6 +50,7 @@ export class RelayManager {
|
|||
|
||||
private detectEnvironment(): PackageEnvironment {
|
||||
if (is.dev) return "dev";
|
||||
if (process.platform === "darwin") return "mac";
|
||||
if (process.env.FLATPAK_ID) return "flatpak";
|
||||
if (process.env.APPIMAGE) return "appimage";
|
||||
return "system";
|
||||
|
@ -61,6 +62,8 @@ export class RelayManager {
|
|||
switch (environment) {
|
||||
case "dev":
|
||||
return join(__dirname, "../../extras/linux/relay");
|
||||
case "mac":
|
||||
return join(process.resourcesPath, "macos", "eve-relay");
|
||||
case "flatpak":
|
||||
return "/app/lib/com.arx_ccn.eve/usr/bin/eve-relay";
|
||||
case "appimage":
|
||||
|
|
Loading…
Add table
Reference in a new issue