Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: revert pre build js

Louis Beaumonte2157f33cb34
diff --git a/screenpipe-app-tauri/scripts/pre_build.js b/screenpipe-app-tauri/scripts/pre_build.js
index 0d7f70f7c..f234d98ad 100644
--- a/screenpipe-app-tauri/scripts/pre_build.js
+++ b/screenpipe-app-tauri/scripts/pre_build.js
@@ -3,10 +3,7 @@ import fs from 'fs/promises'
import os from 'os'
import path from 'path'
-const isDevMode = process.env.SCREENPIPE_APP_DEV === 'true' ||
- process.argv.includes('--dev') ||
- process.env.CARGO_PROFILE_DEV_DEBUG === 'true' ||
- false;
+const isDevMode = process.env.SCREENPIPE_APP_DEV === 'true' || false;
const originalCWD = process.cwd()
// Change CWD to src-tauri
@@ -19,7 +16,6 @@ const platform = {
const cwd = process.cwd()
console.log('cwd', cwd)
-const mkdirp = async (dir) => await fs.mkdir(dir, { recursive: true });
const config = {
ffmpegRealname: 'ffmpeg',
@@ -50,8 +46,8 @@ const config = {
],
},
macos: {
- ffmpegName: 'ffmpeg-7.0-macOS-default',
- ffmpegUrl: 'https://master.dl.sourceforge.net/project/avbuild/macOS/ffmpeg-7.0-macOS-default.tar.xz?viasf=1',
+ ffmpegName: 'ffmpeg-7.1',
+ ffmpegUrl: 'https://evermeet.cx/ffmpeg/ffmpeg-7.1.7z',
},
}
@@ -317,7 +313,6 @@ if (platform == 'windows') {
await $`'C:\\Program Files\\7-Zip\\7z.exe' x ${config.windows.ffmpegName}.7z`
await $`mv ${config.windows.ffmpegName} ${config.ffmpegRealname}`
await $`rm -rf ${config.windows.ffmpegName}.7z`
- // await $`mv ${config.ffmpegRealname}/lib/x64/* ${config.ffmpegRealname}/lib/`
}
// Setup ONNX Runtime
@@ -344,26 +339,6 @@ if (platform == 'windows') {
// Setup vcpkg packages with environment variables set inline
await $`SystemDrive=${process.env.SYSTEMDRIVE} SystemRoot=${process.env.SYSTEMROOT} windir=${process.env.WINDIR} C:\\vcpkg\\vcpkg.exe install ${config.windows.vcpkgPackages}`.quiet()
-
- // Clean up unnecessary files
- const cleanupPaths = [
- 'ffmpeg/doc',
- 'ffmpeg/presets',
- 'ffmpeg/licenses',
- 'ffmpeg/include',
- path.join(onnxRuntimeName, 'docs'),
- path.join(onnxRuntimeName, 'examples'),
- path.join(onnxRuntimeName, 'LICENSE'),
- ];
-
- for (const cleanupPath of cleanupPaths) {
- try {
- await fs.rm(cleanupPath, { recursive: true, force: true });
- console.log(`cleaned up ${cleanupPath}`);
- } catch (error) {
- console.warn(`failed to clean up ${cleanupPath}:`, error.message);
- }
- }
}
async function getMostRecentBinaryPath(targetArch, paths) {
@@ -395,43 +370,11 @@ if (platform == 'macos') {
const architectures = ['arm64', 'x86_64'];
- // Near the top of the file, add target detection
- const getTargetArchs = () => {
- // Check Cargo target
- const cargoTarget = process.env.CARGO_BUILD_TARGET;
- if (cargoTarget) {
- if (cargoTarget.includes('aarch64')) return ['arm64'];
- if (cargoTarget.includes('x86_64')) return ['x86_64'];
- }
-
- // Check if we're doing a universal build
- const isUniversal = process.env.CARGO_BUILD_TARGET === undefined &&
- process.platform === 'darwin';
- if (isUniversal) return ['arm64', 'x86_64'];
-
- // Default to host architecture
- const hostArch = process.arch === 'arm64' ? 'arm64' : 'x86_64';
- console.log(`defaulting to host architecture: ${hostArch}`);
- return [hostArch];
- };
-
- const targetArchs = getTargetArchs();
- console.log('building for architectures:', targetArchs);
-
- await mkdirp(path.join(cwd, '..', 'Frameworks'));
-
for (const arch of architectures) {
- if (!targetArchs.includes(arch)) {
- console.log(`skipping ${arch} (not in target architectures)`);
- continue;
- }
-
if (process.env['SKIP_SCREENPIPE_SETUP']) {
- console.log(`skipping ${arch} setup (SKIP_SCREENPIPE_SETUP=true)`);
- continue;
+ break;
}
-
- console.log(`setting up screenpipe bin for ${arch}...`);
+ console.log(`Setting up screenpipe bin for ${arch}...`);
if (arch === 'arm64') {
const paths = [
@@ -448,58 +391,19 @@ if (platform == 'macos') {
}
try {
- if (await fs.exists('screenpipe-aarch64-apple-darwin')) {
- // Get existing rpaths but suppress detailed output
- const otoolOutput = await $`otool -l ./screenpipe-aarch64-apple-darwin`.quiet();
- const rpathRegex = /LC_RPATH.*?\n.*?path\s+(.*?)\s/gs;
- const existingRpaths = [];
- let match;
- const outputStr = String(otoolOutput);
-
- while ((match = rpathRegex.exec(outputStr)) !== null) {
- existingRpaths.push(match[1]);
- }
-
- // Remove existing rpaths silently
- for (const rpath of existingRpaths) {
- await $`install_name_tool -delete_rpath "${rpath}" ./screenpipe-aarch64-apple-darwin`.quiet();
- }
-
- // Add the rpaths we need
- const rpathsToAdd = [
- '@executable_path/../Frameworks',
- '@loader_path/../Frameworks',
- '@rpath/../Frameworks',
- '@executable_path/screenpipe-vision/lib',
- '@rpath/screenpipe-vision/lib'
- ];
-
- for (const rpath of rpathsToAdd) {
- await $`install_name_tool -add_rpath "${rpath}" ./screenpipe-aarch64-apple-darwin`.quiet();
- }
-
- // Update the dylib reference
- await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_arm64.dylib @rpath/../Frameworks/libscreenpipe_arm64.dylib ./screenpipe-aarch64-apple-darwin`;
-
- // Copy dylib to Frameworks
- const dylib = 'libscreenpipe_arm64.dylib';
- const dyLibSrc = path.join(cwd, 'screenpipe-vision', 'lib', dylib);
- const dyLibDest = path.join(cwd, '..', 'Frameworks', dylib);
-
- if (await fs.exists(dyLibSrc)) {
- await fs.copyFile(dyLibSrc, dyLibDest);
- console.log(`copied ${dylib} to Frameworks directory`);
- } else {
- console.error(`${dylib} not found at ${dyLibSrc}`);
- }
-
- // console.log('verifying final configuration:');
- // await $`otool -L ./screenpipe-aarch64-apple-darwin`;
- // await $`otool -l ./screenpipe-aarch64-apple-darwin | grep -A2 LC_RPATH`;
+ // if the binary exists, hard code the fucking dylib
+ if (await fs.exists('screenpipe-aarch64-apple-darwin') && !isDevMode) {
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_arm64.dylib @rpath/../Frameworks/libscreenpipe_arm64.dylib ./screenpipe-aarch64-apple-darwin`
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe.dylib @rpath/../Frameworks/libscreenpipe.dylib ./screenpipe-aarch64-apple-darwin`
+ console.log(`hard coded the dylib`);
+ } else if (await fs.exists('screenpipe-aarch64-apple-darwin') && isDevMode) {
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_arm64.dylib @executable_path/../Frameworks/libscreenpipe_arm64.dylib ./screenpipe-aarch64-apple-darwin`
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe.dylib @executable_path/../Frameworks/libscreenpipe.dylib ./screenpipe-aarch64-apple-darwin`
+ await $`install_name_tool -add_rpath @executable_path/../Frameworks ./screenpipe-aarch64-apple-darwin`
+ console.log(`Updated dylib paths for arm64 in dev mode`);
}
} catch (error) {
- console.error('error updating dylib paths:', error);
- if (error.stack) console.error(error.stack);
+ console.error('Error updating dylib paths:', error);
}
@@ -515,22 +419,21 @@ if (platform == 'macos') {
if (mostRecentPath) {
await $`cp ${mostRecentPath} screenpipe-x86_64-apple-darwin`;
console.log(`Copied most recent x86_64 screenpipe binary from ${mostRecentPath}`);
+ } else {
+ console.error("No suitable x86_64 screenpipe binary found");
+ }
- try {
- // hard code the dylib
- if (await fs.exists('screenpipe-x86_64-apple-darwin') && !isDevMode) {
- await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_x86_64.dylib @rpath/../Frameworks/libscreenpipe_x86_64.dylib ./screenpipe-x86_64-apple-darwin`;
- await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe.dylib @rpath/../Frameworks/libscreenpipe.dylib ./screenpipe-x86_64-apple-darwin`;
- console.log(`hard coded the dylib`);
- }
- console.log('screenpipe for x86_64 set up successfully.');
- } catch (error) {
- console.error('Error updating dylib paths:', error);
+ try {
+ // hard code the dylib
+ if (await fs.exists('screenpipe-x86_64-apple-darwin') && !isDevMode) {
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe_x86_64.dylib @rpath/../Frameworks/libscreenpipe_x86_64.dylib ./screenpipe-x86_64-apple-darwin`
+ await $`install_name_tool -change screenpipe-vision/lib/libscreenpipe.dylib @rpath/../Frameworks/libscreenpipe.dylib ./screenpipe-x86_64-apple-darwin`
+ console.log(`hard coded the dylib`);
}
- } else {
- console.log("no x86_64 binary found - skipping x86_64 setup");
- // Don't print "set up successfully" if we didn't actually set anything up
+ } catch (error) {
+ console.error('Error updating dylib paths:', error);
}
+
}
console.log(`screenpipe for ${arch} set up successfully.`);
@@ -539,10 +442,10 @@ if (platform == 'macos') {
// Setup FFMPEG
if (!(await fs.exists(config.ffmpegRealname))) {
- await $`wget --no-config -nc ${config.macos.ffmpegUrl} -O ${config.macos.ffmpegName}.tar.xz`
- await $`tar xf ${config.macos.ffmpegName}.tar.xz`
+ await $`wget --no-config -nc ${config.macos.ffmpegUrl} -O ${config.macos.ffmpegName}.7z`
+ await $`7z e ${config.macos.ffmpegName}.7z -o ./${config.macos.ffmpegName}`
await $`mv ${config.macos.ffmpegName} ${config.ffmpegRealname}`
- await $`rm ${config.macos.ffmpegName}.tar.xz`
+ await $`rm ${config.macos.ffmpegName}.7z`
} else {
console.log('FFMPEG already exists');
}
@@ -557,6 +460,7 @@ if (platform == 'macos') {
await fs.copyFile(ffmpegSrc, path.join(cwd, 'ffmpeg-aarch64-apple-darwin'));
console.log('Moved and renamed ffmpeg binary for externalBin');
+
}
@@ -619,20 +523,11 @@ async function installOllamaSidecar() {
throw new Error('Unsupported platform');
}
+
if ((platform === 'macos' && await fs.exists(path.join(ollamaDir, "ollama-aarch64-apple-darwin"))
&& await fs.exists(path.join(ollamaDir, "ollama-x86_64-apple-darwin"))) ||
(platform !== 'macos' && await fs.exists(path.join(ollamaDir, ollamaExe)))) {
console.log('ollama sidecar already exists. skipping installation.');
-
-
- return;
- }
-
- // For our self-hosted runners
- if (platform === 'windows' && await fs.exists('C:\\ollama\\')) {
- console.log('ollama sidecar already exists. skipping installation.');
- await fs.cp('C:\\ollama\\', ollamaDir, { recursive: true });
- await fs.rename(path.join(ollamaDir, 'ollama.exe'), path.join(ollamaDir, ollamaExe));
return;
}
@@ -683,14 +578,7 @@ async function installOllamaSidecar() {
'ggml_cuda_v11.dll',
'rocblas',
'rocblas.dll',
- 'ggml_rocm.dll',
- 'runners/rocm_v6.1',
-
- // just delete cuda files bcs build broken - Nvidia users will have to just their own ollama
- 'cublas64_12.dll',
- 'cublasLt64_12.dll',
- 'cudart64_120.dll',
- 'ggml_cuda_v12.dll',
+ 'ggml_rocm.dll'
];
for (const lib of oldLibs) {
@@ -737,6 +625,4 @@ if (action?.includes('--build' || action.includes('--dev'))) {
}
await $`bun install`
await $`bunx tauri ${action.includes('--dev') ? 'dev' : 'build'}`
-}
-
-
+}
\ No newline at end of file
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index e09df6786..4769ebf55 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.9.29"
+version = "0.10.0"
description = ""
authors = ["you"]
license = ""