diff --git a/.github/workflows/linux-workflow.yml b/.github/workflows/linux-workflow.yml index 1d417a1427..b1f05f37bd 100644 --- a/.github/workflows/linux-workflow.yml +++ b/.github/workflows/linux-workflow.yml @@ -31,33 +31,35 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-20.04 + - os: ubuntu-18.04 platform: x86 compiler: gcc + detail: appimage experimental: false - - os: ubuntu-20.04 + - os: ubuntu-18.04 platform: x64 compiler: gcc + detail: appimage experimental: false - - os: ubuntu-20.04 + - os: ubuntu-18.04 platform: x86 compiler: clang # Need to disable PCH until cmake 3.17 # (PCH conflicts with ccache, fixed by https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4400) cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON - detail: -nopch + detail: nopch experimental: false - - os: ubuntu-20.04 + - os: ubuntu-18.04 platform: x86 compiler: gcc cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON - detail: -nopch + detail: nopch experimental: false - - os: ubuntu-20.04 + - os: ubuntu-18.04 platform: x86 compiler: gcc cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -DARCH_FLAG=-march=haswell - detail: -avx2-nopch + detail: avx2 nopch experimental: false name: "${{ matrix.platform }} | ${{ matrix.compiler }} ${{ matrix.detail }}" @@ -95,22 +97,62 @@ jobs: with: path: .ccache key: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - restore-keys: | - ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache- + restore-keys: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache- + - name: Prepare Artifact Metadata + id: artifact-metadata + shell: bash + run: | + ARCH=$([ "${{ matrix.platform }}" == x86 ] && echo "32bit" || echo "64bit") + ARTIFACT_NAME="" + if [ ${{ github.event_name }} == "pull_request" ]; then + PR_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + ARTIFACT_NAME="PCSX2-${ARCH}" + if [ ! -z "${{ github.event.pull_request.number }}" ]; then + PR_NUM=${{ github.event.pull_request.number }} + ARTIFACT_NAME="${ARTIFACT_NAME}-pr[${PR_NUM}]" + fi + ARTIFACT_NAME="${ARTIFACT_NAME}-sha[${PR_SHA}]" + if [ ! -z "${{ github.event.pull_request.title }}" ]; then + PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr -cd '[a-zA-Z0-9[:space:]]_-') + ARTIFACT_NAME="${ARTIFACT_NAME}-title["${PR_TITLE}"" + fi + else + SHA=$(git rev-parse --short "$GITHUB_SHA") + ARTIFACT_NAME="PCSX2-${ARCH}-sha[${SHA}" + fi + TRIMMED_ARTIFACT_NAME=$(printf "%.199s]" "$ARTIFACT_NAME") + echo "name=$TRIMMED_ARTIFACT_NAME" + echo "##[set-output name=name;]${TRIMMED_ARTIFACT_NAME}" + - name: Install Packages env: PLATFORM: ${{ matrix.platform }} COMPILER: ${{ matrix.compiler }} - run: ./.github/workflows/scripts/linux/install-packages.sh + run: .github/workflows/scripts/linux/install-packages.sh - name: Generate CMake env: PLATFORM: ${{ matrix.platform }} COMPILER: ${{ matrix.compiler }} ADDITIONAL_CMAKE_ARGS: ${{ matrix.cmakeflags }} - run: ./.github/workflows/scripts/linux/generate-cmake.sh + run: .github/workflows/scripts/linux/generate-cmake.sh - name: Build PCSX2 working-directory: ./build run: ../.github/workflows/scripts/linux/compile.sh + + - name: Package AppImage + env: + PLATFORM: ${{ matrix.platform }} + COMPILER: ${{ matrix.compiler }} + name: ${{ steps.artifact-metadata.outputs.name }} + run: .github/workflows/scripts/linux/appimage.sh + if: ${{ matrix.detail == 'appimage' }} + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.artifact-metadata.outputs.name }} + path: artifacts + if: ${{ matrix.detail == 'appimage' }} diff --git a/.github/workflows/scripts/linux/AppRun b/.github/workflows/scripts/linux/AppRun new file mode 100755 index 0000000000..e7f1d2d010 --- /dev/null +++ b/.github/workflows/scripts/linux/AppRun @@ -0,0 +1,15 @@ +#!/bin/bash + +export LD_LIBRARY_PATH="/tmp/PCSX2:$APPDIR/usr/lib:$LD_LIBRARY_PATH" +BINARY_NAME=$(basename "$ARGV0") +if [[ ! -e "$PWD/$BINARY_NAME.config" ]]; then + mkdir "$PWD/$BINARY_NAME.config" +fi +export XDG_CONFIG_HOME="$PWD/$BINARY_NAME.config" + +ln -sf $APPDIR/usr/bin/plugins /tmp/PCSX2 +mkdir -p $HOME/.local/share/icons/hicolor/scalable/apps && cp $APPDIR/PCSX2.png $HOME/.local/share/icons/hicolor/scalable/apps + +$APPDIR/AppRun-patched + +unlink /tmp/PCSX2 diff --git a/.github/workflows/scripts/linux/appimage.sh b/.github/workflows/scripts/linux/appimage.sh new file mode 100755 index 0000000000..429b6fbb07 --- /dev/null +++ b/.github/workflows/scripts/linux/appimage.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -ex + +echo "${PLATFORM}" +if [ "${PLATFORM}" == "x86" ]; then + APPARCH="i686" + ARCH="i386" +else + APPARCH="x86_64" + ARCH="x86_64" +fi +BUILDPATH="$GITHUB_WORKSPACE"/build +BUILDBIN="$BUILDPATH"/pcsx2 +cd /tmp +curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$ARCH.AppImage" +chmod a+x linuxdeploy*.AppImage +./linuxdeploy-"$ARCH".AppImage --appimage-extract +mv /tmp/squashfs-root/usr/bin/patchelf /tmp/squashfs-root/usr/bin/patchelf.orig +sudo cp /usr/local/bin/patchelf /tmp/squashfs-root/usr/bin/patchelf +cd "$GITHUB_WORKSPACE" +mkdir -p squashfs-root/usr/bin +ls -al "$BUILDBIN" +cp -P "$BUILDBIN"/PCSX2 "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/ +patchelf --set-rpath /tmp/PCSX2 "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/PCSX2 +cp ./pcsx2/gui/Resources/AppIcon64.png ./squashfs-root/PCSX2.png +cp ./linux_various/PCSX2.desktop.in ./squashfs-root/PCSX2.desktop +sed -i -e 's|Categories=@PCSX2_MENU_CATEGORIES@|Categories=Game;Emulator;|g' ./squashfs-root/PCSX2.desktop +sed -i -e 's|__GL_THREADED_OPTIMIZATIONS=1|__GL_THREADED_OPTIMIZATIONS=0|g' ./squashfs-root/PCSX2.desktop +curl -sSfL "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-$APPARCH" -o ./squashfs-root/runtime +mkdir -p squashfs-root/usr/share/applications && cp ./squashfs-root/PCSX2.desktop ./squashfs-root/usr/share/applications +mkdir -p squashfs-root/usr/share/icons && cp ./squashfs-root/PCSX2.png ./squashfs-root/usr/share/icons +mkdir -p squashfs-root/usr/share/icons/hicolor/scalable/apps && cp ./squashfs-root/PCSX2.png ./squashfs-root/usr/share/icons/hicolor/scalable/apps +mkdir -p squashfs-root/usr/share/pixmaps && cp ./squashfs-root/PCSX2.png ./squashfs-root/usr/share/pixmaps +mkdir -p squashfs-root/usr/lib/ +cp ./.github/workflows/scripts/linux/AppRun "$GITHUB_WORKSPACE"/squashfs-root/AppRun +curl -sSfL "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-$APPARCH" -o "$GITHUB_WORKSPACE"/squashfs-root/AppRun-patched +chmod a+x ./squashfs-root/AppRun +chmod a+x ./squashfs-root/runtime +chmod a+x ./squashfs-root/AppRun-patched +echo "$name" > "$GITHUB_WORKSPACE"/squashfs-root/version.txt +mkdir -p "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/{plugins,vm} +cp -r "$GITHUB_WORKSPACE"/bin/Langs "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/ +cp "$GITHUB_WORKSPACE"/bin/docs/{Configuration_Guide.pdf,PCSX2_FAQ.pdf} "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins +cp "$GITHUB_WORKSPACE"/bin/cheats_ws.zip "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins +if [[ -e "$BUILDPATH/plugins" ]]; then + find "$BUILDPATH/plugins" -iname '*.so' -exec cp {} "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins \; +fi +cp ./bin/GameIndex.yaml "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins/GameIndex.yaml +export UPD_INFO="gh-releases-zsync|PCSX2|pcsx2|latest|$name.AppImage.zsync" +export OUTPUT="$name.AppImage" +/tmp/squashfs-root/AppRun --appdir="$GITHUB_WORKSPACE"/squashfs-root/ -d "$GITHUB_WORKSPACE"/squashfs-root/PCSX2.desktop -i "$GITHUB_WORKSPACE"/squashfs-root/PCSX2.png --output appimage +mkdir -p "$GITHUB_WORKSPACE"/artifacts/ +ls -al . +mv "$name.AppImage" "$GITHUB_WORKSPACE"/artifacts # && mv "$name.AppImage.zsync" $GITHUB_WORKSPACE/artifacts +chmod -R 777 ./artifacts +cd ./artifacts +ls -al . diff --git a/.github/workflows/scripts/linux/compile.sh b/.github/workflows/scripts/linux/compile.sh index 75b84cc626..c0f8059345 100755 --- a/.github/workflows/scripts/linux/compile.sh +++ b/.github/workflows/scripts/linux/compile.sh @@ -12,6 +12,6 @@ export CCACHE_MAXSIZE="400M" ccache -p ccache -z # Build -make -j4 install +ninja # Save the Cache ccache -s diff --git a/.github/workflows/scripts/linux/generate-cmake.sh b/.github/workflows/scripts/linux/generate-cmake.sh index a8f4cc4f9e..3cf8118267 100755 --- a/.github/workflows/scripts/linux/generate-cmake.sh +++ b/.github/workflows/scripts/linux/generate-cmake.sh @@ -10,17 +10,24 @@ else export CXX=clang++ fi -if [ "${PLATFORM}" = "x86" ]; then - ADDITIONAL_CMAKE_ARGS="$ADDITIONAL_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake" +if [ "${PLATFORM}" = x86 ]; then + ADDITIONAL_CMAKE_ARGS="$ADDITIONAL_CMAKE_ARGS" + TOOLCHAIN="cmake/linux-compiler-i386-multilib.cmake" fi echo "Additional CMake Args - ${ADDITIONAL_CMAKE_ARGS}" # Generate CMake into ./build -cmake \ --D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ --D DISABLE_ADVANCE_SIMD=TRUE \ --D CMAKE_BUILD_TYPE=Release \ --D BUILD_REPLAY_LOADERS=TRUE \ --D CMAKE_BUILD_PO=FALSE \ --D GTK3_API=TRUE ${ADDITIONAL_CMAKE_ARGS} \ +cmake \ +-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ +-DCMAKE_BUILD_TYPE=Release \ +-DPACKAGE_MODE=TRUE \ +-DDISABLE_ADVANCE_SIMD=TRUE \ +-DCMAKE_INSTALL_LIBDIR="/tmp/" \ +-DCMAKE_INSTALL_DATADIR="/tmp/" \ +-DCMAKE_INSTALL_DOCDIR="/tmp/PCSX2" \ +-DOpenGL_GL_PREFERENCE="LEGACY" \ +-DOPENGL_opengl_LIBRARY="" \ +-DXDG_STD=TRUE "${ADDITIONAL_CMAKE_ARGS}" \ +-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \ +-GNinja \ -B build diff --git a/.github/workflows/scripts/linux/install-packages.sh b/.github/workflows/scripts/linux/install-packages.sh index 9a0b08ae0c..a46ee28645 100755 --- a/.github/workflows/scripts/linux/install-packages.sh +++ b/.github/workflows/scripts/linux/install-packages.sh @@ -6,7 +6,8 @@ set -e declare -a BUILD_PACKAGES=( "ccache" "cmake" - "g++-10-multilib" + "g++-8-multilib" + "ninja-build" ) declare -a GCC_PACKAGES=( @@ -18,15 +19,15 @@ declare -a CLANG_PACKAGES=( "clang-tidy" "clang-tools" "clang" - "clangd" + "clangd-10" "libc++-dev" "libc++1" "libc++abi-dev" "libc++abi1" "libclang-dev" "libclang1" - "liblldb-dev" - "libllvm-ocaml-dev" + "liblldb-10-dev" + "libllvm-10-ocaml-dev" "libomp-dev" "libomp5" "lld" @@ -34,50 +35,66 @@ declare -a CLANG_PACKAGES=( "llvm-dev" "llvm-runtime" "llvm" - "python-clang" + "python3-clang-10" ) # Packages - PCSX2 declare -a PCSX2_PACKAGES=( + "curl" + "fuse" + "gettext" "libaio-dev" "libasound2-dev" + "libatk1.0-dev" + "libatk-bridge2.0-dev" + "libbz2-dev" "libcairo2-dev" - "libegl-dev" + "libcggl" + "libdbus-1-dev" "libegl1-mesa-dev" + "libfontconfig1-dev" "libgdk-pixbuf2.0-dev" "libgirepository-1.0-1" "libgl-dev" "libgl1-mesa-dev" "libgl1-mesa-dri" "libgl1" - "libgles-dev" - "libgles-dev" "libgles2-mesa-dev" + "libglew-dev" "libglib2.0-dev" "libglu1-mesa-dev" "libglu1-mesa" "libglvnd-dev" - "libglx-dev" "libglx-mesa0" "libglx0" "libgtk-3-dev" "libgtk2.0-dev" "libharfbuzz-dev" + "libibus-1.0-dev" + "libjack-jackd2-dev" + "libjpeg-dev" "libllvm10" "liblzma-dev" + "liblzma5" "libpango1.0-dev" "libpcap0.8-dev" + "libpng-dev" + "libportaudiocpp0" "libpulse-dev" + "libsdl1.2-dev" "libsdl2-dev" "libsamplerate0-dev" "libsoundtouch-dev" + "libwxgtk3.0-dev" "libwxgtk3.0-gtk3-0v5" "libwxgtk3.0-gtk3-dev" "libx11-xcb-dev" "libxext-dev" "libxft-dev" "libxml2-dev" + "nvidia-cg-toolkit" "portaudio19-dev" + "python" "zlib1g-dev" ) @@ -108,11 +125,11 @@ else fi echo "Will install the following packages for building - ${BUILD_PACKAGE_STR}" -sudo apt remove gcc-9 g++-9 +#sudo apt remove gcc-9 g++-9 sudo apt-get -y install ${BUILD_PACKAGE_STR} -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 -sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 +sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 10 +sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 10 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 @@ -127,3 +144,10 @@ sudo apt-get -y install libgcc-s1:i386 fi echo "Will install the following packages for pcsx2 - ${PCSX2_PACKAGES_STR}" sudo apt-get -y install ${PCSX2_PACKAGES_STR} + +cd /tmp +curl -sSfLO https://github.com/NixOS/patchelf/releases/download/0.12/patchelf-0.12.tar.bz2 +tar xvf patchelf-0.12.tar.bz2 +cd patchelf-0.12*/ +./configure +make && sudo make install