aboutsummaryrefslogtreecommitdiff
path: root/srcds-pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'srcds-pkgs')
-rw-r--r--srcds-pkgs/compressonator-sdk.nix47
-rw-r--r--srcds-pkgs/default.nix6
-rw-r--r--srcds-pkgs/fakegl.nix7
-rw-r--r--srcds-pkgs/libtxc_dxtn.nix25
-rw-r--r--srcds-pkgs/vtex2.nix42
-rw-r--r--srcds-pkgs/vtflib.nix32
6 files changed, 159 insertions, 0 deletions
diff --git a/srcds-pkgs/compressonator-sdk.nix b/srcds-pkgs/compressonator-sdk.nix
new file mode 100644
index 0000000..bdfd4c5
--- /dev/null
+++ b/srcds-pkgs/compressonator-sdk.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, openexr, glm, mesa }:
+stdenv.mkDerivation rec {
+ pname = "compressonator-sdk";
+ version = "4.5.52";
+
+ src = fetchFromGitHub {
+ owner = "GPUOpen-Tools";
+ repo = "compressonator";
+ rev = "V${version}";
+ hash = "sha256-Vehzdlx39LX3p3z+U1y/ZbKyyPNuye21+RHCY2BbNHg=";
+ };
+
+ nativeBuildInputs = [ cmake pkg-config ];
+ buildInputs = [ openexr glm mesa ];
+
+ cmakeFlags = [
+ "-DOPTION_ENABLE_ALL_APPS=OFF"
+ "-DOPTION_BUILD_CMP_SDK=ON"
+ "-DOPTION_BUILD_KTX2=OFF"
+ ];
+
+ postPatch = ''
+ # the call sites for this are guarded behind ifdef OPTION_CMP_OPENCV but
+ # for some reason the thing itself isn't, and still gets built (???)
+ rm applications/_plugins/common/ssim*
+ sed -i '/ssim/d' applications/_plugins/common/CMakeLists.txt
+ '' + lib.optionalString stdenv.isAarch64 ''
+ # still plenty fast for our purposes
+ sed -i '/Core SIMD/,/target_link_libraries/d' \
+ {build/sdk/,}cmp_core/CMakeLists.txt
+ sed -i '/CGU_BOOL useAVX512/,/return result;/d' \
+ cmp_core/shaders/bc1_cmp.h
+ '';
+
+ installPhase = ''
+ mkdir -p $out/include
+ mv lib $out/
+ mv ../cmp_compressonatorlib/compressonator.h $out/include/
+ '';
+
+ meta = {
+ homepage = src.url;
+ description = "Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs";
+ license = with lib.licenses; [ mit asl20 ];
+ platforms = lib.platforms.unix;
+ };
+} \ No newline at end of file
diff --git a/srcds-pkgs/default.nix b/srcds-pkgs/default.nix
index dc402a9..2aa040b 100644
--- a/srcds-pkgs/default.nix
+++ b/srcds-pkgs/default.nix
@@ -48,6 +48,12 @@ in {
smlib = callPackage ./plugins/smlib.nix {};
socket = callPackage ./plugins/socket.nix {};
yuuko_votes = callPackage ./plugins/yuuko_votes.nix {};
+
+ libtxc_dxtn = callPackage ./libtxc_dxtn.nix {};
+ compressonator-sdk = callPackage ./compressonator-sdk.nix {};
+ vtex2 = callPackage ./vtex2.nix {};
+ vtflib = callPackage ./vtflib.nix {};
+ fakegl = callPackage ./fakegl.nix {};
}; in
{ lib
, newScope
diff --git a/srcds-pkgs/fakegl.nix b/srcds-pkgs/fakegl.nix
new file mode 100644
index 0000000..e16e8f1
--- /dev/null
+++ b/srcds-pkgs/fakegl.nix
@@ -0,0 +1,7 @@
+{ libGL, runCommand }:
+runCommand "fakegl" {} ''
+ mkdir -p $out/include/{GL,OpenGL}
+ framework=${libGL}/Library/Frameworks/OpenGL.framework/Headers
+ ln -s $framework/gl.h $out/include/GL/
+ ln -s $framework/{gl{ext,types},OpenGLAvailability}.h $out/include/OpenGL/
+''
diff --git a/srcds-pkgs/libtxc_dxtn.nix b/srcds-pkgs/libtxc_dxtn.nix
new file mode 100644
index 0000000..6bd3828
--- /dev/null
+++ b/srcds-pkgs/libtxc_dxtn.nix
@@ -0,0 +1,25 @@
+{ lib, stdenv, fetchurl, autoreconfHook, libGL, libGLU, runCommand, fakegl }:
+stdenv.mkDerivation rec {
+ pname = "libtxc_dxtn";
+ version = "1.0.1";
+
+ src = fetchurl {
+ url = "https://people.freedesktop.org/~cbrill/libtxc_dxtn/${pname}-${version}.tar.bz2";
+ sha256 = "0q5fjaknl7s0z206dd8nzk9bdh8g4p23bz7784zrllnarl90saa5";
+ };
+
+ nativeBuildInputs = [ autoreconfHook ];
+ buildInputs = [ libGL libGLU ] ++ lib.optional stdenv.isDarwin fakegl;
+
+ postPatch = lib.optionalString stdenv.isDarwin ''
+ substituteInPlace Makefile.am --replace \
+ "-avoid-version -module" \
+ "-avoid-version -static"
+ '';
+ meta = with lib; {
+ homepage = "http://dri.freedesktop.org/wiki/S3TC";
+ repositories.git = "git://people.freedesktop.org/~mareko/libtxc_dxtn";
+ license = licenses.mit;
+ platforms = platforms.unix;
+ };
+}
diff --git a/srcds-pkgs/vtex2.nix b/srcds-pkgs/vtex2.nix
new file mode 100644
index 0000000..bbc16d5
--- /dev/null
+++ b/srcds-pkgs/vtex2.nix
@@ -0,0 +1,42 @@
+{ 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
+stdenv.mkDerivation rec {
+ pname = "vtex2";
+ version = "0.2.0";
+
+ src = fetchFromGitHub {
+ owner = "StrataSource";
+ repo = pname;
+ rev = "v${version}";
+ fetchSubmodules = true;
+ hash = "sha256-LcrRGOOYJB2d/NhlfK5jFXcLNwVA0hcrX7zEquna3LA=";
+ };
+
+ 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
+ '';
+
+ nativeBuildInputs = [ cmake ];
+
+ meta = {
+ homepage = src.url;
+ description = "VTF converter and editor";
+ license = lib.licenses.mit;
+ platforms = lib.platforms.unix;
+ };
+}
diff --git a/srcds-pkgs/vtflib.nix b/srcds-pkgs/vtflib.nix
new file mode 100644
index 0000000..a2dd600
--- /dev/null
+++ b/srcds-pkgs/vtflib.nix
@@ -0,0 +1,32 @@
+{ lib, stdenv, fetchFromGitHub, cmake, libtxc_dxtn
+, libGLU, fakegl }:
+let
+ gl = if stdenv.isDarwin then fakegl else libGLU;
+in
+stdenv.mkDerivation rec {
+ pname = "VTFLib";
+ version = "2022-10-08";
+
+ src = fetchFromGitHub {
+ owner = "panzi";
+ repo = pname;
+ rev = "eaca22de46dc62ccfbac6720a68ae3a82b86907e";
+ hash = "sha256-Q2puLqOZSJ2ZO06U8M8Khs4uRzh1vdPptRlzmfi874M=";
+ };
+
+ nativeBuildInputs = [ cmake ];
+ buildInputs = [ libtxc_dxtn gl ];
+
+ postPatch = ''
+ substituteInPlace VTFLib.pc.in --replace \
+ "''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@" \
+ "@CMAKE_INSTALL_FULL_LIBDIR"
+ '';
+
+ meta = {
+ homepage = src.url;
+ description = "Linux port of Nem's VTFLib";
+ license = lib.licenses.lgpl21Plus;
+ platforms = lib.platforms.unix;
+ };
+}