samba4: Lots of code cleanups

This commit is contained in:
William A. Kennington III 2015-04-03 18:33:36 -07:00
parent d6976a2e41
commit 5f87dd1c66
2 changed files with 68 additions and 48 deletions

@ -5,6 +5,7 @@
# source3/wscript optionals
, kerberos ? null
, zlib ? null
, openldap ? null
, cups ? null
, pam ? null
@ -25,9 +26,7 @@
, libgpgerror ? null
# other optionals
, zlib ? null
, ncurses ? null
, libcap ? null
, libunwind ? null
, dbus ? null
, libibverbs ? null
@ -35,6 +34,21 @@
, systemd ? null
}:
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
stdenv.mkDerivation rec {
name = "samba-4.2.0";
@ -45,9 +59,8 @@ stdenv.mkDerivation rec {
patches = [
./4.x-no-persistent-install.patch
./4.x-heimdal-compat.patch
./4.x-fix-ctdb-deps.patch
];
] ++ stdenv.lib.optional (kerberos != null) ./4.x-heimdal-compat.patch;
buildInputs = [
python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42
@ -55,13 +68,13 @@ stdenv.mkDerivation rec {
pythonPackages.subunit libbsd nss_wrapper socket_wrapper uid_wrapper
libarchive
kerberos openldap cups pam avahi acl libaio fam ceph glusterfs
kerberos zlib openldap cups pam avahi acl libaio fam ceph glusterfs
libiconv gettext
gnutls libgcrypt libgpgerror
zlib ncurses libcap libunwind dbus libibverbs librdmacm systemd
ncurses libunwind dbus libibverbs librdmacm systemd
];
postPatch = ''
@ -76,53 +89,56 @@ stdenv.mkDerivation rec {
configureFlags = [
# source3/wscript options
"--with-static-modules=NONE"
"--with-shared-modules=ALL"
"--with-winbind"
] ++ (if kerberos != null then [ "--with-ads" ] else [ "--without-ads" ])
++ (if openldap != null then [ "--with-ldap" ] else [ "--without-ldap" ])
++ (if cups != null then [ "--enable-cups" ] else [ "--disable-cups" ])
++ (if pam != null then [ "--with-pam" "--with-pam_smbpass" ]
else [ "--without-pam" "--without-pam_smbpass" ]) ++ [
"--with-quotas"
"--with-sendfile-support"
"--with-utmp"
"--enable-pthreadpool"
] ++ (if avahi != null then [ "--enable-avahi" ] else [ "--disable-avahi" ]) ++ [
"--with-iconv"
] ++ (if acl != null then [ "--with-acl-support" ] else [ "--without-acl-support" ]) ++ [
"--with-dnsupdate"
"--with-syslog"
"--with-automount"
] ++ (if libaio != null then [ "--with-aio-support" ] else [ "--without-aio-support" ])
++ (if fam != null then [ "--with-fam" ] else [ "--without-fam" ]) ++ [
"--with-cluster-support"
] ++ (if ceph != null then [ "--with-libcephfs=${ceph}" ] else [ ])
++ (if glusterfs != null then [ "--enable-glusterfs" ] else [ "--disable-glusterfs" ]) ++ [
(mkWith true "static-modules" "NONE")
(mkWith true "shared-modules" "ALL")
(mkWith true "winbind" null)
(mkWith (openldap != null) "ads" null)
(mkWith (openldap != null) "ldap" null)
(mkEnable (cups != null) "cups" null)
(mkEnable (cups != null) "iprint" null)
(mkWith (pam != null) "pam" null)
(mkWith (pam != null) "pam_smbpass" null)
(mkWith true "quotas" null)
(mkWith true "sendfile-support" null)
(mkWith true "utmp" null)
(mkWith true "utmp" null)
(mkEnable true "pthreadpool" null)
(mkEnable (avahi != null) "avahi" null)
(mkWith true "iconv" null)
(mkWith (acl != null) "acl-support" null)
(mkWith true "dnsupdate" null)
(mkWith true "syslog" null)
(mkWith true "automount" null)
(mkWith (libaio != null) "aio-support" null)
(mkWith (fam != null) "fam" null)
(mkWith (libarchive != null) "libarchive" null)
(mkWith true "cluster-support" null)
(mkWith (ncurses != null) "regedit" null)
(mkWith ceph "libcephfs" ceph)
(mkEnable (glusterfs != null) "glusterfs" null)
# dynconfig/wscript options
"--enable-fhs"
"--sysconfdir=/etc"
"--localstatedir=/var"
(mkEnable true "fhs" null)
(mkOther "sysconfdir" "/etc")
(mkOther "localstatedir" "/var")
# buildtools/wafsamba/wscript options
"--bundled-libraries=${if kerberos != null && kerberos.implementation == "heimdal" then "NONE" else "com_err"}"
"--private-libraries=NONE"
"--builtin-libraries=replace"
] ++ (if libiconv != null then [ "--with-libiconv=${libiconv}" ] else [ ])
++ (if gettext != null then [ "--with-gettext=${gettext}" ] else [ "--without-gettext" ]) ++ [
(mkOther "bundled-libraries" bundledLibs)
(mkOther "private-libraries" "NONE")
(mkOther "builtin-libraries" "replace")
(mkWith libiconv "libiconv" libiconv)
(mkWith (gettext != null) "gettext" gettext)
# source4/lib/tls/wscript options
] ++ (if gnutls != null && libgcrypt != null && libgpgerror != null
then [ "--enable-gnutls" ] else [ "--disable-gnutls" ]) ++ [
(mkEnable hasGnutls "gnutls" null)
# wscript options
] ++ stdenv.lib.optional (kerberos != null && kerberos.implementation == "krb5") "--with-system-mitkrb5"
++ stdenv.lib.optional (kerberos == null) "--without-ad-dc" ++ [
(mkWith isKrb5OrNull "system-mitkrb5" null)
(if hasGnutls then null else "--without-ad-dc")
# ctdb/wscript
"--enable-infiniband"
"--enable-pmda"
(mkEnable hasInfinibandOrNull "infiniband" null)
(mkEnable null "pmda" null)
];
stripAllList = [ "bin" "sbin" ];

@ -8514,19 +8514,19 @@ let
samba3 = callPackage ../servers/samba/3.x.nix { };
samba4 = callPackage ../servers/samba/4.x.nix {
libgcrypt = libgcrypt_1_6;
python = python2;
pythonPackages = python2Packages;
kerberos = krb5;
libgcrypt = libgcrypt_1_6;
cups = if stdenv.isDarwin then null else cups;
pam = if stdenv.isDarwin then null else pam;
libaio = if stdenv.isDarwin then null else libaio;
ceph = if stdenv.isDarwin then null else ceph;
glusterfs = if stdenv.isDarwin then null else glusterfs;
libcap = if stdenv.isLinux then libcap else null;
dbus = if stdenv.isLinux then dbus else null;
libibverbs = if stdenv.isLinux then libibverbs else null;
librdmacm = if stdenv.isLinux then librdmacm else null;
systemd = if stdenv.isLinux then system else null;
systemd = if stdenv.isLinux then systemd else null;
};
samba = samba4;
@ -8547,6 +8547,7 @@ let
samba4_light = lowPrio (samba4.override {
# source3/wscript optionals
kerberos = null;
zlib = null;
openldap = null;
cups = null;
pam = null;
@ -8567,9 +8568,12 @@ let
libgpgerror = null;
# other optionals
zlib = null;
ncurses = null;
libcap = null;
libunwind = null;
dbus = null;
libibverbs = null;
librdmacm = null;
systemd = null;
});
samba_light = samba4_light;