From 8ec9f17093d1c54ccecadc375d31dc6420f5d053 Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Fri, 5 Jun 2026 22:10:37 -0700 Subject: [PATCH] flatpak: add OpenCV module and rebuild camera-linux from source --- flatpak/com.cypherstack.campfire.yaml | 47 ++++++++++++++++++++- flatpak/com.cypherstack.stackduo.yaml | 47 ++++++++++++++++++++- flatpak/com.cypherstack.stackwallet.yaml | 54 +++++++++++++++++++++++- 3 files changed, 145 insertions(+), 3 deletions(-) diff --git a/flatpak/com.cypherstack.campfire.yaml b/flatpak/com.cypherstack.campfire.yaml index 9f8cd9efc..d9fd37517 100644 --- a/flatpak/com.cypherstack.campfire.yaml +++ b/flatpak/com.cypherstack.campfire.yaml @@ -9,12 +9,39 @@ finish-args: - --share=ipc - --socket=fallback-x11 - --socket=wayland - - --device=dri + - --device=all - --filesystem=~/.campfire - --talk-name=org.freedesktop.secrets - --talk-name=org.freedesktop.Notifications modules: + - name: opencv + buildsystem: cmake-ninja + builddir: true + config-opts: + - -DCMAKE_BUILD_TYPE=Release + - -DBUILD_LIST=core,imgcodecs,imgproc,videoio + - -DBUILD_EXAMPLES=OFF + - -DBUILD_TESTS=OFF + - -DBUILD_PERF_TESTS=OFF + - -DBUILD_DOCS=OFF + - -DBUILD_opencv_python3=OFF + - -DBUILD_opencv_python_bindings_generator=OFF + - -DWITH_GTK=OFF + - -DWITH_QT=OFF + - -DWITH_OPENGL=OFF + - -DWITH_OPENCL=OFF + - -DWITH_CUDA=OFF + - -DWITH_FFMPEG=OFF + - -DWITH_GSTREAMER=OFF + - -DWITH_V4L=ON + - -DWITH_LIBV4L=ON + sources: + - type: git + url: https://github.com/opencv/opencv + tag: '4.10.0' + commit: 71d3237a093b60a27601c20e9ee6c3e52154e8b1 + - name: campfire buildsystem: simple build-commands: @@ -31,3 +58,21 @@ modules: sources: - type: dir path: . + + - name: camera-linux + buildsystem: simple + build-commands: + - cmake -S src -B _build + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_PREFIX_PATH=/app + -DCMAKE_INSTALL_RPATH=/app/lib/campfire/lib:/app/lib + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON + - cmake --build _build --parallel + - install -Dm755 _build/libopencv_wrapper.so + /app/lib/campfire/lib/libopencv_wrapper.so + - install -Dm755 _build/libcamera_linux.so + /app/lib/campfire/lib/libcamera_linux.so + sources: + - type: git + url: https://github.com/cypherstack/camera-linux + commit: ecb412474c5d240347b04ac1eb9f019802ff7034 diff --git a/flatpak/com.cypherstack.stackduo.yaml b/flatpak/com.cypherstack.stackduo.yaml index 195f67457..a007fa351 100644 --- a/flatpak/com.cypherstack.stackduo.yaml +++ b/flatpak/com.cypherstack.stackduo.yaml @@ -9,12 +9,39 @@ finish-args: - --share=ipc - --socket=fallback-x11 - --socket=wayland - - --device=dri + - --device=all - --filesystem=~/.stackduo - --talk-name=org.freedesktop.secrets - --talk-name=org.freedesktop.Notifications modules: + - name: opencv + buildsystem: cmake-ninja + builddir: true + config-opts: + - -DCMAKE_BUILD_TYPE=Release + - -DBUILD_LIST=core,imgcodecs,imgproc,videoio + - -DBUILD_EXAMPLES=OFF + - -DBUILD_TESTS=OFF + - -DBUILD_PERF_TESTS=OFF + - -DBUILD_DOCS=OFF + - -DBUILD_opencv_python3=OFF + - -DBUILD_opencv_python_bindings_generator=OFF + - -DWITH_GTK=OFF + - -DWITH_QT=OFF + - -DWITH_OPENGL=OFF + - -DWITH_OPENCL=OFF + - -DWITH_CUDA=OFF + - -DWITH_FFMPEG=OFF + - -DWITH_GSTREAMER=OFF + - -DWITH_V4L=ON + - -DWITH_LIBV4L=ON + sources: + - type: git + url: https://github.com/opencv/opencv + tag: '4.10.0' + commit: 71d3237a093b60a27601c20e9ee6c3e52154e8b1 + - name: stack_duo buildsystem: simple build-commands: @@ -31,3 +58,21 @@ modules: sources: - type: dir path: . + + - name: camera-linux + buildsystem: simple + build-commands: + - cmake -S src -B _build + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_PREFIX_PATH=/app + -DCMAKE_INSTALL_RPATH=/app/lib/stack_duo/lib:/app/lib + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON + - cmake --build _build --parallel + - install -Dm755 _build/libopencv_wrapper.so + /app/lib/stack_duo/lib/libopencv_wrapper.so + - install -Dm755 _build/libcamera_linux.so + /app/lib/stack_duo/lib/libcamera_linux.so + sources: + - type: git + url: https://github.com/cypherstack/camera-linux + commit: ecb412474c5d240347b04ac1eb9f019802ff7034 diff --git a/flatpak/com.cypherstack.stackwallet.yaml b/flatpak/com.cypherstack.stackwallet.yaml index f8836e6de..0bf77e3ba 100644 --- a/flatpak/com.cypherstack.stackwallet.yaml +++ b/flatpak/com.cypherstack.stackwallet.yaml @@ -9,12 +9,42 @@ finish-args: - --share=ipc - --socket=fallback-x11 - --socket=wayland - - --device=dri + - --device=all - --filesystem=~/.stackwallet - --talk-name=org.freedesktop.secrets - --talk-name=org.freedesktop.Notifications modules: + # Minimal OpenCV build — only the modules needed by camera_linux (VideoCapture + imencode). + # Keeps the Flatpak from pulling in the full 47-module system OpenCV dependency chain. + - name: opencv + buildsystem: cmake-ninja + builddir: true + config-opts: + - -DCMAKE_BUILD_TYPE=Release + - -DBUILD_LIST=core,imgcodecs,imgproc,videoio + - -DBUILD_EXAMPLES=OFF + - -DBUILD_TESTS=OFF + - -DBUILD_PERF_TESTS=OFF + - -DBUILD_DOCS=OFF + - -DBUILD_opencv_python3=OFF + - -DBUILD_opencv_python_bindings_generator=OFF + - -DWITH_GTK=OFF + - -DWITH_QT=OFF + - -DWITH_OPENGL=OFF + - -DWITH_OPENCL=OFF + - -DWITH_CUDA=OFF + - -DWITH_FFMPEG=OFF + - -DWITH_GSTREAMER=OFF + - -DWITH_V4L=ON + - -DWITH_LIBV4L=ON + sources: + - type: git + url: https://github.com/opencv/opencv + tag: '4.10.0' + commit: 71d3237a093b60a27601c20e9ee6c3e52154e8b1 + + # Install the pre-built Flutter bundle. - name: stack_wallet buildsystem: simple build-commands: @@ -34,3 +64,25 @@ modules: sources: - type: dir path: . + + # Rebuild camera_linux and its OpenCV wrapper against the Flatpak-built OpenCV above, + # then overwrite the pre-built CI libs dropped by the stack_wallet module. + # RPATH includes both the app lib dir (for libopencv_wrapper.so) and /app/lib + # (for the OpenCV modules installed by the opencv module above). + - name: camera-linux + buildsystem: simple + build-commands: + - cmake -S src -B _build + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_PREFIX_PATH=/app + -DCMAKE_INSTALL_RPATH=/app/lib/stack_wallet/lib:/app/lib + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON + - cmake --build _build --parallel + - install -Dm755 _build/libopencv_wrapper.so + /app/lib/stack_wallet/lib/libopencv_wrapper.so + - install -Dm755 _build/libcamera_linux.so + /app/lib/stack_wallet/lib/libcamera_linux.so + sources: + - type: git + url: https://github.com/cypherstack/camera-linux + commit: ecb412474c5d240347b04ac1eb9f019802ff7034