From 28ad91098da44ec9841fea5943bef330c7911d92 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Aug 2012 21:23:42 -0400 Subject: [PATCH] libtool: Separate libltdl from the main package Some packages have a runtime dependency on libltdl, but shouldn't depend on the rest of libtool (which in turn depends on binutils and other stdenv tools). For example, splitting off libltdl cuts about 35 MiB from the closure of PulseAudio. --- pkgs/build-support/multiple-outputs.nix | 22 ++++++++++++------- .../tools/misc/libtool/libtool2.nix | 16 ++++++-------- pkgs/top-level/all-packages.nix | 4 +++- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/pkgs/build-support/multiple-outputs.nix b/pkgs/build-support/multiple-outputs.nix index 5608c5619d11..a4a53733fa05 100644 --- a/pkgs/build-support/multiple-outputs.nix +++ b/pkgs/build-support/multiple-outputs.nix @@ -9,12 +9,16 @@ stdenv.mkDerivation (args // { configureFlags = optionals (elem "bin" outputs) [ "--bindir=$(bin)/bin" "--mandir=$(bin)/share/man" ] + ++ optionals (elem "lib" outputs) + [ "--libdir=$(lib)/lib" ] ++ optional (elem "dev" outputs) - "--includedir=$(dev)/include"; + "--includedir=$(dev)/include" + ++ args.configureFlags or []; installFlags = optionals (elem "dev" outputs) - [ "pkgconfigdir=$(dev)/lib/pkgconfig" "m4datadir=$(dev)/share/aclocal" ]; + [ "pkgconfigdir=$(dev)/lib/pkgconfig" "m4datadir=$(dev)/share/aclocal" "aclocaldir=$(dev)/share/aclocal" ] + ++ args.installFlags or []; postInstall = '' @@ -31,15 +35,17 @@ stdenv.mkDerivation (args // { echo "$propagatedBuildInputs" > "$dev/nix-support/propagated-build-inputs" propagatedBuildInputs= fi - echo "$propagatedBuildNativeInputs $out" > "$dev/nix-support/propagated-build-native-inputs" + echo "$out $lib $propagatedBuildNativeInputs" > "$dev/nix-support/propagated-build-native-inputs" propagatedBuildNativeInputs= + elif [ -n "$out" ]; then + propagatedBuildNativeInputs="$lib $propagatedBuildNativeInputs" fi - if [ -n "$bin" ]; then - prefix="$bin" stripDirs "bin sbin" "${stripDebugFlags:--S}" - prefix="$bin" patchELF - patchShebangs "$bin" - fi + for i in $bin $lib; do + prefix="$i" stripDirs "lib lib64 libexec bin sbin" "${stripDebugFlags:--S}" + prefix="$i" patchELF + patchShebangs "$i" + done ''; # */ }) diff --git a/pkgs/development/tools/misc/libtool/libtool2.nix b/pkgs/development/tools/misc/libtool/libtool2.nix index 403381af4851..544434634a53 100644 --- a/pkgs/development/tools/misc/libtool/libtool2.nix +++ b/pkgs/development/tools/misc/libtool/libtool2.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, m4, perl, lzma }: -stdenv.mkDerivation (rec { +stdenv.mkDerivation rec { name = "libtool-2.4.2"; src = fetchurl { @@ -10,6 +10,8 @@ stdenv.mkDerivation (rec { buildNativeInputs = [ lzma m4 perl ]; + outputs = [ "out" "lib" ]; + # Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the # "fixed" path in generated files! dontPatchShebangs = true; @@ -18,6 +20,10 @@ stdenv.mkDerivation (rec { # leads to the failure of a number of tests. doCheck = false; + # Don't run the native `strip' when cross-compiling. This breaks at least + # with `.a' files for MinGW. + dontStrip = stdenv ? cross; + meta = { description = "GNU Libtool, a generic library support script"; @@ -38,11 +44,3 @@ stdenv.mkDerivation (rec { maintainers = [ stdenv.lib.maintainers.ludo ]; }; } - -// - -# Don't run the native `strip' when cross-compiling. This breaks at least -# with `.a' files for MinGW. -(if (stdenv ? cross) - then { dontStrip = true; } - else { })) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index deb9c626d5d3..7f8e0f0816df 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3111,7 +3111,9 @@ let libtool_1_5 = callPackage ../development/tools/misc/libtool { }; - libtool_2 = callPackage ../development/tools/misc/libtool/libtool2.nix { }; + libtool_2 = callPackage ../development/tools/misc/libtool/libtool2.nix { + stdenv = stdenvMulti; + }; lsof = callPackage ../development/tools/misc/lsof { };