about summary refs log tree commit diff
path: root/pkgs/development/libraries/glm/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/glm/default.nix')
-rw-r--r--pkgs/development/libraries/glm/default.nix47
1 files changed, 12 insertions, 35 deletions
diff --git a/pkgs/development/libraries/glm/default.nix b/pkgs/development/libraries/glm/default.nix
index 417d70d621b69..3894db5ab9c81 100644
--- a/pkgs/development/libraries/glm/default.nix
+++ b/pkgs/development/libraries/glm/default.nix
@@ -1,61 +1,40 @@
 { lib
 , stdenv
 , fetchFromGitHub
-, fetchpatch
 , cmake
 }:
 
 stdenv.mkDerivation rec {
-  version = "0.9.9.8";
+  version = "1.0.1";
   pname = "glm";
 
   src = fetchFromGitHub {
     owner = "g-truc";
     repo = pname;
     rev = version;
-    sha256 = "sha256-F//+3L5Ozrw6s7t4LrcUmO7sN30ZSESdrPAYX57zgr8=";
+    sha256 = "sha256-GnGyzNRpzuguc3yYbEFtYLvG+KiCtRAktiN+NvbOICE=";
   };
 
-  # (https://github.com/g-truc/glm/pull/986 wasn't enough, and -Werror is used)
-  # (https://github.com/g-truc/glm/pull/1055 neither)
-  patches = [
-    (fetchpatch {
-      name = "glm-0.9.9.8-clang.patch";
-      url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/glm/files/glm-0.9.9.8-clang.patch?id=79476d4b145a4a6b0cbc0e73a6cefb5d584bf8fa";
-      hash = "sha256-D8O+qofnGUEaH5nQGdNddwHyr5FhPQa/lOup4z4SFgY=";
-    })
-  ];
-
   outputs = [ "out" "doc" ];
 
   nativeBuildInputs = [ cmake ];
 
-  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102823
-  env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") "-fno-ipa-modref";
+  env.NIX_CFLAGS_COMPILE =
+    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102823
+    if (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") then "-fno-ipa-modref"
+    # Fix compilation errors on darwin
+    else if (stdenv.cc.isClang) then "-Wno-error"
+    else "";
 
   cmakeFlags = [
-    "-DBUILD_SHARED_LIBS=OFF"
-    "-DBUILD_STATIC_LIBS=OFF"
-    "-DGLM_TEST_ENABLE=${if doCheck then "ON" else "OFF"}"
+    (lib.cmakeBool "BUILD_SHARED_LIBS" false)
+    (lib.cmakeBool "BUILD_STATIC_LIBS" false)
+    (lib.cmakeBool "GLM_TEST_ENABLE" doCheck)
   ];
 
   doCheck = true;
 
-  installPhase = ''
-    runHook preInstall
-
-    # Install header-only library
-    mkdir -p $out/include
-    cp -rv ../glm $out/include
-    rm $out/include/glm/CMakeLists.txt
-    rm $out/include/glm/detail/*.cpp
-
-    # Install CMake files
-    mkdir -p $out/lib
-    cp -rv ../cmake $out/lib
-    substituteInPlace $out/lib/cmake/glm/glmConfig.cmake \
-        --replace 'GLM_INCLUDE_DIRS ''${_IMPORT_PREFIX}' "GLM_INCLUDE_DIRS $out/include"
-
+  postInstall = ''
     # Install pkg-config file
     mkdir -p $out/lib/pkgconfig
     substituteAll ${./glm.pc.in} $out/lib/pkgconfig/glm.pc
@@ -64,8 +43,6 @@ stdenv.mkDerivation rec {
     mkdir -p $doc/share/doc/glm
     cp -rv ../doc/api $doc/share/doc/glm/html
     cp -v ../doc/manual.pdf $doc/share/doc/glm
-
-    runHook postInstall
   '';
 
   meta = with lib; {