From 8734e020db92bb0102f30a87f402e1d23d948f4f Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Fri, 18 Jul 2008 14:52:20 +0000
Subject: [PATCH] * ghostscript: force the use of the -fpic flag, otherwise it
 doesn't   build on x86_64-linux.

svn path=/nixpkgs/trunk/; revision=12380
---
 pkgs/misc/ghostscript/builder.sh  |  1 -
 pkgs/misc/ghostscript/default.nix | 10 ++++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/pkgs/misc/ghostscript/builder.sh b/pkgs/misc/ghostscript/builder.sh
index 41b071126822..a1f84f3d80d1 100644
--- a/pkgs/misc/ghostscript/builder.sh
+++ b/pkgs/misc/ghostscript/builder.sh
@@ -6,7 +6,6 @@ preConfigure() {
     rm -rf ijs/ltmain.sh
 }
 
-installPhase=installPhase
 installPhase() {
     make install install-so install-data install-doc install-man
 }
diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix
index c3120d04bb72..1c0c82a94a33 100644
--- a/pkgs/misc/ghostscript/default.nix
+++ b/pkgs/misc/ghostscript/default.nix
@@ -6,6 +6,7 @@ assert x11Support -> x11 != null;
 
 stdenv.mkDerivation rec {
   name = "ghostscript-8.62.0";
+  
   builder = ./builder.sh;
   
   src = fetchurl {
@@ -25,15 +26,16 @@ stdenv.mkDerivation rec {
     # ... add other fonts here
   ];
 
-  buildInputs = [
-    libjpeg libpng zlib
-    (if x11Support then x11 else null)
-  ];
+  buildInputs = [libjpeg libpng zlib]
+    ++ stdenv.lib.optional x11Support x11;
 
   configureFlags = "
+    --disable-static
     ${if x11Support then "--with-x" else "--without-x"}
   ";
 
+  NIX_CFLAGS_COMPILE = "-fpic";
+
   patches = [
 
     # This patch is required to make Ghostscript at least build in a