aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--srcds-pkgs/default.nix1
-rw-r--r--srcds-pkgs/vtex2.nix55
-rw-r--r--srcds-pkgs/vtflib-strata/CMakeLists.txt.append10
-rw-r--r--srcds-pkgs/vtflib-strata/default.nix54
4 files changed, 94 insertions, 26 deletions
diff --git a/srcds-pkgs/default.nix b/srcds-pkgs/default.nix
index 2aa040b..12cd1db 100644
--- a/srcds-pkgs/default.nix
+++ b/srcds-pkgs/default.nix
@@ -53,6 +53,7 @@ in {
compressonator-sdk = callPackage ./compressonator-sdk.nix {};
vtex2 = callPackage ./vtex2.nix {};
vtflib = callPackage ./vtflib.nix {};
+ vtflib-strata = callPackage ./vtflib-strata {};
fakegl = callPackage ./fakegl.nix {};
}; in
{ lib
diff --git a/srcds-pkgs/vtex2.nix b/srcds-pkgs/vtex2.nix
index bbc16d5..73ef48b 100644
--- a/srcds-pkgs/vtex2.nix
+++ b/srcds-pkgs/vtex2.nix
@@ -1,38 +1,41 @@
-{ lib, stdenv, fetchFromGitHub, cmake, compressonator-sdk }:
-let
- cmplibs = "CMP_Compressonator" + lib.optionalString (!stdenv.isAarch64)
- " CMP_Core CMP_Core_SSE CMP_Core_AVX CMP_Core_AVX512";
-in
+{ lib, stdenv, fetchFromGitHub, cmake, qt6, fmt, vtflib-strata }:
stdenv.mkDerivation rec {
pname = "vtex2";
- version = "0.2.0";
-
+ version = "0.3.1";
+
src = fetchFromGitHub {
owner = "StrataSource";
repo = pname;
rev = "v${version}";
- fetchSubmodules = true;
- hash = "sha256-LcrRGOOYJB2d/NhlfK5jFXcLNwVA0hcrX7zEquna3LA=";
+ fetchSubmodules = false;
+ hash = "sha256-u5Tnz4zrOr04jUXYyD4trYne4QiaX40SZM7FAn/kkCk=";
};
-
- cmakeFlags = [ "-DBUILD_GUI=OFF" ];
-
- postPatch = ''
- sed -E -i 's/_?stricmp/strcasecmp/g' \
- external/vtflib/VTFLib/VMT{Wrapper,GroupNode}.cpp
-
- sed -i 's/--no-undefined/-undefined,error/' \
- external/vtflib/CMakeLists.txt
- sed -i 's/CMP_Compressonator/${cmplibs}/' \
- external/vtflib/CMakeLists.txt
- cp ${compressonator-sdk}/lib/libCMP_*.a \
- external/vtflib/thirdparty/lib/x64/
- cp ${compressonator-sdk}/include/compressonator.h \
- external/vtflib/thirdparty/include/Compressonator.h
+
+ cmakeFlags = [ "-DBUILD_GUI=ON" ];
+ nativeBuildInputs = [ cmake qt6.wrapQtAppsHook ];
+ buildInputs = with qt6; [ qtbase qtsvg qtwayland ];
+ dontWrapQtApps = true;
+
+ postUnpack = ''
+ rm -rf source/external/{fmt,vtf}lib
+ cp -r ${fmt.src} source/external/fmtlib
+ cp -r ${vtflib-strata.src} source/external/vtflib
+ chmod -R +w source
+ '';
+
+ preConfigure = ''
+ pwd
+ ls -l
+ '';
+
+ postInstall = ''
+ rm -rf $out/{include,lib}
'';
- nativeBuildInputs = [ cmake ];
-
+ postFixup = ''
+ wrapQtApp $out/bin/vtfview
+ '';
+
meta = {
homepage = src.url;
description = "VTF converter and editor";
diff --git a/srcds-pkgs/vtflib-strata/CMakeLists.txt.append b/srcds-pkgs/vtflib-strata/CMakeLists.txt.append
new file mode 100644
index 0000000..d5e5285
--- /dev/null
+++ b/srcds-pkgs/vtflib-strata/CMakeLists.txt.append
@@ -0,0 +1,10 @@
+file(GLOB_RECURSE VTFLIB_INCLUDES "lib/*.h")
+set_target_properties(vtflib_static
+ PROPERTIES
+ PUBLIC_HEADER "${VTFLIB_INCLUDES}"
+)
+install (TARGETS vtflib vtflib_static
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ PUBLIC_HEADER DESTINATION include
+)
diff --git a/srcds-pkgs/vtflib-strata/default.nix b/srcds-pkgs/vtflib-strata/default.nix
new file mode 100644
index 0000000..b8c1f77
--- /dev/null
+++ b/srcds-pkgs/vtflib-strata/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchFromGitHub, runCommand
+, cmake, compressonator-sdk
+}:
+stdenv.mkDerivation rec {
+ pname = "vtflib-strata";
+ version = "2024-05-31";
+
+ src = let
+ cmplibs = "CMP_Compressonator" + lib.optionalString (!stdenv.isAarch64)
+ " CMP_Core CMP_Core_SSE CMP_Core_AVX CMP_Core_AVX512";
+ osrc = fetchFromGitHub {
+ owner = "StrataSource";
+ repo = "vtflib";
+ rev = "418b1fc341f0912c86fb31867c91dbfd19beff66";
+ hash = "sha256-/oSHgI2F/IJRHVoxq2emfzzTI4fM4Co3V49+GU6ZKbQ=";
+ };
+ in runCommand "vtflib-strata-source-revendored" {} ''
+ cp -r ${osrc} $out
+ chmod -R +w $out
+
+ sed -E -i 's/_?stricmp/strcasecmp/g' \
+ $out/VTFLib/VMT{Wrapper,GroupNode}.cpp
+ sed -i 's/--no-undefined/-undefined,error/' \
+ $out/CMakeLists.txt
+ sed -i 's/CMP_Compressonator/${cmplibs}/' \
+ $out/CMakeLists.txt
+ cp ${compressonator-sdk}/lib/libCMP_*.a \
+ $out/thirdparty/lib/x64/
+ cp ${compressonator-sdk}/include/compressonator.h \
+ $out/thirdparty/include/Compressonator.h
+
+ chmod -R -w $out
+ '';
+
+ postPatch = ''
+ cat ${./CMakeLists.txt.append} >> CMakeLists.txt
+ '';
+
+ nativeBuildInputs = [ cmake ];
+
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out
+ cmake --install .
+ runHook postInstall
+ '';
+
+ meta = {
+ homepage = src.url;
+ description = "C and C++ API for reading and writing Valve VTF and VMT format image files";
+ license = with lib.licenses; [ lgpl2 gpl2 ];
+ platforms = lib.platforms.unix;
+ };
+}