diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-23 15:42:22 -0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-23 15:42:22 -0400 |
commit | b96ab17658b1aec5654cc88f8e67adb544900c82 (patch) | |
tree | cb0adb8eb6570c5b9c0aeb3af5275ddee48cb844 /pkgs | |
parent | fcf88305cc8fc198f3c0b372557a4eaffe316a4f (diff) |
Abstract common multiple output handling into a function
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/applications/audio/flac/default.nix | 17 | ||||
-rw-r--r-- | pkgs/build-support/multiple-outputs.nix | 39 | ||||
-rw-r--r-- | pkgs/development/libraries/libogg/default.nix | 17 | ||||
-rw-r--r-- | pkgs/development/libraries/libsndfile/default.nix | 19 | ||||
-rw-r--r-- | pkgs/development/libraries/libvorbis/default.nix | 18 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
6 files changed, 50 insertions, 62 deletions
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix index 3f00d6b834ed4..21025b27b2498 100644 --- a/pkgs/applications/audio/flac/default.nix +++ b/pkgs/applications/audio/flac/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchurl, libogg }: +{ stdenv, fetchurl, multipleOutputs, libogg }: -stdenv.mkDerivation rec { +multipleOutputs rec { name = "flac-1.2.1"; src = fetchurl { @@ -22,19 +22,6 @@ stdenv.mkDerivation rec { outputs = [ "dev" "out" "bin" "doc" ]; - configureFlags = [ "--bindir=$(bin)/bin" "--includedir=$(dev)/include" "--mandir=$(bin)/share/man" ]; - - installFlags = [ "pkgconfigdir=$(dev)/lib/pkgconfig m4datadir=$(dev)/share/aclocal" ]; - - postInstall = - '' - if [ -e $out/share/doc ]; then - mkdir -p $doc/share/doc - mv $out/share/doc/* $doc/share/doc - rmdir $out/share/doc - fi - ''; # */ - meta = { homepage = http://flac.sourceforge.net; description = "Library and tools for encoding and decoding the FLAC lossless audio file format"; diff --git a/pkgs/build-support/multiple-outputs.nix b/pkgs/build-support/multiple-outputs.nix new file mode 100644 index 0000000000000..5b1dc96dfb026 --- /dev/null +++ b/pkgs/build-support/multiple-outputs.nix @@ -0,0 +1,39 @@ +{ stdenv }: + +with stdenv.lib; + +{ outputs, ... } @ args: + +stdenv.mkDerivation (args // { + + configureFlags = + optionals (elem "bin" outputs) + [ "--bindir=$(bin)/bin" "--mandir=$(bin)/share/man" ] + ++ optional (elem "dev" outputs) + "--includedir=$(dev)/include"; + + installFlags = + optionals (elem "dev" outputs) + [ "pkgconfigdir=$(dev)/lib/pkgconfig" "m4datadir=$(dev)/share/aclocal" ]; + + postInstall = + '' + if [ -n "$doc" -a -e $out/share/doc ]; then + mkdir -p $doc/share/doc + mv $out/share/doc/* $doc/share/doc + rmdir $out/share/doc + rmdir --ignore-fail-on-non-empty $out/share + fi + + if [ -n "$dev" ]; then + mkdir -p "$dev/nix-support" + if [ -n "$propagatedBuildInputs" ]; then + echo "$propagatedBuildInputs" > "$dev/nix-support/propagated-build-inputs" + propagatedBuildInputs= + fi + echo "$propagatedBuildNativeInputs $out" > "$dev/nix-support/propagated-build-native-inputs" + propagatedBuildNativeInputs= + fi + ''; # */ + +}) diff --git a/pkgs/development/libraries/libogg/default.nix b/pkgs/development/libraries/libogg/default.nix index 0b5e4e8174151..d3e7ba43b31c7 100644 --- a/pkgs/development/libraries/libogg/default.nix +++ b/pkgs/development/libraries/libogg/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchurl, xz }: +{ stdenv, fetchurl, multipleOutputs, xz }: -stdenv.mkDerivation rec { +multipleOutputs rec { name = "libogg-1.3.0"; src = fetchurl { @@ -12,19 +12,6 @@ stdenv.mkDerivation rec { outputs = [ "dev" "doc" "out" ]; - configureFlags = [ "--includedir=$(dev)/include" ]; - - installFlags = [ "pkgconfigdir=$(dev)/lib/pkgconfig" ]; - - postInstall = - '' - mkdir -p $doc/share/doc - mv $out/share/doc/* $doc/share/doc - - mkdir -p $dev/nix-support - echo $out > $dev/nix-support/propagated-build-native-inputs - ''; # */ - meta = { homepage = http://xiph.org/ogg/; }; diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix index 3a9153120be15..166e02668f04e 100644 --- a/pkgs/development/libraries/libsndfile/default.nix +++ b/pkgs/development/libraries/libsndfile/default.nix @@ -1,6 +1,6 @@ -{stdenv, fetchurl, flac, libogg, libvorbis, pkgconfig }: +{ stdenv, fetchurl, multipleOutputs, flac, libogg, libvorbis, pkgconfig }: -stdenv.mkDerivation rec { +multipleOutputs rec { name = "libsndfile-1.0.23"; src = fetchurl { @@ -8,25 +8,12 @@ stdenv.mkDerivation rec { sha256 = "0k9x4804gfh9d9zd4rm1v2izm8l716rzk4d6jlrjcf45b5sw7jal"; }; - buildInputs = [pkgconfig flac libogg libvorbis]; + buildInputs = [ pkgconfig flac libogg libvorbis ]; enableParallelBuilding = true; outputs = [ "dev" "out" "bin" "doc" ]; - configureFlags = [ "--bindir=$(bin)/bin" "--includedir=$(dev)/include" "--mandir=$(bin)/share/man" ]; - - installFlags = [ "pkgconfigdir=$(dev)/lib/pkgconfig m4datadir=$(dev)/share/aclocal" ]; - - postInstall = - '' - if [ -e $out/share/doc ]; then - mkdir -p $doc/share/doc - mv $out/share/doc/* $doc/share/doc - rmdir $out/share/doc - fi - ''; # */ - meta = { description = "Libsndfile, a C library for reading and writing files containing sampled sound"; diff --git a/pkgs/development/libraries/libvorbis/default.nix b/pkgs/development/libraries/libvorbis/default.nix index 945bba3d4ea17..dac0583723543 100644 --- a/pkgs/development/libraries/libvorbis/default.nix +++ b/pkgs/development/libraries/libvorbis/default.nix @@ -1,6 +1,6 @@ -{ stdenv, fetchurl, libogg, xz }: +{ stdenv, fetchurl, multipleOutputs, libogg, xz }: -stdenv.mkDerivation rec { +multipleOutputs rec { name = "libvorbis-1.3.3"; src = fetchurl { @@ -13,20 +13,6 @@ stdenv.mkDerivation rec { outputs = [ "dev" "out" "doc" ]; - configureFlags = [ "--includedir=$(dev)/include" ]; - - installFlags = [ "pkgconfigdir=$(dev)/lib/pkgconfig" ]; - - postInstall = - '' - mkdir -p $doc/share/doc - mv $out/share/doc/* $doc/share/doc - - mkdir -p "$dev/nix-support" - echo "$propagatedBuildNativeInputs $out" > "$dev/nix-support/propagated-build-native-inputs" - propagatedBuildNativeInputs= - ''; # */ - meta = { homepage = http://xiph.org/vorbis/; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2ee6dc66b2d61..53e83ca5798f7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -327,6 +327,8 @@ let inherit stdenv perl cpio contents ubootChooser; }; + multipleOutputs = import ../build-support/multiple-outputs.nix { inherit (pkgs) stdenv; }; + makeWrapper = makeSetupHook {} ../build-support/make-wrapper/make-wrapper.sh; makeModulesClosure = {kernel, rootModules, allowMissing ? false}: |