diff options
Diffstat (limited to 'pkgs/servers/samba/4.x.nix')
-rw-r--r-- | pkgs/servers/samba/4.x.nix | 102 |
1 files changed, 59 insertions, 43 deletions
diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix index 7ee1c78ceebb5..79736e17a504c 100644 --- a/pkgs/servers/samba/4.x.nix +++ b/pkgs/servers/samba/4.x.nix @@ -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" ]; |