{
 "app_id": "com.github.sakya.corechess",
 "source_url": "https://raw.githubusercontent.com/flathub/com.github.sakya.corechess/master/com.github.sakya.corechess.json",
 "runtime": "org.freedesktop.Platform",
 "runtime_version": "24.08",
 "sdk": "org.freedesktop.Sdk",
 "finish_args": [
  "--share=ipc",
  "--socket=x11",
  "--socket=pulseaudio",
  "--device=dri",
  "--filesystem=xdg-documents",
  "--filesystem=xdg-pictures"
 ],
 "module_count": 7,
 "fetched_at": "2026-09-17T16:07:50.049313+00:00",
 "manifest": {
  "app-id": "com.github.sakya.corechess",
  "runtime": "org.freedesktop.Platform",
  "runtime-version": "24.08",
  "sdk": "org.freedesktop.Sdk",
  "sdk-extensions": [
   "org.freedesktop.Sdk.Extension.dotnet8"
  ],
  "cleanup": [
   "/include",
   "/lib/*.a"
  ],
  "command": "CoreChess",
  "finish-args": [
   "--filesystem=xdg-documents",
   "--filesystem=xdg-pictures",
   "--share=ipc",
   "--socket=x11",
   "--socket=pulseaudio",
   "--device=dri"
  ],
  "modules": [
   {
    "name": "CoreChess",
    "buildsystem": "simple",
    "build-options": {
     "append-path": "/usr/lib/sdk/dotnet8/bin",
     "append-ld-library-path": "/usr/lib/sdk/dotnet8/lib",
     "env": {
      "PKG_CONFIG_PATH": "/app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib/sdk/dotnet8/lib/pkgconfig"
     },
     "arch": {
      "x86_64": {
       "env": {
        "RUNTIME": "linux-x64"
       }
      },
      "aarch64": {
       "env": {
        "RUNTIME": "linux-arm64"
       }
      }
     }
    },
    "build-commands": [
     "dotnet publish CoreChess.sln -c Release --source ./nuget-sources --runtime $RUNTIME -p:PublishReadyToRun=true --self-contained --output ./dist/$RUNTIME",
     "cp CoreChess/Lib/Bass/$RUNTIME/libbass.so ./dist/$RUNTIME/",
     "cp -r --remove-destination ./dist/$RUNTIME /app/bin/",
     "mkdir -p /app/share/applications/",
     "cp ./Flatpak/com.github.sakya.corechess.desktop /app/share/applications/",
     "mkdir -p /app/share/appdata/",
     "cp ./Flatpak/com.github.sakya.corechess.appdata.xml /app/share/appdata/",
     "mkdir -p /app/share/icons/hicolor/512x512/apps/",
     "cp ./icon.png /app/share/icons/hicolor/512x512/apps/com.github.sakya.corechess.png"
    ],
    "sources": [
     {
      "type": "git",
      "tag": "v0.18.4.0-flathub",
      "url": "https://github.com/sakya/corechess.git"
     },
     "nuget.json"
    ]
   },
   {
    "name": "Stockfish",
    "buildsystem": "simple",
    "build-options": {
     "arch": {
      "x86_64": {
       "env": {
        "ARCH": "x86-64"
       }
      },
      "aarch64": {
       "env": {
        "ARCH": "armv8"
       }
      }
     }
    },
    "build-commands": [
     "cp nn-5af11540bbfe.nnue ./src",
     "cd src; make -j build ARCH=$ARCH",
     "mkdir -p /app/bin/Engines/stockfish",
     "cp ./src/stockfish /app/bin/Engines/stockfish/",
     "cp ./nn-5af11540bbfe.nnue /app/bin/Engines/stockfish"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://github.com/official-stockfish/Stockfish/archive/refs/tags/sf_16.zip",
      "sha256": "c3252184be37b7249b8c439ff1a78585c460aec533b8e5fb234b113f5bb48274"
     },
     {
      "type": "file",
      "url": "https://tests.stockfishchess.org/api/nn/nn-5af11540bbfe.nnue",
      "sha256": "5af11540bbfefcb54e38c5dd000cab4b469dfa7599a1d55be5d2722c20a8929b"
     }
    ]
   },
   {
    "name": "eigen",
    "buildsystem": "cmake-ninja",
    "builddir": true,
    "sources": [
     {
      "type": "archive",
      "url": "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz",
      "sha256": "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72"
     }
    ]
   },
   {
    "name": "openblas",
    "no-autogen": true,
    "make-args": [
     "DYNAMIC_ARCH=1",
     "FC=gfortran",
     "NO_LAPACKE=1",
     "USE_OPENMP=0"
    ],
    "make-install-args": [
     "PREFIX=/app"
    ],
    "post-install": [
     "rm /app/lib/*.a"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://github.com/xianyi/OpenBLAS/archive/refs/tags/v0.3.23.tar.gz",
      "sha256": "5d9491d07168a5d00116cdc068a40022c3455bf9293c7cb86a65b1054d7e5114"
     }
    ]
   },
   {
    "name": "lc0",
    "buildsystem": "meson",
    "config-opts": [
     "-Dopenblas=true",
     "-Dopenblas_libdirs=/app/lib",
     "-Dgtest=false",
     "-Db_lto=true",
     "-Dopencl=false"
    ],
    "post-install": [
     "mkdir -p /app/bin/Engines/lc0",
     "mv /app/bin/lc0 /app/bin/Engines/lc0/"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://github.com/LeelaChessZero/lc0/archive/refs/tags/v0.31.2.zip",
      "sha256": "229273ad25a4948dbd6aa3c0162dc87f19e8e763f3c0ebdc2536cd97039172a8"
     },
     {
      "type": "archive",
      "dest": "./libs/lczero-common/",
      "url": "https://github.com/LeelaChessZero/lczero-common/archive/refs/heads/master.zip",
      "sha256": "ce33de444bf17f8c99dd1f4880cae0f29113197022b174435f94428e15d2e51c"
     }
    ]
   },
   {
    "name": "nn",
    "buildsystem": "simple",
    "build-commands": [
     "mkdir -p /app/bin/Engines/lc0",
     "mv nn /app/bin/Engines/lc0/"
    ],
    "sources": [
     {
      "type": "file",
      "dest-filename": "nn",
      "url": "https://training.lczero.org/get_network?sha=0f2f738e314bf618384045d4320a55333375d273d093adb805a4268ee53b519c",
      "sha256": "5cf80e9e5091134241235400366c6c46c8b1613b07b98243f4e4dcc691bf47ae"
     }
    ]
   },
   {
    "name": "gnuchess",
    "build-options": {
     "ldflags": "-Wl,--allow-multiple-definition",
     "arch": {
      "aarch64": {
       "config-opts": [
        "--build=arm"
       ]
      }
     }
    },
    "post-install": [
     "mkdir -p /app/bin/Engines/gnuchess",
     "mv /app/bin/gnuchess /app/bin/Engines/gnuchess/"
    ],
    "sources": [
     {
      "type": "archive",
      "url": "https://ftp.gnu.org/gnu/chess/gnuchess-6.2.9.tar.gz",
      "sha256": "ddfcc20bdd756900a9ab6c42c7daf90a2893bf7f19ce347420ce36baebc41890"
     }
    ]
   }
  ]
 }
}