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

View File

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

View File

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