about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarco A L Barbosa <malbarbo@gmail.com>2021-06-18 16:32:56 -0300
committerMarco A L Barbosa <malbarbo@gmail.com>2021-06-18 16:32:56 -0300
commit5df7099df96bff4b0568a2c40137320cbade05ef (patch)
treedc30356975e66fc0c341f5c74adb0492f7ccb2a2
parentd1ac06b0096a548f32808a70ba91d7c1c9941029 (diff)
graphite2: enable static build and check phase
-rw-r--r--pkgs/development/libraries/silgraphite/graphite2.nix26
1 files changed, 24 insertions, 2 deletions
diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix
index cd737a82a293f..25f4b5e131773 100644
--- a/pkgs/development/libraries/silgraphite/graphite2.nix
+++ b/pkgs/development/libraries/silgraphite/graphite2.nix
@@ -1,4 +1,11 @@
-{ lib, stdenv, fetchurl, pkg-config, freetype, cmake }:
+{ lib
+, stdenv
+, fetchurl
+, pkg-config
+, freetype
+, cmake
+, static ? stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   version = "1.3.14";
@@ -15,7 +22,22 @@ stdenv.mkDerivation rec {
 
   patches = lib.optionals stdenv.isDarwin [ ./macosx.patch ];
 
-  doCheck = false; # fails, probably missing something
+  cmakeFlags = lib.optionals static [
+    "-DBUILD_SHARED_LIBS=OFF"
+  ];
+
+  # Remove a test that fails to statically link (undefined reference to png and
+  # freetype symbols)
+  postConfigure = lib.optionals static ''
+    sed -e '/freetype freetype.c/d' -i ../tests/examples/CMakeLists.txt
+  '';
+
+  preCheck = ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/src/
+    export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/src/
+  '';
+
+  doCheck = true;
 
   meta = with lib; {
     description = "An advanced font engine";