about summary refs log tree commit diff
path: root/pkgs/development/libraries/glib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/glib/default.nix')
-rw-r--r--pkgs/development/libraries/glib/default.nix32
1 files changed, 20 insertions, 12 deletions
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 9a3303684a15..db59befcb501 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -31,12 +31,12 @@ let
   # This is intended to be run in postInstall of any package
   # which has $out/include/ containing just some disjunct directories.
   flattenInclude = ''
-    for dir in "$out"/include/*; do
-      cp -r "$dir"/* "$out/include/"
+    for dir in "''${!outputInclude}"/include/*; do
+      cp -r "$dir"/* "''${!outputInclude}/include/"
       rm -r "$dir"
       ln -s . "$dir"
     done
-    ln -sr -t "$out/include/" "$out"/lib/*/include/* 2>/dev/null || true
+    ln -sr -t "''${!outputInclude}/include/" "''${!outputInclude}"/lib/*/include/* 2>/dev/null || true
   '';
 
   ver_maj = "2.46";
@@ -53,21 +53,22 @@ stdenv.mkDerivation rec {
 
   patches = optional stdenv.isDarwin ./darwin-compilation.patch ++ optional doCheck ./skip-timer-test.patch;
 
+  outputs = [ "dev" "out" "docdev" ];
+  outputBin = "dev";
+
   setupHook = ./setup-hook.sh;
 
-  buildInputs = [ libelf ]
+  buildInputs = [ libelf setupHook pcre ]
     ++ optionals doCheck [ tzdata libxml2 desktop_file_utils shared_mime_info ];
 
   nativeBuildInputs = [ pkgconfig gettext perl python ];
 
-  propagatedBuildInputs = [ pcre zlib libffi libiconv ]
+  propagatedBuildInputs = [ zlib libffi libiconv ]
     ++ libintlOrEmpty;
 
-  LIBELF_CFLAGS = optional stdenv.isFreeBSD "-I${libelf}";
-  LIBELF_LIBS = optional stdenv.isFreeBSD "-L${libelf} -lelf";
-
-  configureFlags =
-    optional stdenv.isDarwin "--disable-compile-warnings"
+  # internal pcre would only add <200kB, but it's relatively common
+  configureFlags = [ "--with-pcre=system" ]
+    ++ optional stdenv.isDarwin "--disable-compile-warnings"
     ++ optional (stdenv.isFreeBSD || stdenv.isSunOS) "--with-libiconv=gnu"
     ++ optional stdenv.isSunOS "--disable-dtrace";
 
@@ -79,6 +80,9 @@ stdenv.mkDerivation rec {
       sed -i -e 's|inotify.h|foobar-inotify.h|g' configure
     '';
 
+  LIBELF_CFLAGS = optional stdenv.isFreeBSD "-I${libelf}";
+  LIBELF_LIBS = optional stdenv.isFreeBSD "-L${libelf} -lelf";
+
   preBuild = optionalString stdenv.isDarwin
     ''
       export MACOSX_DEPLOYMENT_TARGET=
@@ -87,6 +91,12 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
   DETERMINISTIC_BUILD = 1;
 
+  postInstall = ''
+    moveToOutput "share/glib-2.0" "$dev"
+    substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev"
+    sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|"
+  '';
+
   inherit doCheck;
   preCheck = optionalString doCheck
     '' export LD_LIBRARY_PATH="$NIX_BUILD_TOP/${name}/glib/.libs:$LD_LIBRARY_PATH"
@@ -108,8 +118,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;