fix AppImage issue with finding tcl #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Build | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Setup MSVC | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Build Tcl library | |
| shell: cmd | |
| run: | | |
| mkdir tcltk | |
| cd tcltk | |
| git clone --depth=1 --branch core-8-6-branch https://github.com/tcltk/tcl.git | |
| cd tcl\win | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
| nmake -f makefile.vc release OPTS=nomsvcrt INSTALLDIR=%GITHUB_WORKSPACE%\tcldir | |
| nmake -f makefile.vc install OPTS=nomsvcrt INSTALLDIR=%GITHUB_WORKSPACE%\tcldir | |
| - name: Build Tk library | |
| shell: cmd | |
| run: | | |
| cd tcltk | |
| git clone --depth=1 --branch core-8-6-branch https://github.com/tcltk/tk.git | |
| cd tk\win | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
| nmake -f makefile.vc release OPTS=nomsvcrt INSTALLDIR=%GITHUB_WORKSPACE%\tcldir | |
| nmake -f makefile.vc install OPTS=nomsvcrt INSTALLDIR=%GITHUB_WORKSPACE%\tcldir | |
| - name: Configure CMake | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install -DTCL_INCLUDE_PATH=${{ github.workspace }}\tcldir\include ${{ github.workspace }} -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DWITH_MD_LIBRARY=OFF | |
| - name: Build ScidCommunity | |
| run: | | |
| cd build | |
| cmake --build . --config Release --target INSTALL | |
| - name: Build Stockfish | |
| shell: cmd | |
| run: | | |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
| git clone --depth=1 --branch sf_17 https://github.com/official-stockfish/Stockfish.git stockfish | |
| cd stockfish\src | |
| cl /std:c++20 /DNDEBUG /DUSE_POPCNT /DUSE_AVX2 /DUSE_SSE41 /DUSE_SSSE3 /DUSE_SSE2 /GS- /MT /O2 /Oi /Ot /Oy /GL /EHsc *.cpp nnue/*.cpp nnue/features/*.cpp syzygy/*.cpp /link /LTCG /STACK:reserve=8388608 /OUT:stockfish.exe advapi32.lib | |
| copy stockfish.exe %GITHUB_WORKSPACE%\install\bin | |
| - name: Download Stockfish NNUE | |
| shell: bash | |
| run: | | |
| networks=$(grep -Eo "nn-[a-z0-9]+.nnue" stockfish/src/evaluate.h) | |
| for nnue in $networks; do | |
| echo "Downloading $nnue" | |
| curl -o install/bin/$nnue https://data.stockfishchess.org/nn/$nnue | |
| done | |
| - name: Package for distribution | |
| shell: cmd | |
| run: | | |
| cd install | |
| move bin engines | |
| copy %GITHUB_WORKSPACE%\tcldir\bin\*.dll bin | |
| xcopy /e %GITHUB_WORKSPACE%\tcldir\lib\tcl8 lib\tcl8\ | |
| xcopy /e %GITHUB_WORKSPACE%\tcldir\lib\tcl8.6 lib\tcl8.6\ | |
| xcopy /e %GITHUB_WORKSPACE%\tcldir\lib\tk8.6 lib\tk8.6\ | |
| - name: Create Windows ZIP | |
| run: | | |
| cd install | |
| Compress-Archive -Path * -DestinationPath ${{ github.workspace }}/scidCommunity-windows-x64.zip | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scidCommunity-windows-x64 | |
| path: scidCommunity-windows-x64.zip | |
| build-linux-deb: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| else | |
| VERSION="5.1.1" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Export version to env | |
| run: | | |
| echo "SCIDCOMMUNITY_VERSION=${{ steps.get_version.outputs.version }}" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install tcl-dev tk-dev cmake build-essential | |
| - name: Configure and build | |
| run: | | |
| mkdir build && cd build | |
| cmake -DCPACK_GENERATOR=DEB \ | |
| -DCPACK_PACKAGE_NAME=scidcommunity \ | |
| -DCPACK_PACKAGE_VERSION=${{ steps.get_version.outputs.version }} \ | |
| -DCPACK_DEBIAN_PACKAGE_MAINTAINER="Hugh Whelan" \ | |
| -DCPACK_DEBIAN_PACKAGE_DEPENDS="tk8.6, libtcl8.6, libtk8.6" \ | |
| -DCPACK_DEBIAN_PACKAGE_LICENSE=GPL2 \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \ | |
| ${{ github.workspace }} | |
| make package | |
| - name: Upload DEB artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scidCommunity-ubuntu-deb | |
| path: build/*.deb | |
| build-linux-rpm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| else | |
| VERSION="5.1.0" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Export version to env | |
| run: | | |
| echo "SCIDCOMMUNITY_VERSION=${{ steps.get_version.outputs.version }}" >> $GITHUB_ENV | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install cmake build-essential rpm \ | |
| tcl8.6-dev tk8.6-dev libtcl8.6 libtk8.6 | |
| - name: Configure and build ScidCommunity | |
| run: | | |
| mkdir build && cd build | |
| cmake -DCPACK_GENERATOR=RPM \ | |
| -DCPACK_PACKAGE_NAME=scidcommunity \ | |
| -DCPACK_PACKAGE_VERSION=${{ steps.get_version.outputs.version }} \ | |
| -DCPACK_RPM_PACKAGE_LICENSE=GPL2 \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \ | |
| -DCMAKE_INSTALL_PREFIX=/opt/scidcommunity \ | |
| -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib \ | |
| ${{ github.workspace }} | |
| make -j$(nproc) | |
| make install DESTDIR=${{ github.workspace }}/rpm-root | |
| - name: Bundle Tcl/Tk 8.6 libraries with installation | |
| run: | | |
| mkdir -p ${{ github.workspace }}/rpm-root/opt/scidcommunity/lib | |
| # Copy Tcl/Tk 8.6 shared libraries | |
| cp -a /usr/lib/x86_64-linux-gnu/libtcl8.6.so* ${{ github.workspace }}/rpm-root/opt/scidcommunity/lib/ | |
| cp -a /usr/lib/x86_64-linux-gnu/libtk8.6.so* ${{ github.workspace }}/rpm-root/opt/scidcommunity/lib/ | |
| # Copy Tcl/Tk script directories (including tcl8 subdirectory with modules) | |
| cp -rL /usr/share/tcltk/tcl8.6 ${{ github.workspace }}/rpm-root/opt/scidcommunity/lib/ | |
| cp -rL /usr/share/tcltk/tk8.6 ${{ github.workspace }}/rpm-root/opt/scidcommunity/lib/ | |
| - name: Rename binary and create wrapper script | |
| run: | | |
| mv ${{ github.workspace }}/rpm-root/opt/scidcommunity/bin/scidCommunity \ | |
| ${{ github.workspace }}/rpm-root/opt/scidcommunity/bin/scidCommunity.bin | |
| cat > ${{ github.workspace }}/rpm-root/opt/scidcommunity/bin/scidCommunity << 'EOF' | |
| #!/bin/bash | |
| SCID_DIR="/opt/scidcommunity" | |
| export LD_LIBRARY_PATH="${SCID_DIR}/lib:${LD_LIBRARY_PATH}" | |
| export TCL_LIBRARY="${SCID_DIR}/lib/tcl8.6" | |
| export TK_LIBRARY="${SCID_DIR}/lib/tk8.6" | |
| export TCLLIBPATH="${SCID_DIR}/lib/tcl8.6 ${SCID_DIR}/lib/tk8.6" | |
| exec "${SCID_DIR}/bin/scidCommunity.bin" "$@" | |
| EOF | |
| chmod +x ${{ github.workspace }}/rpm-root/opt/scidcommunity/bin/scidCommunity | |
| - name: Build RPM package | |
| run: | | |
| cd build | |
| # Use only the prepared rpm-root directory, skip CMake install targets | |
| cpack -G RPM \ | |
| -D CPACK_PACKAGE_NAME=scidcommunity \ | |
| -D CPACK_PACKAGE_VERSION=${{ steps.get_version.outputs.version }} \ | |
| -D CPACK_RPM_PACKAGE_LICENSE=GPL2 \ | |
| -D CPACK_INSTALL_CMAKE_PROJECTS="" \ | |
| -D CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION="/opt;/opt/scidcommunity;/usr;/usr/local;/usr/local/bin" \ | |
| -D CPACK_INSTALLED_DIRECTORIES="${{ github.workspace }}/rpm-root/opt/scidcommunity;/opt/scidcommunity;${{ github.workspace }}/rpm-root/usr;/usr" | |
| - name: Upload RPM artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scidCommunity-linux-rpm | |
| path: build/*.rpm | |
| build-linux-appimage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| else | |
| VERSION="5.1.0" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install cmake build-essential wget fuse libfuse2 \ | |
| tcl8.6-dev tk8.6-dev libtcl8.6 libtk8.6 | |
| - name: Download appimagetool | |
| run: | | |
| wget -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage | |
| chmod +x appimagetool | |
| - name: Build ScidCommunity | |
| run: | | |
| mkdir build && cd build | |
| cmake -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_CXX_FLAGS="-fno-exceptions -fno-rtti" \ | |
| -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \ | |
| -DCMAKE_INSTALL_PREFIX=/usr \ | |
| -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib \ | |
| ${{ github.workspace }} | |
| make -j$(nproc) | |
| make install DESTDIR=${{ github.workspace }}/AppDir | |
| - name: Bundle Tcl/Tk 8.6 libraries | |
| run: | | |
| mkdir -p ${{ github.workspace }}/AppDir/usr/lib | |
| # Copy Tcl/Tk 8.6 shared libraries | |
| cp -a /usr/lib/x86_64-linux-gnu/libtcl8.6.so* ${{ github.workspace }}/AppDir/usr/lib/ | |
| cp -a /usr/lib/x86_64-linux-gnu/libtk8.6.so* ${{ github.workspace }}/AppDir/usr/lib/ | |
| # Copy Tcl/Tk script directories (including tcl8 subdirectory with modules) | |
| cp -rL /usr/share/tcltk/tcl8.6 ${{ github.workspace }}/AppDir/usr/lib/ | |
| cp -rL /usr/share/tcltk/tk8.6 ${{ github.workspace }}/AppDir/usr/lib/ | |
| - name: Create AppImage wrapper and metadata | |
| run: | | |
| # Rename binary | |
| mv ${{ github.workspace }}/AppDir/usr/bin/scidCommunity \ | |
| ${{ github.workspace }}/AppDir/usr/bin/scidCommunity.bin | |
| # Create wrapper script | |
| cat > ${{ github.workspace }}/AppDir/usr/bin/scidCommunity << 'EOF' | |
| #!/bin/bash | |
| APPDIR="${APPDIR:-$(dirname $(dirname $(readlink -f "$0")))}" | |
| export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}" | |
| export TCL_LIBRARY="${APPDIR}/usr/lib/tcl8.6" | |
| export TK_LIBRARY="${APPDIR}/usr/lib/tk8.6" | |
| export TCLLIBPATH="${APPDIR}/usr/lib/tcl8.6 ${APPDIR}/usr/lib/tk8.6" | |
| exec "${APPDIR}/usr/bin/scidCommunity.bin" "$@" | |
| EOF | |
| chmod +x ${{ github.workspace }}/AppDir/usr/bin/scidCommunity | |
| # Create AppRun symlink | |
| ln -sf usr/bin/scidCommunity ${{ github.workspace }}/AppDir/AppRun | |
| # Create desktop file | |
| cat > ${{ github.workspace }}/AppDir/scidcommunity.desktop << 'EOF' | |
| [Desktop Entry] | |
| Type=Application | |
| Name=Scid Community | |
| Comment=Chess database application | |
| Exec=scidCommunity | |
| Icon=scidcommunity | |
| Categories=Game;BoardGame; | |
| Terminal=false | |
| EOF | |
| # Copy icon (using scid.gif from img directory) | |
| mkdir -p ${{ github.workspace }}/AppDir/usr/share/icons/hicolor/256x256/apps | |
| if [ -f ${{ github.workspace }}/img/scid.gif ]; then | |
| cp ${{ github.workspace }}/img/scid.gif \ | |
| ${{ github.workspace }}/AppDir/scidcommunity.png | |
| fi | |
| - name: Build AppImage | |
| run: | | |
| ARCH=x86_64 ./appimagetool --appimage-extract-and-run \ | |
| ${{ github.workspace }}/AppDir \ | |
| ${{ github.workspace }}/scidCommunity-${{ steps.get_version.outputs.version }}-x86_64.AppImage | |
| - name: Upload AppImage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: scidCommunity-linux-appimage | |
| path: scidCommunity-*.AppImage | |
| create-release: | |
| needs: [build-windows, build-linux-deb, build-linux-rpm, build-linux-appimage] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| artifacts/scidCommunity-windows-x64/*.zip | |
| artifacts/scidCommunity-ubuntu-deb/*.deb | |
| artifacts/scidCommunity-linux-rpm/*.rpm | |
| artifacts/scidCommunity-linux-appimage/*.AppImage | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |