app-id: net.zdechov.app.C-evo
runtime: org.freedesktop.Platform
runtime-version: '24.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.freepascal
command: c-evo
finish-args:
  - --socket=x11
  - --socket=pulseaudio
  - --share=ipc
  - --device=dri
modules:
  - shared-modules/gtk2/gtk2.json
  - name: c-evo
    sources:
      - type: svn
        url: https://svn.zdechov.net/c-evo/trunk
        revision: 637
    buildsystem: simple
    build-options:
      arch:
        x86_64:
          env:
            STDAI_ARCH: amd64
        aarch64:
          env:
            STDAI_ARCH: arm64
    build-commands:
      - |
        . /usr/lib/sdk/freepascal/enable.sh
        lazbuild --build-mode=Release AI/StdAI/StdAI.lpi
        mv AI/StdAI/libstdai.so AI/StdAI/libstdai-$STDAI_ARCH.so
        lazbuild --build-mode=Release Integrated.lpi
      - install -Dm755 c-evo -t $FLATPAK_DEST/share/c-evo
      - install -d $FLATPAK_DEST/bin
      - ln -s $FLATPAK_DEST/share/c-evo/c-evo $FLATPAK_DEST/bin/c-evo
      - install -Dm644 Language.txt -t $FLATPAK_DEST/share/c-evo
      - install -Dm644 Language2.txt -t $FLATPAK_DEST/share/c-evo
      - install -Dm644 Fonts.txt -t $FLATPAK_DEST/share/c-evo
      - install -Dm644 Install/flatpak/${FLATPAK_ID}.desktop -t $FLATPAK_DEST/share/applications
      - install -Dm644 Install/deb/c-evo.xml -t $FLATPAK_DEST/share/mime/packages
      - install -Dm644 Graphics/c-evo_256x256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
      - install -Dm644 Graphics/c-evo_256x256.png -t $FLATPAK_DEST/share/pixmaps/application-cevo.png
      - install -Dm644 Graphics/c-evo_256x256.png -t $FLATPAK_DEST/share/pixmaps/application-cevomap.png
      - install -Dm644 AI/StdAI/libstdai-$STDAI_ARCH.so -t $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -Dm644 AI/StdAI/StdAI.ai.txt -t $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -Dm644 AI/StdAI/StdAI.png -t $FLATPAK_DEST/share/c-evo/AI/StdAI
      - install -Dm644 Install/flatpak/${FLATPAK_ID}.appdata.xml $FLATPAK_DEST/share/metainfo/${FLATPAK_ID}.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

