app-id: net.zdechov.app.C-evo
runtime: org.kde.Platform
runtime-version: '5.15-23.08'
sdk: org.kde.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.freepascal
command: c-evo
finish-args:
  - --share=ipc
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=home
  - --device=dri
modules:
  - name: qt5pas
    buildsystem: qmake
    config-opts:
      - -after
      - target.path=/app/lib
    sources:
      - type: shell
        commands:
          - cp -r /usr/lib/sdk/freepascal/share/lazarus/lcl/interfaces/qt5/cbindings/. .
  - name: c-evo
    sources:
      - type: svn
        url: https://svn.zdechov.net/c-evo/trunk
        revision: r563
    buildsystem: simple
    build-commands:
      - (. /usr/lib/sdk/freepascal/enable.sh && cd AI/StdAI &&lazbuild --build-mode=Release --ws=qt5 StdAI.lpi)
      - mv AI/StdAI/libstdai.so AI/StdAI/libstdai-amd64.so
      - (. /usr/lib/sdk/freepascal/enable.sh && lazbuild --build-mode=Release --ws=qt5 Integrated.lpi)
      - install -d -m 755 $FLATPAK_DEST/share/c-evo
      - install -s -m 755 c-evo $FLATPAK_DEST/share/c-evo
      - install -m 644 Language.txt $FLATPAK_DEST/share/c-evo
      - install -m 644 Language2.txt $FLATPAK_DEST/share/c-evo
      - install -m 644 Fonts.txt $FLATPAK_DEST/share/c-evo
      - install -d -m 755 $FLATPAK_DEST/bin
      - ln -s $FLATPAK_DEST/share/c-evo/c-evo $FLATPAK_DEST/bin/c-evo
      - install -d -m 755 $FLATPAK_DEST/share/applications
      - install -m 755 Install/flatpak/${FLATPAK_ID}.desktop $FLATPAK_DEST/share/applications
      - install -d -m 755 $FLATPAK_DEST/share/mime/packages
      - install -m 644 Install/deb/c-evo.xml $FLATPAK_DEST/share/mime/packages
      - install -d -m 755 $FLATPAK_DEST/share/icons/hicolor/64x64/apps
      - install -m 644 Graphics/c-evo_64x64.png $FLATPAK_DEST/share/icons/hicolor/64x64/apps/${FLATPAK_ID}.png
      - install -d -m 755 $FLATPAK_DEST/share/pixmaps
      - install -m 644 Graphics/c-evo_64x64.png $FLATPAK_DEST/share/pixmaps/application-cevo.png
      - install -m 644 Graphics/c-evo_64x64.png $FLATPAK_DEST/share/pixmaps/application-cevomap.png
      - install -d -m 755 $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -m 644 AI/StdAI/libstdai-amd64.so $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -m 644 AI/StdAI/StdAI.ai.txt $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -m 644 AI/StdAI/StdAI.png $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -D Install/flatpak/net.zdechov.app.C-evo.appdata.xml -t $FLATPAK_DEST/share/metainfo/net.zdechov.app.C-evo.metainfo.xml
      - cp -r Graphics $FLATPAK_DEST/share/c-evo
      - cp -r Help $FLATPAK_DEST/share/c-evo
      - cp -r Sounds $FLATPAK_DEST/share/c-evo
      - cp -r Tribes $FLATPAK_DEST/share/c-evo
      - cp -r Localization $FLATPAK_DEST/share/c-evo
      - cp -r Maps $FLATPAK_DEST/share/c-evo
      - cp -r Saved $FLATPAK_DEST/share/c-evo
      - cp -r "AI Template" $FLATPAK_DEST/share/c-evo

