Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flatpak build #189

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
bundle: aegisub.flatpak
manifest-path: org.aegisub.Aegisub.yml
run-tests: false
8 changes: 8 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 = []

Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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')
171 changes: 171 additions & 0 deletions org.aegisub.Aegisub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
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

- name: libunibreak
buildsystem: simple
sources:
- type: archive
url: https://github.com/adah1972/libunibreak/releases/download/libunibreak_5_1/libunibreak-5.1.tar.gz
sha256: dd1a92d4c5646aa0e457ff41d89812ec5243863be6c20bbcb5ee380f3dd78377
build-commands:
- mkdir build
- cd build && ../configure --prefix=/app
- cd build && make
- cd build && make install
Totto16 marked this conversation as resolved.
Show resolved Hide resolved

# 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-libunibreak
Totto16 marked this conversation as resolved.
Show resolved Hide resolved
- 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
4 changes: 2 additions & 2 deletions packages/desktop/aegisub.desktop.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
6 changes: 4 additions & 2 deletions packages/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ 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',
configuration: conf_pkg)

i18n = import('i18n')
i18n.merge_file(input: desktop_template,
output: 'aegisub.desktop',
output: app_name + '.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
Expand All @@ -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