diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a80087472..b2cdeef19b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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, @@ -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 @@ -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 @@ -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 diff --git a/libaegisub/unix/path.cpp b/libaegisub/unix/path.cpp index 8fa14cd190..7a2c9a4655 100644 --- a/libaegisub/unix/path.cpp +++ b/libaegisub/unix/path.cpp @@ -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(); diff --git a/meson.build b/meson.build index e948710ac6..514fd3e028 100644 --- a/meson.build +++ b/meson.build @@ -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') @@ -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 = [] @@ -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') diff --git a/meson_options.txt b/meson_options.txt index 5fde15e8a6..ec182fe08f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/packages/meson.build b/packages/meson.build index 1e13be54ac..db933b5e36 100644 --- a/packages/meson.build +++ b/packages/meson.build @@ -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