version: 1

project:
  name: de.volle_kraft_voraus.kraft.desktop
  version_command: git describe --tags

build:
  cmake:

scripts:
  post_build:
    # make sure weasyprint can be launched from a path next to the kraft binary
    # this simplifies the lookup greatly
    # also, if we create the file now (i.e., before linuxdeploy runs), it won't be overwritten by the python plugin
    - |
      cat > "$BUILD_DIR"/AppDir/usr/bin/weasyprint <<\EOF
      #! /bin/bash
      set -eo pipefail
      own_path="$(dirname "$(readlink -f "$0")")"
      export LD_LIBRARY_PATH=$own_path/../lib
      exec "$own_path"/../conda/bin/python -m weasyprint "$@"
      EOF
      chmod +x "$BUILD_DIR"/AppDir/usr/bin/weasyprint
      mkdir -p "$BUILD_DIR"/AppDir/usr/plugins/kf6/ktexttemplate
      cp /usr/lib64/qt6/plugins/kf6/ktexttemplate/*so "$BUILD_DIR"/AppDir/usr/plugins/kf6/ktexttemplate
      mkdir -p "$BUILD_DIR"/AppDir/usr/plugins/kstyle_config
      cp /usr/lib64/qt6/plugins/kstyle_config/breezestyleconfig.so "$BUILD_DIR"/AppDir/usr/plugins/kstyle_config
      mkdir -p "$BUILD_DIR"/AppDir/usr/plugins/styles
      cp /usr/lib64/qt6/plugins/styles/breeze6.so "$BUILD_DIR"/AppDir/usr/plugins/styles
      mkdir -p "$BUILD_DIR"/AppDir/usr/lib
      cp /usr/lib64/libpango* "$BUILD_DIR"/AppDir/usr/lib/

appimage:
  linuxdeploy:
    plugins:
      - qt
      - conda
    environment:
      UPD_INFO: "gh-releases-zsync|dragotin|kraft|latest|Kraft-*x86_64.AppImage.zsync"
      PIP_REQUIREMENTS: "weasyprint pypdf"
      EXTRA_QT_MODULES: "svg;"
