From 0b7b8a40e29eb4a07662ca4f520fd3ce240014d0 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 11 May 2019 15:36:54 +0000 Subject: [PATCH] Linux: add Flatpak integration. To test it, use: $ ./pkg/flatpak/build.sh $ flatpak install ./pkg/flatpak/solvespace.flatpak $ flatpak run com.solvespace.SolveSpace --- pkg/flatpak/.gitignore | 4 + pkg/flatpak/build.sh | 4 + pkg/flatpak/com.solvespace.SolveSpace.json | 141 ++++++++++++++++++ res/CMakeLists.txt | 61 +++++--- res/freedesktop/solvespace-flatpak-mime.xml | 8 + res/freedesktop/solvespace-flatpak.desktop.in | 10 ++ ...olvespace-slvs.xml => solvespace-mime.xml} | 0 7 files changed, 209 insertions(+), 19 deletions(-) create mode 100644 pkg/flatpak/.gitignore create mode 100755 pkg/flatpak/build.sh create mode 100644 pkg/flatpak/com.solvespace.SolveSpace.json create mode 100644 res/freedesktop/solvespace-flatpak-mime.xml create mode 100644 res/freedesktop/solvespace-flatpak.desktop.in rename res/freedesktop/{solvespace-slvs.xml => solvespace-mime.xml} (100%) diff --git a/pkg/flatpak/.gitignore b/pkg/flatpak/.gitignore new file mode 100644 index 00000000..ca1b1d7c --- /dev/null +++ b/pkg/flatpak/.gitignore @@ -0,0 +1,4 @@ +/.flatpak-builder +/build-dir +/repo +*.flatpak diff --git a/pkg/flatpak/build.sh b/pkg/flatpak/build.sh new file mode 100755 index 00000000..a65961fa --- /dev/null +++ b/pkg/flatpak/build.sh @@ -0,0 +1,4 @@ +#!/bin/sh -ex +cd $(dirname $0) +flatpak-builder "$@" --force-clean --repo repo build-dir com.solvespace.SolveSpace.json +flatpak build-bundle repo solvespace.flatpak com.solvespace.SolveSpace diff --git a/pkg/flatpak/com.solvespace.SolveSpace.json b/pkg/flatpak/com.solvespace.SolveSpace.json new file mode 100644 index 00000000..8c4ce513 --- /dev/null +++ b/pkg/flatpak/com.solvespace.SolveSpace.json @@ -0,0 +1,141 @@ +{ + "app-id": "com.solvespace.SolveSpace", + "runtime": "org.gnome.Platform", + "runtime-version": "3.30", + "sdk": "org.gnome.Sdk", + "finish-args": [ + /* Access to display server and OpenGL */ + "--share=ipc", "--socket=fallback-x11", "--socket=wayland", "--device=dri", + /* Access to save files */ + "--filesystem=home" + ], + "cleanup": [ + "/include", "/lib/*/include", + "*.a", "*.la", "*.m4", "/lib/libslvs*.so*", "/lib/libglibmm_generate_extra_defs*.so*", + "/share/pkgconfig", "*.pc", + "/share/man", "/share/doc", + "/share/aclocal", + /* mm-common junk */ + "/bin/mm-common-prepare", + "/share/mm-common" + ], + "command": "solvespace", + "modules": [ + { + "name": "mm-common", + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/mm-common/0.9/mm-common-0.9.12.tar.xz", + "sha256": "ceffdcce1e5b52742884c233ec604bf6fded12eea9da077ce7a62c02c87e7c0b" + } + ] + }, + { + "name": "sigc++", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.10/libsigc++-2.10.1.tar.xz", + "sha256": "c9a25f26178c6cbb147f9904d8c533b5a5c5111a41ac2eb781eb734eea446003" + } + ] + }, + { + "name": "glibmm", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.58/glibmm-2.58.1.tar.xz", + "sha256": "6e5fe03bdf1e220eeffd543e017fd2fb15bcec9235f0ffd50674aff9362a85f0" + } + ] + }, + { + "name": "cairomm", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/cairomm/1.12/cairomm-1.12.0.tar.xz", + "sha256": "a54ada8394a86182525c0762e6f50db6b9212a2109280d13ec6a0b29bfd1afe6" + } + ] + }, + { + "name": "pangomm", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/pangomm/2.40/pangomm-2.40.2.tar.xz", + "sha256": "0a97aa72513db9088ca3034af923484108746dba146e98ed76842cf858322d05" + } + ] + }, + { + "name": "atkmm", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/atkmm/2.28/atkmm-2.28.0.tar.xz", + "sha256": "4c4cfc917fd42d3879ce997b463428d6982affa0fb660cafcc0bc2d9afcedd3a" + } + ] + }, + { + "name": "gtkmm", + "config-opts": [ + "--disable-documentation" + ], + "sources": [ + { + "type": "archive", + "url": "http://ftp.gnome.org/pub/GNOME/sources/gtkmm/3.24/gtkmm-3.24.1.tar.xz", + "sha256": "ddfe42ed2458a20a34de252854bcf4b52d3f0c671c045f56b42aa27c7542d2fd" + } + ] + }, + { + "name": "libjson-c", + "sources": [ + { + "type": "archive", + "url": "https://s3.amazonaws.com/json-c_releases/releases/json-c-0.13.1-nodoc.tar.gz", + "sha256": "94a26340c0785fcff4f46ff38609cf84ebcd670df0c8efd75d039cc951d80132" + } + ], + "buildsystem": "cmake", + "builddir": true + }, + { + "name": "SolveSpace", + "sources": [ + { + "type": "git", + "path": "/home/whitequark/Projects/solvespace" + } + ], + "buildsystem": "cmake", + "builddir": true, + "config-opts": [ + "-DFLATPAK=ON", + "-DENABLE_CLI=OFF", + "-DENABLE_TESTS=OFF" + ] + } + ] +} diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt index 0b51b47e..b9f2e250 100644 --- a/res/CMakeLists.txt +++ b/res/CMakeLists.txt @@ -126,28 +126,51 @@ elseif(APPLE) else() add_resource(freedesktop/solvespace-48x48.png) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace.desktop.in - ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace.desktop) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace.desktop - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) + if(FLATPAK) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace-flatpak.desktop.in + ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace-flatpak.desktop) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace-flatpak.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications + RENAME com.solvespace.SolveSpace.desktop) - install(FILES freedesktop/solvespace-slvs.xml - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages) + install(FILES freedesktop/solvespace-flatpak-mime.xml + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages + RENAME com.solvespace.SolveSpace-slvs.xml) - foreach(SIZE 16x16 24x24 32x32 48x48) - install(FILES freedesktop/solvespace-${SIZE}.png - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/apps - RENAME solvespace.png) - install(FILES freedesktop/solvespace-${SIZE}.png - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/mimetypes - RENAME application.x-solvespace.png) - endforeach() + foreach(SIZE 16x16 24x24 32x32 48x48) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/apps + RENAME com.solvespace.SolveSpace.png) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/mimetypes + RENAME com.solvespace.SolveSpace.png) + endforeach() + else() + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace.desktop.in + ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace.desktop) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freedesktop/solvespace.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications) - foreach(SIZE 16x16 24x24 32x32 48x48) - install(FILES freedesktop/solvespace-${SIZE}.xpm - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps) - endforeach() + install(FILES freedesktop/solvespace-mime.xml + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages + RENAME solvespace-slvs.xml) + + foreach(SIZE 16x16 24x24 32x32 48x48) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/apps + RENAME solvespace.png) + install(FILES freedesktop/solvespace-${SIZE}.png + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/mimetypes + RENAME application.x-solvespace.png) + endforeach() + + foreach(SIZE 16x16 24x24 32x32 48x48) + install(FILES freedesktop/solvespace-${SIZE}.xpm + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps) + endforeach() + endif() endif() add_resources( diff --git a/res/freedesktop/solvespace-flatpak-mime.xml b/res/freedesktop/solvespace-flatpak-mime.xml new file mode 100644 index 00000000..760799dd --- /dev/null +++ b/res/freedesktop/solvespace-flatpak-mime.xml @@ -0,0 +1,8 @@ + + + + SolveSpace model + + + + diff --git a/res/freedesktop/solvespace-flatpak.desktop.in b/res/freedesktop/solvespace-flatpak.desktop.in new file mode 100644 index 00000000..b16ccf44 --- /dev/null +++ b/res/freedesktop/solvespace-flatpak.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=SolveSpace +Comment=A parametric 2d/3d CAD +Exec=${CMAKE_INSTALL_FULL_BINDIR}/solvespace +MimeType=application/x-solvespace +Icon=com.solvespace.SolveSpace +Type=Application +Categories=Graphics +Keywords=parametric;cad;2d;3d; diff --git a/res/freedesktop/solvespace-slvs.xml b/res/freedesktop/solvespace-mime.xml similarity index 100% rename from res/freedesktop/solvespace-slvs.xml rename to res/freedesktop/solvespace-mime.xml