Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/CapSoftware/Cap
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Jan 29, 2025
2 parents f00395c + e29d98f commit 43aa560
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const __root = path.resolve(path.join(__dirname, ".."));
const targetDir = `${__root}/target`;
const targetDir = path.join(__root, "target");

const arch = process.arch === "arm64" ? "aarch64" : "x86_64";

Expand Down Expand Up @@ -72,8 +72,10 @@ async function main() {
} else if (process.platform === "win32") {
const FFMPEG_ZIP_NAME = "ffmpeg-7.1-full_build-shared";
const FFMPEG_ZIP_URL = `https://github.com/GyanD/codexffmpeg/releases/download/7.1/${FFMPEG_ZIP_NAME}.zip`;

await fs.mkdir(targetDir, { recursive: true });

const ffmpegZip = `${targetDir}/ffmpeg.zip`;
const ffmpegZip = `${targetDir}\\ffmpeg.zip`;
if (!(await fileExists(ffmpegZip))) {
const ffmpegZipBytes = await fetch(FFMPEG_ZIP_URL)
.then((r) => r.blob())
Expand All @@ -82,18 +84,19 @@ async function main() {
console.log("Downloaded ffmpeg.zip");
} else console.log("Using cached ffmpeg.zip");

const ffmpegDir = `${targetDir}/ffmpeg`;
const ffmpegDir = `${targetDir}\\ffmpeg`;
if (!(await fileExists(ffmpegDir))) {
await exec(`tar xf ${ffmpegZip} -C ${targetDir}`);
await fs.rename(`${targetDir}/${FFMPEG_ZIP_NAME}`, ffmpegDir);
await fs.rename(`${targetDir}\\${FFMPEG_ZIP_NAME}`, ffmpegDir);
console.log("Extracted ffmpeg");
} else console.log("Using cached ffmpeg");

// alternative to adding ffmpeg/bin to PATH
for (const name of await fs.readdir(`${ffmpegDir}/bin`)) {
await fs.mkdir(`${targetDir}\\debug`, { recursive: true });
for (const name of await fs.readdir(`${ffmpegDir}\\bin`)) {
await fs.copyFile(
`${ffmpegDir}/bin/${name}`,
`${targetDir}/debug/${name}`
`${ffmpegDir}\\bin\\${name}`,
`${targetDir}\\debug\\${name}`
);
}
console.log("Copied ffmpeg dylibs to target/debug");
Expand Down

1 comment on commit 43aa560

@vercel
Copy link

@vercel vercel bot commented on 43aa560 Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.