{
	"//":"To build:",
	"//":"	flatpak-builder --user --install --from-git=https://github.com/fte-team/fteqw.git build-dir flatpak.json",
	"//":"	(drop the git arg if you're making local changes to this file - note that it'll only take committed changes, annoyingly there's no way to have the git sources pick up the proper url)",
	"//":"To then run:",
	"//":"	cd ~/quake && flatpak run info.triptohell.fteqw",

	"//":"To then create a bundle:",
	"//":"  flatpak build-bundle ~/.local/share/flatpak/repo fteqw.flatpak info.triptohell.fteqw",
	"//":"Which can then be distributed and hopefully double-clicked etc, or just 'flatpak install --user fteqw.flatpak'.",

	"//":"Note: If you're making a TC, add your data/fmf as an extra module somehow, and remove the filesystem=host access.",

	"app-id": "info.triptohell.fteqw",
	"runtime": "org.freedesktop.Platform",
	"runtime-version":"22.08",
	"sdk": "org.freedesktop.Sdk",
	"command": "fteqw",

	"//": "NOTE: you will likely need to change this line for a TC, and provide your own",
	"rename-desktop-file":"fteqw.desktop",
	"strip":"true",

	"//":"dri needed for gl",
	"//":"ipc supposedly recommended for x11's shm stuff",
	"//":"flatpak doesn't seem to support alsa. anyone not using pipewire is thus fucked, nothing I can do about that",
	"//":"flatpak doesn't seem to support gamepads, at least not on the steamdeck.",
	"//":"filesystem /usr/share/quake seems b0rked, we can't find standard gamedata there. still using 'host' because steam might have your game library on some other partition/device other than home.",
	"//":"we request network... cos we ARE a game...",
	"//":"--filesystem=host",
	"finish-args": [
		"--share=network",

		"--device=dri",

		"--share=ipc",
		"--socket=x11",

		"--socket=wayland",

		"--socket=pulseaudio"
	],
	"modules": [
		{
			"name": "fteqw",
			"buildsystem": "cmake",

			"//":"Using sdl to provide game controller support eg for steamdeck etc (FIXME: see above complaint about gamepads being unusable in flatpak...). This may result in some clipboard issues as flatpak's sdl is a little too old (and sdl sucked in delaying proper support).",
			"//":"Server stuff disabled, flatpak is not a good match. commandline tools also disabled for the most part, no .desktop files for those",
			"//":"install to /app/bin instead of /app/games, flatpak just prefers it that way and the distinction isn't useful.",
			"config-opts": ["-DCMAKE_BUILD_TYPE=Release",
							"-DFTE_USE_SDL=true",

							"-DFTE_ENGINE_SERVER_ONLY=false",
							"-DFTE_TOOL_QTV=false",
							"-DFTE_TOOL_MASTER=false",
							"-DFTE_TOOL_HTTPSV=false",
							"-DFTE_TOOL_QCC=true",
							"-DFTE_TOOL_IQM=false",
							"-DFTE_TOOL_IMAGE=false",

							"-DCMAKE_INSTALL_PREFIX=/app",
							"-DCMAKE_INSTALL_FULL_LIBDIR=/app/lib",
							"-DCMAKE_INSTALL_DATAROOTDIR=/app/share",
							"-DFTE_INSTALL_BINDIR=bin"],
			"sources": [
				{
					"type": "git",
					"url": "https://github.com/fte-team/fteqw.git"
				}
			],

			"//":"Add in our manifest file(s) for instabbable TCs.",
			"post-install": [
				"install -d /app/etc/xdg/fteqw/",
				"install games/*.fmf /app/etc/xdg/fteqw/"
			],
			"build-options" : {
                "no-debuginfo": true
            }
		}
	]
}