diff options
author | William A. Kennington III <william@wkennington.com> | 2015-05-22 12:59:21 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2015-05-22 13:26:55 -0700 |
commit | 25a148fa196b944b3f134527da87e43d88c066f9 (patch) | |
tree | b75635c87759b11e52eba1bd7d02116257571b8a /pkgs/development/libraries | |
parent | 50fa9d8eeab5e90e8d673c5d65a0af2a7c57b2fe (diff) | |
download | nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.tar nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.tar.gz nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.tar.bz2 nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.tar.lz nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.tar.xz nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.tar.zst nixpkgs-25a148fa196b944b3f134527da87e43d88c066f9.zip |
Refactor mkFlag / shouldUsePkg into the nixpkgs libraries
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r-- | pkgs/development/libraries/kerberos/heimdal.nix | 13 | ||||
-rw-r--r-- | pkgs/development/libraries/libgcrypt/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/libraries/libmicrohttpd/default.nix | 10 | ||||
-rw-r--r-- | pkgs/development/libraries/libssh/default.nix | 3 | ||||
-rw-r--r-- | pkgs/development/libraries/libssh2/default.nix | 10 | ||||
-rw-r--r-- | pkgs/development/libraries/libxml2/default.nix | 11 | ||||
-rw-r--r-- | pkgs/development/libraries/ncurses/default.nix | 18 | ||||
-rw-r--r-- | pkgs/development/libraries/nghttp2/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/libraries/wiredtiger/default.nix | 12 |
9 files changed, 21 insertions, 86 deletions
diff --git a/pkgs/development/libraries/kerberos/heimdal.nix b/pkgs/development/libraries/kerberos/heimdal.nix index b0de8c15146..6050891ba27 100644 --- a/pkgs/development/libraries/kerberos/heimdal.nix +++ b/pkgs/development/libraries/kerberos/heimdal.nix @@ -8,16 +8,9 @@ #, sqlite, db, ncurses, openssl, cyrus_sasl }: +with stdenv; +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; - - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; - optOpenldap = shouldUsePkg openldap; optLibcap_ng = shouldUsePkg libcap_ng; optSqlite = shouldUsePkg sqlite; @@ -97,7 +90,7 @@ stdenv.mkDerivation rec { rmdir $out/libexec ''; - meta = with stdenv.lib; { + meta = { description = "an implementation of Kerberos 5 (and some more stuff) largely written in Sweden"; license = licenses.bsd3; platforms = platforms.linux; diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix index 7d327a499bc..702d54392a6 100644 --- a/pkgs/development/libraries/libgcrypt/default.nix +++ b/pkgs/development/libraries/libgcrypt/default.nix @@ -5,16 +5,9 @@ , libcap ? null, pth ? null }: +with stdenv; +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; - - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; - optLibcap = shouldUsePkg libcap; #optPth = shouldUsePkg pth; optPth = null; # Broken as of 1.6.3 @@ -38,13 +31,13 @@ stdenv.mkDerivation rec { # Also make sure includes are fixed for callers who don't use libgpgcrypt-config postInstall = '' sed -i 's,#include <gpg-error.h>,#include "${libgpgerror}/include/gpg-error.h",g' $out/include/gcrypt.h - '' + stdenv.lib.optionalString (!stdenv.isDarwin && optLibcap != null) '' + '' + optionalString (!stdenv.isDarwin && optLibcap != null) '' sed -i 's,\(-lcap\),-L${optLibcap}/lib \1,' $out/lib/libgcrypt.la ''; doCheck = true; - meta = with stdenv.lib; { + meta = { homepage = https://www.gnu.org/software/libgcrypt/; description = "General-pupose cryptographic library"; license = licenses.lgpl2Plus; diff --git a/pkgs/development/libraries/libmicrohttpd/default.nix b/pkgs/development/libraries/libmicrohttpd/default.nix index 9eca6bd84b9..c7892716c9d 100644 --- a/pkgs/development/libraries/libmicrohttpd/default.nix +++ b/pkgs/development/libraries/libmicrohttpd/default.nix @@ -5,16 +5,8 @@ , openssl ? null, zlib ? null, libgcrypt ? null, gnutls ? null }: +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; - optOpenssl = shouldUsePkg openssl; optZlib = shouldUsePkg zlib; hasSpdy = optOpenssl != null && optZlib != null; diff --git a/pkgs/development/libraries/libssh/default.nix b/pkgs/development/libraries/libssh/default.nix index e5d01f213cb..83efa5e65c9 100644 --- a/pkgs/development/libraries/libssh/default.nix +++ b/pkgs/development/libraries/libssh/default.nix @@ -7,9 +7,8 @@ , openssl ? null, libgcrypt ? null }: +with stdenv; let - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; - # Prefer openssl cryptoStr = if shouldUsePkg openssl != null then "openssl" else if shouldUsePkg libgcrypt != null then "libgcrypt" diff --git a/pkgs/development/libraries/libssh2/default.nix b/pkgs/development/libraries/libssh2/default.nix index 3434fde1a62..a8e8777f06c 100644 --- a/pkgs/development/libraries/libssh2/default.nix +++ b/pkgs/development/libraries/libssh2/default.nix @@ -7,16 +7,8 @@ , openssl ? null, libgcrypt ? null }: +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; - # Prefer openssl cryptoStr = if shouldUsePkg openssl != null then "openssl" else if shouldUsePkg libgcrypt != null then "libgcrypt" diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 0d70a6502fe..77050a1d3b3 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -6,16 +6,8 @@ #TODO: share most stuff between python and non-python builds, perhaps via multiple-output +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; - optIcu = shouldUsePkg icu; optPython = shouldUsePkg python; optReadline = shouldUsePkg readline; @@ -25,6 +17,7 @@ let sitePackages = if optPython == null then null else "\${out}/lib/${python.libPrefix}/site-packages"; in +with stdenv.lib; stdenv.mkDerivation rec { name = "libxml2-${version}"; version = "2.9.2"; diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix index fd545e53625..43fca875f58 100644 --- a/pkgs/development/libraries/ncurses/default.nix +++ b/pkgs/development/libraries/ncurses/default.nix @@ -8,23 +8,11 @@ , unicode ? true }: +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; - - shouldUsePkg = pkg_: let - pkg = (builtins.tryEval pkg_).value; - in if stdenv.lib.any (x: x == stdenv.system) (pkg.meta.platforms or []) - then pkg - else null; - buildShared = !stdenv.isDarwin; - optGpm = shouldUsePkg gpm; + optGpm = stdenv.shouldUsePkg gpm; in stdenv.mkDerivation rec { name = "ncurses-5.9"; @@ -119,7 +107,7 @@ stdenv.mkDerivation rec { echo "INPUT(-lncurses)" > $out/lib/libcurses.so ''; - meta = with stdenv.lib; { + meta = { description = "Free software emulation of curses in SVR4 and more"; longDescription = '' diff --git a/pkgs/development/libraries/nghttp2/default.nix b/pkgs/development/libraries/nghttp2/default.nix index bc8c599a901..d8fd36ecba6 100644 --- a/pkgs/development/libraries/nghttp2/default.nix +++ b/pkgs/development/libraries/nghttp2/default.nix @@ -8,16 +8,9 @@ , prefix ? "" }: +with stdenv; +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; - - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; - isLib = prefix == "lib"; optOpenssl = if isLib then null else shouldUsePkg openssl; @@ -50,7 +43,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgconfig ]; buildInputs = [ optJansson optBoost optLibxml2 optJemalloc ] - ++ stdenv.lib.optionals hasApp [ optOpenssl optLibev optZlib ]; + ++ optionals hasApp [ optOpenssl optLibev optZlib ]; configureFlags = [ (mkEnable false "werror" null) @@ -68,7 +61,7 @@ stdenv.mkDerivation rec { (mkWith false "cython" null) ]; - meta = with stdenv.lib; { + meta = { homepage = http://nghttp2.org/; description = "an implementation of HTTP/2 in C"; license = licenses.mit; diff --git a/pkgs/development/libraries/wiredtiger/default.nix b/pkgs/development/libraries/wiredtiger/default.nix index da4dc9d6bbc..514dcd5972a 100644 --- a/pkgs/development/libraries/wiredtiger/default.nix +++ b/pkgs/development/libraries/wiredtiger/default.nix @@ -5,17 +5,8 @@ , gperftools ? null, leveldb ? null }: -with stdenv.lib; +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 && any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; - optLz4 = shouldUsePkg lz4; optSnappy = shouldUsePkg snappy; optZlib = shouldUsePkg zlib; @@ -24,6 +15,7 @@ let optGperftools = shouldUsePkg gperftools; optLeveldb = shouldUsePkg leveldb; in +with stdenv.lib; stdenv.mkDerivation rec { name = "wiredtiger-${version}"; version = "2.6.0"; |