summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/acl/default.nix2
-rw-r--r--pkgs/development/libraries/apr-util/default.nix4
-rw-r--r--pkgs/development/libraries/apr/default.nix14
-rw-r--r--pkgs/development/libraries/atk/default.nix6
-rw-r--r--pkgs/development/libraries/attr/default.nix2
-rw-r--r--pkgs/development/libraries/boehm-gc/default.nix8
-rw-r--r--pkgs/development/libraries/cairo/default.nix9
-rw-r--r--pkgs/development/libraries/freetype/default.nix8
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix10
-rw-r--r--pkgs/development/libraries/gettext/default.nix2
-rw-r--r--pkgs/development/libraries/glib/default.nix6
-rw-r--r--pkgs/development/libraries/glib/setup-hook.sh17
-rw-r--r--pkgs/development/libraries/glibc/builder.sh17
-rw-r--r--pkgs/development/libraries/glibc/common.nix5
-rw-r--r--pkgs/development/libraries/glibc/default.nix2
-rw-r--r--pkgs/development/libraries/glibc/locales.nix2
-rw-r--r--pkgs/development/libraries/gmime/default.nix4
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix2
-rw-r--r--pkgs/development/libraries/gobject-introspection/default.nix4
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix4
-rw-r--r--pkgs/development/libraries/jasper/default.nix10
-rw-r--r--pkgs/development/libraries/libav/default.nix8
-rw-r--r--pkgs/development/libraries/libdrm/default.nix2
-rw-r--r--pkgs/development/libraries/libelf/default.nix16
-rw-r--r--pkgs/development/libraries/libffi/default.nix12
-rw-r--r--pkgs/development/libraries/libjpeg-turbo/default.nix8
-rw-r--r--pkgs/development/libraries/libjpeg/default.nix2
-rw-r--r--pkgs/development/libraries/libogg/default.nix2
-rw-r--r--pkgs/development/libraries/libpng/default.nix7
-rw-r--r--pkgs/development/libraries/libsamplerate/default.nix6
-rw-r--r--pkgs/development/libraries/libsndfile/default.nix4
-rw-r--r--pkgs/development/libraries/libtiff/default.nix2
-rw-r--r--pkgs/development/libraries/libvorbis/default.nix2
-rw-r--r--pkgs/development/libraries/mesa/default.nix2
-rw-r--r--pkgs/development/libraries/mpfr/default.nix2
-rw-r--r--pkgs/development/libraries/openssl/default.nix28
-rw-r--r--pkgs/development/libraries/pango/default.nix7
-rw-r--r--pkgs/development/libraries/pcre/default.nix8
-rw-r--r--pkgs/development/libraries/speex/default.nix11
-rw-r--r--pkgs/development/libraries/zlib/default.nix10
40 files changed, 208 insertions, 69 deletions
diff --git a/pkgs/development/libraries/acl/default.nix b/pkgs/development/libraries/acl/default.nix
index d37d8926fbd..4055708907b 100644
--- a/pkgs/development/libraries/acl/default.nix
+++ b/pkgs/development/libraries/acl/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "08qd9s3wfhv0ajswsylnfwr5h0d7j9d4rgip855nrh400nxp940p";
   };
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   nativeBuildInputs = [ gettext ];
   buildInputs = [ attr ];
 
diff --git a/pkgs/development/libraries/apr-util/default.nix b/pkgs/development/libraries/apr-util/default.nix
index 0f21af94c64..e504aab0848 100644
--- a/pkgs/development/libraries/apr-util/default.nix
+++ b/pkgs/development/libraries/apr-util/default.nix
@@ -24,11 +24,13 @@ stdenv.mkDerivation rec {
   configureFlags = ''
     --with-apr=${apr} --with-expat=${expat}
     --with-crypto
-    ${stdenv.lib.optionalString sslSupport "--with-openssl=${openssl}"}
+    ${stdenv.lib.optionalString sslSupport "--with-openssl"}
     ${stdenv.lib.optionalString bdbSupport "--with-berkeley-db=${db}"}
     ${stdenv.lib.optionalString ldapSupport "--with-ldap"}
   '';
 
+  buildInputs = stdenv.lib.optional sslSupport openssl;
+
   propagatedBuildInputs = [ makeWrapper apr expat libiconv ]
     ++ optional sslSupport openssl
     ++ optional bdbSupport db
diff --git a/pkgs/development/libraries/apr/default.nix b/pkgs/development/libraries/apr/default.nix
index 3810a47fac3..2bf39f0eb26 100644
--- a/pkgs/development/libraries/apr/default.nix
+++ b/pkgs/development/libraries/apr/default.nix
@@ -10,6 +10,13 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optionals stdenv.isDarwin [ ./is-this-a-compiler-bug.patch ];
 
+  outputs = [ "dev" "out" ];
+
+  preConfigure =
+    ''
+      configureFlagsArray+=("--with-installbuilddir=$dev/share/build")
+    '';
+
   configureFlags =
     # Including the Windows headers breaks unistd.h.
     # Based on ftp://sourceware.org/pub/cygwin/release/libapr1/libapr1-1.3.8-2-src.tar.bz2
@@ -17,6 +24,13 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  postInstall =
+    ''
+      mkdir $dev/bin $dev/lib
+      mv $out/bin/apr-1-config $dev/bin
+      mv $out/lib/pkgconfig $dev/lib
+    '';
+
   meta = {
     homepage = http://apr.apache.org/;
     description = "The Apache Portable Runtime library";
diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix
index ce7f92a2035..d6b080050be 100644
--- a/pkgs/development/libraries/atk/default.nix
+++ b/pkgs/development/libraries/atk/default.nix
@@ -12,6 +12,10 @@ stdenv.mkDerivation rec {
     sha256 = "13zijfcmx7sda83qkryzsmr9hw0r3b73xkagq9cmm733fhcl7a28";
   };
 
+  enableParallelBuilding = true;
+
+  outputs = [ "dev" "out" "doc" ];
+
   buildInputs = libintlOrEmpty;
 
   nativeBuildInputs = [ pkgconfig perl ];
@@ -20,8 +24,6 @@ stdenv.mkDerivation rec {
 
   #doCheck = true; # no checks in there (2.10.0)
 
-  postInstall = "rm -rf $out/share/gtk-doc";
-
   meta = {
     description = "Accessibility toolkit";
 
diff --git a/pkgs/development/libraries/attr/default.nix b/pkgs/development/libraries/attr/default.nix
index 8d87e2ee50d..e4e9142b632 100644
--- a/pkgs/development/libraries/attr/default.nix
+++ b/pkgs/development/libraries/attr/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "0nd8y0m6awc9ahv0ciiwf8gy54c8d3j51pw9xg7f7cn579jjyxr5";
   };
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   nativeBuildInputs = [ gettext ];
 
   configureFlags = "MAKE=make MSGFMT=msgfmt MSGMERGE=msgmerge XGETTEXT=xgettext ECHO=echo SED=sed AWK=gawk";
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index d71440a61d8..08937019547 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "119x7p1cqw40mpwj80xfq879l9m1dkc7vbc1f3bz3kvkf8bf6p16";
   };
 
+  outputs = [ "dev" "out" "doc" ];
+
   configureFlags =
     [ "--enable-cplusplus" ]
     ++ lib.optional enableLargeConfig "--enable-large-config";
@@ -17,6 +19,12 @@ stdenv.mkDerivation rec {
   # Don't run the native `strip' when cross-compiling.
   dontStrip = stdenv ? cross;
 
+  postInstall =
+    ''
+      mkdir -p $out/share/doc
+      mv $out/share/gc $out/share/doc/gc
+    '';
+
   meta = {
     description = "The Boehm-Demers-Weiser conservative garbage collector for C and C++";
 
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index 89c791fae02..0d0d5a55ae8 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -18,6 +18,8 @@ stdenv.mkDerivation rec {
     sha1 = "c8da68aa66ca0855b5d0ff552766d3e8679e1d24";
   };
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   nativeBuildInputs = [ pkgconfig libiconv ] ++ libintlOrEmpty;
 
   propagatedBuildInputs =
@@ -53,12 +55,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # The default `--disable-gtk-doc' is ignored.
-  postInstall = "rm -rf $out/share/gtk-doc"
-    + stdenv.lib.optionalString stdenv.isDarwin (''
-      #newline
-    '' + glib.flattenInclude
-    );
+  postInstall = stdenv.lib.optionalString stdenv.isDarwin glib.flattenInclude;
 
   meta = {
     description = "A 2D graphics library with support for multiple output devices";
diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix
index e9e393075b3..dccde33efcf 100644
--- a/pkgs/development/libraries/freetype/default.nix
+++ b/pkgs/development/libraries/freetype/default.nix
@@ -31,12 +31,16 @@ stdenv.mkDerivation rec {
       (fetch_bohoomil "04-infinality-2.5.4-2014.12.07.patch" "1gph7z9s2221gy5dxn01v3lga0m9yib8yqsaqj5km74bqx1vlalh")
     ];
 
+  outputs = [ "dev" "out" ];
+
   propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype
   # dependence on harfbuzz is looser than the reverse dependence
   buildInputs = [ pkgconfig which ]
     # FreeType requires GNU Make, which is not part of stdenv on FreeBSD.
     ++ optional (!stdenv.isLinux) gnumake;
 
+  configureFlags = "--disable-static --bindir=$(dev)/bin";
+
   # from Gentoo, see https://bugzilla.redhat.com/show_bug.cgi?id=506840
   NIX_CFLAGS_COMPILE = "-fno-strict-aliasing";
   # The asm for armel is written with the 'asm' keyword.
@@ -47,8 +51,8 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   # compat hacks
-  postInstall = glib.flattenInclude + ''
-    ln -s . "$out"/include/freetype
+  postFixup = glib.flattenInclude + ''
+    ln -s . "$dev"/include/freetype
   '';
 
   crossAttrs = {
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index da6a3ad1dff..69d39855699 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -13,8 +13,12 @@ stdenv.mkDerivation rec {
     sha256 = "ddd861747bb7c580acce7cfa3ce38c3f52a9516e66a6477988fd100c8fb9eabc";
   };
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   setupHook = ./setup-hook.sh;
 
+  enableParallelBuilding = true;
+
   # !!! We might want to factor out the gdk-pixbuf-xlib subpackage.
   buildInputs = [ libX11 libintlOrEmpty ];
 
@@ -28,7 +32,11 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  postInstall = "rm -rf $out/share/gtk-doc";
+  # propagate the bin output
+  postPhases = "postPostFixup";
+  postPostFixup = ''
+    echo -n " $bin" >> "$dev"/nix-support/propagated-*build-inputs
+  '';
 
   meta = {
     description = "A library for image loading and manipulation";
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 8f6277ca2e9..b48ea97abba 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation (rec {
     fi
   '';
 
-  buildInputs = [ xz ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv;
+  buildInputs = [ xz xz.bin ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv;
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 91832ac650e..939f3969665 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -53,9 +53,11 @@ stdenv.mkDerivation rec {
 
   patches = optional stdenv.isDarwin ./darwin-compilation.patch ++ optional doCheck ./skip-timer-test.patch;
 
+  #outputs = [ "dev" "out" "bin" ]; # ToDo: no idea what's wrong! docs? 
+
   setupHook = ./setup-hook.sh;
 
-  buildInputs = [ libelf ]
+  buildInputs = [ /*stdenv.hookLib.multiout*/ libelf ]
     ++ optionals doCheck [ tzdata libxml2 desktop_file_utils shared_mime_info ];
 
   nativeBuildInputs = [ pkgconfig gettext perl python ];
@@ -97,8 +99,6 @@ stdenv.mkDerivation rec {
        sed -e '/g_subprocess_launcher_set_environ (launcher, envp);/a g_subprocess_launcher_setenv (launcher, "PATH", g_getenv("PATH"), TRUE);' -i gio/tests/gsubprocess.c
     '';
 
-  postInstall = ''rm -rvf $out/share/gtk-doc'';
-
   passthru = {
      gioModuleDir = "lib/gio/modules";
      inherit flattenInclude;
diff --git a/pkgs/development/libraries/glib/setup-hook.sh b/pkgs/development/libraries/glib/setup-hook.sh
index f173744e5ca..91411e68dd2 100644
--- a/pkgs/development/libraries/glib/setup-hook.sh
+++ b/pkgs/development/libraries/glib/setup-hook.sh
@@ -14,4 +14,19 @@ glibPreFixupPhase() {
     addToSearchPath GSETTINGS_SCHEMAS_PATH "$out/share/gsettings-schemas/$name"
 }
 
-preFixupPhases="$preFixupPhases glibPreFixupPhase"
+preFixupPhases+=(glibPreFixupPhase)
+
+
+preFixupHooks+=(_multioutGtkDocs)
+
+# Move documentation to the desired outputs.
+_multioutGtkDocs() {
+    if [ "$outputs" = "out" ]; then return; fi;
+    _moveToOutput share/gtk-doc "${!outputDoc}"
+
+    # Remove empty share directory.
+    if [ -d "$out/share" ]; then
+        rmdir "$out/share" 2> /dev/null || true
+    fi
+}
+
diff --git a/pkgs/development/libraries/glibc/builder.sh b/pkgs/development/libraries/glibc/builder.sh
index 2836063e3bf..46f47d9b99c 100644
--- a/pkgs/development/libraries/glibc/builder.sh
+++ b/pkgs/development/libraries/glibc/builder.sh
@@ -12,8 +12,10 @@ postConfigure() {
 
     export NIX_DONT_SET_RPATH=1
     unset CFLAGS
-}
 
+    # Apparently --bindir is not respected.
+    makeFlagsArray+=("bindir=$bin/bin" "sbindir=$bin/sbin" "rootsbindir=$bin/sbin")
+}
 
 postInstall() {
     if test -n "$installLocales"; then
@@ -27,7 +29,7 @@ postInstall() {
     if test -z "$hurdHeaders"; then
         # Include the Linux kernel headers in Glibc, except the `scsi'
         # subdirectory, which Glibc provides itself.
-        (cd $out/include && \
+        (cd $dev/include && \
          ln -sv $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
     fi
 
@@ -48,6 +50,17 @@ postInstall() {
 
     # Get rid of more unnecessary stuff.
     rm -rf $out/var $out/sbin/sln
+
+    # Put libraries for static linking in a separate output.  Note
+    # that libc_nonshared.a and libpthread_nonshared.a are required
+    # for dynamically-linked applications.
+    mkdir -p $static/lib
+    mv $out/lib/*.a $static/lib
+    mv $static/lib/lib*_nonshared.a $out/lib
+
+    # Work around a Nix bug: hard links across outputs cause a build failure.
+    cp $bin/bin/getconf $bin/bin/getconf_
+    mv $bin/bin/getconf_ $bin/bin/getconf
 }
 
 genericBuild
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index 9a451d48cbc..4bff795ba5f 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -119,7 +119,10 @@ stdenv.mkDerivation ({
 
   installFlags = [ "sysconfdir=$(out)/etc" ];
 
-  buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ]
+  outputs = [ "out" "dev" "bin" "static" ];
+
+  buildInputs = [ ]
+    ++ stdenv.lib.optionals (cross != null) [ gccCross ]
     ++ stdenv.lib.optional (mig != null) mig
     ++ stdenv.lib.optionals withGd [ gd libpng ];
 
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index f60df4a30d6..8322ccefff3 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -96,7 +96,7 @@ in
 
       # To avoid a dependency on the build system 'bash'.
       preFixup = ''
-        rm $out/bin/{ldd,tzselect,catchsegv,xtrace}
+        rm $bin/bin/{ldd,tzselect,catchsegv,xtrace}
       '';
     }
    else {}))
diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix
index 5d6e678bfe6..ad522f78668 100644
--- a/pkgs/development/libraries/glibc/locales.nix
+++ b/pkgs/development/libraries/glibc/locales.nix
@@ -25,7 +25,7 @@ build null {
   # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
   buildPhase =
     ''
-      mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
+      mkdir -p $TMPDIR/"${stdenv.gcc.libc}/lib/locale"
 
       # Hack to allow building of the locales (needed since glibc-2.12)
       sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
diff --git a/pkgs/development/libraries/gmime/default.nix b/pkgs/development/libraries/gmime/default.nix
index 6564fc51186..93bad0059b7 100644
--- a/pkgs/development/libraries/gmime/default.nix
+++ b/pkgs/development/libraries/gmime/default.nix
@@ -8,9 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "0rfzbgsh8ira5p76kdghygl5i3fvmmx4wbw5rp7f8ajc4vxp18g0";
   };
 
+  outputs = [ "dev" "out" "doc" ];
+
   nativeBuildInputs = [ pkgconfig ];
   propagatedBuildInputs = [ glib zlib libgpgerror ];
 
+  enableParallelBuilding = true;
+
   meta = {
     homepage = http://spruce.sourceforge.net/gmime/;
     description = "A C/C++ library for manipulating MIME messages";
diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index 0df1a4f8cd8..ae8ae7c0f18 100644
--- a/pkgs/development/libraries/gmp/5.1.x.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
     sha256 = "0q5i39pxrasgn9qdxzpfbwhh11ph80p57x6hf48m74261d97j83m";
   };
 
+  outputs = [ "out" "info" ];
+
   nativeBuildInputs = [ m4 ];
 
   patches = if stdenv.isDarwin then [ ./need-size-t.patch ] else null;
diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix
index 8263ee7071c..0dcf6e9f0d5 100644
--- a/pkgs/development/libraries/gobject-introspection/default.nix
+++ b/pkgs/development/libraries/gobject-introspection/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
     sha256 = "162flbzwzz0b8axab2gimc4dglpaw88fh1d177zfg0whczlpbsln";
   };
 
+  outputs = [ "dev" "out" "doc" ];
+
   buildInputs = [ flex bison pkgconfig python ]
     ++ libintlOrEmpty
     ++ stdenv.lib.optional stdenv.isDarwin otool;
@@ -25,8 +27,6 @@ stdenv.mkDerivation rec {
   # other dependencies).
   configureFlags = [ "--disable-tests" ];
 
-  postInstall = "rm -rf $out/share/gtk-doc";
-
   setupHook = ./setup-hook.sh;
 
   patches = [ ./absolute_shlib_path.patch ];
diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index 774193cc06c..16691e8588c 100644
--- a/pkgs/development/libraries/gtk+/2.x.nix
+++ b/pkgs/development/libraries/gtk+/2.x.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
     sha256 = "1x14rnjvqslpa1q19fp1qalz5sxds72amsgjk8m7769rwk511jr0";
   };
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   enableParallelBuilding = true;
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (libintlOrEmpty != []) "-lintl";
@@ -35,8 +37,6 @@ stdenv.mkDerivation rec {
     then "--disable-glibtest --disable-introspection --disable-visibility"
     else "--with-xinput=yes";
 
-  postInstall = "rm -rf $out/share/gtk-doc";
-
   passthru = {
     gtkExeEnvPostBuild = ''
       rm $out/lib/gtk-2.0/2.10.0/immodules.cache
diff --git a/pkgs/development/libraries/jasper/default.nix b/pkgs/development/libraries/jasper/default.nix
index 7b86403b0aa..a642c0acb34 100644
--- a/pkgs/development/libraries/jasper/default.nix
+++ b/pkgs/development/libraries/jasper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip, xlibs, libjpeg }:
+{ stdenv, fetchurl, autoreconfHook, unzip, xlibs, libjpeg }:
 
 stdenv.mkDerivation rec {
   name = "jasper-1.900.1";
@@ -17,11 +17,15 @@ stdenv.mkDerivation rec {
     ./jasper-CVE-2014-9029.diff
   ];
 
-  nativeBuildInputs = [unzip];
+  nativeBuildInputs = [ unzip autoreconfHook ];
   propagatedBuildInputs = [ libjpeg ];
 
   configureFlags = "--enable-shared";
-  
+
+  outputs = [ "dev" "out" "man" "bin" ];
+
+  enableParallelBuilding = true;
+
   meta = {
     homepage = https://www.ece.uvic.ca/~frodo/jasper/;
     description = "JPEG2000 Library";
diff --git a/pkgs/development/libraries/libav/default.nix b/pkgs/development/libraries/libav/default.nix
index 41a8b391eb3..d0a40d7e8d0 100644
--- a/pkgs/development/libraries/libav/default.nix
+++ b/pkgs/development/libraries/libav/default.nix
@@ -10,7 +10,7 @@
 , vaapiSupport  ? false,  libva     ? null # ToDo: it has huge closure
 , vdpauSupport  ? true,   libvdpau  ? null
 , freetypeSupport ? true, freetype  ? null # it's small and almost everywhere
-, SDL # only for avplay in $tools, adds nontrivial closure to it
+, SDL # only for avplay in $bin, adds nontrivial closure to it
 , enableGPL ? true # ToDo: some additional default stuff may need GPL
 , enableUnfree ? faacSupport
 }:
@@ -77,12 +77,12 @@ let
 
     enableParallelBuilding = true;
 
-    outputs = [ "out" "tools" ];
+    outputs = [ "dev" "out" "bin" ]; #TODO: re-check
 
     # move avplay to get rid of the SDL dependency in the main output
     postInstall = ''
-      mkdir -p "$tools/bin"
-      mv "$out/bin/avplay" "$tools/bin"
+      mkdir -p "$bin/bin"
+      mv "$out/bin/avplay" "$bin/bin"
     '';
 
     doInstallCheck = false; # fails randomly
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 5ffdd9303e0..c3608c1aea3 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "12cqnmssi6mbr93n29mm84k8wix5nx6zs82k7wcmj7z3r335ymwr";
   };
 
+  outputs = [ "dev" "out" ];
+
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libpthreadstubs libpciaccess ]
     ++ stdenv.lib.optional stdenv.isLinux udev;
diff --git a/pkgs/development/libraries/libelf/default.nix b/pkgs/development/libraries/libelf/default.nix
index 4a34ac6bdec..686b444e430 100644
--- a/pkgs/development/libraries/libelf/default.nix
+++ b/pkgs/development/libraries/libelf/default.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, gettext, glibc }:
 
-stdenv.mkDerivation (rec {
+stdenv.mkDerivation rec {
   name = "libelf-0.8.13";
 
   src = fetchurl {
@@ -15,6 +15,11 @@ stdenv.mkDerivation (rec {
     nativeBuildInputs = [ glibc ];
   };
 
+  # Libelf's custom NLS macros fail to determine the catalog file extension on
+  # Darwin, so disable NLS for now.
+  # FIXME: Eventually make Gettext a build input on all platforms.
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-nls";
+
   meta = {
     description = "ELF object file access library";
 
@@ -26,12 +31,3 @@ stdenv.mkDerivation (rec {
     maintainers = [ ];
   };
 }
-
-//
-
-# Libelf's custom NLS macros fail to determine the catalog file extension on
-# Darwin, so disable NLS for now.
-# FIXME: Eventually make Gettext a build input on all platforms.
-(if stdenv.isDarwin
- then { configureFlags = [ "--disable-nls" ]; }
- else { }))
diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix
index bc15e88ba2f..f0226eaaac7 100644
--- a/pkgs/development/libraries/libffi/default.nix
+++ b/pkgs/development/libraries/libffi/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "0dya49bnhianl0r65m65xndz6ls2jn1xngyn72gd28ls3n7bnvnh";
   };
 
+  outputs = [ "dev" "out" "doc" ];
+
   buildInputs = stdenv.lib.optional doCheck dejagnu;
 
   configureFlags = [
@@ -19,9 +21,15 @@ stdenv.mkDerivation rec {
 
   dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling.
 
-  # Install headers in the right place.
+  # Install headers and libs in the right places.
   postInstall = ''
-    ln -s${if (stdenv.isFreeBSD || stdenv.isOpenBSD || stdenv.isDarwin) then "" else "r"}v "$out/lib/"libffi*/include "$out/include"
+    mv "$out"/lib64/* "$out/lib"
+    rmdir "$out/lib64"
+    ln -s lib "$out/lib64"
+
+    mkdir -p "$dev/"
+    mv "$out/lib/${name}/include" "$dev/include"
+    rmdir "$out/lib/${name}"
   '';
 
   meta = {
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index 6a650de8564..4ce79a0f894 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, nasm }:
+{ stdenv, fetchurl, nasm, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "libjpeg-turbo-1.4.0";
@@ -8,7 +8,11 @@ stdenv.mkDerivation rec {
     sha256 = "1vmv5ciqq98gi2ishqbvlx9hsk7sl06lr6xkcgw480jiddadhfnr";
   };
 
-  buildInputs = [ nasm ];
+  outputs = [ "dev" "out" "doc" "bin" ];
+
+  buildInputs = [ autoreconfHook nasm ];
+
+  enableParallelBuilding = true;
 
   doCheck = true;
   checkTarget = "test";
diff --git a/pkgs/development/libraries/libjpeg/default.nix b/pkgs/development/libraries/libjpeg/default.nix
index bf2ebb27f37..025be200959 100644
--- a/pkgs/development/libraries/libjpeg/default.nix
+++ b/pkgs/development/libraries/libjpeg/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation {
 
   configureFlags = optional static "--enable-static --disable-shared";
 
+  outputs = [ "dev" "out" "man" "bin" ];
+
   meta = {
     homepage = http://www.ijg.org/;
     description = "A library that implements the JPEG image file format";
diff --git a/pkgs/development/libraries/libogg/default.nix b/pkgs/development/libraries/libogg/default.nix
index 57b8b2fc66e..ea2c4226289 100644
--- a/pkgs/development/libraries/libogg/default.nix
+++ b/pkgs/development/libraries/libogg/default.nix
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
   };
 
   meta = with stdenv.lib; {
+
+  outputs = [ "dev" "doc" "out" ];
     homepage = http://xiph.org/ogg/;
     license = licenses.bsd3;
     maintainers = [ maintainers.emery ];
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index 17820fa8188..7a233b6715c 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -18,13 +18,18 @@ in stdenv.mkDerivation rec {
     url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
     inherit sha256;
   };
-
   postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1";
 
+  outputs = [ "dev" "out" "man" ];
+
   propagatedBuildInputs = [ zlib ];
 
+  preConfigure = "export bin=$dev";
+
   doCheck = true;
 
+  postInstall = ''mv "$out/bin" "$dev/bin"'';
+
   passthru = { inherit zlib; };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libsamplerate/default.nix b/pkgs/development/libraries/libsamplerate/default.nix
index 85d51d0ad71..f885024bca0 100644
--- a/pkgs/development/libraries/libsamplerate/default.nix
+++ b/pkgs/development/libraries/libsamplerate/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, fftw, libsndfile }:
+{ stdenv, fetchurl, pkgconfig, libsndfile }:
 
 stdenv.mkDerivation rec {
   name = "libsamplerate-0.1.8";
@@ -9,12 +9,14 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ pkgconfig ];
-  propagatedBuildInputs = [ fftw libsndfile ];
+  propagatedBuildInputs = [ libsndfile ];
 
   # maybe interesting configure flags:
   #--disable-fftw          disable usage of FFTW
   #--disable-cpu-clip      disable tricky cpu specific clipper
 
+  outputs = [ "dev" "bin" "out" ];
+
   postConfigure = stdenv.lib.optionalString stdenv.isDarwin
     ''
       # need headers from the Carbon.framework in /System/Library/Frameworks to
diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix
index 74140d5f335..c4bdc23f937 100644
--- a/pkgs/development/libraries/libsndfile/default.nix
+++ b/pkgs/development/libraries/libsndfile/default.nix
@@ -10,6 +10,10 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ pkgconfig flac libogg libvorbis ];
 
+  enableParallelBuilding = true;
+
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   # need headers from the Carbon.framework in /System/Library/Frameworks to
   # compile this on darwin -- not sure how to handle
   preConfigure = stdenv.lib.optionalString stdenv.isDarwin
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index 7ed9794011c..681d3d97af5 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -32,6 +32,8 @@ stdenv.mkDerivation rec {
     patch -p0 < ${patchDir}/${if stdenv.isDarwin then "tiff-4.0.3" else "*"}-tiff2pdf-colors.patch
   ''; # ^ sh on darwin seems not to expand globs in redirects, and I don't want to rebuild all again elsewhere
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   nativeBuildInputs = [ pkgconfig ];
 
   propagatedBuildInputs = [ zlib libjpeg xz ]; #TODO: opengl support (bogus configure detection)
diff --git a/pkgs/development/libraries/libvorbis/default.nix b/pkgs/development/libraries/libvorbis/default.nix
index 5d3218169d9..0e5cd8b85e8 100644
--- a/pkgs/development/libraries/libvorbis/default.nix
+++ b/pkgs/development/libraries/libvorbis/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "1lg1n3a6r41492r7in0fpvzc7909mc5ir9z0gd3qh2pz4yalmyal";
   };
 
+  outputs = [ "dev" "out" "doc" ];
+
   buildInputs = [ pkgconfig ];
 
   propagatedBuildInputs = [ libogg ];
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 8db89b60f18..39a65886585 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -58,7 +58,7 @@ stdenv.mkDerivation {
       --replace _EGL_DRIVER_SEARCH_DIR '"${driverLink}"'
   '';
 
-  outputs = ["out" "drivers" "osmesa"];
+  outputs = [ "dev" "out" "drivers" "osmesa" ];
 
   configureFlags = [
     "--sysconfdir=/etc"
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index 555351bddc3..06cebf04189 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "0sqvpfkzamxdr87anzakf9dhkfh15lfmm5bsqajk02h1mxh3zivr";
   };
 
+  outputs = [ "dev" "out" "doc" ];
+
   # mpfr.h requires gmp.h
   propagatedBuildInputs = [ gmp ];
 
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 7255e91f282..3504cf5fd97 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -50,7 +50,11 @@ stdenv.mkDerivation {
 
   patches = patchesCross false;
 
-  buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
+  outputs = [ "dev" "out" "man" "bin" ];
+  setOutputFlags = false;
+
+  buildInputs = [ ]
+    ++ stdenv.lib.optional withCryptodev cryptodevHeaders;
 
   nativeBuildInputs = [ perl ];
 
@@ -69,7 +73,7 @@ stdenv.mkDerivation {
     sed -i -e "s|-march=i486|-march=x86-64|g" Makefile
   '';
 
-  makeFlags = "MANDIR=$(out)/share/man";
+  makeFlags = "MANDIR=$(man)/share/man";
 
   # Parallel building is broken in OpenSSL.
   enableParallelBuilding = false;
@@ -81,6 +85,18 @@ stdenv.mkDerivation {
       if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib)" ]; then
           rm $out/lib/*.a
       fi
+
+      mkdir -p $bin
+      mv $out/bin $bin/
+
+      rm -rf $out/etc/ssl/misc
+
+      mkdir $dev
+      mv $out/include $dev/
+
+      # OpenSSL installs readonly files, which otherwise we can't strip.
+      # FIXME: Can remove this after the next stdenv merge.
+      chmod -R +w $out
     ''; # */
 
   crossAttrs = {
@@ -91,14 +107,6 @@ stdenv.mkDerivation {
       export configureFlags="--libdir=lib --cross-compile-prefix=${stdenv.cross.config}- shared ${opensslCrossSystem}"
     '';
 
-    postInstall = ''
-      # Openssl installs readonly files, which otherwise we can't strip.
-      # This could at some stdenv hash change be put out of crossAttrs, too
-      chmod -R +w $out
-
-      # Remove references to perl, to avoid depending on it at runtime
-      rm $out/bin/c_rehash $out/ssl/misc/CA.pl $out/ssl/misc/tsget
-    '';
     configureScript = "./Configure";
   } // stdenv.lib.optionalAttrs (opensslCrossSystem == "darwin64-x86_64-cc") {
     CC = "gcc";
diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix
index 87187667a92..e72071b4cfd 100644
--- a/pkgs/development/libraries/pango/default.nix
+++ b/pkgs/development/libraries/pango/default.nix
@@ -14,8 +14,9 @@ stdenv.mkDerivation rec {
     sha256 = "01rdzjh68w8l5zn0648yibyarj8p6g7yfn59nw5awaz1i8dvbnqq";
   };
 
-  buildInputs = with stdenv.lib; [ gobjectIntrospection ]
-    ++ optionals stdenv.isDarwin [ fontconfig ];
+  outputs = [ "dev" "out" "bin" "doc" ];
+
+  buildInputs = with stdenv.lib; [ gobjectIntrospection ];
   nativeBuildInputs = [ pkgconfig ];
 
   propagatedBuildInputs = [ x11 glib cairo libpng fontconfig freetype harfbuzz ] ++ libintlOrEmpty;
@@ -29,8 +30,6 @@ stdenv.mkDerivation rec {
   # .../bin/sh: line 5: 14823 Abort trap: 6 srcdir=. PANGO_RC_FILE=./pangorc ${dir}$tst
   # FAIL: testiter
 
-  postInstall = "rm -rf $out/share/gtk-doc";
-
   meta = {
     description = "A library for laying out and rendering of text, with an emphasis on internationalization";
 
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index 77d21abb6d2..6ae8e475d1e 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
     sha256 = "1fs5p1z67m9f4xnyil3s4lhgyld78f7m4d1yawpyhh0cvrbk90zg";
   };
 
+  outputs = [ "dev" "out" "bin" "doc" "man" ];
+
   configureFlags = ''
     --enable-jit
     ${if unicodeSupport then "--enable-unicode-properties" else ""}
@@ -26,6 +28,12 @@ stdenv.mkDerivation rec {
     buildInputs = [ windows.mingw_w64_pthreads.crossDrv ];
   };
 
+  postInstall =
+    ''
+      mkdir $dev/bin
+      mv $bin/bin/pcre-config $dev/bin/
+    '';
+
   meta = {
     homepage = "http://www.pcre.org/";
     description = "A library for Perl Compatible Regular Expressions";
diff --git a/pkgs/development/libraries/speex/default.nix b/pkgs/development/libraries/speex/default.nix
index 93a01a3d2bc..6aceef78eea 100644
--- a/pkgs/development/libraries/speex/default.nix
+++ b/pkgs/development/libraries/speex/default.nix
@@ -2,11 +2,18 @@
 
 stdenv.mkDerivation rec {
   name = "speex-1.2rc1";
-  
+
   src = fetchurl {
     url = "http://downloads.us.xiph.org/releases/speex/${name}.tar.gz";
     sha256 = "19mpkhbz3s08snvndn0h1dk2j139max6b0rr86nnsjmxazf30brl";
   };
-  
+
   buildInputs = [ libogg ];
+
+  outputs = [ "dev" "out" "bin" "doc" ];
+
+  meta = {
+    homepage = http://www.speex.org/;
+    description = "A audio compression codec designed for speech";
+  };
 }
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index 8a79806bf93..706c74b6ce6 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -13,15 +13,21 @@ stdenv.mkDerivation (rec {
     sha256 = "039agw5rqvqny92cpkrfn243x2gd4xn13hs3xi6isk55d2vqqr9n";
   };
 
-  configureFlags = if static then "" else "--shared";
+  outputs = [ "dev" "out" "static" "man" ];
+  setOutputFlags = false;
+
+  configureFlags = stdenv.lib.optional (!static) "--shared";
 
   preConfigure = ''
     if test -n "$crossConfig"; then
       export CC=$crossConfig-gcc
-      configureFlags=${if static then "" else "--shared"}
     fi
   '';
 
+  postInstall = ''
+    _moveToOutput lib/libz.a "$static"
+  '';
+
   # As zlib takes part in the stdenv building, we don't want references
   # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc";