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
rename-icon: c-evo
rename-desktop-file: c-evo.desktop
finish-args:
  - --socket=x11
  - --socket=pulseaudio
  - --device=all # ALSA
  - --share=ipc
  - --device=dri
modules:
  - shared-modules/gtk2/gtk2.json
  - name: portaudio
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/PortAudio/portaudio.git
        tag: v19.7.0
        commit: 147dd722548358763a8b649b3e4b41dfffbcfbb6
        x-checker-data:
          type: git
          tag-pattern: ^v([\d.]+)$
  - name: libxmp
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/libxmp/libxmp.git
        tag: libxmp-4.6.3
        commit: bed660f8e530d399c38f27a5a7732f4e79740585
  - name: c-evo
    sources:
      - type: svn
        url: https://svn.zdechov.net/c-evo/tags/1.3.9
        revision: r728
    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/bin
      - 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/common/c-evo.desktop -t $FLATPAK_DEST/share/applications
      - install -Dm644 Install/common/c-evo.xml -t $FLATPAK_DEST/share/mime/packages
      - install -Dm644 Install/common/c-evo_256x256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/c-evo.png
      - install -Dm644 Install/common/c-evo_256x256.png $FLATPAK_DEST/share/pixmaps/application-cevo.png
      - install -Dm644 Install/common/c-evo_256x256.png $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}.metainfo.xml -t $FLATPAK_DEST/share/metainfo
      - 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 Music $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

