diff --git a/.github/workflows/flatpak.yml b/.github/workflows/flatpak.yml new file mode 100644 index 0000000000..b1e3b8aef1 --- /dev/null +++ b/.github/workflows/flatpak.yml @@ -0,0 +1,26 @@ +name: Flatpak build + +on: + release: + types: [published] + push: + branches: ["master"] + pull_request: + workflow_dispatch: + +jobs: + flatpak: + name: "Flatpak build" + runs-on: ubuntu-22.04 + container: + image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08 + options: --privileged + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6.1 + with: + bundle: aegisub.flatpak + manifest-path: org.aegisub.Aegisub.yml + run-tests: false diff --git a/meson.build b/meson.build index 3d1e01b7a4..af8b4e6cfd 100644 --- a/meson.build +++ b/meson.build @@ -50,6 +50,11 @@ else endif docdir = prefix / 'doc' +app_name = 'aegisub' +if get_option('build_flatpak_bundle') + app_name = 'org.aegisub.Aegisub' +endif + # MSVC sets this automatically with -MDd, but it has a different meaning on other platforms if get_option('debug') and host_machine.system() != 'windows' add_project_arguments('-D_DEBUG', language: 'cpp') @@ -69,11 +74,14 @@ if get_option('official_release') conf.set('AEGI_OFFICIAL_RELEASE', 1) endif conf.set('WITH_UPDATE_CHECKER', get_option('enable_update_checker')) +conf.set('FLATPAK_BUILD', get_option('build_flatpak_bundle')) + if get_option('enable_update_checker') conf.set_quoted('UPDATE_CHECKER_SERVER', get_option('update_server')) conf.set_quoted('UPDATE_CHECKER_BASE_URL', get_option('update_url')) endif + deps = [] deps_inc = [] diff --git a/meson_options.txt b/meson_options.txt index 5509d90bda..808dc1395f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -26,3 +26,4 @@ option('update_server', type: 'string', value: 'https://updates.aegisub.org', de option('update_url', type: 'string', value: '/trunk', description: 'Base path to use for the update checker') option('build_osx_bundle', type: 'boolean', value: 'false', description: 'Package Aegisub.app on OSX') +option('build_flatpak_bundle', type: 'boolean', value: false, description: 'enable flatpak bundle build') diff --git a/org.aegisub.Aegisub.yml b/org.aegisub.Aegisub.yml new file mode 100644 index 0000000000..eacc719aad --- /dev/null +++ b/org.aegisub.Aegisub.yml @@ -0,0 +1,159 @@ +app-id: org.aegisub.Aegisub +runtime: org.freedesktop.Platform +runtime-version: "23.08" +sdk: org.freedesktop.Sdk +command: aegisub +modules: + - name: lua5.1 + buildsystem: simple + sources: + - type: archive + url: https://www.lua.org/ftp/lua-5.1.5.tar.gz + sha256: 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 + build-commands: + - sed -i 's/INSTALL_TOP= \/usr\/local/INSTALL_TOP= \/app/g' Makefile + - make linux + - make install + + - name: glu + buildsystem: meson + sources: + - type: archive + url: https://ftp.osuosl.org/pub/blfs/conglomeration/glu/glu-9.0.3.tar.xz + sha256: bd43fe12f374b1192eb15fe20e45ff456b9bc26ab57f0eee919f96ca0f8a330f + + - name: wxWidgets + buildsystem: simple + sources: + - type: archive + url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.3/wxWidgets-3.2.3.tar.bz2 + sha256: c170ab67c7e167387162276aea84e055ee58424486404bba692c401730d1a67a + build-commands: + - mkdir buildgtk + - cd buildgtk && ../configure --prefix=/app --with-opengl --with-gtk --enable-monolithic --enable-unicode --with-regex --enable-image + - cd buildgtk && make + - cd buildgtk && make install + - cd buildgtk && ldconfig + + - name: luarocks + buildsystem: simple + sources: + - type: archive + url: https://luarocks.org/releases/luarocks-3.9.2.tar.gz + sha256: bca6e4ecc02c203e070acdb5f586045d45c078896f6236eb46aa33ccd9b94edb + build-commands: + - ./configure --prefix=/app --with-lua=/app + - make + - make install + + - name: YUtils + buildsystem: simple + sources: + - type: git + url: https://github.com/TypesettingTools/YUtils.git + build-commands: + - mkdir -p /app/share/aegisub/automation/include/ + - cp src/Yutils.lua /app/share/aegisub/automation/include/Yutils.lua + + - name: luajson + buildsystem: simple + sources: + - type: git + url: https://github.com/harningt/luajson.git + build-commands: + - mkdir -p /app/share/aegisub/automation/include/ + - cp -r lua/* /app/share/aegisub/automation/include/ + + - name: ffi-experiments + buildsystem: simple + sources: + - type: git + url: https://github.com/TypesettingTools/ffi-experiments.git + build-commands: + - luarocks install moonscript + - make -B lua + # - luarocks remove moonscript # TODO: remove again, to not end in the final pack, or is it still needed? + - make -B all + - mkdir -p /app/share/aegisub/automation/include/requireffi/ + - cp build/requireffi.lua /app/share/aegisub/automation/include/requireffi/ + - mkdir -p /app/share/aegisub/automation/include/BM/ + - cp build/BadMutex.lua /app/share/aegisub/automation/include/BM/ + - mkdir -p /app/share/aegisub/automation/include/DM/ + - cp build/DownloadManager.lua /app/share/aegisub/automation/include/DM/ + - mkdir -p /app/share/aegisub/automation/include/PT/ + - cp build/PreciseTimer.lua /app/share/aegisub/automation/include/PT/ + - cp build/lib*.so /app/lib/ + build-options: + build-args: + - --share=network + + - name: DependencyControl + buildsystem: simple + sources: + - type: archive + url: https://github.com/TypesettingTools/DependencyControl/archive/refs/tags/v0.6.4-alpha.tar.gz + sha256: b4ba3da034be85d2394d4ec7de4192a76be45f900a60dd484a0d1af3d6671c71 + build-commands: + - mkdir -p /app/share/aegisub/automation/autoload/ + - cp macros/l0.DependencyControl.Toolbox.moon /app/share/aegisub/automation/autoload/ + - mkdir -p /app/share/aegisub/automation/include/l0/ + - cp -r modules/* /app/share/aegisub/automation/include/l0/ + + - name: boost + buildsystem: simple + sources: + - type: archive + url: https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.gz + sha256: c0685b68dd44cc46574cce86c4e17c0f611b15e195be9848dfd0769a0a207628 + build-commands: + - ./bootstrap.sh + - ./b2 --prefix=/app --with-chrono --with-thread --with-locale --with-regex --with-system install variant=release + + # TODO: remove and use meson-pr branch of TypesettingTools/libass + - name: libass + buildsystem: simple + sources: + - type: archive + url: https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.gz + sha256: d653be97198a0543c69111122173c41a99e0b91426f9e17f06a858982c2fb03d + build-commands: + - mkdir build + - cd build && ../configure --prefix=/app --enable-asm + - cd build && make + - cd build && make install + + - name: aegisub + buildsystem: meson + config-opts: + - -Dbuildtype=release + - -Dwx_version=3.2.3 + - -Dcredit=Flatpak build + - -Dbuild_flatpak_bundle=true + build-options: + build-args: + - --share=network + sources: + - type: dir + path: "." + skip: + - .github/ + - .vscode/ + - build + post-install: + - find subprojects/ -iregex ".*\.so" -exec cp {} ${FLATPAK_DEST}/lib/ \; + run-tests: true + +finish-args: + - --socket=x11 + - --socket=wayland + - --socket=pulseaudio + - --share=network + - --device=all + - --device=dri + - --filesystem=~/.aegisub + - --filesystem=~/.fonts + - --filesystem=~/.local/share/fonts + - --filesystem=~/.cache/fontconfig + - --filesystem=host + - --talk-name=org.freedesktop.portal.Background + - --talk-name=org.freedesktop.portal.Notification diff --git a/packages/desktop/aegisub.desktop.template.in b/packages/desktop/aegisub.desktop.template.in index ce73b14170..da5562e3af 100644 --- a/packages/desktop/aegisub.desktop.template.in +++ b/packages/desktop/aegisub.desktop.template.in @@ -6,10 +6,10 @@ GenericName=Subtitle Editor Comment=Create and edit subtitles for film and videos. Exec=@AEGISUB_COMMAND@ %f TryExec=@AEGISUB_COMMAND@ -Icon=aegisub +Icon=@AEGISUB_APP_NAME@ Terminal=false Categories=AudioVideo;AudioVideoEditing;GTK; _Keywords=subtitles;subtitle;captions;captioning;video;audio; MimeType=application/x-srt;text/plain;text/x-ass;text/x-microdvd;text/x-ssa; StartupNotify=true -StartupWMClass=aegisub +StartupWMClass=@AEGISUB_APP_NAME@ diff --git a/packages/meson.build b/packages/meson.build index 70575ed769..2d0646e46f 100644 --- a/packages/meson.build +++ b/packages/meson.build @@ -23,6 +23,7 @@ elif host_machine.system() == 'darwin' command: [build_dmg_sh, meson.project_source_root(), meson.project_build_root(), meson.project_version()]) else conf_pkg.set('AEGISUB_COMMAND', 'aegisub') + conf_pkg.set('AEGISUB_APP_NAME', app_name) desktop_template = configure_file(input: 'desktop/aegisub.desktop.template.in', output: 'aegisub.desktop.template', @@ -30,7 +31,7 @@ else i18n = import('i18n') i18n.merge_file(input: desktop_template, - output: 'aegisub.desktop', + output: app_name + '.desktop', type: 'desktop', po_dir: '../po', install: true, @@ -42,6 +43,7 @@ else dir = s.split('.')[0] ext = s.split('.')[1] install_data('desktop' / dir / 'aegisub.' + ext, - install_dir: datadir / 'icons' / 'hicolor' / dir / 'apps') + install_dir: datadir / 'icons' / 'hicolor' / dir / 'apps', + rename: [app_name + '.' + ext]) endforeach endif