diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 1995e7d2..78f002fa 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -78,11 +78,20 @@ jobs: echo "Set version to: $VERSION" - name: Create deployment package + env: + RUSTFLAGS: "-C link-arg=-Wl,-rpath,@executable_path/../lib -C link-arg=-Wl,-rpath,@loader_path/../lib" run: | mkdir -p screenpipe-${{ env.VERSION }}-${{ matrix.target }}/bin mkdir -p screenpipe-${{ env.VERSION }}-${{ matrix.target }}/lib cp target/${{ matrix.target }}/release/screenpipe screenpipe-${{ env.VERSION }}-${{ matrix.target }}/bin/ - cp screenpipe-vision/lib/libscreenpipe.dylib screenpipe-${{ env.VERSION }}-${{ matrix.target }}/lib/ + if [ "${{ matrix.target }}" = "x86_64-apple-darwin" ]; then + cp screenpipe-vision/lib/libscreenpipe_x86_64.dylib screenpipe-${{ env.VERSION }}-${{ matrix.target }}/lib/libscreenpipe_x86_64.dylib + elif [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then + cp screenpipe-vision/lib/libscreenpipe_arm64.dylib screenpipe-${{ env.VERSION }}-${{ matrix.target }}/lib/libscreenpipe_arm64.dylib + else + echo "Unknown target: ${{ matrix.target }}" + exit 1 + fi tar -czf screenpipe-${{ env.VERSION }}-${{ matrix.target }}.tar.gz -C screenpipe-${{ env.VERSION }}-${{ matrix.target }} . - name: Calculate SHA256 diff --git a/Cargo.toml b/Cargo.toml index 1278a6a4..3938e1c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ resolver = "2" [workspace.package] -version = "0.1.53" +version = "0.1.54" authors = ["louis030195 "] description = "" repository = "https://github.com/louis030195/screen-pipe" diff --git a/Formula/screenpipe.rb b/Formula/screenpipe.rb index 42d1a1a6..2d15de3d 100644 --- a/Formula/screenpipe.rb +++ b/Formula/screenpipe.rb @@ -18,7 +18,8 @@ class Screenpipe < Formula depends_on "tesseract" def install - bin.install "screenpipe" + bin.install Dir["bin/*"] + lib.install Dir["lib/*"] end test do diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs index 397dcadb..f8e4921e 100644 --- a/screenpipe-server/src/bin/screenpipe-server.rs +++ b/screenpipe-server/src/bin/screenpipe-server.rs @@ -59,7 +59,13 @@ const DISPLAY: &str = r" "; #[derive(Parser)] -#[command(author, version, about, long_about = None)] +#[command( + author, + version, + about, + long_about = None, + name = "screenpipe" +)] struct Cli { /// FPS for continuous recording /// 1 FPS = 30 GB / month diff --git a/screenpipe-vision/build.rs b/screenpipe-vision/build.rs deleted file mode 100644 index de61af8f..00000000 --- a/screenpipe-vision/build.rs +++ /dev/null @@ -1,17 +0,0 @@ -#[cfg(target_os = "macos")] -fn main() { - println!("cargo:rustc-link-lib=dylib=screenpipe"); - - // Add the library search path - println!("cargo:rustc-link-search=native=screenpipe-vision/lib"); - - // Set the rpath - println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../lib"); - println!("cargo:rustc-link-arg=-Wl,-rpath,@loader_path/../lib"); - - // Ensure the linker uses the correct library name - println!("cargo:rustc-link-arg=-Wl,-install_name,@rpath/libscreenpipe.dylib"); -} - -#[cfg(not(target_os = "macos"))] -fn main() {} diff --git a/screenpipe-vision/src/core.rs b/screenpipe-vision/src/core.rs index a166c61a..be66304a 100644 --- a/screenpipe-vision/src/core.rs +++ b/screenpipe-vision/src/core.rs @@ -3,12 +3,11 @@ use log::{debug, error}; use serde_json; use std::sync::atomic::{AtomicBool, Ordering}; use std::{ - collections::{HashMap, HashSet}, + collections::HashMap, sync::Arc, time::{Duration, Instant}, }; -use strsim::levenshtein; -use tokio::sync::{mpsc::Sender, Mutex}; // Corrected import for Mutex +use tokio::sync::mpsc::Sender; use xcap::{Monitor, Window}; #[cfg(target_os = "macos")] @@ -282,13 +281,7 @@ pub async fn process_ocr_task( }); if save_text_files_flag { - save_text_files( - frame_number, - ¤t_text_json, - ¤t_text_json, - &None, - ) - .await; + save_text_files(frame_number, ¤t_text_json, ¤t_text_json, &None).await; } if let Err(e) = result_tx @@ -315,4 +308,4 @@ pub async fn process_ocr_task( frame_number, _duration ); Ok(()) -} \ No newline at end of file +} diff --git a/screenpipe-vision/src/ocr.swift b/screenpipe-vision/src/ocr.swift index da8e60a8..540090ff 100644 --- a/screenpipe-vision/src/ocr.swift +++ b/screenpipe-vision/src/ocr.swift @@ -2,6 +2,8 @@ import CoreGraphics import Foundation import Vision +// ! TODO long term we should use core_foundation or objc crate to be 100% rust + @_cdecl("perform_ocr") public func performOCR(imageData: UnsafePointer, length: Int, width: Int, height: Int) -> UnsafeMutablePointer? { @@ -82,13 +84,9 @@ public func performOCR(imageData: UnsafePointer, length: Int, width: Int, } // # Compile for x86_64 -// swiftc -emit-library -target x86_64-apple-macosx10.15 -o libscreenpipe_x86_64.dylib screenpipe-vision/src/ocr.swift +// swiftc -emit-library -target x86_64-apple-macosx10.15 -o screenpipe-vision/lib/libscreenpipe_x86_64.dylib screenpipe-vision/src/ocr.swift // # Compile for arm64 (aarch64) -// swiftc -emit-library -target arm64-apple-macosx11.0 -o libscreenpipe_arm64.dylib screenpipe-vision/src/ocr.swift - -// # Combine into a universal binary -// lipo -create libscreenpipe_x86_64.dylib libscreenpipe_arm64.dylib -output screenpipe-vision/lib/libscreenpipe.dylib +// swiftc -emit-library -target arm64-apple-macosx11.0 -o screenpipe-vision/lib/libscreenpipe_arm64.dylib screenpipe-vision/src/ocr.swift -// rm libscreenpipe_x86_64.dylib libscreenpipe_arm64.dylib