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/SDL/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/SDL2/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/boost/1.59.nix58
-rw-r--r--pkgs/development/libraries/boost/generic.nix150
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/glib/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/glibc/common.nix2
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix4
-rw-r--r--pkgs/development/libraries/gobject-introspection/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/grantlee/5/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/gstreamer/core/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdoctools/default.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/libopcodes/default.nix3
-rw-r--r--pkgs/development/libraries/libqmatrixclient/default.nix6
-rw-r--r--pkgs/development/libraries/librep/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/libtoxcore/default.nix7
-rw-r--r--pkgs/development/libraries/libxc/default.nix31
-rw-r--r--pkgs/development/libraries/ncurses/default.nix3
-rw-r--r--pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh6
-rw-r--r--pkgs/development/libraries/rep-gtk/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/slib/setup-hook.sh2
24 files changed, 153 insertions, 169 deletions
diff --git a/pkgs/development/libraries/SDL/setup-hook.sh b/pkgs/development/libraries/SDL/setup-hook.sh
index 3696e743a07a..20382f18f529 100644
--- a/pkgs/development/libraries/SDL/setup-hook.sh
+++ b/pkgs/development/libraries/SDL/setup-hook.sh
@@ -4,8 +4,4 @@ addSDLPath () {
   fi
 }
 
-if test -n "$crossConfig"; then
-  crossEnvHooks+=(addSDLPath)
-else
-  envHooks+=(addSDLPath)
-fi
+addEnvHooks "$hostOffset" addSDLPath
diff --git a/pkgs/development/libraries/SDL2/setup-hook.sh b/pkgs/development/libraries/SDL2/setup-hook.sh
index 5a26440f37b3..3acce9d473c5 100644
--- a/pkgs/development/libraries/SDL2/setup-hook.sh
+++ b/pkgs/development/libraries/SDL2/setup-hook.sh
@@ -4,8 +4,4 @@ addSDL2Path () {
   fi
 }
 
-if test -n "$crossConfig"; then
-  crossEnvHooks+=(addSDL2Path)
-else
-  envHooks+=(addSDL2Path)
-fi
+addEnvHooks "$hostOffset" addSDL2Path
diff --git a/pkgs/development/libraries/boost/1.59.nix b/pkgs/development/libraries/boost/1.59.nix
index 2666b1d6c5d2..603d7883c647 100644
--- a/pkgs/development/libraries/boost/1.59.nix
+++ b/pkgs/development/libraries/boost/1.59.nix
@@ -8,33 +8,33 @@ callPackage ./generic.nix (args // rec {
     sha256 = "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj";
   };
 
-  patches = if stdenv.isCygwin then [
-      ./cygwin-fedora-boost-1.50.0-fix-non-utf8-files.patch
-      ./cygwin-fedora-boost-1.50.0-pool.patch
-      ./cygwin-fedora-boost-1.57.0-mpl-print.patch
-      ./cygwin-fedora-boost-1.57.0-spirit-unused_typedef.patch
-      ./cygwin-fedora-boost-1.54.0-locale-unused_typedef.patch
-      ./cygwin-fedora-boost-1.54.0-python-unused_typedef.patch
-      ./cygwin-fedora-boost-1.57.0-pool-test_linking.patch
-      ./cygwin-fedora-boost-1.54.0-pool-max_chunks_shadow.patch
-      ./cygwin-fedora-boost-1.57.0-signals2-weak_ptr.patch
-      ./cygwin-fedora-boost-1.57.0-uuid-comparison.patch
-      ./cygwin-fedora-boost-1.57.0-move-is_class.patch
-      ./cygwin-1.40.0-cstdint-cygwin.patch
-      ./cygwin-1.57.0-asio-cygwin.patch
-      ./cygwin-1.55.0-asio-MSG_EOR.patch
-      ./cygwin-1.57.0-config-cygwin.patch
-      ./cygwin-1.57.0-context-cygwin.patch
-      ./cygwin-1.57.0-filesystem-cygwin.patch
-      ./cygwin-1.55.0-interlocked-cygwin.patch
-      ./cygwin-1.40.0-iostreams-cygwin.patch
-      ./cygwin-1.57.0-locale-cygwin.patch
-      ./cygwin-1.57.0-log-cygwin.patch
-      ./cygwin-1.40.0-python-cygwin.patch
-      ./cygwin-1.40.0-regex-cygwin.patch
-      ./cygwin-1.57.0-smart_ptr-cygwin.patch
-      ./cygwin-1.57.0-system-cygwin.patch
-      ./cygwin-1.45.0-jam-cygwin.patch
-      ./cygwin-1.50.0-jam-pep3149.patch
-    ] else null;
+  patches = stdenv.lib.optionals stdenv.isCygwin [
+    ./cygwin-fedora-boost-1.50.0-fix-non-utf8-files.patch
+    ./cygwin-fedora-boost-1.50.0-pool.patch
+    ./cygwin-fedora-boost-1.57.0-mpl-print.patch
+    ./cygwin-fedora-boost-1.57.0-spirit-unused_typedef.patch
+    ./cygwin-fedora-boost-1.54.0-locale-unused_typedef.patch
+    ./cygwin-fedora-boost-1.54.0-python-unused_typedef.patch
+    ./cygwin-fedora-boost-1.57.0-pool-test_linking.patch
+    ./cygwin-fedora-boost-1.54.0-pool-max_chunks_shadow.patch
+    ./cygwin-fedora-boost-1.57.0-signals2-weak_ptr.patch
+    ./cygwin-fedora-boost-1.57.0-uuid-comparison.patch
+    ./cygwin-fedora-boost-1.57.0-move-is_class.patch
+    ./cygwin-1.40.0-cstdint-cygwin.patch
+    ./cygwin-1.57.0-asio-cygwin.patch
+    ./cygwin-1.55.0-asio-MSG_EOR.patch
+    ./cygwin-1.57.0-config-cygwin.patch
+    ./cygwin-1.57.0-context-cygwin.patch
+    ./cygwin-1.57.0-filesystem-cygwin.patch
+    ./cygwin-1.55.0-interlocked-cygwin.patch
+    ./cygwin-1.40.0-iostreams-cygwin.patch
+    ./cygwin-1.57.0-locale-cygwin.patch
+    ./cygwin-1.57.0-log-cygwin.patch
+    ./cygwin-1.40.0-python-cygwin.patch
+    ./cygwin-1.40.0-regex-cygwin.patch
+    ./cygwin-1.57.0-smart_ptr-cygwin.patch
+    ./cygwin-1.57.0-system-cygwin.patch
+    ./cygwin-1.45.0-jam-cygwin.patch
+    ./cygwin-1.50.0-jam-pep3149.patch
+  ];
 })
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index b2ec31ace17b..adb7ca665cc2 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -1,18 +1,19 @@
 { stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
-, buildPlatform, hostPlatform
-, toolset ? if stdenv.cc.isClang then "clang" else null
+, which
+, buildPackages, buildPlatform, hostPlatform
+, toolset ? /**/ if stdenv.cc.isClang                                then "clang"
+            else if stdenv.cc.isGNU && hostPlatform != buildPlatform then "gcc-cross"
+            else null
 , enableRelease ? true
 , enableDebug ? false
 , enableSingleThreaded ? false
 , enableMultiThreaded ? true
 , enableShared ? !(hostPlatform.libc == "msvcrt") # problems for now
 , enableStatic ? !enableShared
-, enablePIC ? false
-, enableExceptions ? false
 , enablePython ? hostPlatform == buildPlatform
 , enableNumpy ? false
 , taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
-, patches ? null
+, patches ? []
 , mpi ? null
 
 # Attributes inherit from specific versions
@@ -21,8 +22,9 @@
 }:
 
 # We must build at least one type of libraries
-assert !enableShared -> enableStatic;
+assert enableShared || enableStatic;
 
+# Python isn't supported when cross-compiling
 assert enablePython -> hostPlatform == buildPlatform;
 assert enableNumpy -> enablePython;
 
@@ -46,86 +48,41 @@ let
   # To avoid library name collisions
   layout = if taggedLayout then "tagged" else "system";
 
-  cflags = if enablePIC && enableExceptions then
-             "cflags=\"-fPIC -fexceptions\" cxxflags=-fPIC linkflags=-fPIC"
-           else if enablePIC then
-             "cflags=-fPIC cxxflags=-fPIC linkflags=-fPIC"
-           else if enableExceptions then
-             "cflags=-fexceptions"
-           else
-             "";
-
-  withToolset = stdenv.lib.optionalString (toolset != null) "--with-toolset=${toolset}";
-
-  genericB2Flags = [
+  b2Args = concatStringsSep " " ([
     "--includedir=$dev/include"
     "--libdir=$out/lib"
     "-j$NIX_BUILD_CORES"
     "--layout=${layout}"
     "variant=${variant}"
     "threading=${threading}"
-  ] ++ optional (link != "static") "runtime-link=${runtime-link}" ++ [
+    "runtime-link=${runtime-link}"
     "link=${link}"
-    "${cflags}"
-  ] ++ optional (variant == "release") "debug-symbols=off"
-    ++ optional (!enablePython) "--without-python";
-
-  nativeB2Flags = [
     "-sEXPAT_INCLUDE=${expat.dev}/include"
     "-sEXPAT_LIBPATH=${expat.out}/lib"
-  ] ++ optional (toolset != null) "toolset=${toolset}"
-    ++ optional (mpi != null) "--user-config=user-config.jam";
-  nativeB2Args = concatStringsSep " " (genericB2Flags ++ nativeB2Flags);
-
-  crossB2Flags = [
-    "-sEXPAT_INCLUDE=${expat.crossDrv}/include"
-    "-sEXPAT_LIBPATH=${expat.crossDrv}/lib"
-    "--user-config=user-config.jam"
-    "toolset=gcc-cross"
-  ] ++ optionals (hostPlatform.libc == "msvcrt") [
+  ] ++ optional (variant == "release") "debug-symbols=off"
+    ++ optional (toolset != null) "toolset=${toolset}"
+    ++ optional (mpi != null || hostPlatform != buildPlatform) "--user-config=user-config.jam"
+    ++ optionals (hostPlatform.libc == "msvcrt") [
     "target-os=windows"
     "threadapi=win32"
     "binary-format=pe"
     "address-model=${toString hostPlatform.parsed.cpu.bits}"
     "architecture=x86"
-  ];
-  crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
-
-  builder = b2Args: ''
-    ./b2 ${b2Args}
-  '';
-
-  installer = b2Args: ''
-    # boostbook is needed by some applications
-    mkdir -p $dev/share/boostbook
-    cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/
-
-    # Let boost install everything else
-    ./b2 ${b2Args} install
-  '';
-
-  commonConfigureFlags = [
-    "--includedir=$(dev)/include"
-    "--libdir=$(out)/lib"
-  ];
-
-  fixup = ''
-    # Make boost header paths relative so that they are not runtime dependencies
-    (
-      cd "$dev"
-      find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
-        -exec sed '1i#line 1 "{}"' -i '{}' \;
-    )
-  '' + optionalString (hostPlatform.libc == "msvcrt") ''
-    ${stdenv.cc.targetPrefix}ranlib "$out/lib/"*.a
-  '';
+  ]);
 
 in
 
 stdenv.mkDerivation {
   name = "boost-${version}";
 
-  inherit src patches version;
+  inherit src;
+
+  patchFlags = optionalString (hostPlatform.libc == "msvcrt") "-p0";
+  patches = patches ++ optional (hostPlatform.libc == "msvcrt") (fetchurl {
+    url = "https://svn.boost.org/trac/boost/raw-attachment/tickaet/7262/"
+        + "boost-mingw.patch";
+    sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj";
+  });
 
   meta = {
     homepage = http://boost.org/;
@@ -142,9 +99,13 @@ stdenv.mkDerivation {
           --replace '@rpath/$(<[1]:D=)' "$out/lib/\$(<[1]:D=)";
     fi;
   '' + optionalString (mpi != null) ''
-    cat << EOF > user-config.jam
+    cat << EOF >> user-config.jam
     using mpi : ${mpi}/bin/mpiCC ;
     EOF
+  '' + optionalString (hostPlatform != buildPlatform) ''
+    cat << EOF >> user-config.jam
+    using gcc : cross : ${stdenv.cc.targetPrefix}c++ ;
+    EOF
   '';
 
   NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.isDarwin
@@ -152,6 +113,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
+  nativeBuildInputs = [ which buildPackages.stdenv.cc ];
   buildInputs = [ expat zlib bzip2 libiconv ]
     ++ optional (hostPlatform == buildPlatform) icu
     ++ optional stdenv.isDarwin fixDarwinDylibNames
@@ -159,39 +121,35 @@ stdenv.mkDerivation {
     ++ optional enableNumpy python.pkgs.numpy;
 
   configureScript = "./bootstrap.sh";
-  configureFlags = commonConfigureFlags
-    ++ [ "--with-python=${python.interpreter}" ]
-    ++ optional (hostPlatform == buildPlatform) "--with-icu=${icu.dev}"
-    ++ optional (toolset != null) "--with-toolset=${toolset}";
+  configurePlatforms = [];
+  configureFlags = [
+    "--includedir=$(dev)/include"
+    "--libdir=$(out)/lib"
+    (if enablePython then "--with-python=${python.interpreter}" else "--without-python")
+    (if hostPlatform == buildPlatform then "--with-icu=${icu.dev}" else  "--without-icu")
+  ] ++ optional (toolset != null) "--with-toolset=${toolset}";
 
-  buildPhase = builder nativeB2Args;
+  buildPhase = ''
+    ./b2 ${b2Args}
+  '';
+
+  installPhase = ''
+    # boostbook is needed by some applications
+    mkdir -p $dev/share/boostbook
+    cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/
 
-  installPhase = installer nativeB2Args;
+    # Let boost install everything else
+    ./b2 ${b2Args} install
+  '';
 
-  postFixup = fixup;
+  postFixup = ''
+    # Make boost header paths relative so that they are not runtime dependencies
+    find "$dev/include" \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
+      -exec sed '1i#line 1 "{}"' -i '{}' \;
+  '' + optionalString (hostPlatform.libc == "msvcrt") ''
+    $RANLIB "$out/lib/"*.a
+  '';
 
   outputs = [ "out" "dev" ];
   setOutputFlags = false;
-
-  crossAttrs = rec {
-    # We want to substitute the contents of configureFlags, removing thus the
-    # usual --build and --host added on cross building.
-    preConfigure = ''
-      export configureFlags="--without-icu ${concatStringsSep " " commonConfigureFlags}"
-      cat << EOF > user-config.jam
-      using gcc : cross : $crossConfig-g++ ;
-      EOF
-    '';
-    buildPhase = builder crossB2Args;
-    installPhase = installer crossB2Args;
-    postFixup = fixup;
-  } // optionalAttrs (hostPlatform.libc == "msvcrt") {
-    patches = fetchurl {
-      url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
-          + "boost-mingw.patch";
-      sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj";
-    };
-
-    patchFlags = "-p0";
-  };
 }
diff --git a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
index ba7ab82f50b4..5a7dcd792996 100644
--- a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
+++ b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
@@ -14,4 +14,4 @@ findGdkPixbufLoaders() {
 
 }
 
-envHooks+=(findGdkPixbufLoaders)
+addEnvHooks "$hostOffset" findGdkPixbufLoaders
diff --git a/pkgs/development/libraries/glib/setup-hook.sh b/pkgs/development/libraries/glib/setup-hook.sh
index c5cf293902cd..98341376fdf6 100644
--- a/pkgs/development/libraries/glib/setup-hook.sh
+++ b/pkgs/development/libraries/glib/setup-hook.sh
@@ -5,7 +5,7 @@ make_glib_find_gsettings_schemas() {
         addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"*
     fi
 }
-envHooks+=(make_glib_find_gsettings_schemas)
+addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas
 
 # Install gschemas, if any, in a package-specific directory
 glibPreInstallPhase() {
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index 5af914d179b8..cfec3209b98a 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -141,7 +141,7 @@ stdenv.mkDerivation ({
 
   outputs = [ "out" "bin" "dev" "static" ];
 
-  nativeBuildInputs = lib.optional (cross != null) buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   buildInputs = lib.optionals withGd [ gd libpng ];
 
   # Needed to install share/zoneinfo/zone.tab.  Set to impure /bin/sh to
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index e3bacc86d58e..dce052f8baab 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -19,8 +19,8 @@ let self = stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "info" ];
   passthru.static = self.out;
 
-  nativeBuildInputs = [ m4 ]
-    ++ stdenv.lib.optional (buildPlatform != hostPlatform) buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ m4 ];
 
   configureFlags =
     # Build a "fat binary", with routines for several sub-architectures
diff --git a/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/pkgs/development/libraries/gobject-introspection/setup-hook.sh
index 583d8475ec3b..6d3488a6622d 100644
--- a/pkgs/development/libraries/gobject-introspection/setup-hook.sh
+++ b/pkgs/development/libraries/gobject-introspection/setup-hook.sh
@@ -11,7 +11,7 @@ make_gobject_introspection_find_gir_files() {
     fi
 }
 
-envHooks+=(make_gobject_introspection_find_gir_files)
+addEnvHooks "$hostOffset" make_gobject_introspection_find_gir_files
 
 _multioutMoveGlibGir() {
   moveToOutput share/gir-1.0 "${!outputDev}"
diff --git a/pkgs/development/libraries/grantlee/5/setup-hook.sh b/pkgs/development/libraries/grantlee/5/setup-hook.sh
index aaa64868dc94..b51cb4a31909 100644
--- a/pkgs/development/libraries/grantlee/5/setup-hook.sh
+++ b/pkgs/development/libraries/grantlee/5/setup-hook.sh
@@ -10,8 +10,4 @@ _grantleeEnvHook() {
         propagatedUserEnvPkgs+=" $1"
     fi
 }
-if [ "$crossEnv" ]; then
-    crossEnvHooks+=(_grantleeEnvHook)
-else
-    envHooks+=(_grantleeEnvHook)
-fi
+addEnvHooks "$hostOffset" _grantleeEnvHook
diff --git a/pkgs/development/libraries/gstreamer/core/setup-hook.sh b/pkgs/development/libraries/gstreamer/core/setup-hook.sh
index 3dd7812ece6d..b8c741af578f 100644
--- a/pkgs/development/libraries/gstreamer/core/setup-hook.sh
+++ b/pkgs/development/libraries/gstreamer/core/setup-hook.sh
@@ -5,5 +5,5 @@ addGstreamer1LibPath () {
     fi
 }
 
-envHooks+=(addGstreamer1LibPath)
+addEnvHooks "$hostOffset" addGstreamer1LibPath
 
diff --git a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
index e89aeda5bc1c..65ce26112519 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
+++ b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
@@ -5,4 +5,4 @@ addGstreamerLibPath () {
     fi
 }
 
-envHooks+=(addGstreamerLibPath)
+addEnvHooks "$hostOffset" addGstreamerLibPath
diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
index c1b1e21852cf..88091e78a0cd 100644
--- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
@@ -2,7 +2,7 @@ _ecmEnvHook() {
     addToSearchPath XDG_DATA_DIRS "$1/share"
     addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
 }
-envHooks+=(_ecmEnvHook)
+addEnvHooks "$targetOffset" _ecmEnvHook
 
 _ecmPreConfigureHook() {
     # Because we need to use absolute paths here, we must set *all* the paths.
diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
index 661e89e30782..0a600fe8d057 100644
--- a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
@@ -8,10 +8,18 @@
 mkDerivation {
   name = "kdoctools";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedNativeBuildInputs = [ perl perlPackages.URI ];
+  nativeBuildInputs = [
+    extra-cmake-modules
+    # The build system insists on having native Perl.
+    perl perlPackages.URI
+  ];
+  propagatedBuildInputs = [
+    # kdoctools at runtime actually needs Perl for the platform kdoctools is
+    # running on, not necessarily native perl.
+    perl perlPackages.URI
+    qtbase
+  ];
   buildInputs = [ karchive ki18n ];
-  propagatedBuildInputs = [ qtbase ];
   outputs = [ "out" "dev" ];
   patches = [ ./kdoctools-no-find-docbook-xml.patch ];
   cmakeFlags = [
diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
index 5cfffbd622d1..2928d9b34dbe 100644
--- a/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
@@ -2,4 +2,4 @@ addXdgData() {
     addToSearchPath XDG_DATA_DIRS "$1/share"
 }
 
-envHooks+=(addXdgData)
+addEnvHooks "$targetOffset" addXdgData
diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix
index 7ffc40f14946..d6d6989761bc 100644
--- a/pkgs/development/libraries/libopcodes/default.nix
+++ b/pkgs/development/libraries/libopcodes/default.nix
@@ -19,7 +19,8 @@ stdenv.mkDerivation rec {
     find . ../include/opcode -type f -exec sed {} -i -e 's/"bfd.h"/<bfd.h>/' \;
   '';
 
-  nativeBuildInputs = [ autoreconfHook264 bison buildPackages.stdenv.cc ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ autoreconfHook264 bison ];
   buildInputs = [ libiberty ];
   # dis-asm.h includes bfd.h
   propagatedBuildInputs = [ libbfd ];
diff --git a/pkgs/development/libraries/libqmatrixclient/default.nix b/pkgs/development/libraries/libqmatrixclient/default.nix
index dc4981798bce..f537013d2fec 100644
--- a/pkgs/development/libraries/libqmatrixclient/default.nix
+++ b/pkgs/development/libraries/libqmatrixclient/default.nix
@@ -6,13 +6,13 @@
 
 stdenv.mkDerivation rec {
   name = "libqmatrixclient-${version}";
-  version = "0.1";
+  version = "0.2";
 
   src = fetchFromGitHub {
     owner  = "QMatrixClient";
     repo   = "libqmatrixclient";
-    rev    = "v${version}";
-    sha256 = "1dlanf0y65zf6n1b1f4jzw04w07sl85wiw01c3yyn2ivp3clr13l";
+    rev    = "v${version}-q0.0.5";
+    sha256 = "1m53yxsqjxv2jq0h1xipwsgaj5rca4fk4cl3azgvmf19l9yn00ck";
   };
 
   buildInputs = [ qtbase ];
diff --git a/pkgs/development/libraries/librep/setup-hook.sh b/pkgs/development/libraries/librep/setup-hook.sh
index 420d63d6c513..4d875b693304 100644
--- a/pkgs/development/libraries/librep/setup-hook.sh
+++ b/pkgs/development/libraries/librep/setup-hook.sh
@@ -2,4 +2,4 @@ addRepDLLoadPath () {
     addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
 }
 
-envHooks+=(addRepDLLoadPath)
+addEnvHooks "$hostOffset" addRepDLLoadPath
diff --git a/pkgs/development/libraries/libtoxcore/default.nix b/pkgs/development/libraries/libtoxcore/default.nix
index af9c38a96346..a742be3c1e4d 100644
--- a/pkgs/development/libraries/libtoxcore/default.nix
+++ b/pkgs/development/libraries/libtoxcore/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation rec {
   name = "libtoxcore-${version}";
-  version = "0.1.10";
+  version = "0.1.11";
 
   src = fetchFromGitHub {
     owner  = "TokTok";
     repo   = "c-toxcore";
     rev    = "v${version}";
-    sha256 = "1d3f7lnlxra2lhih838bvlahxqv50j35g9kfyzspq971sb5z30mv";
+    sha256 = "1fya5gfiwlpk6fxhalv95n945ymvp2iidiyksrjw1xw95fzsp1ij";
   };
 
   cmakeFlags = [
@@ -37,7 +37,8 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   meta = with stdenv.lib; {
-    description = "P2P FOSS instant messaging application aimed to replace Skype with crypto";
+    description = "P2P FOSS instant messaging application aimed to replace Skype";
+    homepage = https://tox.chat;
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ peterhoeg ];
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/libxc/default.nix b/pkgs/development/libraries/libxc/default.nix
new file mode 100644
index 000000000000..925c1b6d083d
--- /dev/null
+++ b/pkgs/development/libraries/libxc/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, gfortran, perl }:
+
+let
+  version = "2.2.3";
+in stdenv.mkDerivation {
+  name = "libxc-${version}";
+  src = fetchurl {
+    url = "http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-${version}.tar.gz";
+    sha256 = "1rv8vsf7zzw0g7j93rqcipzhk2pj1iq71bpkwf7zxivmgavh0arg";
+  };
+
+  buildInputs = [ gfortran ];
+  nativeBuildInputs = [ perl ];
+
+  preConfigure = ''
+    patchShebangs ./
+  '';
+
+  configureFlags = [ "--enable-shared" ];
+
+  doCheck = true;
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Library of exchange-correlation functionals for density-functional theory";
+    homepage = http://octopus-code.org/wiki/Libxc;
+    license = licenses.lgpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ markuskowa ];
+  };
+}
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 9aade8b96725..79414f016d39 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -37,10 +37,11 @@ stdenv.mkDerivation rec {
   # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
   CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [
     pkgconfig
   ] ++ lib.optionals (buildPlatform != hostPlatform) [
-    buildPackages.ncurses buildPackages.stdenv.cc
+    buildPackages.ncurses
   ];
   buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
 
diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
index 8ec7eeda8aee..754a75cbef4f 100644
--- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
@@ -42,11 +42,7 @@ qtEnvHook() {
         propagatedUserEnvPkgs+=" $1"
     fi
 }
-if [ "$crossConfig" ]; then
-   crossEnvHooks+=(qtEnvHook)
-else
-   envHooks+=(qtEnvHook)
-fi
+envHostTargetHooks+=(qtEnvHook)
 
 postPatchMkspecs() {
     local bin="${!outputBin}"
diff --git a/pkgs/development/libraries/rep-gtk/setup-hook.sh b/pkgs/development/libraries/rep-gtk/setup-hook.sh
index 420d63d6c513..4d875b693304 100644
--- a/pkgs/development/libraries/rep-gtk/setup-hook.sh
+++ b/pkgs/development/libraries/rep-gtk/setup-hook.sh
@@ -2,4 +2,4 @@ addRepDLLoadPath () {
     addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
 }
 
-envHooks+=(addRepDLLoadPath)
+addEnvHooks "$hostOffset" addRepDLLoadPath
diff --git a/pkgs/development/libraries/slib/setup-hook.sh b/pkgs/development/libraries/slib/setup-hook.sh
index 62b72d6dc0ab..3c7e91e81886 100644
--- a/pkgs/development/libraries/slib/setup-hook.sh
+++ b/pkgs/development/libraries/slib/setup-hook.sh
@@ -10,4 +10,4 @@ addSlibPath () {
     fi
 }
 
-envHooks+=(addSlibPath)
+addEnvHooks "$hostOffset" addSlibPath