Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"

This reverts commit 25a148fa19.
This commit is contained in:
Eelco Dolstra
2015-06-01 20:52:03 +02:00
parent 4f60156afb
commit 3096d03435
18 changed files with 176 additions and 104 deletions

View File

@@ -8,9 +8,16 @@
#, 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;
@@ -90,7 +97,7 @@ stdenv.mkDerivation rec {
rmdir $out/libexec
'';
meta = {
meta = with stdenv.lib; {
description = "an implementation of Kerberos 5 (and some more stuff) largely written in Sweden";
license = licenses.bsd3;
platforms = platforms.linux;

View File

@@ -5,9 +5,16 @@
, 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
@@ -31,13 +38,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
'' + optionalString (!stdenv.isDarwin && optLibcap != null) ''
'' + stdenv.lib.optionalString (!stdenv.isDarwin && optLibcap != null) ''
sed -i 's,\(-lcap\),-L${optLibcap}/lib \1,' $out/lib/libgcrypt.la
'';
doCheck = true;
meta = {
meta = with stdenv.lib; {
homepage = https://www.gnu.org/software/libgcrypt/;
description = "General-pupose cryptographic library";
license = licenses.lgpl2Plus;

View File

@@ -5,8 +5,16 @@
, 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;

View File

@@ -7,8 +7,9 @@
, 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"

View File

@@ -7,8 +7,16 @@
, 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"

View File

@@ -6,8 +6,16 @@
#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;
@@ -17,7 +25,6 @@ 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";

View File

@@ -8,11 +8,23 @@
, 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 = stdenv.shouldUsePkg gpm;
optGpm = shouldUsePkg gpm;
in
stdenv.mkDerivation rec {
name = "ncurses-5.9";
@@ -124,7 +136,7 @@ stdenv.mkDerivation rec {
ln -svf libncurses.so $out/lib/libcurses.so
'';
meta = {
meta = with stdenv.lib; {
description = "Free software emulation of curses in SVR4 and more";
longDescription = ''

View File

@@ -8,9 +8,16 @@
, 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;
@@ -43,7 +50,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ optJansson optBoost optLibxml2 optJemalloc ]
++ optionals hasApp [ optOpenssl optLibev optZlib ];
++ stdenv.lib.optionals hasApp [ optOpenssl optLibev optZlib ];
configureFlags = [
(mkEnable false "werror" null)
@@ -61,7 +68,7 @@ stdenv.mkDerivation rec {
(mkWith false "cython" null)
];
meta = {
meta = with stdenv.lib; {
homepage = http://nghttp2.org/;
description = "an implementation of HTTP/2 in C";
license = licenses.mit;

View File

@@ -5,8 +5,17 @@
, gperftools ? null, leveldb ? 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 && any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
optLz4 = shouldUsePkg lz4;
optSnappy = shouldUsePkg snappy;
optZlib = shouldUsePkg zlib;
@@ -15,7 +24,6 @@ let
optGperftools = shouldUsePkg gperftools;
optLeveldb = shouldUsePkg leveldb;
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "wiredtiger-${version}";
version = "2.6.0";