From e350c97b3f4f23f2bdbe794326378d70dee32202 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Tue, 7 Nov 2023 23:42:28 -0800 Subject: [PATCH 1/2] Add files to allow generation of Flatpak packages. --- flatpak/LPCNet-flatpak-support.patch | 17 +++++++ flatpak/README.md | 37 +++++++++++++++ flatpak/org.freedv.freedv.yml | 71 ++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 flatpak/LPCNet-flatpak-support.patch create mode 100644 flatpak/README.md create mode 100644 flatpak/org.freedv.freedv.yml diff --git a/flatpak/LPCNet-flatpak-support.patch b/flatpak/LPCNet-flatpak-support.patch new file mode 100644 index 000000000..19852b954 --- /dev/null +++ b/flatpak/LPCNet-flatpak-support.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1600871..613cb09 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -169,10 +169,10 @@ set(LPCNET_ROOT http://rowetel.com/downloads/deep/) + set(LPCNET_FILE lpcnet_191005_v1.0.tgz) + set(LPCNET_URL ${LPCNET_ROOT}${LPCNET_FILE}) + +-if(EXISTS ${CMAKE_BINARY_DIR}/${LPCNET_FILE}) ++if(EXISTS ${CMAKE_SOURCE_DIR}/${LPCNET_FILE}) + set(lpcnet_SOURCE_DIR ${CMAKE_BINARY_DIR}/src) + file(MAKE_DIRECTORY ${lpcnet_SOURCE_DIR}) +- execute_process(COMMAND tar -xzf ${CMAKE_BINARY_DIR}/${LPCNET_FILE} -C ${CMAKE_BINARY_DIR}/src) ++ execute_process(COMMAND tar -xzf ${CMAKE_SOURCE_DIR}/${LPCNET_FILE} -C ${CMAKE_BINARY_DIR}/src) + + # Work around not having the FetchContent module. + elseif(CMAKE_VERSION VERSION_LESS 3.11.4) diff --git a/flatpak/README.md b/flatpak/README.md new file mode 100644 index 000000000..ac8834c94 --- /dev/null +++ b/flatpak/README.md @@ -0,0 +1,37 @@ +# Flatpak packaging + +This folder contains the files necessary to generate a Flatpak package for FreeDV. Flatpak +is a container-based packaging scheme available on most common Linux distros that enables +the generation of a single package that works on multiple systems with no modifications +required. + +## Setting up a Flatpak build environment + +Execute the following command (Debian/Ubuntu): + +``` +$ git config --global protocol.file.allow always +$ sudo apt install flatpak flatpak-builder gnome-software-plugin-flatpak +$ flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo +$ flatpak install flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 +``` + +On other distros, the packages should be similar. + +## Generating a Flatpak package + +``` +$ flatpak-builder flatpak-build org.freedv.freedv.yml +``` + +## Installing and testing the generated package + +``` +$ flatpak-builder --user --install --force-clean flatpak-build org.freedv.freedv.yml +$ flatpak run org.freedv.freedv +``` + +## Additional notes + +The Flatpak build container has no network access, so any new dependencies added to FreeDV will +need to be downloaded and built as a separate module to ensure that the package can still be built. diff --git a/flatpak/org.freedv.freedv.yml b/flatpak/org.freedv.freedv.yml new file mode 100644 index 000000000..97abf7aed --- /dev/null +++ b/flatpak/org.freedv.freedv.yml @@ -0,0 +1,71 @@ +app-id: org.freedv.freedv +runtime: org.freedesktop.Platform +runtime-version: '23.08' +sdk: org.freedesktop.Sdk +command: freedv +finish-args: + - --share=network + - --socket=wayland + - --share=ipc + - --socket=fallback-x11 + - --socket=pulseaudio + - --filesystem=home +modules: + - name: wxWidgets + buildsystem: cmake + builddir: true + sources: + - type: git + url: https://github.com/wxWidgets/wxWidgets + tag: v3.2.3 + - name: LPCNet + buildsystem: cmake + builddir: true + sources: + - type: git + url: https://github.com/drowe67/LPCNet.git + tag: v0.5 + - type: file + url: http://rowetel.com/downloads/deep/lpcnet_191005_v1.0.tgz + sha256: 509440924751fdd87ffaa5683ee3dddd937af5c833b9104ccce65d51614926c8 + - type: patch + path: LPCNet-flatpak-support.patch + - name: codec2 + buildsystem: cmake + builddir: true + modules: + - LPCNet + sources: + - type: git + url: https://github.com/drowe67/codec2.git + tag: 1.2.0 + config-opts: + - -DLPCNET=ON + - name: hamlib + buildsystem: autotools + sources: + - type: git + url: https://github.com/Hamlib/Hamlib.git + tag: 4.5.5 + - name: socketio-cpp + buildsystem: cmake + sources: + - type: git + url: https://github.com/socketio/socket.io-client-cpp.git + tag: master + config-opts: + - -DBUILD_TESTING=OFF + - name: freedv + buildsystem: cmake + builddir: true + modules: + - wxWidgets + - LPCNet + - codec2 + - hamlib + - socketio-cpp + sources: + - type: git + url: https://github.com/drowe67/freedv-gui.git + tag: v1.9.4 + From 525bd903cdf3720e4cba3433aeee8dee2af35d3b Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Wed, 8 Nov 2023 00:04:16 -0800 Subject: [PATCH 2/2] Grant device access to Flatpak for CAT/PTT control. --- flatpak/org.freedv.freedv.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/flatpak/org.freedv.freedv.yml b/flatpak/org.freedv.freedv.yml index 97abf7aed..0727775c8 100644 --- a/flatpak/org.freedv.freedv.yml +++ b/flatpak/org.freedv.freedv.yml @@ -10,6 +10,7 @@ finish-args: - --socket=fallback-x11 - --socket=pulseaudio - --filesystem=home + - --device=all modules: - name: wxWidgets buildsystem: cmake