trenchbroom: 2022.1 -> 2023.1
This commit is contained in:
parent
e74e68449c
commit
199d7bd52e
1 changed files with 60 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
|||
{ lib, stdenv, fetchFromGitHub
|
||||
, cmake, ninja, git, pandoc, pkg-config
|
||||
, libGL, libGLU, freeimage
|
||||
{ lib, stdenv, fetchFromGitHub, writeText
|
||||
, cmake, ninja, curl, git, pandoc, pkg-config, unzip, zip
|
||||
, libGL, libGLU, freeimage, freetype, assimp
|
||||
, catch2, fmt, glew, miniz, tinyxml-2, xorg
|
||||
, qtbase, wrapQtAppsHook
|
||||
, copyDesktopItems, makeDesktopItem
|
||||
|
@ -8,38 +8,88 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "TrenchBroom";
|
||||
version = "2022.1";
|
||||
version = "2023.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "TrenchBroom";
|
||||
repo = "TrenchBroom";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-FNpYBfKnY9foPq1+21+382KKXieHksr3tCox251iJn4=";
|
||||
sha256 = "sha256-62xcFKSqxPS+J54+kLo/hewM+Wu/rVBGD8oiECDCJpA=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
# Manually simulate a vcpkg installation so that it can link the libraries
|
||||
# properly.
|
||||
postUnpack =
|
||||
let
|
||||
vcpkg_target = "x64-linux";
|
||||
|
||||
vcpkg_pkgs = [
|
||||
"assimp"
|
||||
"catch2"
|
||||
"fmt"
|
||||
"freeimage"
|
||||
"freetype"
|
||||
"glew"
|
||||
"miniz"
|
||||
"tinyxml2"
|
||||
];
|
||||
|
||||
updates_vcpkg_file = writeText "update_vcpkg_trenchbroom" (
|
||||
lib.concatMapStringsSep "\n" (name: ''
|
||||
Package : ${name}
|
||||
Architecture : ${vcpkg_target}
|
||||
Version : 1.0
|
||||
Status : is installed
|
||||
'') vcpkg_pkgs);
|
||||
in ''
|
||||
export VCPKG_ROOT="$TMP/vcpkg"
|
||||
|
||||
mkdir -p $VCPKG_ROOT/.vcpkg-root
|
||||
mkdir -p $VCPKG_ROOT/installed/${vcpkg_target}/lib
|
||||
mkdir -p $VCPKG_ROOT/installed/vcpkg/updates
|
||||
ln -s ${updates_vcpkg_file} $VCPKG_ROOT/installed/vcpkg/status
|
||||
mkdir -p $VCPKG_ROOT/installed/vcpkg/info
|
||||
${lib.concatMapStrings (name: ''
|
||||
touch $VCPKG_ROOT/installed/vcpkg/info/${name}_1.0_${vcpkg_target}.list
|
||||
'') vcpkg_pkgs}
|
||||
|
||||
ln -s ${assimp.lib}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${catch2}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${fmt}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${freeimage}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${freetype}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${glew.out}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${miniz}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
ln -s ${tinyxml-2}/lib/lib* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
|
||||
'';
|
||||
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}
|
||||
substituteInPlace app/CMakeLists.txt \
|
||||
--replace 'set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")' 'set(CPACK_PACKAGING_INSTALL_PREFIX "'$out'")'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ cmake git pandoc wrapQtAppsHook copyDesktopItems pkg-config ];
|
||||
nativeBuildInputs = [ cmake ninja curl git pandoc wrapQtAppsHook copyDesktopItems pkg-config unzip zip ];
|
||||
buildInputs = [
|
||||
libGL libGLU xorg.libXxf86vm freeimage qtbase catch2 fmt glew miniz tinyxml-2
|
||||
xorg.libSM
|
||||
libGL libGLU xorg.libXxf86vm xorg.libSM
|
||||
freeimage freetype qtbase catch2 fmt
|
||||
glew miniz tinyxml-2 assimp
|
||||
];
|
||||
QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}";
|
||||
QT_QPA_PLATFORM = "offscreen";
|
||||
|
||||
cmakeFlags = [
|
||||
"-DCMAKE_MAKE_PROGRAM=ninja"
|
||||
"-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
"-DVCPKG_MANIFEST_INSTALL=OFF"
|
||||
# https://github.com/TrenchBroom/TrenchBroom/issues/4002#issuecomment-1125390780
|
||||
"-DCMAKE_PREFIX_PATH=cmake/packages"
|
||||
];
|
||||
ninjaFlags = [
|
||||
"TrenchBroom"
|
||||
];
|
||||
preBuild = "export HOME=$(mktemp -d)";
|
||||
|
||||
postInstall = ''
|
||||
pushd $out/share/TrenchBroom/icons
|
||||
|
@ -71,5 +121,6 @@ stdenv.mkDerivation rec {
|
|||
description = "Level editor for Quake-engine based games";
|
||||
license = licenses.gpl3Only;
|
||||
maintainers = with maintainers; [ astro ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue