id: org.sdrangel.SDRangel
runtime: org.kde.Platform
runtime-version: '6.9'
sdk: org.kde.Sdk
base: io.qt.qtwebengine.BaseApp
base-version: '6.9'
command: sdrangel
rename-desktop-file: sdrangel.desktop
rename-icon: sdrangel_icon
copy-icon: true
finish-args:
  - --device=all
  - --share=network
  - --share=ipc
  - --socket=pulseaudio
  - --socket=x11
  - --filesystem=xdg-documents
  - --system-talk-name=org.freedesktop.GeoClue2
cleanup-commands:
  - /app/cleanup-BaseApp.sh
  - mkdir -p ${FLATPAK_DEST}/lib/ffmpeg
add-extensions:
  org.freedesktop.Platform.ffmpeg-full:
    directory: lib/ffmpeg
    add-ld-path: .
    version: '24.08'
    autodownload: true
    autodelete: false

modules:
  - name: fftw3f
    config-opts:
      - --enable-threads
      - --enable-shared
      - --disable-static
      - --enable-float
    build-options:
      arch:
        x86_64:
          config-opts:
            - --enable-sse2
        aarch64:
          config-opts:
            - --enable-neon
    sources:
      - type: archive
        url: https://www.fftw.org/fftw-3.3.10.tar.gz
        sha256: 56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467

  - name: libusb
    config-opts:
      - --disable-static
    sources:
      - type: archive
        url: https://github.com/libusb/libusb/releases/download/v1.0.29/libusb-1.0.29.tar.bz2
        sha256: 5977fc950f8d1395ccea9bd48c06b3f808fd3c2c961b44b0c2e6e29fc3a70a85
    post-install:
      - install -Dm644 COPYING ${FLATPAK_DEST}/share/licenses/libusb/COPYING

  - name: libxml2
    config-opts:
      - --without-python
    sources:
      - type: archive
        url: https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.tar.xz
        sha256: c008bac08fd5c7b4a87f7b8a71f283fa581d80d80ff8d2efd3b26224c39bc54c

  - name: boost
    buildsystem: simple
    sources:
      - type: archive
        # 1.88.0 brings breaking changes for uhd
        url: https://sourceforge.net/projects/boost/files/boost/1.87.0/boost_1_87_0.tar.bz2
        sha256: af57be25cb4c4f4b413ed692fe378affb4352ea50fbe294a11ef548f4d527d89
    build-commands:
      - ./bootstrap.sh --prefix=/app
      - ./b2 -j $FLATPAK_BUILDER_N_JOBS
      - ./b2 install

  - name: xxd
    build-options:
      env:
        LIBS: -lm
    cleanup:
      - /bin/vim*
      - /bin/rvim
      - /bin/view
      - /bin/rview
      - /bin/ex
      - /share
    config-opts:
      - --disable-gui
      - --disable-gtk3
      - --disable-luainterp
      - --disable-python3interp
      - --disable-xim
      - --disable-xsmp
      - --disable-xsmp-interact
      - --disable-desktop-database-update
      - --disable-icon-cache-update
      - --disable-gnome-check
      - --disable-motif-check
      - --disable-athena-check
      - --disable-fontset
    sources:
      - type: archive
        url: https://github.com/vim/vim/archive/refs/tags/v9.1.2045.tar.gz
        sha256: af5bb47954653eec32239ba41505c4fe1067b71fd7e52d8012c5daa52f4caa2c

  - name: python-cheetah
    buildsystem: simple
    sources:
      - type: archive
        url: https://files.pythonhosted.org/packages/23/33/ace0250068afca106c1df34348ab0728e575dc9c61928d216de3e381c460/Cheetah3-3.2.6.post1.tar.gz
        sha256: 58b5d84e5fbff6cf8e117414b3ea49ef51654c02ee887d155113c5b91d761967
    build-commands:
      - python setup.py install --prefix=/app --root=/

  - name: python-mako
    buildsystem: simple
    sources:
      - type: archive
        url: https://files.pythonhosted.org/packages/9e/38/bd5b78a920a64d708fe6bc8e0a2c075e1389d53bef8413725c63ba041535/mako-1.3.10.tar.gz
        sha256: 99579a6f39583fa7e5630a28c3c1f440e4e97a414b80372649c0ce338da2ea28
    build-commands:
      - python setup.py install --prefix=/app --root=/

  - name: flit-core
    buildsystem: simple
    sources:
      - type: archive
        url: https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz
        sha256: 18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2
    build-commands:
      - pip3 install --no-index --find-links=file://${PWD} --prefix=${FLATPAK_DEST}
        --no-build-isolation .

  - name: pyproject-metadata
    buildsystem: simple
    sources:
      - type: archive
        url: https://files.pythonhosted.org/packages/75/bd/74706b3671c443944f487a42a0148a507b733c60600df1d34cde41e6d10b/pyproject_metadata-0.10.0.tar.gz
        sha256: 7f5bd0ef398b60169556cb17ea261d715caf7f8561238151f51b2305084ba8d4
    build-commands:
      - pip3 install --no-index --find-links=file://${PWD} --prefix=${FLATPAK_DEST}
        --no-build-isolation .

  - name: python-meson
    buildsystem: simple
    sources:
      - type: archive
        url: https://files.pythonhosted.org/packages/26/bd/fdb26366443620f1a8a4d4ec7bfa37d1fbbe7bf737b257c205bbcf95ba95/meson_python-0.18.0.tar.gz
        sha256: c56a99ec9df669a40662fe46960321af6e4b14106c14db228709c1628e23848d
    build-commands:
      - pip3 install --no-index --find-links=file://${PWD} --prefix=${FLATPAK_DEST}
        --no-build-isolation .

  - name: python-numpy
    buildsystem: simple
    sources:
      - type: archive
        url: https://files.pythonhosted.org/packages/a4/7a/6a3d14e205d292b738db449d0de649b373a59edb0d0b4493821d0a3e8718/numpy-2.4.0.tar.gz
        sha256: 6e504f7b16118198f138ef31ba24d985b124c2c469fe8467007cf30fd992f934
    build-commands:
      - pip3 install --no-index --find-links=file://${PWD} --prefix=${FLATPAK_DEST}
        --no-build-isolation .

  - name: opencv
    buildsystem: cmake-ninja
    builddir: true
    build-options:
      cxxflags: -std=c++14
    sources:
      - type: archive
        url: https://github.com/opencv/opencv/archive/refs/tags/4.13.0.tar.gz
        sha256: 1d40ca017ea51c533cf9fd5cbde5b5fe7ae248291ddf2af99d4c17cf8e13017d

  - name: libpostproc
    config-opts:
      - --disable-debug
      - --disable-doc
      - --disable-static
      - --enable-shared
      - --enable-gpl
      - --disable-libvpx
      - --disable-ffplay
      - --disable-ffprobe
      - --disable-everything
      - --enable-postproc
    sources:
      - type: archive
        url: https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz
        sha256: 40973d44970dbc83ef302b0609f2e74982be2d85916dd2ee7472d30678a7abe6

  - name: libaio
    no-autogen: true
    make-install-args:
      - prefix=${FLATPAK_DEST}
    sources:
      - type: archive
        url: https://pagure.io/libaio/archive/libaio-0.3.113/libaio-libaio-0.3.113.tar.gz
        sha256: 716c7059703247344eb066b54ecbc3ca2134f0103307192e6c2b7dab5f9528ab

  - name: cm256cc
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
      - -DENABLE_DISTRIBUTION=ON
    sources:
      - type: git
        url: https://github.com/f4exb/cm256cc.git
        commit: da87adbe3e583877870cb159d37e0456549b2c29

  - name: mbelib
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/szechyjs/mbelib/archive/refs/tags/v1.3.0.tar.gz
        sha256: 5a2d5ca37cef3b6deddd5ce8c73918f27936c50eb0e63b27e4b4fc493310518d

  - name: serialdv
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/f4exb/serialDV/archive/refs/tags/v1.1.5.tar.gz
        sha256: 9ff90d85ff613e81659a2d661515e01d3c1f3ad1cade58908838b97fdd7ab5d2

  - name: dsdcc
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
      - -DUSE_MBELIB=ON
    sources:
      - type: archive
        url: https://github.com/f4exb/dsdcc/archive/refs/tags/v1.9.6.tar.gz
        sha256: 43505fe537b12492860a44d0373b6b2a7edacbaec058160b5007c341af1b40d9

  - name: codec2
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/drowe67/codec2/archive/refs/tags/1.2.0.tar.gz
        sha256: cbccae52b2c2ecc5d2757e407da567eb681241ff8dadce39d779a7219dbcf449

  - name: faad2
    sources:
      - type: archive
        url: https://sourceforge.net/projects/faac/files/faad2-src/faad2-2.8.0/faad2-2.8.8.tar.gz
        sha256: 985c3fadb9789d2815e50f4ff714511c79c2710ac27a4aaaf5c0c2662141426d

  - name: libdab
    subdir: library
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/srcejon/dab-cmdline.git
        # branch: msvc
        commit: 4c7ab58857a1de71f585728ffcbc4916db9b56c7

  - name: hidapi
    buildsystem: cmake-ninja
    sources:
      - type: archive
        url: https://github.com/libusb/hidapi/archive/refs/tags/hidapi-0.15.0.tar.gz
        sha256: 5d84dec684c27b97b921d2f3b73218cb773cf4ea915caee317ac8fc73cef8136

  - name: graphviz
    buildsystem: cmake-ninja
    sources:
      - type: archive
        url: https://gitlab.com/graphviz/graphviz/-/archive/14.1.1/graphviz-14.1.1.tar.gz
        sha256: 8a212d58ada30df56511d6a581f3e4417e82802d6560e5720c19195bc593e1cc

  - name: libsigmf
    buildsystem: cmake-ninja
    build-options:
      cflags: -Wno-error
      cflags-override: true
      cxxflags: -Wno-error
      cxxflags-override: true
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/f4exb/libsigmf.git
        # branch: new-namespaces
        commit: 299dc8f9725f1733e5cc1ce8a69fbcf7f18a2f58

  - name: cspice
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
      - -DCSPICE_BUILD_STATIC_LIBRARY=OFF
    sources:
      - type: git
        url: https://github.com/srcejon/cspice-cmake
        # branch: msvc
        commit: 817571e78709fd8c25d70a2fd1bacaee0829101e

  - name: sgp4
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/dnwrnr/sgp4.git
        commit: d176906dbfaf8361eee1f83bd1dc1bacc6582798

  - name: aptdec
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/srcejon/aptdec.git
        # branch: libaptdec
        commit: d037f77cfaff946318e39293ae97fc2e68595f0f

  - name: ggmorse
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/f4exb/ggmorse.git
        commit: 3662036c7ee37223f29d59a653a571d2c399eea0

  - name: hamlib
    sources:
      - type: archive
        url: https://github.com/Hamlib/Hamlib/releases/download/4.7.1/hamlib-4.7.1.tar.gz
        sha256: d197a08a3d5d936d7571ae573f745bbba619e88998742c8267e3fcb0fb3d5974

  - name: airspy
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/airspy/airspyone_host/archive/refs/tags/v1.0.10.tar.gz
        sha256: fcca23911c9a9da71cebeffeba708c59d1d6401eec6eb2dd73cae35b8ea3c613

  - name: airspyhf
    buildsystem: cmake-ninja
    config-opts:
      - -DINSTALL_UDEV_RULES=OFF
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/airspy/airspyhf/archive/refs/tags/1.6.8.tar.gz
        sha256: cd1e5ae89e09b813b096ae4a328e352c9432a582e03fd7da86760ba60efa77ab

  - name: hydrasdr
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/hydrasdr/hydrasdr-host/archive/refs/tags/v1.0.4.tar.gz
        sha256: e1aaf437e7bfc97141cf73e16d7bf4960b07677cb2ee6787dfd84cd3ad5c2fd7

  - name: bladerf
    buildsystem: cmake-ninja
    build-options:
      cflags: -Wno-calloc-transposed-args
    sources:
      - type: git
        url: https://github.com/Nuand/bladeRF.git
        tag: '2025.10'
        commit: fcf9423325ae49f5fdd2e5b52ab68bfc2576ad47

  - name: rtlsdr
    buildsystem: cmake-ninja
    config-opts:
      - -DDETACH_KERNEL_DRIVER=ON
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/steve-m/librtlsdr.git
        # latest master for 2.0.2 versioning fix
        commit: ae0dd6d4f09088d13500a854091b45ad281ca4f0

  - name: plutosdr
    buildsystem: cmake-ninja
    config-opts:
      - -DINSTALL_UDEV_RULE=OFF
      - -DHAVE_DNS_SD=OFF
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/analogdevicesinc/libiio/archive/refs/tags/v0.26.tar.gz
        sha256: fb445fb860ef1248759f45d4273a4eff360534480ec87af64c6b8db3b99be7e5

  - name: hackrf
    buildsystem: cmake-ninja
    subdir: host
    config-opts:
      - -DINSTALL_UDEV_RULE=OFF
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/greatscottgadgets/hackrf/archive/refs/tags/v2026.01.3.tar.gz
        sha256: 48238f3a21189fa8cbe67838584cc045b9e5433767db8c9c30c1da02a1489f2c

  - name: limesdr
    buildsystem: cmake-ninja
    config-opts:
      - -DENABLE_QUICKTEST=OFF
      - -DENABLE_GUI=OFF
      - -DENABLE_SOAPY_LMS7=OFF
      - -DENABLE_EXAMPLES=OFF
      - -DENABLE_UTILITIES=OFF
      - -DENABLE_HEADERS=ON
      - -DENABLE_SIMD_FLAGS=SSE4.2
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/myriadrf/LimeSuite/archive/refs/tags/v23.11.0.tar.gz
        sha256: fd8a448b92bc5ee4012f0ba58785f3c7e0a4d342b24e26275318802dfe00eb33

  - name: perseus
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/f4exb/libperseus-sdr.git
        commit: 30de6c708fa6afe2040a80df74afb39dcdc6e74a

  - name: xtrx
    buildsystem: cmake-ninja
    subdir: sources
    config-opts:
      - -DENABLE_SOAPY=NO
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/xtrx-sdr/images.git
        commit: e7c68fa621004ee0d6a65171c786fd9d5a1f2ce6

  - name: uhd
    buildsystem: cmake-ninja
    subdir: host
    config-opts:
      - -DENABLE_PYTHON_API=OFF
      - -DINSTALL_UDEV_RULES=OFF
      - -Wno-dev
    sources:
      - type: archive
        # 4.9.0.0 has possible breaking API changes
        url: https://github.com/EttusResearch/uhd/archive/refs/tags/v4.8.0.0.tar.gz
        sha256: a2159491949477dca67f5a9b05f5a80d8c2b32e91b95dd7fac8ddd3893e36d09
      - type: patch
        paths:
          - uhd-disable-ascii-art-dft.patch
          - uhd-disable-latency-utils.patch

  - name: uhd_images
    buildsystem: simple
    sources:
      - type: archive
        url: https://github.com/EttusResearch/uhd/releases/download/v4.8.0.0/uhd-images_4.8.0.0.tar.xz
        sha256: 602ee2b9806d5d9ae40a9b068e55ba084e6becea51fdbd956d1f0229d553bf44
    build-commands:
      - install -Dm644 LICENSE -t ${FLATPAK_DEST}/share/uhd/images
      - for f in usrp_b2*; do install -m644 $f -t ${FLATPAK_DEST}/share/uhd/images; done

  - name: libmirisdr
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/f4exb/libmirisdr-4/archive/refs/tags/v2.0.0.tar.gz
        sha256: c9fa00737f37de788873248c71dd653b0e9c043aed70620ea17cfde8894be2df

  - name: soapy
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: archive
        url: https://github.com/pothosware/SoapySDR/archive/refs/tags/soapy-sdr-0.8.1.tar.gz
        sha256: a508083875ed75d1090c24f88abef9895ad65f0f1b54e96d74094478f0c400e6

  - name: soapy_remote
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/pothosware/SoapyRemote.git
        # latest master for multiple fixes
        commit: 40c3ef9053b63885b7444ce7e9ef00d2c7964c9d

  - name: soapy_uhd
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/pothosware/SoapyUHD.git
        # latest master for multiple fixes
        commit: 2a5d381f68fd05d5b3c0e7db56c36892ea99b4ae

  - name: soapy_redpitaya
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/pothosware/SoapyRedPitaya.git
        # latest master for multiple fixes
        commit: 0702140487231658d200d488dfde7db3e41a5538

  - name: soapy_hydrasdr
    buildsystem: cmake-ninja
    config-opts:
      - -Wno-dev
    sources:
      - type: git
        url: https://github.com/hydrasdr/SoapyHydraSDR.git
        # latest main for multiple fixes
        commit: 77b6ae2929830e8a01a0e8efa69e44d6ac438cde

  - name: inmarsatc
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/cropinghigh/inmarsatc.git
        commit: cda1242e79981d71cd8608e971c8dbc691942b10

  - name: rnnoise
    sources:
      - type: git
        url: https://github.com/xiph/rnnoise.git
        # latest main for multiple fixes
        commit: 70f1d256acd4b34a572f999a05c87bf00b67730d
      - type: file
        url: https://media.xiph.org/rnnoise/models/rnnoise_data-0a8755f8e2d834eff6a54714ecc7d75f9932e845df35f8b59bc52a7cfe6e8b37.tar.gz
        sha256: 0a8755f8e2d834eff6a54714ecc7d75f9932e845df35f8b59bc52a7cfe6e8b37

  - name: sdrangel
    buildsystem: cmake-ninja
    build-options:
      cxxflags: -fpermissive
      arch:
        x86_64:
          config-opts:
            - -DARCH_OPT=nehalem
        aarch64:
          config-opts:
            - -DARCH_OPT=armv8-a
    config-opts:
      - -DCMAKE_BUILD_TYPE=RelWithDebInfo
      - -DENABLE_QT6=ON
      - -DRX_SAMPLE_24BIT=ON
      - -Wno-dev
    sources:
      - type: dir
        path: ..
      - type: shell
        commands:
          - sed -e 's|/usr/|/app/|g' -i cmake/Modules/FindSerialDV.cmake
          - sed -e 's|/usr/|/app/|g' -i cmake/Modules/FindLibDAB.cmake
          - sed -e 's|/usr/|/app/|g' -i cmake/Modules/FindSgp4.cmake
          - sed -e 's|/usr/|/app/|g' -i cmake/Modules/FindAptDec.cmake
