Refactor mkFlag out of old packages

This commit is contained in:
William A. Kennington III 2015-05-22 13:33:08 -07:00
parent 25a148fa19
commit 3117e0c897
12 changed files with 173 additions and 215 deletions

View file

@ -17,10 +17,6 @@ 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
@ -37,38 +33,38 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
configureFlags = [
(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")
(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)
] ++ 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
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
sndfileFileIO = if sndfileFileIOSupport then "sndfile" else "lame";
in
with stdenv.lib;
@ -39,17 +39,18 @@ stdenv.mkDerivation rec {
++ optional sndfileFileIOSupport libsndfile;
configureFlags = [
(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 "")
(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")
];
meta = {

View file

@ -13,10 +13,6 @@ 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}";
@ -28,11 +24,11 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(mkFlag encaSupport "enca")
(mkFlag fontconfigSupport "fontconfig")
(mkFlag harfbuzzSupport "harfbuzz")
(mkFlag rasterizerSupport "rasterizer")
(mkFlag largeTilesSupport "large-tiles")
(mkEnable encaSupport "enca" null)
(mkEnable fontconfigSupport "fontconfig" null)
(mkEnable harfbuzzSupport "harfbuzz" null)
(mkEnable rasterizerSupport "rasterizer" null)
(mkEnable largeTilesSupport "large-tiles" null)
];
nativeBuildInputs = [ pkgconfig yasm ];

View file

@ -9,10 +9,6 @@ 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";
@ -23,9 +19,9 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(mkFlag documentationSupport "documentation")
(mkFlag eventGUISupport "event-gui")
(mkFlag testsSupport "tests")
(mkEnable documentationSupport "documentation" null)
(mkEnable eventGUISupport "event-gui" null)
(mkEnable testsSupport "tests" null)
];
nativeBuildInputs = [ pkgconfig ];

View file

@ -20,10 +20,6 @@ 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}";
@ -35,19 +31,19 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(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")
(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)
];
buildInputs = [ ]

View file

@ -2,10 +2,6 @@
, 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";
@ -21,7 +17,7 @@ stdenv.mkDerivation rec {
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_STATIC_LIBS=OFF"
"-DCMAKE_BUILD_TYPE=Release"
(mkFlag parallel "USE_GNU_PARALLEL")
"-DUSE_GNU_PARALLEL=${if parallel then "ON" else "OFF"}"
];
passthru = {

View file

@ -6,10 +6,6 @@
# Require the optional to be enabled until upstream fixes or removes the configure flag
assert expat != null;
let
mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "wayland-${version}";
@ -21,7 +17,7 @@ stdenv.mkDerivation rec {
};
configureFlags = [
(mkFlag (expat != null) "scanner")
(mkEnable (expat != null) "scanner" null)
];
nativeBuildInputs = [ pkgconfig ];

View file

@ -25,13 +25,13 @@
, opusSupport ? true, libopus
}:
with stdenv.lib;
let
opt = stdenv.lib.optional;
mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}";
opt = optional;
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 @@ in stdenv.mkDerivation rec {
++ opt opusSupport libopus;
configureFlags =
[ (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"
[ (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)
]
++ opt stdenv.isLinux
"--with-systemdsystemunitdir=$(out)/etc/systemd/system";
@ -103,7 +103,7 @@ in stdenv.mkDerivation rec {
${if shoutSupport then "-lshout" else ""}
'';
meta = with stdenv.lib; {
meta = {
description = "A flexible, powerful daemon for playing music";
homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
license = licenses.gpl2;

View file

@ -37,18 +37,12 @@
assert kerberos != null -> zlib != null;
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;
bundledLibs = if kerberos != null && kerberos.implementation == "heimdal" then "NONE" else "com_err";
hasGnutls = gnutls != null && libgcrypt != null && libgpgerror != null;
isKrb5OrNull = if kerberos != null && kerberos.implementation == "krb5" then true else null;
hasInfinibandOrNull = if libibverbs != null && librdmacm != null then true else null;
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "samba-4.2.1";
@ -60,7 +54,7 @@ stdenv.mkDerivation rec {
patches = [
./4.x-no-persistent-install.patch
./4.x-fix-ctdb-deps.patch
] ++ stdenv.lib.optional (kerberos != null) ./4.x-heimdal-compat.patch;
] ++ optional (kerberos != null) ./4.x-heimdal-compat.patch;
buildInputs = [
python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42
@ -162,7 +156,7 @@ stdenv.mkDerivation rec {
find $out -type f -exec $SHELL -c "$SCRIPT" \;
'';
meta = with stdenv.lib; {
meta = {
homepage = http://www.samba.org/;
description = "The standard Windows interoperability suite of programs for Linux and Unix";
license = licenses.gpl3;

View file

@ -28,13 +28,6 @@ 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,9 +3,6 @@
}:
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;
@ -20,12 +17,12 @@ stdenv.mkDerivation rec {
buildInputs = [ libcap gtk2 ncurses qt4 ];
configureFlags = [
(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")
(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)
];
nativeBuildInputs = [ pkgconfig ];

View file

@ -7,9 +7,6 @@
}:
with stdenv.lib;
let
mkFlag = cond: name: if cond then "--enable-${name}" else "--disable-${name}";
in
stdenv.mkDerivation rec {
name = "rsyslog-8.9.0";
@ -26,70 +23,70 @@ stdenv.mkDerivation rec {
] ++ stdenv.lib.optional stdenv.isLinux systemd;
configureFlags = [
"--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")
(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)
];
meta = {