{
  "id": "io.github.banjorecomp.banjorecomp",
  "runtime": "org.freedesktop.Platform",
  "runtime-version": "25.08",
  "sdk": "org.freedesktop.Sdk",
  "sdk-extensions" : [ "org.freedesktop.Sdk.Extension.llvm20" ],
  "finish-args": [
    "--share=network",
    "--socket=wayland",
    "--socket=fallback-x11",
    "--socket=pulseaudio",
    "--device=all",
    "--filesystem=host",
    "--filesystem=/media",
    "--filesystem=/run/media",
    "--filesystem=/mnt"
  ],
  "modules": [
    {
      "name": "BanjoRecompiled",
      "buildsystem": "simple",
      "build-commands": [
        "cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S lib/N64Recomp -B lib/N64Recomp/cmake-build",
        "cmake --build lib/N64Recomp/cmake-build --config Release --target N64Recomp --parallel",
        "cmake --build lib/N64Recomp/cmake-build --config Release --target RSPRecomp --parallel",
        "cp lib/N64Recomp/cmake-build/N64Recomp N64Recomp",
        "cp lib/N64Recomp/cmake-build/RSPRecomp RSPRecomp",
        "./N64Recomp banjo.us.rev0.toml",
        "./RSPRecomp n_aspMain.us.rev0.toml",
        "cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_MAKE_PROGRAM=ninja -DPATCHES_C_COMPILER=clang -DPATCHES_LD=ld.lld -DRECOMP_FLATPAK=ON -G Ninja -S . -B cmake-build",
        "cmake --build cmake-build --config Release --target BanjoRecompiled --parallel",
        "rm -rf assets/scss",
        "mkdir -p /app/bin",
        "cp cmake-build/BanjoRecompiled /app/bin/BanjoRecompiled",
        "cp recompcontrollerdb.txt /app/bin/recompcontrollerdb.txt",
        "cp -R assets /app/bin/assets",
        "install -Dm644 icons/app.png /app/share/icons/hicolor/512x512/apps/${FLATPAK_ID}.png",
        "install -Dm644 flatpak/io.github.banjorecomp.banjorecomp.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml",
        "install -Dm644 flatpak/io.github.banjorecomp.banjorecomp.desktop /app/share/applications/${FLATPAK_ID}.desktop"
      ],
      "sources": [
        {
          "type": "git",
          "url": "https://github.com/N64Recomp/N64Recomp.git",
          "commit": "2b6f05688de2abc7d86da5b4a89b84c2c6acbabe",
          "dest": "lib/N64Recomp"
        },
        {
          "type": "dir",
          "path": "../"
        }
      ],
      "build-options": {
        "append-path": "/usr/lib/sdk/llvm20/bin",
        "prepend-ld-library-path": "/usr/lib/sdk/llvm20/lib",
        "build-args": [
          "--share=network"
        ]
      }
    }
  ]
}
