Add AppImage build on linux
This consists of a meson option that - sets a flag to make Aegisub read paths relative to the executable - makes meson set up the symlinks like AppRun and .DirIcon as following the AppDir format and a CI workflow that builds with this option, installs to an AppDir directory, and bundles it as an AppImage. Modified from arch1t3cht/Aegisub#12 . Co-authored-by: Fred Brennan <copypaste@kittens.ph>
This commit is contained in:
parent
8633e2c4ae
commit
165cb14879
5 changed files with 57 additions and 9 deletions
42
.github/workflows/ci.yml
vendored
42
.github/workflows/ci.yml
vendored
|
@ -49,6 +49,19 @@ jobs:
|
||||||
buildtype: release,
|
buildtype: release,
|
||||||
args: ''
|
args: ''
|
||||||
}
|
}
|
||||||
|
- name: Ubuntu AppImage
|
||||||
|
os: ubuntu-22.04
|
||||||
|
buildtype: release
|
||||||
|
appimage: true
|
||||||
|
# distro ffms is currently broken
|
||||||
|
args: >-
|
||||||
|
--prefix=/usr
|
||||||
|
-Dbuild_appimage=true
|
||||||
|
-Ddefault_library=static
|
||||||
|
--force-fallback-for=ffms2
|
||||||
|
-Davisynth=enabled
|
||||||
|
-Dbestsource=enabled
|
||||||
|
-Dvapoursynth=enabled
|
||||||
- {
|
- {
|
||||||
name: macOS Debug,
|
name: macOS Debug,
|
||||||
os: macos-latest,
|
os: macos-latest,
|
||||||
|
@ -102,13 +115,13 @@ jobs:
|
||||||
brew install pulseaudio # NO OpenAL in github CI
|
brew install pulseaudio # NO OpenAL in github CI
|
||||||
|
|
||||||
- name: Install dependencies (Linux)
|
- name: Install dependencies (Linux)
|
||||||
if: matrix.config.os == 'ubuntu-latest'
|
if: startsWith(matrix.config.os, 'ubuntu-')
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install ninja-build build-essential libx11-dev libwxgtk3.0-gtk3-dev libfreetype6-dev pkg-config libfontconfig1-dev libass-dev libasound2-dev libffms2-dev intltool libboost-all-dev
|
sudo apt-get install ninja-build build-essential libx11-dev libwxgtk3.0-gtk3-dev libfreetype6-dev pkg-config libfontconfig1-dev libass-dev libasound2-dev libffms2-dev intltool libboost-all-dev
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: meson build ${{ matrix.config.args }} -Dbuildtype=${{ matrix.config.buildtype }}
|
run: meson setup build ${{ matrix.config.args }} -Dbuildtype=${{ matrix.config.buildtype }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: meson compile -C build
|
run: meson compile -C build
|
||||||
|
@ -157,3 +170,28 @@ jobs:
|
||||||
name: ${{ matrix.config.name }} - installer
|
name: ${{ matrix.config.name }} - installer
|
||||||
path: build/Aegisub-*.dmg
|
path: build/Aegisub-*.dmg
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
# Linux artifacts (AppImage)
|
||||||
|
- name: Generate AppImage
|
||||||
|
if: matrix.config.appimage
|
||||||
|
run: |
|
||||||
|
mkdir -p appimage/appdir
|
||||||
|
meson install -C build --destdir=../appimage/appdir
|
||||||
|
|
||||||
|
cd appimage
|
||||||
|
sudo apt-get install libfuse2
|
||||||
|
curl -L "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20220822-1/linuxdeploy-x86_64.AppImage" -o linuxdeploy
|
||||||
|
curl -L "https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage" -o appimagetool
|
||||||
|
chmod +x linuxdeploy appimagetool
|
||||||
|
|
||||||
|
./linuxdeploy --appdir appdir --desktop-file=appdir/aegisub.desktop
|
||||||
|
./appimagetool appdir
|
||||||
|
# ./appimagetool -g -s appdir --comp xz
|
||||||
|
|
||||||
|
- name: Upload artifacts - Linux AppImage
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: matrix.config.appimage
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.config.name }}
|
||||||
|
path: appimage/*.AppImage
|
||||||
|
if-no-files-found: error
|
||||||
|
|
|
@ -75,14 +75,13 @@ void Path::FillPlatformSpecificPaths() {
|
||||||
SetToken("?local", home/".aegisub");
|
SetToken("?local", home/".aegisub");
|
||||||
|
|
||||||
#ifdef APPIMAGE_BUILD
|
#ifdef APPIMAGE_BUILD
|
||||||
agi::fs::path data = exe_dir();
|
agi::fs::path exe = exe_dir();
|
||||||
if (data == "") data = home/".aegisub";
|
agi::fs::path data_from_bin = agi::fs::path(P_DATA).lexically_relative(P_BIN);
|
||||||
SetToken("?data", data);
|
SetToken("?data", (exe != "" ? exe/data_from_bin : home/".aegisub").make_preferred());
|
||||||
SetToken("?dictionary", Decode("?data/dictionaries"));
|
|
||||||
#else
|
#else
|
||||||
SetToken("?data", P_DATA);
|
SetToken("?data", P_DATA);
|
||||||
SetToken("?dictionary", "/usr/share/hunspell");
|
|
||||||
#endif
|
#endif
|
||||||
|
SetToken("?dictionary", "/usr/share/hunspell");
|
||||||
|
|
||||||
#else
|
#else
|
||||||
agi::fs::path app_support = agi::util::GetApplicationSupportDirectory();
|
agi::fs::path app_support = agi::util::GetApplicationSupportDirectory();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
project('Aegisub', ['c', 'cpp'],
|
project('Aegisub', ['c', 'cpp'],
|
||||||
license: 'BSD-3-Clause',
|
license: 'BSD-3-Clause',
|
||||||
meson_version: '>=0.57.0',
|
meson_version: '>=0.61.0',
|
||||||
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
|
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
|
||||||
version: '3.2.2')
|
version: '3.2.2')
|
||||||
|
|
||||||
|
@ -57,11 +57,15 @@ if get_option('buildtype') == 'release'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
conf = configuration_data()
|
conf = configuration_data()
|
||||||
|
conf.set_quoted('P_BIN', bindir)
|
||||||
conf.set_quoted('P_DATA', dataroot)
|
conf.set_quoted('P_DATA', dataroot)
|
||||||
conf.set_quoted('P_LOCALE', localedir)
|
conf.set_quoted('P_LOCALE', localedir)
|
||||||
if get_option('credit') != ''
|
if get_option('credit') != ''
|
||||||
conf.set_quoted('BUILD_CREDIT', get_option('credit'))
|
conf.set_quoted('BUILD_CREDIT', get_option('credit'))
|
||||||
endif
|
endif
|
||||||
|
if get_option('build_appimage')
|
||||||
|
conf.set('APPIMAGE_BUILD', 1)
|
||||||
|
endif
|
||||||
conf.set('WITH_UPDATE_CHECKER', get_option('enable_update_checker'))
|
conf.set('WITH_UPDATE_CHECKER', get_option('enable_update_checker'))
|
||||||
|
|
||||||
deps = []
|
deps = []
|
||||||
|
@ -94,7 +98,7 @@ deps += dependency('libass', version: '>=0.9.7',
|
||||||
|
|
||||||
boost_modules = ['chrono', 'filesystem', 'thread', 'locale', 'regex']
|
boost_modules = ['chrono', 'filesystem', 'thread', 'locale', 'regex']
|
||||||
if not get_option('local_boost')
|
if not get_option('local_boost')
|
||||||
boost_dep = dependency('boost', version: '>=1.50.0',
|
boost_dep = dependency('boost', version: '>=1.60.0',
|
||||||
modules: boost_modules + ['system'],
|
modules: boost_modules + ['system'],
|
||||||
required: false,
|
required: false,
|
||||||
static: get_option('default_library') == 'static')
|
static: get_option('default_library') == 'static')
|
||||||
|
|
|
@ -25,3 +25,4 @@ option('update_server', type: 'string', value: 'updates.aegisub.org', descriptio
|
||||||
option('update_url', type: 'string', value: '/trunk', description: 'Base path to use for the update checker')
|
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_osx_bundle', type: 'boolean', value: 'false', description: 'Package Aegisub.app on OSX')
|
||||||
|
option('build_appimage', type: 'boolean', value: 'false', description: 'Prepare for AppImage packaging')
|
||||||
|
|
|
@ -38,4 +38,10 @@ else
|
||||||
install_data('desktop' / dir / 'aegisub.' + ext,
|
install_data('desktop' / dir / 'aegisub.' + ext,
|
||||||
install_dir: datadir / 'icons' / 'hicolor' / dir / 'apps')
|
install_dir: datadir / 'icons' / 'hicolor' / dir / 'apps')
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
if get_option('build_appimage')
|
||||||
|
install_symlink('AppRun', install_dir: '/', pointing_to: bindir.strip('/') / 'aegisub')
|
||||||
|
install_symlink('.DirIcon', install_dir: '/', pointing_to: datadir.strip('/') / 'icons' / 'hicolor' / 'scalable' / 'apps' / 'aegisub.svg')
|
||||||
|
install_symlink('aegisub.desktop', install_dir: '/', pointing_to: datadir.strip('/') / 'applications' / 'aegisub.desktop')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue