app-id: net.zdechov.app.Tunneler
runtime: org.kde.Platform
runtime-version: '5.15-23.08'
sdk: org.kde.Sdk
sdk-extensions:
  - org.freedesktop.Sdk.Extension.freepascal
command: Tunneler
finish-args:
  - --share=ipc
  - --socket=fallback-x11
  - --socket=wayland
  - --socket=pulseaudio
  - --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: Tunneler
    sources:
      - type: archive
        path: tunneler.tar.gz
    buildsystem: simple
    build-commands:
      - (. /usr/lib/sdk/freepascal/enable.sh && lazbuild --build-mode=Release --ws=qt5 tunneler.lpi)
      - install -d -m 755 $FLATPAK_DEST/share/Tunneler
      - install -s -m 755 Tunneler $FLATPAK_DEST/share/Tunneler
      - install -d -m 755 $FLATPAK_DEST/bin
      - ln -s $FLATPAK_DEST/share/Tunneler/Tunneler $FLATPAK_DEST/bin/Tunneler
      - 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/icons/hicolor/256x256/apps
      - install -m 644 Images/256x256/Tunneler.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
      - install -d -m 755 $FLATPAK_DEST/share/Tunneler/Languages
      - install -D -m 755 Languages/*.pot $FLATPAK_DEST/share/Tunneler/Languages
      - install -D -m 755 Languages/*.po $FLATPAK_DEST/share/Tunneler/Languages
      - install -d -m 755 $FLATPAK_DEST/share/Tunneler/Audio
      - install -D -m 755 Audio/*.wav $FLATPAK_DEST/share/Tunneler/Audio
      - install -d -m 755 $FLATPAK_DEST/share/metainfo
      - install -D Install/flatpak/${FLATPAK_ID}.appdata.xml $FLATPAK_DEST/share/metainfo/${FLATPAK_ID}.metainfo.xml
