diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 86258b6eb..a9a81e6e4 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -20,7 +20,7 @@ jobs: - {name: i686-pc-windows-msvc, os: windows-latest, shell: cmd, arch: x86, cmakeArgs: -G Ninja, buildType: Release} - {name: apple-darwin, os: macos-latest, shell: sh, cmakeArgs: -G Xcode -DAPPLE_BREAKPAD=ON, destDir: osx, buildType: RelWithDebInfo} - {name: apple-ios, os: macos-latest, shell: sh, cmakeArgs: -DCMAKE_SYSTEM_NAME=iOS -G Xcode, destDir: ios, buildType: Release} - - {name: x86_64-pc-linux-gnu, os: ubuntu-latest, shell: sh, cmakeArgs: -G Ninja, buildType: Release} + - {name: x86_64-pc-linux-gnu, os: ubuntu-20.04, shell: sh, cmakeArgs: -G Ninja, destDir: linux, buildType: RelWithDebInfo} - {name: x86_64-pc-windows-msvc, os: windows-latest, shell: cmd, arch: x64, cmakeArgs: -G Ninja, buildType: Release} - {name: x86_64-w64-mingw32, os: windows-latest, shell: 'msys2 {0}', cmakeArgs: -G Ninja, destDir: win, buildType: RelWithDebInfo} - {name: libretro-x86_64-pc-linux-gnu, os: ubuntu-latest, shell: sh, cmakeArgs: -DLIBRETRO=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -G Ninja, buildType: Release} @@ -42,6 +42,7 @@ jobs: - name: Set up build environment (Linux) run: | + sudo add-apt-repository ppa:christianrauch/libdecoration sudo apt-get update sudo apt-get -y install ccache libao-dev libasound2-dev libevdev-dev libgl1-mesa-dev liblua5.3-dev libminiupnpc-dev libpulse-dev libsdl2-dev libudev-dev libzip-dev ninja-build libcurl4-openssl-dev sudo apt-get -y install libwayland-dev libdecor-0-dev libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev @@ -106,6 +107,24 @@ jobs: strip artifact/bin/flycast.exe if: matrix.config.name == 'x86_64-w64-mingw32' + - name: Build breakpad (linux) + working-directory: core/deps/breakpad + run: | + ./configure + make + sudo make install + if: matrix.config.name == 'x86_64-pc-linux-gnu' + + - name: Dump symbols and make AppImage (linux) + run: | + mkdir -p symbols + dump_syms artifact/bin/flycast > symbols/flycast.sym 2>/dev/null + strip artifact/bin/flycast + shell/linux/make-appimage.sh . artifact/bin appimage + mv flycast-x86_64.AppImage artifact/bin + rm artifact/bin/flycast + if: matrix.config.name == 'x86_64-pc-linux-gnu' + - uses: actions/upload-artifact@v3 with: name: flycast-${{ matrix.config.name }} @@ -148,14 +167,14 @@ jobs: project: minidump if: ${{ env.SENTRY_TOKEN != '' }} - - name: Upload symbols to Sentry (Windows, macOS) + - name: Upload symbols to Sentry (Windows, macOS, Linux) run: | VERSION=$(git describe --tags --always) sentry-cli releases new "$VERSION" sentry-cli releases set-commits "$VERSION" --auto - sentry-cli upload-dif symbols + sentry-cli upload-dif symbols shell: bash env: SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }} - if: ${{ env.SENTRY_TOKEN != '' && (matrix.config.name == 'x86_64-w64-mingw32' || matrix.config.name == 'apple-darwin') }} + if: ${{ env.SENTRY_TOKEN != '' && (matrix.config.name == 'x86_64-w64-mingw32' || matrix.config.name == 'apple-darwin' || matrix.config.name == 'x86_64-pc-linux-gnu') }} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f951fb4db..2a776c7dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,7 +356,7 @@ if(NOT LIBRETRO) endif() if(NOT ANDROID AND NOT IOS) - if(NOT APPLE AND NOT LINUX) + if(NOT APPLE AND NOT UNIX) find_package(SDL2) endif() if(NOT SDL2_FOUND) diff --git a/shell/linux/make-appimage.sh b/shell/linux/make-appimage.sh new file mode 100755 index 000000000..805a9bc13 --- /dev/null +++ b/shell/linux/make-appimage.sh @@ -0,0 +1,158 @@ +#!/bin/bash + +if [ "$#" -ne 3 ]; then + echo "Syntax: $0 " + exit 1 +fi + +SHLIBS=( + libcurl-gnutls.so.4 + libz.so.1 + liblua5.3.so.0 + libminiupnpc.so.17 + libGL.so.1 + libgomp.so.1 + libao.so.4 + libpulse.so.0 + libzip.so.5 + libnghttp2.so.14 + libidn2.so.0 + librtmp.so.1 + libssh.so.4 + libpsl.so.5 + libnettle.so.7 + libgnutls.so.30 + libgssapi_krb5.so.2 + libldap_r-2.4.so.2 + liblber-2.4.so.2 + libbrotlidec.so.1 + libGLdispatch.so.0 + libGLX.so.0 + pulseaudio/libpulsecommon-13.99.so + libdbus-1.so.3 + libbz2.so.1.0 + libcrypto.so.1.1 + libunistring.so.2 + libhogweed.so.5 + libgmp.so.10 + libp11-kit.so.0 + libtasn1.so.6 + libkrb5.so.3 + libk5crypto.so.3 + libcom_err.so.2 + libkrb5support.so.0 + libresolv.so.2 + libsasl2.so.2 + libgssapi.so.3 + libbrotlicommon.so.1 + libX11.so.6 + libxcb.so.1 + libsystemd.so.0 + libwrap.so.0 + libsndfile.so.1 + libasyncns.so.0 + libapparmor.so.1 + libffi.so.7 + libkeyutils.so.1 + libheimntlm.so.0 + libkrb5.so.26 + libasn1.so.8 + libhcrypto.so.4 + libroken.so.18 + libXau.so.6 + libXdmcp.so.6 + liblzma.so.5 + liblz4.so.1 + libgcrypt.so.20 + libnsl.so.1 + libFLAC.so.8 + libogg.so.0 + libvorbis.so.0 + libvorbisenc.so.2 + libwind.so.0 + libheimbase.so.1 + libhx509.so.5 + libsqlite3.so.0 + libcrypt.so.1 + libbsd.so.0 +) + +if [ ! -f appimagetool-x86_64.AppImage ]; then + wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage + chmod +x appimagetool-x86_64.AppImage +fi + +SRCDIR=$1 +ARTDIR=$2 +OUTDIR=$3 + +rm -rf "$OUTDIR" +mkdir -p "$OUTDIR/usr/bin" "$OUTDIR/usr/lib" "$OUTDIR/usr/lib/pulseaudio" "$OUTDIR/usr/optional" + +echo "Building checkrt" +mkdir -p "$OUTDIR/tmp" +pushd "$OUTDIR/tmp" +git clone https://github.com/darealshinji/AppImageKit-checkrt +cd AppImageKit-checkrt/src +make +cp -a checkrt ../../../usr/optional +cd ../../.. +rm -rf tmp +popd +if [ ! -f "$OUTDIR/usr/optional/checkrt" ]; then + echo "checkrt build failed" + exit 1 +fi +"$OUTDIR/usr/optional/checkrt" --copy-libraries + +cp -a "$ARTDIR/flycast" "$OUTDIR/usr/bin" +patchelf --set-rpath '$ORIGIN/../lib' "$OUTDIR/usr/bin/flycast" + +echo "Copying system shared libraries" +for lib in "${SHLIBS[@]}"; do + blib=$(basename "$lib") + if [ -f "/lib/x86_64-linux-gnu/$lib" ]; then + cp "/lib/x86_64-linux-gnu/$lib" "$OUTDIR/usr/lib/$blib" + elif [ -f "$CHROOT/usr/lib/x86_64-linux-gnu/$lib" ]; then + cp "$CHROOT/usr/lib/x86_64-linux-gnu/$lib" "$OUTDIR/usr/lib/$blib" + elif [ -f "$CHROOT/lib/$lib" ]; then + cp "$CHROOT/lib/$lib" "$OUTDIR/usr/lib/$blib" + elif [ -f "$CHROOT/usr/lib/$lib" ]; then + cp "$CHROOT/usr/lib/$lib" "$OUTDIR/usr/lib/$blib" + else + echo "*** Failed to find '$blib'" + exit 1 + fi + + strip "$OUTDIR/usr/lib/$blib" +done + +for so in $(find "$OUTDIR/usr/lib" -maxdepth 1); do + if [ -f "$so" ]; then + echo "Patching RPATH in ${so}" + patchelf --set-rpath '$ORIGIN' "$so" + fi +done + +cp -a "$SRCDIR/shell/linux/flycast.desktop" "$SRCDIR/shell/linux/flycast.png" "$OUTDIR" + +echo "Creating AppRun..." +cat > "$OUTDIR/AppRun" << EOF +#!/bin/sh +APPDIR=\$(dirname "\$0") +if [ -x "\$APPDIR/usr/optional/checkrt" ]; then + extra_libs="\$(\$APPDIR/usr/optional/checkrt)" +fi +if [ -n "\$extra_libs" ]; then + export LD_LIBRARY_PATH="\${extra_libs}\${LD_LIBRARY_PATH}" + if [ -e "\$APPDIR/usr/optional/exec.so" ]; then + export LD_PRELOAD="\$APPDIR/usr/optional/exec.so:\${LD_PRELOAD}" + fi +fi +exec "\$APPDIR/usr/bin/flycast" "\$@" +EOF +chmod +x "$OUTDIR/AppRun" + +echo "Generate AppImage" +ARCH=x86_64 ./appimagetool-x86_64.AppImage -v "$OUTDIR" "flycast-x86_64.AppImage" +