summary refs log tree commit diff
path: root/pkgs/development/libraries/silgraphite
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/silgraphite')
-rw-r--r--pkgs/development/libraries/silgraphite/default.nix22
-rw-r--r--pkgs/development/libraries/silgraphite/graphite2.nix33
2 files changed, 27 insertions, 28 deletions
diff --git a/pkgs/development/libraries/silgraphite/default.nix b/pkgs/development/libraries/silgraphite/default.nix
deleted file mode 100644
index 9d0aca0ab14..00000000000
--- a/pkgs/development/libraries/silgraphite/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, freetype, libXft, pango, fontconfig }:
-
-stdenv.mkDerivation rec {
-  version = "2.3.1";
-  name = "silgraphite-2.3.1";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/silgraphite/silgraphite/${version}/${name}.tar.gz";
-    sha256 = "9b07c6e91108b1fa87411af4a57e25522784cfea0deb79b34ced608444f2ed65";
-  };
-
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ freetype libXft pango fontconfig];
-
-  NIX_CFLAGS_COMPILE = "-I${freetype.dev}/include/freetype2";
-
-  meta = {
-    description = "An advanced font engine";
-    maintainers = [ stdenv.lib.maintainers.raskin ];
-    platforms = stdenv.lib.platforms.linux;
-  };
-}
diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix
index 564c32bf10d..25f4b5e1317 100644
--- a/pkgs/development/libraries/silgraphite/graphite2.nix
+++ b/pkgs/development/libraries/silgraphite/graphite2.nix
@@ -1,4 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, freetype, cmake, python }:
+{ lib
+, stdenv
+, fetchurl
+, pkg-config
+, freetype
+, cmake
+, static ? stdenv.hostPlatform.isStatic
+}:
 
 stdenv.mkDerivation rec {
   version = "1.3.14";
@@ -10,15 +17,29 @@ stdenv.mkDerivation rec {
     sha256 = "1790ajyhk0ax8xxamnrk176gc9gvhadzy78qia4rd8jzm89ir7gr";
   };
 
-  nativeBuildInputs = [ pkgconfig cmake ];
+  nativeBuildInputs = [ pkg-config cmake ];
   buildInputs = [ freetype ];
 
-  patches = stdenv.lib.optionals stdenv.isDarwin [ ./macosx.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./macosx.patch ];
 
-  checkInputs = [ python ];
-  doCheck = false; # fails, probably missing something
+  cmakeFlags = lib.optionals static [
+    "-DBUILD_SHARED_LIBS=OFF"
+  ];
 
-  meta = with stdenv.lib; {
+  # 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";
     maintainers = [ maintainers.raskin ];
     platforms = platforms.unix;