Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix windows setup script (#328)

Brendan Allanf92ca67519d6
diff --git a/.github/prebuild.js b/.github/prebuild.js
deleted file mode 100644
index e70a53596..000000000
--- a/.github/prebuild.js
+++ /dev/null
@@ -1,173 +0,0 @@
-import * as fs from "node:fs/promises";
-import * as path from "node:path";
-import { fileURLToPath } from "node:url";
-import { exec as execCb } from "node:child_process";
-import { env } from "node:process";
-import { promisify } from "node:util";
-import { createTauriPlatformConfigs } from "../apps/desktop/scripts/prepare.js";
-
-const exec = promisify(execCb);
-const signId = env.APPLE_SIGNING_IDENTITY || "-";
-const keychain = env.APPLE_KEYCHAIN ? `--keychain ${env.APPLE_KEYCHAIN}` : "";
-
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = path.dirname(__filename);
-
-const __root = path.resolve(path.join(__dirname, ".."));
-const nativeDeps = path.join(__root, "native-deps");
-const srcTauri = path.join(__root, "apps/desktop/src-tauri");
-
-async function main() {
- await fs.mkdir(path.join(__root, ".cargo"), { recursive: true });
-
- await fs.writeFile(
- path.join(__root, ".cargo/config.toml"),
- `[env]
-FFMPEG_DIR = { force = true, value = "${nativeDeps}" }
-
-[target.x86_64-apple-darwin]
-rustflags = [
-"-L",
-"${nativeDeps}/lib",
-"-Csplit-debuginfo=unpacked",
-]
-
-[target.aarch64-apple-darwin]
-rustflags = [
-"-L",
-"${nativeDeps}/lib",
-"-Csplit-debuginfo=unpacked",
-]`
- );
-
- const os = process.argv[2];
- const arch = process.argv[3];
-
- if (!os) throw new Error("OS not provided");
- if (!arch) throw new Error("Arch not provided");
-
- await fs.rm(nativeDeps, { recursive: true, force: true });
- await fs.mkdir(nativeDeps, { recursive: true });
- const res = await fetch(`${NATIVE_DEPS_URL}/${NATIVE_DEPS_ASSETS[os][arch]}`);
- const body = await res.blob();
-
- await fs.writeFile(
- `${__root}/native-deps.tar.xz`,
- Buffer.from(await body.arrayBuffer())
- );
-
- await exec(`tar xf ${__root}/native-deps.tar.xz -C ${nativeDeps}`);
-
- if (os === "darwin") {
- const frameworkDir = path.join(nativeDeps, "Spacedrive.framework");
-
- const headersDir = path.join(frameworkDir, "Headers");
- const librariesDir = path.join(frameworkDir, "Libraries");
-
- const libraries = await fs.readdir(librariesDir);
-
- const unnecessaryLibraries = libraries.filter(
- (v) =>
- !(
- v.startsWith("libav") ||
- v.startsWith("libsw") ||
- v.startsWith("libpostproc")
- )
- );
-
- for (const lib of unnecessaryLibraries) {
- await fs.rm(path.join(librariesDir, lib), { recursive: true });
- }
-
- const headers = await fs.readdir(headersDir);
-
- const unnecessaryHeaders = headers.filter(
- (v) =>
- !(
- v.startsWith("libav") ||
- v.startsWith("libsw") ||
- v.startsWith("libpostproc")
- )
- );
-
- for (const header of unnecessaryHeaders) {
- await fs.rm(path.join(headersDir, header), { recursive: true });
- }
-
- await fs.rm(path.join(frameworkDir, "Resources", "Models"), {
- recursive: true,
- });
-
- await symlinkSharedLibsMacOS(nativeDeps).catch((e) => {
- console.error(`Failed to symlink shared libs.`);
- throw e;
- });
-
- createTauriPlatformConfigs("darwin", {
- bundle: {
- macOS: {
- frameworks: [path.join(nativeDeps, "Spacedrive.framework")],
- },
- },
- });
- } else if (os === "windows") {
- // const binFiles = await fs.readdir(path.join(nativeDeps, "bin"));
- // await fs.writeFile(
- // `${srcTauri}/tauri.windows.conf.json`,
- // JSON.stringify(
- // {
- // bundle: {
- // resources: binFiles.filter(
- // (f) =>
- // f.endsWith(".dll") && (f.startsWith("av") || f.startsWith("sw"))
- // ),
- // },
- // },
- // null,
- // 4
- // )
- // );
- }
-}
-
-main();
-
-const NATIVE_DEPS_URL =
- "https://github.com/spacedriveapp/native-deps/releases/latest/download";
-
-const NATIVE_DEPS_ASSETS = {
- darwin: {
- x86_64: "native-deps-x86_64-darwin-apple.tar.xz",
- aarch64: "native-deps-aarch64-darwin-apple.tar.xz",
- },
- windows: {
- x86_64: "native-deps-x86_64-windows-gnu.tar.xz",
- aarch64: "native-deps-aarch64-windows-gnu.tar.xz",
- },
-};
-
-async function symlinkSharedLibsMacOS(nativeDeps) {
- // Framework
- const framework = path.join(nativeDeps, "Spacedrive.framework");
-
- // Sign dylibs (Required for them to work on macOS 13+)
- await fs
- .readdir(path.join(framework, "Libraries"), {
- recursive: true,
- withFileTypes: true,
- })
- .then((files) =>
- Promise.all(
- files
- .filter((entry) => entry.isFile() && entry.name.endsWith(".dylib"))
- .map((entry) =>
- exec(
- `codesign ${keychain} -s "${signId}" -f "${path.join(
- entry.path,
- entry.name
- )}"`
- )
- )
- )
- );
-}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 069370b10..b8731100d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -53,3 +53,72 @@ jobs:
uses: actions-rs-plus/clippy-check@v2
with:
args: --workspace --all-features --locked
+
+ build-desktop:
+ name: Build Desktop
+ strategy:
+ fail-fast: false
+ matrix:
+ settings:
+ - target: aarch64-apple-darwin
+ runner: macos-latest
+ - target: x86_64-pc-windows-msvc
+ runner: windows-latest
+ runs-on: ${{ matrix.settings.runner }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Rust setup
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ targets: ${{ matrix.settings.target }}
+
+ - name: Rust cache
+ uses: swatinem/rust-cache@v2
+ with:
+ shared-key: ${{ matrix.settings.target }}
+
+ - name: Setup pnpm
+ uses: pnpm/action-setup@v4
+ with:
+ version: 9.8.0
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: pnpm
+
+ - name: Install dependencies
+ run: pnpm install
+
+ - name: Create .env file in root
+ run: |
+ echo "appVersion=${{ needs.draft.outputs.version }}" >> .env
+ echo "VITE_ENVIRONMENT=production" >> .env
+ echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
+ echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}" >> .env
+ echo 'NEXTAUTH_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env
+ echo 'NEXT_PUBLIC_POSTHOG_KEY=${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}' >> .env
+ echo 'NEXT_PUBLIC_POSTHOG_HOST=${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}' >> .env
+ echo 'VITE_POSTHOG_KEY=${{ secrets.NEXT_PUBLIC_POSTHOG_KEY }}' >> .env
+ echo 'VITE_POSTHOG_HOST=${{ secrets.NEXT_PUBLIC_POSTHOG_HOST }}' >> .env
+ echo 'VITE_SERVER_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}' >> .env
+ echo "NEXT_PUBLIC_CAP_AWS_REGION=${{ secrets.NEXT_PUBLIC_CAP_AWS_REGION }}" >> .env
+ echo "NEXT_PUBLIC_CAP_AWS_BUCKET=${{ secrets.NEXT_PUBLIC_CAP_AWS_BUCKET }}" >> .env
+
+ - name: Copy .env to apps/desktop
+ run: cp .env apps/desktop/.env
+
+ - name: Output .env file
+ run: cat apps/desktop/.env
+
+ - name: Build macOS apps
+ working-directory: apps/desktop
+ run: |
+ pnpm -w cap-setup
+ pnpm tauri build --debug
+ env:
+ # https://github.com/tauri-apps/tauri-action/issues/740
+ CI: false
diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml
deleted file mode 100644
index f4f78d29e..000000000
--- a/.github/workflows/debug.yml
+++ /dev/null
@@ -1,97 +0,0 @@
-name: "Debug Build: Silicon"
-
-on:
- workflow_dispatch:
- pull_request:
- branches: [main]
-
-env:
- APP_CARGO_TOML: apps/desktop/src-tauri/Cargo.toml
-
-jobs:
- build:
- runs-on: macos-latest
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
-
- - name: Create API Key File
- run: echo "${{ secrets.APPLE_API_KEY_FILE }}" > api.p8
-
- - uses: apple-actions/import-codesign-certs@v2
- with:
- p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
- p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
-
- - name: Verify certificate
- run: security find-identity -v -p codesigning ${{ runner.temp }}/build.keychain
-
- - name: Rust setup
- uses: dtolnay/rust-toolchain@stable
- with:
- targets: aarch64-apple-darwin
-
- - name: Rust cache
- uses: swatinem/rust-cache@v2
- with:
- shared-key: aarch64-apple-darwin
-
- - name: Setup pnpm
- uses: pnpm/action-setup@v4
- with:
- version: 9.8.0
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: "20"
- cache: pnpm
-
- - name: Setup native dependencies
- run: pnpm cap-setup
-
- - name: Install dependencies
- run: pnpm install
-
- - name: Create .env file in root
- run: |
- echo "appVersion=debug" >> .env
- echo "CAP_DESKTOP_SENTRY_URL=https://6a3b6a09e6ae976c2ad6fff710e88748@o4506859771527168.ingest.us.sentry.io/4508330917101568" >> .env
- echo "NEXT_PUBLIC_WEB_URL=${{ secrets.NEXT_PUBLIC_WEB_URL }}" >> .env
- echo 'NEXTAUTH_URL=${NEXT_PUBLIC_WEB_URL}' >> .env
- echo 'VITE_SERVER_URL=${NEXT_PUBLIC_WEB_URL}' >> .env
- echo "NEXT_PUBLIC_CAP_AWS_REGION=${{ secrets.NEXT_PUBLIC_CAP_AWS_REGION }}" >> .env
- echo "NEXT_PUBLIC_CAP_AWS_BUCKET=${{ secrets.NEXT_PUBLIC_CAP_AWS_BUCKET }}" >> .env
-
- - name: Copy .env to apps/desktop
- run: cp .env apps/desktop/.env
-
- - name: Output .env file
- run: cat apps/desktop/.env
-
- - name: Build Debug MacOS App (aarch64)
- working-directory: apps/desktop
- run: |
- export TARGET_TRIPLE=aarch64-apple-darwin
- pnpm tauri build --target aarch64-apple-darwin --debug
- env:
- CI: false
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- # codesigning
- APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
- APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
- # notarization
- APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
- APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
- APPLE_API_KEY_PATH: ${{ github.workspace }}/api.p8
- APPLE_KEYCHAIN: ${{ runner.temp }}/build.keychain
- TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
- TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
-
- - name: Upload Debug Artifact
- uses: actions/upload-artifact@v3
- with:
- name: debug-build-aarch64-apple-darwin
- path: apps/desktop/src-tauri/target/aarch64-apple-darwin/debug/bundle/**/*.app
- if-no-files-found: error
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 8d8c05263..1fe8b681c 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -132,15 +132,17 @@ jobs:
if: ${{ needs.draft.outputs.needs_release == 'true' }}
permissions:
contents: write
- runs-on: macos-latest
strategy:
fail-fast: false
matrix:
settings:
- target: x86_64-apple-darwin
- prebuild: x86_64
+ runner: macos-latest
- target: aarch64-apple-darwin
- prebuild: aarch64
+ runner: macos-latest
+ - target: x86_64-pc-windows-msvc
+ runner: windows-latest
+ runs-on: ${{ matrix.settings.runner }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -149,11 +151,13 @@ jobs:
run: echo "${{ secrets.APPLE_API_KEY_FILE }}" > api.p8
- uses: apple-actions/import-codesign-certs@v2
+ if: ${{ matrix.settings.runner == 'macos-latest' }}
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: Verify certificate
+ if: ${{ matrix.settings.runner == 'macos-latest' }}
run: security find-identity -v -p codesigning ${{ runner.temp }}/build.keychain
- name: Rust setup
@@ -201,14 +205,10 @@ jobs:
- name: Output .env file
run: cat apps/desktop/.env
- - name: Cargo clean
- run: cargo clean
-
- - name: Build macOS apps
+ - name: Build app
working-directory: apps/desktop
run: |
- export TARGET_TRIPLE=${{ matrix.settings.target }}
- node ${{ github.workspace }}/.github/prebuild.js darwin ${{ matrix.settings.prebuild }}
+ pnpm -w cap-setup
pnpm tauri build --target ${{ matrix.settings.target }} --config src-tauri/tauri.conf.prod.json
env:
# https://github.com/tauri-apps/tauri-action/issues/740
diff --git a/apps/desktop/scripts/prepare.js b/apps/desktop/scripts/prepare.js
index 012577948..fdf9db03c 100644
--- a/apps/desktop/scripts/prepare.js
+++ b/apps/desktop/scripts/prepare.js
@@ -3,34 +3,10 @@
import * as fs from "node:fs/promises";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
-import { exec as execCb, execSync } from "node:child_process";
-import { promisify } from "node:util";
-
-const exec = promisify(execCb);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
-const binariesDir = path.join(__dirname, "../../../target/binaries");
-const ffmpegUnzippedPath = path.join(binariesDir, "ffmpeg-unzipped");
-
-const isWindows = process.platform === "win32";
-const fileExtension = isWindows ? ".exe" : "";
-const rustInfo = execSync("rustc -vV");
-const rsTargetTriple =
- process.env.TARGET_TRIPLE || /host: (\S+)/.exec(rustInfo.toString())?.[1];
-
-/**
- * @param {string} filePath
- * @returns {Promise<boolean>}
- */
-async function exists(filePath) {
- return fs
- .access(filePath)
- .then(() => true)
- .catch(() => false);
-}
-
/**
* Creates a Microsoft Windows Installer (TM) compatible version from the provided crate's semver version.
* `major.minor.patch.build`
@@ -113,17 +89,8 @@ export async function createTauriPlatformConfigs(
},
},
};
- } else if (platform === "darwin") {
- configFileName = "tauri.macos.conf.json";
- baseConfig = {
- ...baseConfig,
- bundle: {
- icon: ["icons/macos/icon.icns"],
- },
- };
- } else {
- throw new Error("Unsupported platform!");
}
+
const mergedConfig = configOptions
? deepMerge(baseConfig, configOptions)
: baseConfig;
@@ -135,9 +102,6 @@ export async function createTauriPlatformConfigs(
async function main() {
console.log("--- Preparing sidecars and configs...");
- const targetTripleEnv = process.env.TARGET_TRIPLE || rsTargetTriple;
- console.log(`Target is ${targetTripleEnv}`);
-
await createTauriPlatformConfigs(process.platform);
console.log("--- Preparation finished");
}
diff --git a/apps/desktop/scripts/prodBeforeBundle.js b/apps/desktop/scripts/prodBeforeBundle.js
new file mode 100644
index 000000000..2ae2dc351
--- /dev/null
+++ b/apps/desktop/scripts/prodBeforeBundle.js
@@ -0,0 +1,52 @@
+// @ts-check
+
+import * as fs from "node:fs/promises";
+import * as path from "node:path";
+import { fileURLToPath } from "node:url";
+import { exec as execCb } from "node:child_process";
+import { promisify } from "node:util";
+
+const exec = promisify(execCb);
+
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = path.dirname(__filename);
+
+const targetDir = path.join(__dirname, "../../../target");
+
+async function main() {
+ if (process.platform === "darwin") {
+ const dirs = [];
+ let releaseDir = path.join(targetDir, "release");
+ if (!(await fileExists(releaseDir))) return;
+ const releaseFiles = await fs.readdir(releaseDir);
+ let releaseFile = releaseFiles.find((f) => f.startsWith("Cap"));
+ dirs.push(releaseDir);
+
+ if (!releaseFile) {
+ releaseDir = path.join(
+ targetDir,
+ `${process.env.TAURI_ENV_TARGET_TRIPLE}/release`
+ );
+ dirs.push(releaseDir);
+ const releaseFiles = await fs.readdir(releaseDir);
+ releaseFile = releaseFiles.find((f) => f.startsWith("Cap"));
+ }
+
+ if (!releaseFile) throw new Error(`No binary found at ${dirs.join(", ")}`);
+
+ const binaryPath = path.join(releaseDir, releaseFile);
+
+ await exec(
+ `dsymutil "${binaryPath}" -o "${path.join(targetDir, releaseFile)}.dSYM"`
+ );
+ }
+}
+
+main();
+
+async function fileExists(path) {
+ return await fs
+ .access(path)
+ .then(() => true)
+ .catch(() => false);
+}
diff --git a/apps/desktop/scripts/stripDebugSymbols.js b/apps/desktop/scripts/stripDebugSymbols.js
deleted file mode 100644
index 174ee1e01..000000000
--- a/apps/desktop/scripts/stripDebugSymbols.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// @ts-check
-
-import * as fs from "node:fs/promises";
-import * as path from "node:path";
-import { fileURLToPath } from "node:url";
-import { exec as execCb } from "node:child_process";
-import { promisify } from "node:util";
-
-const exec = promisify(execCb);
-
-const __filename = fileURLToPath(import.meta.url);
-const __dirname = path.dirname(__filename);
-
-const targetDir = path.join(__dirname, "../../../target");
-
-async function main() {
- const dirs = [];
- let releaseDir = path.join(targetDir, "release");
- const releaseFiles = await fs.readdir(releaseDir);
- let releaseFile = releaseFiles.find((f) => f.startsWith("Cap"));
- dirs.push(releaseDir);
-
- if (!releaseFile) {
- releaseDir = path.join(
- targetDir,
- `${process.env.TAURI_ENV_TARGET_TRIPLE}/release`
- );
- dirs.push(releaseDir);
- const releaseFiles = await fs.readdir(releaseDir);
- releaseFile = releaseFiles.find((f) => f.startsWith("Cap"));
- }
-
- if (!releaseFile) throw new Error(`No binary found at ${dirs.join(", ")}`);
-
- const binaryPath = path.join(releaseDir, releaseFile);
-
- if (process.platform === "darwin") {
- await exec(
- `dsymutil "${binaryPath}" -o "${path.join(targetDir, releaseFile)}.dSYM"`
- );
- // await exec(`strip "${binaryPath}"`);
- } else if (process.platform === "win32") {
- // TODO
- } else {
- throw new Error("Unsupported platform!");
- }
-}
-
-main();
diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json
index 50f7d188b..dc15c2324 100644
--- a/apps/desktop/src-tauri/tauri.conf.json
+++ b/apps/desktop/src-tauri/tauri.conf.json
@@ -7,7 +7,6 @@
"beforeDevCommand": "pnpm localdev",
"devUrl": "http://localhost:3001",
"beforeBuildCommand": "pnpm turbo build --filter @cap/desktop",
- "beforeBundleCommand": "node scripts/stripDebugSymbols.js",
"frontendDist": "../.output/public"
},
"app": {
@@ -21,14 +20,7 @@
}
},
"plugins": {
- "updater": {
- "active": false,
- "endpoints": [
- "https://cdn.crabnebula.app/update/cap/cap/{{target}}-{{arch}}/{{current_version}}"
- ],
- "dialog": true,
- "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUyOTAzOTdFNzJFQkRFOTMKUldTVDN1dHlmam1RNHFXb1VYTXlrQk1iMFFkcjN0YitqZlA5WnZNY0ZtQ1dvM1dxK211M3VIYUQK"
- },
+ "updater": { "active": false, "pubkey": "" },
"deep-link": {
"desktop": {
"schemes": ["cap-desktop"]
@@ -44,7 +36,6 @@
"bundle": {
"active": true,
"targets": "all",
- "createUpdaterArtifacts": true,
"icon": [
"icons/32x32.png",
"icons/128x128.png",
diff --git a/apps/desktop/src-tauri/tauri.conf.prod.json b/apps/desktop/src-tauri/tauri.conf.prod.json
deleted file mode 100644
index 9dfde482c..000000000
--- a/apps/desktop/src-tauri/tauri.conf.prod.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "$schema": "https://schema.tauri.app/config/2",
- "productName": "Cap",
- "mainBinaryName": "Cap",
- "identifier": "so.cap.desktop",
- "plugins": {
- "updater": {
- "active": true
- }
- },
- "bundle": {
- "macOS": {
- "entitlements": "Entitlements.plist"
- },
- "windows": {
- "wix": {
- "upgradeCode": "a765d9de-0ecc-55d0-b8a0-61e9d3276664"
- }
- }
- }
-}
diff --git a/apps/desktop/src-tauri/tauri.prod.conf.json b/apps/desktop/src-tauri/tauri.prod.conf.json
new file mode 100644
index 000000000..ef5f58aa8
--- /dev/null
+++ b/apps/desktop/src-tauri/tauri.prod.conf.json
@@ -0,0 +1,30 @@
+{
+ "$schema": "https://schema.tauri.app/config/2",
+ "productName": "Cap",
+ "mainBinaryName": "Cap",
+ "identifier": "so.cap.desktop",
+ "build": {
+ "beforeBundleCommand": "node scripts/prodBeforeBundle.js"
+ },
+ "plugins": {
+ "updater": {
+ "active": true,
+ "endpoints": [
+ "https://cdn.crabnebula.app/update/cap/cap/{{target}}-{{arch}}/{{current_version}}"
+ ],
+ "dialog": true,
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUyOTAzOTdFNzJFQkRFOTMKUldTVDN1dHlmam1RNHFXb1VYTXlrQk1iMFFkcjN0YitqZlA5WnZNY0ZtQ1dvM1dxK211M3VIYUQK"
+ }
+ },
+ "bundle": {
+ "createUpdaterArtifacts": true,
+ "macOS": {
+ "entitlements": "Entitlements.plist"
+ },
+ "windows": {
+ "wix": {
+ "upgradeCode": "a765d9de-0ecc-55d0-b8a0-61e9d3276664"
+ }
+ }
+ }
+}
diff --git a/scripts/setup.js b/scripts/setup.js
index c90a79070..c8286104b 100644
--- a/scripts/setup.js
+++ b/scripts/setup.js
@@ -88,6 +88,7 @@ async function main() {
await fs.mkdir(targetDir, { recursive: true });
+ let downloadedFfmpeg = false;
const ffmpegZip = `ffmpeg-${FFMPEG_VERSION}.zip`;
const ffmpegZipPath = path.join(targetDir, ffmpegZip);
if (!(await fileExists(ffmpegZipPath))) {
@@ -96,11 +97,13 @@ async function main() {
.then((b) => b.arrayBuffer());
await fs.writeFile(ffmpegZipPath, Buffer.from(ffmpegZipBytes));
console.log(`Downloaded ${ffmpegZip}`);
+ downloadedFfmpeg = true;
} else console.log(`Using cached ${ffmpegZip}`);
const ffmpegDir = path.join(targetDir, "ffmpeg");
- if (!(await fileExists(ffmpegDir))) {
- await exec(`tar xf ${ffmpegZip} -C ${targetDir}`);
+ if (!(await fileExists(ffmpegDir)) || downloadedFfmpeg) {
+ await exec(`tar xf ${ffmpegZipPath} -C ${targetDir}`);
+ await fs.rm(ffmpegDir, { recursive: true, force: true }).catch(() => {});
await fs.rename(path.join(targetDir, FFMPEG_ZIP_NAME), ffmpegDir);
console.log("Extracted ffmpeg");
} else console.log("Using cached ffmpeg");
@@ -150,7 +153,7 @@ async function main() {
path.join(__root, ".cargo/config.toml"),
`[env]
FFMPEG_DIR = { relative = true, force = true, value = "target/native-deps" }
-LIBCLANG_PATH = "${libclangPath}"`
+LIBCLANG_PATH = "${libclangPath.replaceAll("\\", "/")}"`
);
}
}