Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"

This reverts commit 25a148fa19.
This commit is contained in:
Eelco Dolstra
2015-06-04 14:54:48 +02:00
parent 4f60156afb
commit 3096d03435
18 changed files with 176 additions and 104 deletions
+14 -7
View File
@@ -15,8 +15,16 @@
, prefix ? ""
}:
with stdenv;
let
mkFlag = trueStr: falseStr: cond: name: val:
if cond == null then null else
"--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
mkEnable = mkFlag "enable-" "disable-";
mkWith = mkFlag "with-" "without-";
mkOther = mkFlag "" "" true;
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
libOnly = prefix == "lib";
hasXlibs = xlibs != null;
@@ -58,7 +66,6 @@ let
simple = null;
}.${databaseName};
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "${prefix}pulseaudio-${version}";
version = "6.0";
@@ -77,9 +84,9 @@ stdenv.mkDerivation rec {
optLibcap valgrind optOss optCoreaudio optAlsaLib optEsound optGlib
optGtk3 optGconf optAvahi optLibjack2 optLibasyncns optLirc optDbus optUdev
optOpenssl optFftw optSpeexdsp optSystemd optWebrtc-audio-processing
] ++ optionals hasXlibs (with xlibs; [
] ++ stdenv.lib.optionals hasXlibs (with xlibs; [
libX11 libxcb libICE libSM libXtst xextproto libXi
]) ++ optionals (optBluez5 != null) [ optBluez5 optSbc ];
]) ++ stdenv.lib.optionals (optBluez5 != null) [ optBluez5 optSbc ];
preConfigure = ''
# Performs and autoreconf
@@ -155,7 +162,7 @@ stdenv.mkDerivation rec {
# the alternative is to copy the files from /usr/include to src, but there are
# probably a large number of files that would need to be copied (I stopped
# after the seventh)
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin
"-I/usr/include";
installFlags = [
@@ -163,11 +170,11 @@ stdenv.mkDerivation rec {
"pulseconfdir=$(out)/etc/pulse"
];
postInstall = optionalString libOnly ''
postInstall = stdenv.lib.optionalString libOnly ''
rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
'';
meta = {
meta = with stdenv.lib; {
description = "Sound server for POSIX and Win32 systems";
homepage = http://www.pulseaudio.org/;
# Note: Practically, the server is under the GPL due to the