--- samba-4.2.0.ebuild 2015-03-08 16:21:55.000000000 +0300 +++ samba-4.2.0-r2.ebuild 2015-03-14 03:05:11.901127000 +0300 @@ -24,13 +24,16 @@ SLOT="0" -IUSE="acl addns ads aio avahi client cluster cups dmapi fam gnutls iprint -ldap quota selinux syslog systemd test winbind" +IUSE="acl addns ads aio avahi client cluster cups dmapi fam iprint cephfs +ldap quota selinux syslog systemd test winbind afs minimal hardened pam sasl" + +# useflag sasl control only cyrus-sasl linking, not own sasl wrapper # sys-apps/attr is an automagic dependency (see bug #489748) -# sys-libs/pam is an automagic dependency (see bug #489770) CDEPEND="${PYTHON_DEPS} - >=app-crypt/heimdal-1.5[-ssl] + virtual/krb5 + !=sys-libs/tevent-0.9.24 >=sys-libs/uid_wrapper-1.0.1 sys-libs/zlib - virtual/pam + pam? ( virtual/pam ) acl? ( virtual/acl ) addns? ( net-dns/bind-tools[gssapi] ) aio? ( dev-libs/libaio ) - cluster? ( >=dev-db/ctdb-1.0.114_p1 ) + cluster? ( !dev-db/ctdb ) cups? ( net-print/cups ) dmapi? ( sys-apps/dmapi ) fam? ( virtual/fam ) - gnutls? ( dev-libs/libgcrypt:0 + !minimal? ( dev-libs/libgcrypt:0 >=net-libs/gnutls-1.4.0 ) ldap? ( net-nds/openldap ) + minimal? ( ldap? ( !net-nds/openldap[gnutls] ) ) + afs? ( net-fs/openafs ) + sasl? ( dev-libs/cyrus-sasl ) + cephfs? ( sys-cluster/ceph ) systemd? ( sys-apps/systemd:0= )" DEPEND="${CDEPEND} virtual/pkgconfig" @@ -93,10 +100,31 @@ fi } +src_prepare(){ + cd "${S}" || die + has_version app-crypt/heimdal && sed -i -e 's:USING_SYSTEM_KDC:USING_SYSTEM_KDC_:' source4/kdc/wscript_build + use sasl || sed -i -e 's:HAVE_SASL:HAVE_SASL_:' source4/auth/wscript_configure + sed -i -e 's:/tmp/ctdb.socket:/var/run/ctdb/ctdb.socket:g' {ctdb/doc,docs-xml/smbdotconf/misc}/*ml +} + +automagic(){ + local i + for i in "${@}"; do + egrep "#define.*$i.*" "${S}"/bin/default/include/config.h + sed -i -e "/#define.*$i.*/d" "${S}"/bin/default/include/config.h + done +} + src_configure() { local myconf='' - use "cluster" && myconf+=" --with-ctdb-dir=/usr" use "test" && myconf+=" --enable-selftest" + has_version app-crypt/mit-krb5 && myconf+=" --with-system-mitkrb5" + if use minimal; then + ewarn "Selected minimal build may be failed, disabling AD DC" + myconf+=" --without-ad-dc --without-libarchive" + use !hardened && myconf+=" --without-pie" && ewarn " & PIE" + fi + use cephfs || myconf+=" --with-libcephfs=/dev/null" myconf="${myconf} \ --enable-fhs \ --sysconfdir=/etc \ @@ -119,20 +147,27 @@ $(use_enable cups) \ $(use_with dmapi) \ $(use_with fam) \ - $(use_enable gnutls) \ + $(use_enable !minimal gnutls) \ $(use_enable iprint) \ $(use_with ldap) \ - --with-pam \ - --with-pam_smbpass \ + $(use_with pam) \ + $(use_with pam pam_smbpass) \ $(use_with quota quotas) \ $(use_with syslog) \ $(use_with systemd) \ + $(use_with afs fake-kaserver) \ $(use_with winbind) " use "ads" && myconf+=" --with-shared-modules=idmap_ad" CPPFLAGS="-I/usr/include/et ${CPPFLAGS}" \ waf-utils_src_configure ${myconf} + + einfo "Removing automagic definitions" + # KDC wrong here + use pam || automagic _PAM_ '_LIBPAM ' +# use sasl || automagic SASL + } src_install() { @@ -151,6 +186,11 @@ newinitd "${CONFDIR}/samba4.initd-r1" samba newconfd "${CONFDIR}/samba4.confd" samba + if use cluster; then + newinitd "${CONFDIR}/ctdb.initd" ctdb + newconfd "${CONFDIR}/ctdb.confd" ctdb + fi + systemd_dotmpfilesd "${FILESDIR}"/samba.conf systemd_dounit "${FILESDIR}"/nmbd.service systemd_dounit "${FILESDIR}"/smbd.{service,socket}