Revert "Refactor mkFlag out of old packages"

This reverts commit 3117e0c897.

Conflicts:
	pkgs/development/libraries/wayland/default.nix
	pkgs/servers/samba/4.x.nix
This commit is contained in:
Eelco Dolstra 2015-06-01 21:29:47 +02:00
parent 17b6a597fb
commit 5d8fe045b6
11 changed files with 202 additions and 170 deletions

View File

@ -17,6 +17,10 @@ let
else if stdenv.system == "x86_64-linux" || stdenv.system == "x86_64-darwin" then "x86-64"
else throw "ImageMagick is not supported on this platform.";
mkFlag = trueStr: falseStr: cond: val: "--${if cond then trueStr else falseStr}-${val}";
mkWith = mkFlag "with" "without";
mkEnable = mkFlag "enable" "disable";
hasX11 = libX11 != null && libXext != null && libXt != null;
in
@ -33,38 +37,38 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
configureFlags = [
(mkEnable (libcl != null) "opencl" null)
(mkWith true "modules" null)
(mkWith true "gcc-arch" arch)
#(mkEnable true "hdri" null) This breaks some dependencies
(mkWith (perl != null) "perl" null)
(mkWith (jemalloc != null) "jemalloc" null)
(mkWith true "frozenpaths" null)
(mkWith (bzip2 != null) "bzlib" null)
(mkWith hasX11 "x" null)
(mkWith (zlib != null) "zlib" null)
(mkWith false "dps" null)
(mkWith (fftw != null) "fftw" null)
(mkWith (libfpx != null) "fpx" null)
(mkWith (djvulibre != null) "djvu" null)
(mkWith (fontconfig != null) "fontconfig" null)
(mkWith (freetype != null) "freetype" null)
(mkWith (ghostscript != null) "gslib" null)
(mkWith (graphviz != null) "gvc" null)
(mkWith (jbigkit != null) "jbig" null)
(mkWith (libjpeg != null) "jpeg" null)
(mkWith (lcms2 != null) "lcms2" null)
(mkWith false "lcms" null)
(mkWith (openjpeg != null) "openjp2" null)
(mkWith (liblqr1 != null) "lqr" null)
(mkWith (xz != null) "lzma" null)
(mkWith (openexr != null) "openexr" null)
(mkWith (pango != null) "pango" null)
(mkWith (libpng != null) "png" null)
(mkWith (librsvg != null) "rsvg" null)
(mkWith (libtiff != null) "tiff" null)
(mkWith (libwebp != null) "webp" null)
(mkWith (libxml2 != null) "xml" null)
(mkEnable (libcl != null) "opencl")
(mkWith true "modules")
(mkWith true "gcc-arch=${arch}")
#(mkEnable true "hdri") This breaks some dependencies
(mkWith (perl != null) "perl")
(mkWith (jemalloc != null) "jemalloc")
(mkWith true "frozenpaths")
(mkWith (bzip2 != null) "bzlib")
(mkWith hasX11 "x")
(mkWith (zlib != null) "zlib")
(mkWith false "dps")
(mkWith (fftw != null) "fftw")
(mkWith (libfpx != null) "fpx")
(mkWith (djvulibre != null) "djvu")
(mkWith (fontconfig != null) "fontconfig")
(mkWith (freetype != null) "freetype")
(mkWith (ghostscript != null) "gslib")
(mkWith (graphviz != null) "gvc")
(mkWith (jbigkit != null) "jbig")
(mkWith (libjpeg != null) "jpeg")
(mkWith (lcms2 != null) "lcms2")
(mkWith false "lcms")
(mkWith (openjpeg != null) "openjp2")
(mkWith (liblqr1 != null) "lqr")
(mkWith (xz != null) "lzma")
(mkWith (openexr != null) "openexr")
(mkWith (pango != null) "pango")
(mkWith (libpng != null) "png")
(mkWith (librsvg != null) "rsvg")
(mkWith (libtiff != null) "tiff")
(mkWith (libwebp != null) "webp")
(mkWith (libxml2 != null) "xml")
] ++ optional (dejavu_fonts != null) "--with-dejavu-font-dir=${dejavu_fonts}/share/fonts/truetype/"
++ optional (ghostscript != null) "--with-gs-font-dir=${ghostscript}/share/ghostscript/fonts/";

View File

@ -17,7 +17,7 @@ assert sndfileFileIOSupport -> (libsndfile != null);
#assert mp3xSupport -> (analyzerHooksSupport && (gtk1 != null));
let
sndfileFileIO = if sndfileFileIOSupport then "sndfile" else "lame";
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
in
with stdenv.lib;
@ -39,18 +39,17 @@ stdenv.mkDerivation rec {
++ optional sndfileFileIOSupport libsndfile;
configureFlags = [
(mkEnable nasmSupport "nasm" null)
(mkEnable cpmlSupport "cpml" null)
#(mkEnable efenceSupport "efence" null)
(mkWith true "fileio" sndfileFileIO)
(mkEnable analyzerHooksSupport "analyzer-hooks" null)
(mkEnable decoderSupport "decoder" null)
(mkEnable frontendSupport "frontend" null)
(mkEnable frontendSupport "dynamic-frontends" null)
#(mkEnable mp3xSupport "mp3x" null)
(mkEnable mp3rtpSupport "mp3rtp" null)
] ++ optional debugSupport [
(mkEnable true "debug" "alot")
(mkFlag nasmSupport "nasm")
(mkFlag cpmlSupport "cpml")
#(mkFlag efenceSupport "efence")
(if sndfileFileIOSupport then "--with-fileio=sndfile" else "--with-fileio=lame")
(mkFlag analyzerHooksSupport "analyzer-hooks")
(mkFlag decoderSupport "decoder")
(mkFlag frontendSupport "frontend")
(mkFlag frontendSupport "dynamic-frontends")
#(mkFlag mp3xSupport "mp3x")
(mkFlag mp3rtpSupport "mp3rtp")
(if debugSupport then "--enable-debug=alot" else "")
];
meta = {

View File

@ -11,6 +11,10 @@ assert encaSupport -> enca != null;
assert fontconfigSupport -> fontconfig != null;
assert harfbuzzSupport -> harfbuzz != null;
let
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "libass-${version}";
@ -22,11 +26,11 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(mkEnable encaSupport "enca" null)
(mkEnable fontconfigSupport "fontconfig" null)
(mkEnable harfbuzzSupport "harfbuzz" null)
(mkEnable rasterizerSupport "rasterizer" null)
(mkEnable largeTilesSupport "large-tiles" null)
(mkFlag encaSupport "enca")
(mkFlag fontconfigSupport "fontconfig")
(mkFlag harfbuzzSupport "harfbuzz")
(mkFlag rasterizerSupport "rasterizer")
(mkFlag largeTilesSupport "large-tiles")
];
nativeBuildInputs = [ pkgconfig yasm ];

View File

@ -9,6 +9,10 @@ assert documentationSupport -> doxygen != null && graphviz != null;
assert eventGUISupport -> cairo != null && glib != null && gtk3 != null;
assert testsSupport -> check != null && valgrind != null;
let
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "libinput-0.15.0";
@ -19,9 +23,9 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(mkEnable documentationSupport "documentation" null)
(mkEnable eventGUISupport "event-gui" null)
(mkEnable testsSupport "tests" null)
(mkFlag documentationSupport "documentation")
(mkFlag eventGUISupport "event-gui")
(mkFlag testsSupport "tests")
];
nativeBuildInputs = [ pkgconfig ];

View File

@ -20,6 +20,10 @@ assert jpegSupport -> (libjpeg != null);
assert tiffSupport -> (libtiff != null);
assert gifSupport -> (giflib != null);
let
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "libwebp-${version}";
@ -31,19 +35,19 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(mkEnable threadingSupport "threading" null)
(mkEnable openglSupport "gl" null)
(mkEnable pngSupport "png" null)
(mkEnable jpegSupport "jpeg" null)
(mkEnable tiffSupport "tiff" null)
(mkEnable gifSupport "gif" null)
#(mkEnable (wicSupport && stdenv.isCygwin) "wic" null)
(mkEnable alignedSupport "aligned" null)
(mkEnable swap16bitcspSupport "swap-16bit-csp" null)
(mkEnable experimentalSupport "experimental" null)
(mkEnable libwebpmuxSupport "libwebpmux" null)
(mkEnable libwebpdemuxSupport "libwebpdemux" null)
(mkEnable libwebpdecoderSupport "libwebpdecoder" null)
(mkFlag threadingSupport "threading")
(mkFlag openglSupport "gl")
(mkFlag pngSupport "png")
(mkFlag jpegSupport "jpeg")
(mkFlag tiffSupport "tiff")
(mkFlag gifSupport "gif")
#(mkFlag (wicSupport && stdenv.isCygwin) "wic")
(mkFlag alignedSupport "aligned")
(mkFlag swap16bitcspSupport "swap-16bit-csp")
(mkFlag experimentalSupport "experimental")
(mkFlag libwebpmuxSupport "libwebpmux")
(mkFlag libwebpdemuxSupport "libwebpdemux")
(mkFlag libwebpdecoderSupport "libwebpdecoder")
];
buildInputs = [ ]

View File

@ -2,6 +2,10 @@
, parallel ? true
}:
let
mkFlag = optset: flag: if optset then "-D${flag}=ON" else "-D${flag}=OFF";
in
stdenv.mkDerivation rec {
name = "stxxl-${version}";
version = "1.4.1";
@ -17,7 +21,7 @@ stdenv.mkDerivation rec {
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_STATIC_LIBS=OFF"
"-DCMAKE_BUILD_TYPE=Release"
"-DUSE_GNU_PARALLEL=${if parallel then "ON" else "OFF"}"
(mkFlag parallel "USE_GNU_PARALLEL")
];
passthru = {

View File

@ -25,13 +25,13 @@
, opusSupport ? true, libopus
}:
with stdenv.lib;
let
opt = optional;
opt = stdenv.lib.optional;
mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}";
major = "0.19";
minor = "9";
in
stdenv.mkDerivation rec {
in stdenv.mkDerivation rec {
name = "mpd-${major}.${minor}";
src = fetchurl {
url = "http://www.musicpd.org/download/mpd/${major}/${name}.tar.xz";
@ -68,33 +68,33 @@ stdenv.mkDerivation rec {
++ opt opusSupport libopus;
configureFlags =
[ (mkEnable (!stdenv.isDarwin && alsaSupport) "alsa" null)
(mkEnable flacSupport "flac" null)
(mkEnable vorbisSupport "vorbis" null)
(mkEnable vorbisSupport "vorbis-encoder" null)
(mkEnable (!stdenv.isDarwin && madSupport) "mad" null)
(mkEnable mikmodSupport "mikmod" null)
(mkEnable id3tagSupport "id3" null)
(mkEnable shoutSupport "shout" null)
(mkEnable sqliteSupport "sqlite" null)
(mkEnable curlSupport "curl" null)
(mkEnable audiofileSupport "audiofile" null)
(mkEnable bzip2Support "bzip2" null)
(mkEnable ffmpegSupport "ffmpeg" null)
(mkEnable fluidsynthSupport "fluidsynth" null)
(mkEnable zipSupport "zzip" null)
(mkEnable samplerateSupport "lsr" null)
(mkEnable mmsSupport "mms" null)
(mkEnable mpg123Support "mpg123" null)
(mkEnable aacSupport "aac" null)
(mkEnable pulseaudioSupport "pulse" null)
(mkEnable jackSupport "jack" null)
(mkEnable stdenv.isDarwin "osx" null)
(mkEnable icuSupport "icu" null)
(mkEnable gmeSupport "gme" null)
(mkEnable clientSupport "libmpdclient" null)
(mkEnable opusSupport "opus" null)
(mkEnable true "debug" null)
[ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa")
(mkFlag flacSupport "flac")
(mkFlag vorbisSupport "vorbis")
(mkFlag vorbisSupport "vorbis-encoder")
(mkFlag (!stdenv.isDarwin && madSupport) "mad")
(mkFlag mikmodSupport "mikmod")
(mkFlag id3tagSupport "id3")
(mkFlag shoutSupport "shout")
(mkFlag sqliteSupport "sqlite")
(mkFlag curlSupport "curl")
(mkFlag audiofileSupport "audiofile")
(mkFlag bzip2Support "bzip2")
(mkFlag ffmpegSupport "ffmpeg")
(mkFlag fluidsynthSupport "fluidsynth")
(mkFlag zipSupport "zzip")
(mkFlag samplerateSupport "lsr")
(mkFlag mmsSupport "mms")
(mkFlag mpg123Support "mpg123")
(mkFlag aacSupport "aac")
(mkFlag pulseaudioSupport "pulse")
(mkFlag jackSupport "jack")
(mkFlag stdenv.isDarwin "osx")
(mkFlag icuSupport "icu")
(mkFlag gmeSupport "gme")
(mkFlag clientSupport "libmpdclient")
(mkFlag opusSupport "opus")
"--enable-debug"
]
++ opt stdenv.isLinux
"--with-systemdsystemunitdir=$(out)/etc/systemd/system";
@ -103,7 +103,7 @@ stdenv.mkDerivation rec {
${if shoutSupport then "-lshout" else ""}
'';
meta = {
meta = with stdenv.lib; {
description = "A flexible, powerful daemon for playing music";
homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
license = licenses.gpl2;

View File

@ -86,7 +86,7 @@ stdenv.mkDerivation rec {
find $out -type f -exec $SHELL -c "$SCRIPT" \;
'';
meta = {
meta = with stdenv.lib; {
homepage = http://www.samba.org/;
description = "The standard Windows interoperability suite of programs for Linux and Unix";
license = licenses.gpl3;

View File

@ -28,6 +28,13 @@ assert cryptopp != null || (nss != null && nspr != null);
with stdenv.lib;
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;
hasServer = snappy != null && leveldb != null;
hasMon = hasServer;
hasMds = hasServer;

View File

@ -3,6 +3,9 @@
}:
let
mkFlag = pfxTrue: pfxFalse: cond: name: "--${if cond then pfxTrue else pfxFalse}-${name}";
mkEnable = mkFlag "enable" "disable";
mkWith = mkFlag "with" "without";
hasX = gtk2 != null || qt4 != null;
in
with stdenv.lib;
@ -17,12 +20,12 @@ stdenv.mkDerivation rec {
buildInputs = [ libcap gtk2 ncurses qt4 ];
configureFlags = [
(mkWith (libcap != null) "libcap" null)
(mkWith (hasX) "x" null)
(mkEnable (ncurses != null) "pinentry-curses" null)
(mkEnable true "pinentry-tty" null)
(mkEnable (gtk2 != null) "pinentry-gtk2" null)
(mkEnable (qt4 != null) "pinentry-qt4" null)
(mkWith (libcap != null) "libcap")
(mkWith (hasX) "x")
(mkEnable (ncurses != null) "pinentry-curses")
(mkEnable true "pinentry-tty")
(mkEnable (gtk2 != null) "pinentry-gtk2")
(mkEnable (qt4 != null) "pinentry-qt4")
];
nativeBuildInputs = [ pkgconfig ];

View File

@ -7,6 +7,9 @@
}:
with stdenv.lib;
let
mkFlag = cond: name: if cond then "--enable-${name}" else "--disable-${name}";
in
stdenv.mkDerivation rec {
name = "rsyslog-8.9.0";
@ -23,70 +26,70 @@ stdenv.mkDerivation rec {
] ++ stdenv.lib.optional stdenv.isLinux systemd;
configureFlags = [
(mkOther "sysconfdir" "/etc")
(mkOther "localstatedir" "/var")
(mkWith true "systemdsystemunitdir" "\${out}/etc/systemd/system")
(mkEnable true "largefile" null)
(mkEnable true "regexp" null)
(mkEnable (krb5 != null) "gssapi-krb5" null)
(mkEnable true "klog" null)
(mkEnable true "kmsg" null)
(mkEnable (systemd != null) "imjournal" null)
(mkEnable true "inet" null)
(mkEnable (jemalloc != null) "jemalloc" null)
(mkEnable true "unlimited-select" null)
(mkEnable true "usertools" null)
(mkEnable (libmysql != null) "mysql" null)
(mkEnable (postgresql != null) "pgsql" null)
(mkEnable (libdbi != null) "libdbi" null)
(mkEnable (net_snmp != null) "snmp" null)
(mkEnable (libuuid != null) "uuid" null)
(mkEnable (curl != null) "elasticsearch" null)
(mkEnable (gnutls != null) "gnutls" null)
(mkEnable (libgcrypt != null) "libgcrypt" null)
(mkEnable true "rsyslogrt" null)
(mkEnable true "rsyslogd" null)
(mkEnable true "mail" null)
(mkEnable (liblognorm != null) "mmnormalize" null)
(mkEnable true "mmjsonparse" null)
(mkEnable true "mmaudit" null)
(mkEnable true "mmanon" null)
(mkEnable true "mmutf8fix" null)
(mkEnable true "mmcount" null)
(mkEnable true "mmsequence" null)
(mkEnable true "mmfields" null)
(mkEnable true "mmpstrucdata" null)
(mkEnable (openssl != null) "mmrfc5424addhmac" null)
(mkEnable (librelp != null) "relp" null)
(mkEnable (libgt != null) "guardtime" null)
(mkEnable (liblogging != null) "liblogging-stdlog" null)
(mkEnable (liblogging != null) "rfc3195" null)
(mkEnable true "imfile" null)
(mkEnable false "imsolaris" null)
(mkEnable true "imptcp" null)
(mkEnable true "impstats" null)
(mkEnable true "omprog" null)
(mkEnable (libnet != null) "omudpspoof" null)
(mkEnable true "omstdout" null)
(mkEnable (systemd != null) "omjournal" null)
(mkEnable true "pmlastmsg" null)
(mkEnable true "pmcisconames" null)
(mkEnable true "pmciscoios" null)
(mkEnable true "pmaixforwardedfrom" null)
(mkEnable true "pmsnare" null)
(mkEnable true "omruleset" null)
(mkEnable true "omuxsock" null)
(mkEnable true "mmsnmptrapd" null)
(mkEnable (hadoop != null) "omhdfs" null)
(mkEnable (rdkafka != null) "omkafka" null)
(mkEnable (libmongo-client != null) "ommongodb" null)
(mkEnable (czmq != null) "imzmq3" null)
(mkEnable (czmq != null) "imczmq" null)
(mkEnable (czmq != null) "omzmq3" null)
(mkEnable (czmq != null) "omczmq" null)
(mkEnable (rabbitmq-c != null) "omrabbitmq" null)
(mkEnable (hiredis != null) "omhiredis" null)
(mkEnable true "generate-man-pages" null)
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-systemdsystemunitdir=\${out}/etc/systemd/system"
(mkFlag true "largefile")
(mkFlag true "regexp")
(mkFlag (krb5 != null) "gssapi-krb5")
(mkFlag true "klog")
(mkFlag true "kmsg")
(mkFlag (systemd != null) "imjournal")
(mkFlag true "inet")
(mkFlag (jemalloc != null) "jemalloc")
(mkFlag true "unlimited-select")
(mkFlag true "usertools")
(mkFlag (libmysql != null) "mysql")
(mkFlag (postgresql != null) "pgsql")
(mkFlag (libdbi != null) "libdbi")
(mkFlag (net_snmp != null) "snmp")
(mkFlag (libuuid != null) "uuid")
(mkFlag (curl != null) "elasticsearch")
(mkFlag (gnutls != null) "gnutls")
(mkFlag (libgcrypt != null) "libgcrypt")
(mkFlag true "rsyslogrt")
(mkFlag true "rsyslogd")
(mkFlag true "mail")
(mkFlag (liblognorm != null) "mmnormalize")
(mkFlag true "mmjsonparse")
(mkFlag true "mmaudit")
(mkFlag true "mmanon")
(mkFlag true "mmutf8fix")
(mkFlag true "mmcount")
(mkFlag true "mmsequence")
(mkFlag true "mmfields")
(mkFlag true "mmpstrucdata")
(mkFlag (openssl != null) "mmrfc5424addhmac")
(mkFlag (librelp != null) "relp")
(mkFlag (libgt != null) "guardtime")
(mkFlag (liblogging != null) "liblogging-stdlog")
(mkFlag (liblogging != null) "rfc3195")
(mkFlag true "imfile")
(mkFlag false "imsolaris")
(mkFlag true "imptcp")
(mkFlag true "impstats")
(mkFlag true "omprog")
(mkFlag (libnet != null) "omudpspoof")
(mkFlag true "omstdout")
(mkFlag (systemd != null) "omjournal")
(mkFlag true "pmlastmsg")
(mkFlag true "pmcisconames")
(mkFlag true "pmciscoios")
(mkFlag true "pmaixforwardedfrom")
(mkFlag true "pmsnare")
(mkFlag true "omruleset")
(mkFlag true "omuxsock")
(mkFlag true "mmsnmptrapd")
(mkFlag (hadoop != null) "omhdfs")
(mkFlag (rdkafka != null) "omkafka")
(mkFlag (libmongo-client != null) "ommongodb")
(mkFlag (czmq != null) "imzmq3")
(mkFlag (czmq != null) "imczmq")
(mkFlag (czmq != null) "omzmq3")
(mkFlag (czmq != null) "omczmq")
(mkFlag (rabbitmq-c != null) "omrabbitmq")
(mkFlag (hiredis != null) "omhiredis")
(mkFlag true "generate-man-pages")
];
meta = {