@@ -1,48 +1,23 @@
1−{ stdenv, fetchurl, python, pkgconfig, perl, libxslt, docbook_xsl
1+{ lib, stdenv, fetchurl, python, pkgconfig, perl, libxslt, docbook_xsl
22, docbook_xml_dtd_42, docbook_xml_dtd_45, readline, talloc, ntdb, tdb, tevent
3−, ldb, popt, iniparser, subunit, libbsd, nss_wrapper, socket_wrapper
4−, uid_wrapper, libarchive
5−
6−# source3/wscript optionals
7−, kerberos ? null
8−, zlib ? null
9−, openldap ? null
10−, cups ? null
11−, pam ? null
12−, avahi ? null
13−, acl ? null
14−, libaio ? null
15−, fam ? null
16−, libceph ? null
17−, glusterfs ? null
18−
19−# buildtools/wafsamba/wscript optionals
20−, libiconv ? null
21−, gettext ? null
22−
23−# source4/lib/tls/wscript optionals
24−, gnutls ? null
25−, libgcrypt ? null
26−, libgpgerror ? null
27−
28−# other optionals
29−, ncurses ? null
30−, libunwind ? null
31−, dbus ? null
32−, libibverbs ? null
33−, librdmacm ? null
34−, systemd ? null
3+, ldb, popt, iniparser, libbsd, libarchive, libiconv, gettext
4+, kerberos, zlib, openldap, cups, pam, avahi, acl, libaio, fam, libceph, glusterfs
5+, gnutls, libgcrypt, libgpgerror
6+, ncurses, libunwind, libibverbs, librdmacm, systemd
7+
8+, enableKerberos ? false
9+, enableInfiniband ? false
10+, enableLDAP ? false
11+, enablePrinting ? false
12+, enableMDNS ? false
13+, enableDomainController ? false
14+, enableRegedit ? true
15+, enableCephFS ? false
16+, enableGlusterFS ? false
3517}:
3618
37−assert kerberos != null -> zlib != null;
19+with lib;
3820
39−let
40− bundledLibs = if kerberos != null && kerberos.implementation == "heimdal" then "NONE" else "com_err";
41− hasGnutls = gnutls != null && libgcrypt != null && libgpgerror != null;
42− isKrb5OrNull = if kerberos != null && kerberos.implementation == "krb5" then true else null;
43− hasInfinibandOrNull = if libibverbs != null && librdmacm != null then true else null;
44−in
45−with stdenv.lib;
4621stdenv.mkDerivation rec {
4722 name = "samba-4.2.1";
4823
@@ -51,25 +26,26 @@ stdenv.mkDerivation rec {
5126 sha256 = "1hsakc8h6rs48xr6i55m90pd53hpxcqjjnlwq8i2rp0nq4ws5sip";
5227 };
5328
54− patches = [
55− ./4.x-no-persistent-install.patch
56− ./4.x-fix-ctdb-deps.patch
57− ] ++ optional (kerberos != null) ./4.x-heimdal-compat.patch;
58−
59− buildInputs = [
60− python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42
61− docbook_xml_dtd_45 readline talloc ntdb tdb tevent ldb popt iniparser
62− subunit libbsd nss_wrapper socket_wrapper uid_wrapper
63− libarchive
64−
65− kerberos zlib openldap cups pam avahi acl libaio fam libceph glusterfs
66−
67− libiconv gettext
68−
69− gnutls libgcrypt libgpgerror
70−
71− ncurses libunwind dbus libibverbs librdmacm systemd
72− ];
29+ patches =
30+ [ ./4.x-no-persistent-install.patch
31+ ./4.x-fix-ctdb-deps.patch
32+ ] ++ stdenv.lib.optional enableKerberos ./4.x-heimdal-compat.patch;
33+
34+ buildInputs =
35+ [ python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42 /*
36+ docbook_xml_dtd_45 */ readline talloc ntdb tdb tevent ldb popt iniparser
37+ libbsd libarchive zlib acl fam libiconv gettext libunwind
38+ ]
39+ ++ optionals stdenv.isLinux [ libaio pam systemd ]
40+ ++ optional enableKerberos kerberos
41+ ++ optionals (enableInfiniband && stdenv.isLinux) [ libibverbs librdmacm ]
42+ ++ optional enableLDAP openldap
43+ ++ optional (enablePrinting && stdenv.isLinux) cups
44+ ++ optional enableMDNS avahi
45+ ++ optional enableDomainController gnutls
46+ ++ optional enableRegedit ncurses
47+ ++ optional (enableCephFS && stdenv.isLinux) libceph
48+ ++ optional (enableGlusterFS && stdenv.isLinux) glusterfs;
7349
7450 postPatch = ''
7551 # Removes absolute paths in scripts
@@ -79,70 +55,24 @@ stdenv.mkDerivation rec {
7955 sed -i "s,\(XML_CATALOG_FILES=\"\),\1$XML_CATALOG_FILES ,g" buildtools/wafsamba/wafsamba.py
8056 '';
8157
82− enableParallelBuilding = true;
83−
84− configureFlags = [
85− # source3/wscript options
86− (mkWith true "static-modules" "NONE")
87− (mkWith true "shared-modules" "ALL")
88− (mkWith true "winbind" null)
89− (mkWith (openldap != null) "ads" null)
90− (mkWith (openldap != null) "ldap" null)
91− (mkEnable (cups != null) "cups" null)
92− (mkEnable (cups != null) "iprint" null)
93− (mkWith (pam != null) "pam" null)
94− (mkWith (pam != null) "pam_smbpass" null)
95− (mkWith true "quotas" null)
96− (mkWith true "sendfile-support" null)
97− (mkWith true "utmp" null)
98− (mkWith true "utmp" null)
99− (mkEnable true "pthreadpool" null)
100− (mkEnable (avahi != null) "avahi" null)
101− (mkWith true "iconv" null)
102− (mkWith (acl != null) "acl-support" null)
103− (mkWith true "dnsupdate" null)
104− (mkWith true "syslog" null)
105− (mkWith true "automount" null)
106− (mkWith (libaio != null) "aio-support" null)
107− (mkWith (fam != null) "fam" null)
108− (mkWith (libarchive != null) "libarchive" null)
109− (mkWith true "cluster-support" null)
110− (mkWith (ncurses != null) "regedit" null)
111− (mkWith libceph "libcephfs" libceph)
112− (mkEnable (glusterfs != null) "glusterfs" null)
113−
114− # dynconfig/wscript options
115− (mkEnable true "fhs" null)
116− (mkOther "sysconfdir" "/etc")
117− (mkOther "localstatedir" "/var")
118−
119− # buildtools/wafsamba/wscript options
120− (mkOther "bundled-libraries" bundledLibs)
121− (mkOther "private-libraries" "NONE")
122− (mkOther "builtin-libraries" "replace")
123− (mkWith libiconv "libiconv" libiconv)
124− (mkWith (gettext != null) "gettext" gettext)
125−
126− # source4/lib/tls/wscript options
127− (mkEnable hasGnutls "gnutls" null)
58+ configureFlags =
59+ [ "--with-static-modules=NONE"
60+ "--with-shared-modules=ALL"
61+ "--enable-fhs"
62+ "--sysconfdir=/etc"
63+ "--localstatedir=/var"
64+ "--bundled-libraries=${if enableKerberos && kerberos.implementation == "heimdal" then "NONE" else "com_err"}"
65+ "--private-libraries=NONE"
66+ "--builtin-libraries=replace"
67+ ]
68+ ++ optional (enableKerberos != null && kerberos.implementation == "krb5") "--with-system-mitkrb5"
69+ ++ optional (!enableDomainController) "--without-ad-dc"
70+ ++ optionals (!enableLDAP) [ "--without-ldap" "--without-ads" ];
12871
129− # wscript options
130− (mkWith isKrb5OrNull "system-mitkrb5" null)
131− (if hasGnutls then null else "--without-ad-dc")
132−
133− # ctdb/wscript
134− (mkEnable hasInfinibandOrNull "infiniband" null)
135− (mkEnable null "pmda" null)
136− ];
72+ enableParallelBuilding = true;
13773
13874 stripAllList = [ "bin" "sbin" ];
13975
140− postInstall = ''
141− # Remove unecessary components
142− rm -r $out/{lib,share}/ctdb-tests
143− rm $out/bin/ctdb_run{_cluster,}_tests
144− '';
145−
14676 postFixup = ''
14777 export SAMBA_LIBS="$(find $out -type f -name \*.so -exec dirname {} \; | sort | uniq)"
14878 read -r -d "" SCRIPT << EOF