From 5df7099df96bff4b0568a2c40137320cbade05ef Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Fri, 18 Jun 2021 16:32:56 -0300 Subject: [PATCH] graphite2: enable static build and check phase --- .../libraries/silgraphite/graphite2.nix | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix index cd737a82a29..25f4b5e1317 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";