2021-09-15 18:48:04 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2022-08-07 20:15:30 +00:00
|
|
|
, cmake, ninja, git, pandoc, pkg-config
|
2022-10-13 22:16:16 +00:00
|
|
|
, libGL, libGLU, freeimage
|
2022-08-07 20:15:30 +00:00
|
|
|
, catch2, fmt, glew, miniz, tinyxml-2, xorg
|
2021-09-15 18:48:04 +00:00
|
|
|
, qtbase, wrapQtAppsHook
|
|
|
|
, copyDesktopItems, makeDesktopItem
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "TrenchBroom";
|
2022-08-07 20:15:30 +00:00
|
|
|
version = "2022.1";
|
2021-09-15 18:48:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "TrenchBroom";
|
|
|
|
repo = "TrenchBroom";
|
|
|
|
rev = "v${version}";
|
2022-08-07 20:15:30 +00:00
|
|
|
sha256 = "sha256-FNpYBfKnY9foPq1+21+382KKXieHksr3tCox251iJn4=";
|
2021-09-15 18:48:04 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace common/src/Version.h.in \
|
|
|
|
--subst-var-by APP_VERSION_YEAR ${lib.versions.major version} \
|
|
|
|
--subst-var-by APP_VERSION_NUMBER ${lib.versions.minor version} \
|
|
|
|
--subst-var-by GIT_DESCRIBE v${version}
|
|
|
|
'';
|
|
|
|
|
2022-08-07 20:15:30 +00:00
|
|
|
nativeBuildInputs = [ cmake git pandoc wrapQtAppsHook copyDesktopItems pkg-config ];
|
|
|
|
buildInputs = [
|
2022-10-13 22:16:16 +00:00
|
|
|
libGL libGLU xorg.libXxf86vm freeimage qtbase catch2 fmt glew miniz tinyxml-2
|
2022-08-07 20:15:30 +00:00
|
|
|
xorg.libSM
|
|
|
|
];
|
2021-09-15 18:48:04 +00:00
|
|
|
QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}";
|
|
|
|
QT_QPA_PLATFORM = "offscreen";
|
2022-08-07 20:15:30 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
# https://github.com/TrenchBroom/TrenchBroom/issues/4002#issuecomment-1125390780
|
|
|
|
"-DCMAKE_PREFIX_PATH=cmake/packages"
|
|
|
|
];
|
2021-09-15 18:48:04 +00:00
|
|
|
ninjaFlags = [
|
|
|
|
"TrenchBroom"
|
|
|
|
];
|
|
|
|
preBuild = "export HOME=$(mktemp -d)";
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
pushd $out/share/TrenchBroom/icons
|
|
|
|
|
|
|
|
for F in icon_*.png; do
|
|
|
|
SIZE=$(echo $F|sed -e s/icon_// -e s/.png//)
|
|
|
|
DIR=$out/share/icons/hicolor/$SIZE"x"$SIZE/apps
|
|
|
|
mkdir -p $DIR
|
|
|
|
ln -s ../../../../TrenchBroom/icons/$F $DIR/trenchbroom.png
|
|
|
|
done
|
|
|
|
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "TrenchBroom";
|
|
|
|
desktopName = "TrenchBroom level editor";
|
|
|
|
icon = "trenchbroom";
|
|
|
|
comment = meta.description;
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Development" ];
|
2021-09-15 18:48:04 +00:00
|
|
|
exec = "trenchbroom";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://trenchbroom.github.io/";
|
2022-08-07 20:15:30 +00:00
|
|
|
changelog = "https://github.com/TrenchBroom/TrenchBroom/releases/tag/v${version}";
|
2021-09-15 18:48:04 +00:00
|
|
|
description = "Level editor for Quake-engine based games";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ astro ];
|
|
|
|
};
|
|
|
|
}
|