{
 "app_id": "eu.usdx.UltraStarDeluxe",
 "source_url": "https://raw.githubusercontent.com/flathub/eu.usdx.UltraStarDeluxe/master/eu.usdx.UltraStarDeluxe.yaml",
 "runtime": "org.freedesktop.Platform",
 "runtime_version": "25.08",
 "sdk": "org.freedesktop.Sdk",
 "finish_args": [
  "--share=ipc",
  "--socket=fallback-x11",
  "--socket=pulseaudio",
  "--socket=wayland",
  "--device=all",
  "--filesystem=~/.java/.userPrefs/PortMidi:ro"
 ],
 "module_count": 7,
 "fetched_at": "2026-09-17T16:09:54.311477+00:00",
 "manifest": {
  "id": "eu.usdx.UltraStarDeluxe",
  "runtime": "org.freedesktop.Platform",
  "sdk": "org.freedesktop.Sdk",
  "runtime-version": "25.08",
  "separate-locales": false,
  "rename-desktop-file": "ultrastardx.desktop",
  "rename-icon": "ultrastardx",
  "command": "ultrastardx",
  "finish-args": [
   "--socket=wayland",
   "--socket=fallback-x11",
   "--share=ipc",
   "--socket=pulseaudio",
   "--device=all",
   "--filesystem=~/.java/.userPrefs/PortMidi:ro",
   "--persist=.ultrastardx"
  ],
  "cleanup": [
   "/include",
   "/lib/cmake",
   "/lib/pkgconfig",
   "/lib/*.so",
   "/lib/*.la",
   "setup_vars_opencv4.sh"
  ],
  "add-extensions": {
   "eu.usdx.UltraStarDeluxe.Songs": {
    "directory": "share/ultrastardx/songs",
    "subdirectories": true,
    "no-autodownload": true
   },
   "eu.usdx.UltraStarDeluxe.Themes": {
    "directory": "theme-extensions",
    "merge-dirs": "share/ultrastardx/themes",
    "subdirectories": true,
    "no-autodownload": true
   }
  },
  "sdk-extensions": [
   "org.freedesktop.Sdk.Extension.freepascal"
  ],
  "build-options": {
   "append-path": "/usr/lib/sdk/freepascal/bin",
   "env": [
    "FPCDIR=/usr/lib/sdk/freepascal/fpcsrc"
   ],
   "no-debuginfo-compression": true,
   "cflags": "-gdwarf-3",
   "cxxflags": "-gdwarf-3"
  },
  "modules": [
   {
    "name": "opencv",
    "buildsystem": "cmake-ninja",
    "builddir": true,
    "config-opts": [
     "-DCMAKE_BUILD_TYPE=Release",
     "-DOPENCV_GENERATE_PKGCONFIG=ON",
     "-DBUILD_TESTS=OFF",
     "-DBUILD_opencv_apps=OFF",
     "-DBUILD_opencv_calib3d=OFF",
     "-DBUILD_opencv_dnn=OFF",
     "-DBUILD_opencv_features2d=OFF",
     "-DBUILD_opencv_flann=OFF",
     "-DBUILD_opencv_gapi=OFF",
     "-DBUILD_opencv_highgui=OFF",
     "-DBUILD_opencv_java_bindings_generator=OFF",
     "-DBUILD_opencv_ml=OFF",
     "-DBUILD_opencv_objdetect=OFF",
     "-DBUILD_opencv_photo=OFF",
     "-DBUILD_opencv_python2=OFF",
     "-DBUILD_opencv_python_bindings_generator=OFF",
     "-DBUILD_opencv_python_tests=OFF",
     "-DBUILD_opencv_stitching=OFF",
     "-DBUILD_opencv_ts=OFF",
     "-DBUILD_opencv_video=OFF",
     "-DCV_TRACE=OFF",
     "-DWITH_PROTOBUF=OFF",
     "-DWITH_FFMPEG=OFF",
     "-DWITH_ADE=OFF",
     "-DWITH_QUIRC=OFF",
     "-DWITH_GTK=OFF",
     "-DWITH_TIFF=OFF",
     "-DWITH_WEBP=OFF",
     "-DWITH_JASPER=OFF",
     "-DWITH_OPENJPEG=OFF",
     "-DWITH_PNG=OFF",
     "-DWITH_OPENEXR=OFF",
     "-DWITH_GDAL=OFF",
     "-DWITH_GDCM=OFF",
     "-DWITH_IMGCODEC_HDR=OFF",
     "-DWITH_IMGCODEC_SUNRASTER=OFF",
     "-DWITH_IMGCODEC_PXM=OFF",
     "-DWITH_IMGCODEC_PFM=OFF"
    ],
    "cleanup": [
     "/share/opencv4/*cascades",
     "/share/opencv4/valgrind*.supp"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://github.com/opencv/opencv/archive/refs/tags/4.12.0.tar.gz",
      "sha256": "44c106d5bb47efec04e531fd93008b3fcd1d27138985c5baf4eafac0e1ec9e9d"
     }
    ]
   },
   {
    "name": "projectm",
    "buildsystem": "cmake-ninja",
    "build-options": {
     "arch": {
      "x86_64": {
       "config-opts": [
        "-DCMAKE_BUILD_TYPE=Release",
        "-DENABLE_PLAYLIST=OFF",
        "-DENABLE_GLES=OFF"
       ]
      },
      "aarch64": {
       "config-opts": [
        "-DCMAKE_BUILD_TYPE=Release",
        "-DENABLE_PLAYLIST=OFF",
        "-DENABLE_GLES=ON"
       ]
      }
     }
    },
    "cleanup": [
     "/include/projectM-4",
     "/lib/cmake/projectM4"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://github.com/projectM-visualizer/projectm/releases/download/v4.1.6/libprojectM-4.1.6.tar.gz",
      "sha256": "1b9e6d56c59fe24e5416da4d42e941a34c982811003e43ac88b5aca8afa52c87"
     }
    ]
   },
   "shared-modules/lua5.4/lua-5.4.json",
   {
    "name": "portmidi",
    "buildsystem": "cmake-ninja",
    "config-opts": [
     "-DCMAKE_BUILD_TYPE=Release",
     "-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
     "-DCMAKE_C_STANDARD=11"
    ],
    "cleanup": [
     "*.a",
     "libporttime.*"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://sourceforge.net/projects/portmedia/files/portmidi/217/portmidi-src-217.zip",
      "sha256": "08e9a892bd80bdb1115213fb72dc29a7bf2ff108b378180586aa65f3cfd42e0f"
     },
     {
      "type": "shell",
      "commands": [
       "find -type f | while read a ; do tr -d '\\r' < \"$a\" > /tmp/t && cat /tmp/t > \"$a\" ; done"
      ]
     },
     {
      "type": "patch",
      "paths": [
       "patches/00_cmake.diff",
       "patches/02_pmlinuxalsa.diff",
       "patches/03_pm_test_Makefile.diff",
       "patches/11-pmlinuxalsa.patch",
       "patches/13-disablejni.patch",
       "patches/20-movetest.diff",
       "patches/21-hardentests.diff",
       "patches/30-porttime_cmake.diff",
       "patches/40-test_sysex.diff",
       "patches/41-pm_linux.diff",
       "patches/50-change_assert.diff",
       "patches/51-remove_assert.diff"
      ]
     }
    ]
   },
   {
    "name": "SDL2_image",
    "buildsystem": "cmake-ninja",
    "builddir": true,
    "config-opts": [
     "-DSDL2IMAGE_BACKEND_STB=OFF",
     "-DSDL2IMAGE_DEPS_SHARED=OFF",
     "-DSDL2IMAGE_STRICT=ON"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://github.com/libsdl-org/SDL_image/releases/download/release-2.8.10/SDL2_image-2.8.10.tar.gz",
      "sha256": "ebc059d01c007a62f4b04f10cf858527c875062532296943174df9a80264fd65",
      "x-checker-data": {
       "type": "anitya",
       "project-id": 382729,
       "stable-only": true,
       "url-template": "https://github.com/libsdl-org/SDL_image/releases/download/release-$version/SDL2_image-$version.tar.gz"
      }
     }
    ]
   },
   {
    "name": "ultrastardx",
    "buildsystem": "autotools",
    "config-opts": [
     "--with-libprojectM",
     "--with-opencv-cxx-api"
    ],
    "post-install": [
     "cd ${FLATPAK_DEST}/share/ultrastardx/fonts ; fc-scan -f '%{file} :fullname=%{fullname}\n' . | while read a b ; do a=${a#./} c=$(fc-list -f '%{file}\n' \"$b\" | head -n 1) ; if [ -n \"$c\" ] ; then sed -i \"s:=$a:=$c:\" fonts.ini ; rm \"$a\" ; fi ; done",
     "for i in ${FLATPAK_DEST}/share/ultrastardx/fonts/*/ ; do [ -n \"$(fc-scan -f '%{file}' \"$i\" | head -n 1)\" ] || rm -Rf \"$i\" ; done",
     "mkdir ${FLATPAK_DEST}/lib/ffmpeg"
    ],
    "sources": [
     {
      "type": "git",
      "url": "https://github.com/UltraStar-Deluxe/USDX.git",
      "tag": "v2026.9.0",
      "commit": "8b5324f321d54491badadf5f95b4678a0bcf4633",
      "disable-submodules": true
     },
     {
      "type": "patch",
      "paths": [
       "patches/install-data.patch",
       "patches/instructions.patch",
       "patches/ldflags.patch",
       "patches/debinfo.patch",
       "patches/find-debinfo.patch"
      ]
     },
     {
      "type": "shell",
      "commands": [
       "cp /usr/lib/sdk/freepascal/etc/fpc.cfg fpc.cfg",
       "ln -s ../fpc.cfg src/",
       "set -- `gcc -print-file-name=crtbegin.o` ; echo -Fl${1%/*} >> fpc.cfg"
      ]
     }
    ]
   },
   {
    "name": "link-debug-data",
    "buildsystem": "simple",
    "build-commands": [
     "mkdir -p ${FLATPAK_DEST}/lib/debug/for-freepascal",
     "ln -s ${FLATPAK_DEST}/bin/ultrastardx ${FLATPAK_DEST}/lib/debug/for-freepascal/",
     "(\n    echo ${FLATPAK_DEST}/bin/ultrastardx\n    ldd ${FLATPAK_DEST}/bin/ultrastardx | sed -n 's/.* => //;s/ ([^)]*)$//;s:^[[:space:]]*/:/:p'\n) | while read a ; do\n    objcopy --dump-section .gnu_debuglink=/tmp/debuglink \"$a\" /dev/null\n    if [ -e /tmp/debuglink ] ; then\n        l=`hexdump -e '1/2000 \"%s\"' /tmp/debuglink`\n        rm -f /tmp/debuglink\n        a=${a%/*}\n        case \"$a\" in\n        ${FLATPAK_DEST}/*)\n            ln -s ..${a#${FLATPAK_DEST}}/$l ${FLATPAK_DEST}/lib/debug/for-freepascal/\n        esac\n    fi\ndone\n"
    ]
   }
  ]
 }
}