mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
Refactor mkFlag / shouldUsePkg into the nixpkgs libraries
This commit is contained in:
parent
50fa9d8eea
commit
25a148fa19
@ -158,4 +158,27 @@ rec {
|
||||
drv' = (lib.head outputsList).value;
|
||||
in lib.deepSeq drv' drv';
|
||||
|
||||
|
||||
/* Tests whether a derivation can be used by the current platform
|
||||
Returns the derivation if true, otherwise null. */
|
||||
shouldUsePkgSystem = system: pkg_: let pkg = (builtins.tryEval pkg_).value;
|
||||
in if lib.any (x: x == system) (pkg.meta.platforms or [])
|
||||
then pkg
|
||||
else null;
|
||||
|
||||
/* Returns a configure flag string in an autotools format
|
||||
trueStr: Prepended when cond is true
|
||||
falseStr: Prepended when cond is false
|
||||
cond: The condition for the prepended string type and value
|
||||
name: The flag name
|
||||
val: The value of the flag only set when cond is true */
|
||||
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 ""}";
|
||||
|
||||
/* Flag setting helpers for autotools like packages */
|
||||
mkEnable = mkFlag "enable-" "disable-";
|
||||
mkWith = mkFlag "with-" "without-";
|
||||
mkOther = mkFlag "" "" true;
|
||||
}
|
||||
|
@ -27,65 +27,60 @@
|
||||
, type ? ""
|
||||
}:
|
||||
|
||||
with stdenv;
|
||||
with stdenv.lib;
|
||||
let
|
||||
n = "qemu-2.3.0";
|
||||
|
||||
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;
|
||||
isKvmOnly = type == "kvm-only";
|
||||
isNix = type == "nix";
|
||||
|
||||
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
|
||||
|
||||
optSDL2 = if type == "nix" then null else shouldUsePkg SDL2;
|
||||
optGtk = if type == "nix" then null else shouldUsePkg gtk;
|
||||
optLibcap = if type == "nix" then null else shouldUsePkg libcap;
|
||||
optAttr = if type == "nix" then null else shouldUsePkg attr;
|
||||
optGnutls = if type == "nix" then null else shouldUsePkg gnutls;
|
||||
optCyrus_sasl = if type == "nix" then null else shouldUsePkg cyrus_sasl;
|
||||
optLibjpeg = if type == "nix" then null else shouldUsePkg libjpeg;
|
||||
optLibpng = if type == "nix" then null else shouldUsePkg libpng;
|
||||
optNcurses = if type == "nix" then null else shouldUsePkg ncurses;
|
||||
optCurl = if type == "nix" then null else shouldUsePkg curl;
|
||||
optBluez = if type == "nix" then null else shouldUsePkg bluez;
|
||||
optLibibverbs = if type == "nix" then null else shouldUsePkg libibverbs;
|
||||
optLibrdmacm = if type == "nix" then null else shouldUsePkg librdmacm;
|
||||
optLibuuid = if type == "nix" then null else shouldUsePkg libuuid;
|
||||
optVde2 = if type == "nix" then null else shouldUsePkg vde2;
|
||||
optSDL2 = if isNix then null else shouldUsePkg SDL2;
|
||||
optGtk = if isNix then null else shouldUsePkg gtk;
|
||||
optLibcap = if isNix then null else shouldUsePkg libcap;
|
||||
optAttr = if isNix then null else shouldUsePkg attr;
|
||||
optGnutls = if isNix then null else shouldUsePkg gnutls;
|
||||
optCyrus_sasl = if isNix then null else shouldUsePkg cyrus_sasl;
|
||||
optLibjpeg = if isNix then null else shouldUsePkg libjpeg;
|
||||
optLibpng = if isNix then null else shouldUsePkg libpng;
|
||||
optNcurses = if isNix then null else shouldUsePkg ncurses;
|
||||
optCurl = if isNix then null else shouldUsePkg curl;
|
||||
optBluez = if isNix then null else shouldUsePkg bluez;
|
||||
optLibibverbs = if isNix then null else shouldUsePkg libibverbs;
|
||||
optLibrdmacm = if isNix then null else shouldUsePkg librdmacm;
|
||||
optLibuuid = if isNix then null else shouldUsePkg libuuid;
|
||||
optVde2 = if isNix then null else shouldUsePkg vde2;
|
||||
optLibaio = shouldUsePkg libaio;
|
||||
optLibcap_ng = shouldUsePkg libcap_ng;
|
||||
optSpice = if type == "nix" then null else shouldUsePkg spice;
|
||||
optSpice_protocol = if type == "nix" then null else shouldUsePkg spice_protocol;
|
||||
optLibceph = if type == "nix" then null else shouldUsePkg libceph;
|
||||
optLibxfs = if type == "nix" then null else shouldUsePkg libxfs;
|
||||
optNss = if type == "nix" then null else shouldUsePkg nss;
|
||||
optNspr = if type == "nix" then null else shouldUsePkg nspr;
|
||||
optLibusb = if type == "nix" then null else shouldUsePkg libusb;
|
||||
optUsbredir = if type == "nix" then null else shouldUsePkg usbredir;
|
||||
optMesa = if type == "nix" then null else shouldUsePkg mesa;
|
||||
optLzo = if type == "nix" then null else shouldUsePkg lzo;
|
||||
optSnappy = if type == "nix" then null else shouldUsePkg snappy;
|
||||
optBzip2 = if type == "nix" then null else shouldUsePkg bzip2;
|
||||
optLibseccomp = if type == "nix" then null else shouldUsePkg libseccomp;
|
||||
optGlusterfs = if type == "nix" then null else shouldUsePkg glusterfs;
|
||||
optLibssh2 = if type == "nix" then null else shouldUsePkg libssh2;
|
||||
optNumactl = if type == "nix" then null else shouldUsePkg numactl;
|
||||
optSpice = if isNix then null else shouldUsePkg spice;
|
||||
optSpice_protocol = if isNix then null else shouldUsePkg spice_protocol;
|
||||
optLibceph = if isNix then null else shouldUsePkg libceph;
|
||||
optLibxfs = if isNix then null else shouldUsePkg libxfs;
|
||||
optNss = if isNix then null else shouldUsePkg nss;
|
||||
optNspr = if isNix then null else shouldUsePkg nspr;
|
||||
optLibusb = if isNix then null else shouldUsePkg libusb;
|
||||
optUsbredir = if isNix then null else shouldUsePkg usbredir;
|
||||
optMesa = if isNix then null else shouldUsePkg mesa;
|
||||
optLzo = if isNix then null else shouldUsePkg lzo;
|
||||
optSnappy = if isNix then null else shouldUsePkg snappy;
|
||||
optBzip2 = if isNix then null else shouldUsePkg bzip2;
|
||||
optLibseccomp = if isNix then null else shouldUsePkg libseccomp;
|
||||
optGlusterfs = if isNix then null else shouldUsePkg glusterfs;
|
||||
optLibssh2 = if isNix then null else shouldUsePkg libssh2;
|
||||
optNumactl = if isNix then null else shouldUsePkg numactl;
|
||||
|
||||
hasSDLAbi = if optSDL2 != null then true else null;
|
||||
|
||||
hasVirtfs = stdenv.isLinux && optLibcap != null && optAttr != null;
|
||||
|
||||
hasVnc = type != "nix";
|
||||
hasVnc = !isNix;
|
||||
hasVncTls = hasVnc && optGnutls != null;
|
||||
hasVncSasl = hasVnc && optCyrus_sasl != null;
|
||||
hasVncJpeg = hasVnc && optLibjpeg != null;
|
||||
hasVncPng = hasVnc && optLibpng != null;
|
||||
hasVncWs = hasVnc && optGnutls != null;
|
||||
|
||||
hasFdt = type != "nix";
|
||||
hasFdt = !isNix;
|
||||
|
||||
hasRdma = optLibibverbs != null && optLibrdmacm != null;
|
||||
|
||||
@ -95,8 +90,8 @@ let
|
||||
|
||||
hasNss = optNss != null && optNspr != null;
|
||||
|
||||
optLibpulseaudio = if type == "nix" then null else shouldUsePkg libpulseaudio;
|
||||
optAlsaLib = if type == "nix" then null else shouldUsePkg alsaLib;
|
||||
optLibpulseaudio = if isNix then null else shouldUsePkg libpulseaudio;
|
||||
optAlsaLib = if isNix then null else shouldUsePkg alsaLib;
|
||||
audio = concatStringsSep "," (
|
||||
optional (optSDL2 != null) "sdl"
|
||||
++ optional (optLibpulseaudio != null) "pa"
|
||||
@ -179,9 +174,9 @@ stdenv.mkDerivation rec {
|
||||
(mkEnable (optBluez != null) "bluez" null)
|
||||
(mkEnable stdenv.isLinux "kvm" null)
|
||||
(mkEnable hasRdma "rdma" null)
|
||||
(mkEnable (type != "nix") "system" null)
|
||||
(mkEnable (type != "kvm-only") "user" null)
|
||||
(mkEnable (type != "kvm-only") "guest-base" null)
|
||||
(mkEnable (!isNix) "system" null)
|
||||
(mkEnable (!isKvmOnly) "user" null)
|
||||
(mkEnable (!isKvmOnly) "guest-base" null)
|
||||
(mkEnable true "pie" null)
|
||||
(mkEnable (optLibuuid != null) "uuid" null)
|
||||
(mkEnable (optVde2 != null) "vde" null)
|
||||
@ -189,7 +184,7 @@ stdenv.mkDerivation rec {
|
||||
(mkEnable hasLinuxAio "linux-aio" null)
|
||||
(mkEnable (optLibcap_ng != null) "cap-ng" null)
|
||||
(mkEnable (optAttr != null) "attr" null)
|
||||
(mkEnable (type != "nix") "docs" null)
|
||||
(mkEnable (!isNix) "docs" null)
|
||||
(mkEnable stdenv.isLinux "vhost-net" null)
|
||||
(mkEnable hasSpice "spice" null)
|
||||
(mkEnable (optLibceph != null) "rbd" null)
|
||||
@ -212,7 +207,7 @@ stdenv.mkDerivation rec {
|
||||
(mkEnable (optLibuuid != null) "vhdx" null)
|
||||
(mkEnable (optGnutls != null) "quorum" null)
|
||||
(mkEnable (optNumactl != null) "numa" null)
|
||||
] ++ optionals (type == "kvm-only") [
|
||||
] ++ optionals isKvmOnly [
|
||||
(mkOther "target-list" targetList)
|
||||
];
|
||||
|
||||
@ -235,6 +230,6 @@ stdenv.mkDerivation rec {
|
||||
description = "A generic and open source machine emulator and virtualizer";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ viric shlevy eelco wkennington ];
|
||||
platforms = if type == "kvm-only" then platforms.linux else platforms.all;
|
||||
platforms = if isKvmOnly then platforms.linux else platforms.all;
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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";
|
||||
|
@ -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 = ''
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -9,10 +9,9 @@
|
||||
, prefix ? ""
|
||||
}:
|
||||
|
||||
with stdenv;
|
||||
with stdenv.lib;
|
||||
let
|
||||
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
|
||||
|
||||
libOnly = prefix == "lib";
|
||||
|
||||
optDbus = shouldUsePkg dbus;
|
||||
|
@ -4,9 +4,8 @@
|
||||
, alsaLib ? null, db ? null, libuuid ? null, libffado ? null, celt ? null
|
||||
}:
|
||||
|
||||
with stdenv;
|
||||
let
|
||||
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
|
||||
|
||||
optAlsaLib = shouldUsePkg alsaLib;
|
||||
optDb = shouldUsePkg db;
|
||||
optLibuuid = shouldUsePkg libuuid;
|
||||
|
@ -9,10 +9,8 @@
|
||||
, prefix ? ""
|
||||
}:
|
||||
|
||||
with stdenv;
|
||||
let
|
||||
|
||||
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
|
||||
|
||||
libOnly = prefix == "lib";
|
||||
|
||||
optLibjack2 = shouldUsePkg libjack2;
|
||||
|
@ -15,16 +15,8 @@
|
||||
, 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;
|
||||
@ -66,6 +58,7 @@ let
|
||||
simple = null;
|
||||
}.${databaseName};
|
||||
in
|
||||
with stdenv.lib;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "${prefix}pulseaudio-${version}";
|
||||
version = "6.0";
|
||||
@ -84,9 +77,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
|
||||
] ++ stdenv.lib.optionals hasXlibs (with xlibs; [
|
||||
] ++ optionals hasXlibs (with xlibs; [
|
||||
libX11 libxcb libICE libSM libXtst xextproto libXi
|
||||
]) ++ stdenv.lib.optionals (optBluez5 != null) [ optBluez5 optSbc ];
|
||||
]) ++ optionals (optBluez5 != null) [ optBluez5 optSbc ];
|
||||
|
||||
preConfigure = ''
|
||||
# Performs and autoreconf
|
||||
@ -162,7 +155,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 = stdenv.lib.optionalString stdenv.isDarwin
|
||||
NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
|
||||
"-I/usr/include";
|
||||
|
||||
installFlags = [
|
||||
@ -170,11 +163,11 @@ stdenv.mkDerivation rec {
|
||||
"pulseconfdir=$(out)/etc/pulse"
|
||||
];
|
||||
|
||||
postInstall = stdenv.lib.optionalString libOnly ''
|
||||
postInstall = optionalString libOnly ''
|
||||
rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}}
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
meta = {
|
||||
description = "Sound server for POSIX and Win32 systems";
|
||||
homepage = http://www.pulseaudio.org/;
|
||||
# Note: Practically, the server is under the GPL due to the
|
||||
|
@ -5,16 +5,8 @@
|
||||
, pam ? null, libidn ? 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;
|
||||
|
||||
optPam = shouldUsePkg pam;
|
||||
optLibidn = shouldUsePkg libidn;
|
||||
optGnutls = shouldUsePkg gnutls;
|
||||
|
@ -229,6 +229,8 @@ let
|
||||
|| system == "armv7l-linux";
|
||||
isBigEndian = system == "powerpc-linux";
|
||||
|
||||
shouldUsePkg = lib.shouldUsePkgSystem system;
|
||||
|
||||
# Whether we should run paxctl to pax-mark binaries.
|
||||
needsPax = isLinux;
|
||||
|
||||
|
@ -8,19 +8,12 @@
|
||||
, suffix ? ""
|
||||
}:
|
||||
|
||||
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;
|
||||
|
||||
isLight = suffix == "light";
|
||||
isFull = suffix == "full";
|
||||
nameSuffix = stdenv.lib.optionalString (suffix != "") "-${suffix}";
|
||||
nameSuffix = optionalString (suffix != "") "-${suffix}";
|
||||
|
||||
# Normal Depedencies
|
||||
optZlib = if isLight then null else shouldUsePkg zlib;
|
||||
@ -35,7 +28,6 @@ let
|
||||
optOpenldap = if !isFull then null else shouldUsePkg openldap;
|
||||
optLibidn = if !isFull then null else shouldUsePkg libidn;
|
||||
in
|
||||
with stdenv.lib;
|
||||
stdenv.mkDerivation rec {
|
||||
name = "curl${nameSuffix}-${version}";
|
||||
version = "7.42.1";
|
||||
|
Loading…
Reference in New Issue
Block a user