diff --git a/.gitmodules b/.gitmodules index fd84f97..b18e5fe 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,6 @@ [submodule "ext/macos-installer-builder"] path = ext/macos-installer-builder url = https://github.com/KosalaHerath/macos-installer-builder.git +[submodule "flatpak/shared-modules"] + path = flatpak/shared-modules + url = https://github.com/flathub/shared-modules.git diff --git a/flatpak/make_flatpak.sh.in b/flatpak/make_flatpak.sh.in new file mode 100755 index 0000000..7206431 --- /dev/null +++ b/flatpak/make_flatpak.sh.in @@ -0,0 +1,53 @@ +#!@BASH@ +# +# Copyright (C) 2022 Alexandros Theodotou +# +# This file is part of Zrythm +# +# Zrythm is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Zrythm is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Zrythm. If not, see . + +set -xe + +# args: +# 1: output package (.flatpak) path +# 2: .json path +# 3: private dir +# 4: shared modules dir + +out_pkg="$1" +flatpak_json="$2" +private_dir="$3" +shared_modules_dir="$4" + +flatpak_json_filename=`basename "$flatpak_json"` +out_pkg_filename=`basename "$out_pkg"` + +rm -rf "$private_dir" +mkdir -p "$private_dir" + +cp -r "$shared_modules_dir" "$private_dir/shared-modules" +cp "$flatpak_json" "$private_dir/$flatpak_json_filename" + +pushd "$private_dir" + +flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo +flatpak-builder --repo=zrythm --force-clean --install-deps-from=flathub --ccache --user build-dir "$flatpak_json_filename" +flatpak remote-add --user zrythm zrythm --no-gpg-verify +#flatpak install --user zrythm org.zrythm.Zrythm +flatpak build-bundle zrythm "$out_pkg_filename" org.zrythm.Zrythm +#flatpak install "$out_pkg" + +popd + +mv "$private_dir/$out_pkg_filename" "$out_pkg" diff --git a/flatpak/meson.build b/flatpak/meson.build new file mode 100644 index 0000000..8af5610 --- /dev/null +++ b/flatpak/meson.build @@ -0,0 +1,57 @@ +# Copyright (C) 2022 Alexandros Theodotou +# +# This file is part of Zrythm +# +# Zrythm is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Zrythm is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Zrythm. If not, see . + +flatpak_conf = configuration_data () +flatpak_conf.merge_from (global_conf) +#flatpak_conf.set ( + #'BUILT_ZPLUGINS_DIR', zplugins_installation.full_path ()) + +find_program ('flatpak') +find_program ('flatpak-builder') + +make_flatpak_pkg = configure_file ( + output: 'make_flatpak.sh', + input: 'make_flatpak.sh.in', + configuration: flatpak_conf, + ) + +flatpak_json = configure_file ( + output: 'org.zrythm.Zrythm.json', + input: 'org.zrythm.Zrythm.json', + configuration: flatpak_conf, + ) + +flatpak_pkg_filename = run_command ( + get_pkg_filename, 'FLATPAK', dash_trial).stdout ().strip () +flatpak_pkg = custom_target ( + 'flatpak-pkg', + output: flatpak_pkg_filename, + input: [ flatpak_json, ], + command: [ + make_flatpak_pkg, '@OUTPUT@', '@INPUT0@', + '@PRIVATE_DIR@', + meson.current_source_dir () / 'shared-modules', + ], + console: true, + install: true, + install_dir: get_option ('prefix'), + ) + +run_target ( + 'flatpak', + command: [ 'echo', 'done' ], + depends: flatpak_pkg) diff --git a/flatpak/org.zrythm.Zrythm.json b/flatpak/org.zrythm.Zrythm.json new file mode 100644 index 0000000..a700e05 --- /dev/null +++ b/flatpak/org.zrythm.Zrythm.json @@ -0,0 +1,496 @@ +{ + "app-id": "org.zrythm.Zrythm", + "runtime": "org.gnome.Platform", + "runtime-version": "41", + "sdk": "org.gnome.Sdk", + "command": "zrythm_launch", + "rename-icon": "zrythm", + "copy-icon": true, + "finish-args": [ + "--share=ipc", + "--device=dri", + "--socket=x11", + "--share=network", + "--socket=pulseaudio", + "--device=all", + "--filesystem=home", + "--filesystem=xdg-run/pipewire-0", + "--system-talk-name=org.freedesktop.RealtimeKit1" + ], + "add-extensions": { + "org.freedesktop.LinuxAudio.Plugins": { + "directory": "extensions/Plugins", + "version": "21.08", + "add-ld-path": "lib", + "merge-dirs": "ladspa;dssi;lv2;lxvst;vst3", + "subdirectories": true, + "no-autodownload": true + } + }, + "cleanup": [ + "/include", + "/lib/pkgconfig", + "/man", + "/share/doc", + "/share/gtk-doc", + "/share/man", + "/share/pkgconfig", + "*.la", + "*.a" + ], + "modules": [ + { + "name": "vamp-plugin-sdk", + "buildsystem": "simple", + "build-commands": [ + "./configure --prefix=/app", + "make -j 1 host", + "make install" + ], + "sources": [ + { + "type": "archive", + "url": "https://archive.org/download/vamp-plugin-sdk-2.8.0-source/vamp-plugin-sdk-2.8.0.tar.gz", + "sha256": "dcc96ae894795822398789f251c2c7effa602fc60e9dd6c7a5c5d2e7a513526c" + } + ], + "post-install": [ + "install -Dm644 -t /app/share/licenses/vamp-plugin-sdk COPYING" + ], + "cleanup": [ + "/bin", + "/include", + "/lib/pkgconfig" + ] + }, + "shared-modules/linux-audio/lv2.json", + "shared-modules/linux-audio/lilv.json", + "shared-modules/linux-audio/fftw3f.json", + "shared-modules/linux-audio/jack2.json", + "shared-modules/linux-audio/liblo.json", + { + "name": "libatomic_ops", + "buildsystem": "autotools", + "config-opts": [], + "build-options": { + "no-debuginfo": true + }, + "sources": [ + { + "type": "archive", + "url": "https://github.com/ivmai/libatomic_ops/releases/download/v7.6.10/libatomic_ops-7.6.10.tar.gz", + "sha256": "587edf60817f56daf1e1ab38a4b3c729b8e846ff67b4f62a6157183708f099af" + } + ], + "cleanup": [ + "*.a", + "*.la", + "/include", + "/share/info", + "/share/man", + "/share/aclocal", + "/lib/pkgconfig" + ] + }, + { + "name": "bdwgc", + "buildsystem": "autotools", + "config-opts": [], + "build-options": { + "no-debuginfo": true + }, + "sources": [ + { + "type": "git", + "url": "https://github.com/ivmai/bdwgc.git", + "tag": "v7.6.6" + } + ], + "cleanup": [ + "*.a", + "*.la", + "/include", + "/share/info", + "/share/doc", + "/lib/pkgconfig" + ] + }, + { + "name": "guile", + "cleanup": [ + "/bin", + "/lib/libguile-3.0.so.1.2.0-gdb.scm" + ], + "build-options": { + "no-debuginfo": true + }, + "sources": [ + { + "type": "archive", + "url": "https://ftp.gnu.org/gnu/guile/guile-3.0.4.tar.xz", + "sha256": "6b7947dc2e3d115983846a268b8f5753c12fd5547e42fbf2b97d75a3b79f0d31" + } + ] + }, + { + "name": "libaudec", + "buildsystem": "meson", + "build-options": { + "no-debuginfo": true + }, + "sources": [ + { + "type": "git", + "url": "https://git.sr.ht/~alextee/libaudec", + "commit": "46f5aa04316f94bfbfa90d6b3514df54e90f0602" + } + ] + }, + { + "name": "carla", + "buildsystem": "simple", + "build-commands": [ + "make PREFIX=/app -j $FLATPAK_BUILDER_N_JOBS", + "make PREFIX=/app install" + ], + "build-options": { + "arch": { + "aarch64": { + "env": { + "NOOPT": "true" + } + } + }, + "no-debuginfo": true + }, + "sources": [ + { + "type": "archive", + "url": "https://github.com/falkTX/Carla/archive/v2.4.1.tar.gz", + "sha256": "bbb188a672ea8871b11648d36770ba013497d03407ca9c73ed68429016f7536f" + } + ] + }, + { + "name": "xxHash", + "buildsystem": "simple", + "build-commands": [ + "make PREFIX=/app -j $FLATPAK_BUILDER_N_JOBS", + "make PREFIX=/app install" + ], + "build-options": { + "no-debuginfo": true + }, + "sources": [ + { + "type": "git", + "url": "https://github.com/Cyan4973/xxHash/", + "commit": "b1a61dff654af43552b5ee05c737b6fd2a0ee14b" + } + ] + }, + { + "name": "libadwaita", + "buildsystem": "meson", + "build-options": { + "no-debuginfo": true + }, + "config-opts": [ + "-Dintrospection=disabled", + "-Dgtk_doc=false", + "-Dtests=false", + "-Dexamples=false", + "-Dvapi=false" + ], + "sources": [ + { + "type": "git", + "url": "https://gitlab.gnome.org/GNOME/libadwaita.git", + "tag": "1.0.1", + "commit": "b274a0c32c51a92692e3b282f04e88f033ba73b1" + } + ], + "cleanup": [ + "/include", + "/lib/pkgconfig" + ], + "modules": [ + { + "name": "pango", + "buildsystem": "meson", + "build-options": { + "no-debuginfo": true + }, + "config-opts": [ + "-Dtests=false", + "-Dbuild-documentation=false" + ], + "sources": [ + { + "type": "git", + "url": "https://gitlab.gnome.org/GNOME/pango.git", + "tag": "1.50.3", + "commit": "26aadb2508f9022cbfc72e73b558c6791f5d46d9" + } + ], + "cleanup": [ + "/include", + "/bin/pango-*" + ] + }, + { + "name": "libsass", + "buildsystem": "meson", + "build-options": { + "no-debuginfo": true + }, + "cleanup": [ + "*" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/lazka/libsass.git", + "branch": "meson", + "commit": "302397c0c8ae2d7ab02f45ea461c2c3d768f248e" + } + ] + }, + { + "name": "sassc", + "buildsystem": "meson", + "build-options": { + "no-debuginfo": true + }, + "cleanup": [ + "*" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/lazka/sassc.git", + "branch": "meson", + "commit": "82803377c33247265d779af034eceb5949e78354" + } + ] + }, + { + "name": "gtk", + "buildsystem": "meson", + "build-options": { + "no-debuginfo": true + }, + "config-opts": [ + "-Dbuild-documentation=false", + "-Dintrospection=disabled", + "-Dgtk_doc=false", + "-Dtests=false", + "-Dexamples=false", + "-Dvapi=false" + ], + "sources": [ + { + "type": "git", + "url": "https://gitlab.gnome.org/GNOME/gtk.git", + "tag": "4.6.0", + "commit": "70cb61fb7104c76a15bc6494a10e6ff1d470f6d8" + } + ], + "cleanup": [ + "/include", + "/bin/gtk4-*" + ] + }, + { + "name": "gtksourceview", + "buildsystem": "meson", + "build-options": { + "env": { + "LIBRARY_PATH": "/app/lib" + }, + "no-debuginfo": true + }, + "config-opts": [ + "-Dvapi=false", + "-Dintrospection=disabled" + ], + "sources": [ + { + "type": "archive", + "url": "https://download.gnome.org/sources/gtksourceview/5.2/gtksourceview-5.2.0.tar.xz", + "sha256": "c9b34fa02654f56ce22fa08827d89db4ba81631b2e6d7d31ea65d13c729430e9" + } + ] + } + ] + }, + { + "name": "libyaml", + "build-options": { + "no-debuginfo": true + }, + "sources": [ + { + "type": "archive", + "url": "https://pyyaml.org/download/libyaml/yaml-0.2.1.tar.gz", + "sha256": "78281145641a080fb32d6e7a87b9c0664d611dcb4d542e90baf731f51cbb59cd" + } + ] + }, + { + "name": "libcyaml", + "buildsystem": "simple", + "build-options": { + "no-debuginfo": true + }, + "build-commands": [ + "make PREFIX=/app -j $FLATPAK_BUILDER_N_JOBS", + "make PREFIX=/app install" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/tlsa/libcyaml/", + "commit": "499d1e990869455de30a706eb2ee6a2ad60900ab", + "tag": "v1.3.0" + } + ] + }, + { + "name": "backtrace", + "buildsystem": "autotools", + "build-options": { + "env": { + "CFLAGS": "-fPIC" + }, + "no-debuginfo": true + }, + "sources": [ + { + "type": "git", + "url": "https://github.com/ianlancetaylor/libbacktrace", + "commit": "d0f5e95a87a4d3e0a1ed6c069b5dae7cbab3ed2a" + } + ] + }, + { + "name": "rubberband", + "build-options": { + "env": { + "Vamp_CFLAGS": " ", + "Vamp_LIBS": " " + }, + "no-debuginfo": true + }, + "sources": [ + { + "type": "archive", + "url": "http://code.breakfastquay.com/attachments/download/34/rubberband-1.8.1.tar.bz2", + "sha256": "ff0c63b0b5ce41f937a8a3bc560f27918c5fe0b90c6bc1cb70829b86ada82b75" + } + ], + "post-install": [ + "install -Dm644 -t /app/share/licenses/rubberband COPYING" + ], + "cleanup": [ + "/bin", + "/include", + "/share/ladspa", + "*.a", + "*.so" + ] + }, + { + "name": "reproc", + "buildsystem": "cmake-ninja", + "build-options": { + "env": { + "BUILD_SHARED_LIBS": "ON", + "REPROC_WARNINGS": "ON", + "REPROC_WARNINGS_AS_ERRORS": "ON", + "CFLAGS": "-fPIC" + }, + "no-debuginfo": true + }, + "sources": [ + { + "type": "git", + "url": "https://github.com/DaanDeMeyer/reproc", + "commit": "8aea3aef64c37a7ed0db759a7128a80c2540c808", + "tag": "v14.2.4" + } + ] + }, + { + "name": "breeze-icons", + "builddir": true, + "buildsystem": "simple", + "build-options": { + "no-debuginfo": true + }, + "build-commands": [ + "mkdir -p /app/share/icons/breeze-dark", + "cp -r icons-dark/* /app/share/icons/breeze-dark" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/KDE/breeze-icons", + "commit": "c8ca52623d49f77fe32dc1bdb400fa16bc4afb06", + "tag": "v5.90.0" + } + ] + }, + { + "name": "lsp-dsp-lib", + "buildsystem": "simple", + "build-options": { + "no-debuginfo": true + }, + "build-commands": [ + "make PREFIX=/app config", + "make PREFIX=/app -j $FLATPAK_BUILDER_N_JOBS", + "make PREFIX=/app install" + ], + "sources": [ + { + "type": "archive", + "url": "https://github.com/lsp-plugins/lsp-dsp-lib/releases/download/0.5.14/lsp-dsp-lib-0.5.14-src.tar.gz", + "sha256": "781dae54c934bc11c412a7abbea1321e4ea6513ca24327627b8bfbe5fdb49fbd" + } + ] + }, + { + "name": "zrythm", + "builddir": true, + "buildsystem": "meson", + "config-opts": [ + "-Dflatpak=true", + "-Dfallback_version=@ZRYTHM_PKG_SEMVER_VERSION@", + "-Dtrial_ver=@TRIAL_TRUE_FALSE@", + "-Dcheck_updates=true", + "-Dinstaller_ver=true" + ], + "build-options": { + "env": { + "LIBRARY_PATH": "/app/lib" + }, + "no-debuginfo": true + }, + "post-install": [ + "install -d /app/extensions/Plugins" + ], + "sources": [ + { + "type": "git", + "url": "https://git.sr.ht/~alextee/zrythm", + "commit": "@ZRYTHM_GIT_VERSION@", + "x-checker-data": { + "type": "git", + "tag-pattern": "^v(.*[\\d.]+)$" + } + } + ] + } + ] +} diff --git a/flatpak/shared-modules b/flatpak/shared-modules new file mode 160000 index 0000000..6eadfab --- /dev/null +++ b/flatpak/shared-modules @@ -0,0 +1 @@ +Subproject commit 6eadfabfa09fe21969ecf05f24a6c2af73b37ee5 diff --git a/meson.build b/meson.build index 587f688..528ea0d 100644 --- a/meson.build +++ b/meson.build @@ -69,6 +69,7 @@ is_windows_msys = distro.contains ('windows10-msys') is_osx_brew = distro.contains ('osx-brew') is_gnu_linux = distro.contains ('gnu-linux') is_appimage = distro.contains ('appimage') +is_flatpak = distro.contains ('flatpak') meson_src_root = meson.source_root () @@ -231,6 +232,10 @@ if is_appimage subdir ('appimage') endif +if is_flatpak + subdir ('flatpak') +endif + summary ({ 'prefix': prefix, 'libdir': libdir, diff --git a/scripts/get_pkg_filename.sh.in b/scripts/get_pkg_filename.sh.in index ecb3920..54a38da 100755 --- a/scripts/get_pkg_filename.sh.in +++ b/scripts/get_pkg_filename.sh.in @@ -38,6 +38,9 @@ case "$pkg_type" in "APPIMAGE") echo "zrythm${trial}-$zrythm_pkg_ver-x86_64.AppImage" ;; + "FLATPAK") + echo "zrythm${trial}-$zrythm_pkg_ver-x86_64.flatpak" + ;; "GNU_LINUX") echo "zrythm${trial}-$zrythm_pkg_ver-installer.zip" ;; diff --git a/scripts/get_pkg_filename_from_distro.sh.in b/scripts/get_pkg_filename_from_distro.sh.in index 96a5e4e..1aea469 100755 --- a/scripts/get_pkg_filename_from_distro.sh.in +++ b/scripts/get_pkg_filename_from_distro.sh.in @@ -56,6 +56,9 @@ distro_to_pkg_type () { "appimage") echo "APPIMAGE" ;; + "flatpak") + echo "FLATPAK" + ;; esac } pkg_type=$(distro_to_pkg_type $distro)