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: distribution

Louis Beaumont35787e7122f8
diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml
index c1e4aef9c..2a6c81b99 100644
--- a/.github/workflows/release-cli.yml
+++ b/.github/workflows/release-cli.yml
@@ -77,8 +77,11 @@ jobs:
- name: Create deployment package
run: |
- ls -R target/
- tar -czf screenpipe-${{ env.VERSION }}-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release screenpipe
+ 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 target/${{ matrix.target }}/release/libscreenpipe.dylib screenpipe-${{ env.VERSION }}-${{ matrix.target }}/lib/
+ tar -czf screenpipe-${{ env.VERSION }}-${{ matrix.target }}.tar.gz -C screenpipe-${{ env.VERSION }}-${{ matrix.target }} .
- name: Calculate SHA256
run: |
diff --git a/Formula/screenpipe.rb b/Formula/screenpipe.rb
index 04ae26788..229251044 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 "screenpipe"
+ lib.install "libscreenpipe.dylib"
end
test do
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
index 78d6e91fe..9a645845a 100644
--- a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
@@ -9,7 +9,8 @@
"ffmpeg/lib/libavutil.59.dylib",
"ffmpeg/lib/libffmpeg.7.dylib",
"ffmpeg/lib/libswresample.5.dylib",
- "ffmpeg/lib/libswscale.8.dylib"
+ "ffmpeg/lib/libswscale.8.dylib",
+ "../../../../screenpipe-vision/lib/libscreenpipe.dylib"
],
"entitlements": "entitlements.plist",
"signingIdentity": "-",
diff --git a/screenpipe-vision/build.rs b/screenpipe-vision/build.rs
index e9085f4df..2a14c61fd 100644
--- a/screenpipe-vision/build.rs
+++ b/screenpipe-vision/build.rs
@@ -1,7 +1,18 @@
+use std::env;
+
#[cfg(target_os = "macos")]
fn main() {
- println!("cargo:rustc-link-search=native=screenpipe-vision/lib");
- println!("cargo:rustc-link-lib=dylib=ocr");
+ let destination = env::var("DESTINATION").unwrap_or_default();
+
+ if destination == "brew" {
+ println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../lib");
+ } else if destination == "tauri" {
+ println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../Frameworks");
+ } else {
+ println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path/../../screenpipe-vision/lib");
+ }
+
+ println!("cargo:rustc-link-lib=dylib=screenpipe");
}
#[cfg(not(target_os = "macos"))]
diff --git a/screenpipe-vision/src/apple.rs b/screenpipe-vision/src/apple.rs
index 77018e11f..101c97808 100644
--- a/screenpipe-vision/src/apple.rs
+++ b/screenpipe-vision/src/apple.rs
@@ -2,7 +2,7 @@ use image::DynamicImage;
use std::ffi::CStr;
use std::os::raw::{c_char, c_uchar};
-#[link(name = "ocr")]
+#[link(name = "screenpipe")]
extern "C" {
fn perform_ocr(
image_data: *const c_uchar,
diff --git a/screenpipe-vision/src/ocr.swift b/screenpipe-vision/src/ocr.swift
index 0e2b3bc8f..d7cdf83d0 100644
--- a/screenpipe-vision/src/ocr.swift
+++ b/screenpipe-vision/src/ocr.swift
@@ -6,12 +6,12 @@ import Vision
public func performOCR(imageData: UnsafePointer<UInt8>, length: Int, width: Int, height: Int)
-> UnsafeMutablePointer<CChar>? {
- print("Attempting to create image from raw data")
- print("Image dimensions: \(width)x\(height)")
+ // print("Attempting to create image from raw data")
+ // print("Image dimensions: \(width)x\(height)")
guard let dataProvider = CGDataProvider(data: Data(bytes: imageData, count: length) as CFData)
else {
- print("Failed to create CGDataProvider.")
+ // print("Failed to create CGDataProvider.")
return strdup("Error: Failed to create CGDataProvider")
}
@@ -30,11 +30,11 @@ public func performOCR(imageData: UnsafePointer<UInt8>, length: Int, width: Int,
intent: .defaultIntent
)
else {
- print("Failed to create CGImage.")
+ // print("Failed to create CGImage.")
return strdup("Error: Failed to create CGImage")
}
- print("CGImage created successfully.")
+ // print("CGImage created successfully.")
let semaphore = DispatchSemaphore(value: 0)
var ocrResult = ""
@@ -43,22 +43,22 @@ public func performOCR(imageData: UnsafePointer<UInt8>, length: Int, width: Int,
defer { semaphore.signal() }
if let error = error {
- print("Error in text recognition request: \(error)")
+ // print("Error in text recognition request: \(error)")
ocrResult = "Error: \(error.localizedDescription)"
return
}
guard let observations = request.results as? [VNRecognizedTextObservation] else {
- print("Failed to process image or no text found.")
+ // print("Failed to process image or no text found.")
ocrResult = "Error: Failed to process image or no text found"
return
}
- print("Number of text observations: \(observations.count)")
+ // print("Number of text observations: \(observations.count)")
- for (index, observation) in observations.enumerated() {
+ for (_, observation) in observations.enumerated() {
guard let topCandidate = observation.topCandidates(1).first else {
- print("No top candidate for observation \(index)")
+ // print("No top candidate for observation \(index)")
continue
}
ocrResult += "\(topCandidate.string)\n"
@@ -69,10 +69,10 @@ public func performOCR(imageData: UnsafePointer<UInt8>, length: Int, width: Int,
let handler = VNImageRequestHandler(cgImage: cgImage, options: [:])
do {
- print("Performing OCR...")
+ // print("Performing OCR...")
try handler.perform([request])
} catch {
- print("Failed to perform OCR: \(error)")
+ // print("Failed to perform OCR: \(error)")
return strdup("Error: Failed to perform OCR - \(error.localizedDescription)")
}
@@ -81,6 +81,7 @@ public func performOCR(imageData: UnsafePointer<UInt8>, length: Int, width: Int,
return strdup(ocrResult.isEmpty ? "No text found" : ocrResult)
}
-// swiftc -emit-library -o screenpipe-vision/lib/libocr.dylib screenpipe-vision/src/ocr.swift
+// swiftc -emit-library -o screenpipe-vision/lib/libscreenpipe.dylib screenpipe-vision/src/ocr.swift
+
// or
-// swiftc -emit-library -o /usr/local/lib/libocr.dylib screenpipe-vision/src/ocr.swift
+// swiftc -emit-library -o /usr/local/lib/libscreenpipe.dylib screenpipe-vision/src/ocr.swift