Skip to content

Commit

Permalink
Test AppImage build
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Apr 21, 2023
1 parent 26a5f00 commit 1d8e74e
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 40 deletions.
104 changes: 71 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ jobs:
fail-fast: false
matrix:
config:
- name: Windows MSVC Release
os: windows-latest
msvc: true
buildtype: release
args: >-
-Ddefault_library=static
--force-fallback-for=zlib,harfbuzz,freetype2,fribidi,libpng
-Dfreetype2:harfbuzz=disabled
-Dharfbuzz:freetype=disabled
-Dharfbuzz:cairo=disabled
-Dharfbuzz:glib=disabled
-Dharfbuzz:gobject=disabled
-Dharfbuzz:tests=disabled
-Dharfbuzz:docs=disabled
-Dfribidi:tests=false
-Dfribidi:docs=false
-Dlibass:fontconfig=disabled
-Davisynth=enabled
-Dbestsource=enabled
-Dvapoursynth=enabled
#- {
# name: Windows MinGW,
# os: windows-latest,
# msvc: false
#}
# - name: Windows MSVC Release
# os: windows-latest
# msvc: true
# buildtype: release
# args: >-
# -Ddefault_library=static
# --force-fallback-for=zlib,harfbuzz,freetype2,fribidi,libpng
# -Dfreetype2:harfbuzz=disabled
# -Dharfbuzz:freetype=disabled
# -Dharfbuzz:cairo=disabled
# -Dharfbuzz:glib=disabled
# -Dharfbuzz:gobject=disabled
# -Dharfbuzz:tests=disabled
# -Dharfbuzz:docs=disabled
# -Dfribidi:tests=false
# -Dfribidi:docs=false
# -Dlibass:fontconfig=disabled
# -Davisynth=enabled
# -Dbestsource=enabled
# -Dvapoursynth=enabled
# - {
# name: Windows MinGW,
# os: windows-latest,
# msvc: false
# }
- {
name: Ubuntu Debug,
os: ubuntu-latest,
Expand All @@ -57,12 +57,25 @@ jobs:
buildtype: release,
args: ''
}
- {
name: macOS Release,
os: macos-latest,
buildtype: release,
args: -Ddefault_library=static -Dbuild_osx_bundle=true -Dlocal_boost=true --force-fallback-for=ffms2
}
- name: Ubuntu AppImage
os: ubuntu-20.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 Release,
# os: macos-latest,
# buildtype: release,
# args: -Ddefault_library=static -Dbuild_osx_bundle=true -Dlocal_boost=true --force-fallback-for=ffms2
# }

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -104,13 +117,13 @@ jobs:
brew install pulseaudio # NO OpenAL in github CI
- name: Install dependencies (Linux)
if: matrix.config.os == 'ubuntu-latest'
if: startsWith(matrix.config.os, 'ubuntu-')
run: |
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
- 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
run: meson compile -C build
Expand Down Expand Up @@ -159,3 +172,28 @@ jobs:
name: ${{ matrix.config.name }} - installer
path: build/Aegisub-*.dmg
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
9 changes: 4 additions & 5 deletions libaegisub/unix/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,13 @@ void Path::FillPlatformSpecificPaths() {
SetToken("?local", home/".aegisub");

#ifdef APPIMAGE_BUILD
agi::fs::path data = exe_dir();
if (data == "") data = home/".aegisub";
SetToken("?data", data);
SetToken("?dictionary", Decode("?data/dictionaries"));
agi::fs::path exe = exe_dir();
agi::fs::path data_from_bin = agi::fs::path(P_DATA).lexically_relative(P_BIN);
SetToken("?data", (exe != "" ? exe/data_from_bin : home/".aegisub").make_preferred());
#else
SetToken("?data", P_DATA);
SetToken("?dictionary", "/usr/share/hunspell");
#endif
SetToken("?dictionary", "/usr/share/hunspell");

#else
agi::fs::path app_support = agi::util::GetApplicationSupportDirectory();
Expand Down
8 changes: 6 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('Aegisub', ['c', 'cpp'],
license: 'BSD-3-Clause',
meson_version: '>=0.57.0',
meson_version: '>=0.61.0',
default_options: ['cpp_std=c++14', 'buildtype=debugoptimized'],
version: '3.2.2')

Expand Down Expand Up @@ -57,11 +57,15 @@ if get_option('buildtype') == 'release'
endif

conf = configuration_data()
conf.set_quoted('P_BIN', bindir)
conf.set_quoted('P_DATA', dataroot)
conf.set_quoted('P_LOCALE', localedir)
if get_option('credit') != ''
conf.set_quoted('BUILD_CREDIT', get_option('credit'))
endif
if get_option('build_appimage')
conf.set('APPIMAGE_BUILD', 1)
endif
conf.set('WITH_UPDATE_CHECKER', get_option('enable_update_checker'))

deps = []
Expand Down Expand Up @@ -98,7 +102,7 @@ deps += dependency('libass', version: '>=0.9.7',

boost_modules = ['chrono', 'filesystem', 'thread', 'locale', 'regex']
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'],
required: false,
static: get_option('default_library') == 'static')
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,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('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')
6 changes: 6 additions & 0 deletions packages/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ else
install_data('desktop' / dir / 'aegisub.' + ext,
install_dir: datadir / 'icons' / 'hicolor' / dir / 'apps')
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

0 comments on commit 1d8e74e

Please sign in to comment.