net-fs/samba: Bump to versions 4.5.4 and 4.6.0_rc1
authorLars Wendler <polynomial-c@gentoo.org>
Thu, 19 Jan 2017 02:15:30 +0000 (03:15 +0100)
committerLars Wendler <polynomial-c@gentoo.org>
Thu, 19 Jan 2017 02:43:45 +0000 (03:43 +0100)
Added possibility to build AD Domain Controller against bundled heimdal.
Thanks to Denis Kaganovich and David Williams for providing patches in
Gentoo bug #594130.

Package-Manager: Portage-2.3.3, Repoman-2.3.1

net-fs/samba/Manifest
net-fs/samba/files/samba-4.5.1-compile_et_fix.patch [new file with mode: 0644]
net-fs/samba/metadata.xml
net-fs/samba/samba-4.5.4.ebuild [moved from net-fs/samba/samba-4.5.2.ebuild with 78% similarity]
net-fs/samba/samba-4.6.0_rc1.ebuild [new file with mode: 0644]

index 6dd456e99d78b9e485d1519c4ea1624a397f00e5..5856653a5058863e5f6d6c923abea5cef3ee3472 100644 (file)
@@ -3,10 +3,12 @@ DIST samba-4.2.14.tar.gz 20883281 SHA256 db820a9947e44f04b0eb25e4aa0c3db32c4042f
 DIST samba-4.3.12.tar.gz 20587617 SHA256 7e9c75b1e269224fd2fcd80415c813c7cf8021389e40777c7b63348d94a25180 SHA512 cba129bae5bb01e85b48e82336ddf8e348852e922829a3ed37a8aa02860057441f3b941cab6d9989cd09099ca4c45ee89cb343f30c10de51dff398ffbcaa43ce WHIRLPOOL 8f885da2ea0a15a04d7deb6aeb1919214b9a19306285e4e1c1ee1557e26b6dcc6f252f50e41fe5d3bc0ac537c446610c820909321c4e6aeb22e4708e6e05dcbc
 DIST samba-4.4.7.tar.gz 20739248 SHA256 a69d6612e4a421640242ca66c4dbb0e4c20281e77dc24970a332770814d45c7c SHA512 a5c4fb9224c622c21efe479bccb5a14a9a55c92838dce2e45faf466cf9ca8cbf786dd4a4c0ed1b19d9fd0ee6a5b0c2a916d367ae96389d2280269971121b418c WHIRLPOOL 64d01c5041f12a4debec25fb5ec8a5f31a0aaa60274be34d96cccaf642dba3f0a709b12a5bbbc79633ad0e2548aa8f71c00fa52b67ac9e217ed849ec51af8f71
 DIST samba-4.4.9.tar.gz 20750010 SHA256 10f76fa113213ae512db4a4823351178c93fb6bc95d98d0ebc72e3a74d43386f SHA512 9fda913ece883fbd4309623b03676629d944c6f14df359904db938ac956a2f56b347d51fd7293417b021d5b18145fb693649a54ec2125868ae3fb88f63a17e12 WHIRLPOOL ba92ee892e64e0192b9198423cea86548b4f8b1552634d8775fcff1b7d5c85b874155e4150568e5364b921678d69b668d907de955c2de4f03bc0c0a8075724ee
-DIST samba-4.5.2.tar.gz 20944229 SHA256 9297c4da1a2ee2cdb65161699b7007bc94afb39d46c25acd33f64e64c6b4397a SHA512 ac8309273de08703be9bfc182143175168dccc895c7e33dfe65d621d80788b10baa5a04f3b6d84476661c158769ee0a813dfe4890f6a511ed6e43441de18f722 WHIRLPOOL 6dee3ebceb0d6b06607b1c39ee7ab91368e721588e4f15b5d8f7f246a99a1c8ca422c4c82de42407b85d14dbdf7bd86bfa84d4fbd58f4b8dcfde66ea1d2bde4b
 DIST samba-4.5.3.tar.gz 20946015 SHA256 f06dc454a1bb72b21a329e1ad75a14795886401671ec7439d69a6b824c492eca SHA512 3ba4002131a5d7db35a62bc5841ed7aa7c43d85f7f3509237aa97bd1ff8bac6358eb3acec178ddfa6e8fa9c390dadb947fa90eec27d1299e2a9ccdecc5e9bc16 WHIRLPOOL 6667ca8dac8f315f3d27ad8751f26538d0bc0749c16796640e09bdb8e085ceb095e780ff60c4bfcd29f77a65c56933bb42ec9358d706a62ca9d3612b70d68a8f
+DIST samba-4.5.4.tar.gz 20958348 SHA256 1800d10ea14cabef67c83cc56a0f37f4f30ba5df218b3a1e7c874069a08c0f40 SHA512 7b24227e17ab091e6165c605f28af19fa846de63f3f24508411db2b509d942e599702dd278c8430481d7a404c5a97005148286ea4e94a35b57a1ec303b1a4409 WHIRLPOOL a1b84726b0a0addb1ca2de8d84429280a82001bf2fb0fbd7524dd2499fb18370d19e099b0852b93cb105b3db45583688b107533d404703ac635c2e6e8e2cb81b
+DIST samba-4.6.0rc1.tar.gz 20981499 SHA256 9b940a1d099e4953552fec204fb67e4d20e329fb26a7233b608b054ebf3d1db9 SHA512 6204d133c0cbe108f6bdd818ccce0ea462b9f6e5dc3da7033b9d544108617c8826f8223cd9712b46b1230ed9a6b87ab45f326b8644db30dcbfd7158ec2f14130 WHIRLPOOL 82071173ff61a12ada51b8e4710a3990e8310a811ebf751d2bdbe6d3e0cc9705f9c0cde6121225829a80fcac97952e41d5aee497e6b269c1e3feae4c1f5ad88e
 DIST samba-disable-python-patches-4.2.12.tar.xz 6052 SHA256 8903eacbabdfaf7b64cbde03d7c367d1efdc92e54090f0f4b9ed5d2a462b1c18 SHA512 c527d0a052d3211e5b12c17bc94db56cc5e5545189ed65a760c0656c94c22e27a4b159e6439eb0370873e1619873a741f3b3bd10d3876b38eb3914a87eace372 WHIRLPOOL ad63db55d5dc96f56e6c9b30c2092e2f6e206b0ed5d13c249879d10753c8db2f475c5d4e651e2fc042ad992b648d3b4465f1b28c6b4bbf821cf503d27f741f7e
 DIST samba-disable-python-patches-4.2.9.tar.xz 6016 SHA256 222d0153f03dddde28a0b906ee2b27076223ac88b84a998aaa285f658861edfa SHA512 02fc666a36f8e733e522663d80775d130fabee9d5fb4e1c261d28815e07be425ae8977213f9216c7af62dd8b2619e7e13d71f9a25780b058c8119901c2115a18 WHIRLPOOL ebba3a6d41a41844621759672aa8c984d26f44d12007c8e929405470c381bc262523ec68d3972e86cf675c45f092fa287496167e42940e70d704790753e47b03
 DIST samba-disable-python-patches-4.3.12.tar.xz 6172 SHA256 d46c03d906d3ab1009bcfd511b85107b276b7950854f2a36c714a6a73244f632 SHA512 5396419fb4e104564b889806596d76c8e84620c9236da7421e12e2eaeaa48811e4528f51fae49b832cb917010c2e10defd5fd70e8d65b6706f7833bdac4c8892 WHIRLPOOL f4aa70cf50e592e603f8e0a0e36e40d7eee1f2c336d701c84243d79ae5d43a7d247785730a91f16b5ec38c6dc387561cfd64ec476a96096e8ba3e6ca97c5ffbe
 DIST samba-disable-python-patches-4.4.6.tar.xz 6284 SHA256 64414f0fc431257693087be2a745f50c35d3256d5e9fad4e9fdb74606617cc4f SHA512 91e7c14096a9c1a5ccdd44fe8930604537b32d472c1e18866c20643e72729ab75f3ad1f0fb4233c168cfb987c0db69e636944df8e539b6564c74121497e00b79 WHIRLPOOL f16cff9a254e7caa2d76c89f3063853dfc25249414b70a9bb62183bdce4e4bbe582e8a9dbce2f70e9e1bff1f4f0c59f77f74012574611f61a90edda668597a98
 DIST samba-disable-python-patches-4.5.0_rc1.tar.xz 6204 SHA256 fa0d776e04e3222c0dc4761e376717f4154937cdcb85f4117b8978dfb770a78e SHA512 920089ba3c6e8e7d913b1d7ef1017262a19d1af41215adb30cfc98a57556efc4b0116931d4ef774c01124149d8eca2be3a23814ce7e11daf0180d2c111799927 WHIRLPOOL 6d55710895435ad012e23f8c252e5276966241014710349ca7fa9cf037e8742030b8e053f7cb71309a0a45f48d2235d55393243bf4d19476a22dd39bb1b7748d
+DIST samba-disable-python-patches-4.6.0_rc1.tar.xz 6208 SHA256 9d013d65759c66db89d99c6017c618f2eff9928c2d761e5865dd125c6ca2ba1b SHA512 f11faaab3ca92d7ca5e3b43fc0d9d8360c0773cfd085ab273622be8ea8769ec4783e8a81ecee005bdb73dc07e45073248b24a3c52da5455f3ff0c9416295188f WHIRLPOOL 7712e5d7af563da12c4cf8a06bb64eca021e5b7a390a7b64f209e304c365847013fc9be6381397b203bc9c4040b3d838afd0be8b72bc1bed4099f6ed21f70860
diff --git a/net-fs/samba/files/samba-4.5.1-compile_et_fix.patch b/net-fs/samba/files/samba-4.5.1-compile_et_fix.patch
new file mode 100644 (file)
index 0000000..463512f
--- /dev/null
@@ -0,0 +1,16 @@
+--- samba-4.5.1/source4/heimdal_build/wscript_configure
++++ samba-4.5.1/source4/heimdal_build/wscript_configure
+@@ -258,7 +258,11 @@
+ # With the proper checks in place we should be able to build against the system libtommath.
+ #if conf.CHECK_BUNDLED_SYSTEM('tommath', checkfunctions='mp_init', headers='tommath.h'):
+ #    conf.define('USING_SYSTEM_TOMMATH', 1)
+-check_system_heimdal_binary("compile_et")
+-check_system_heimdal_binary("asn1_compile")
++# comment out next line to stop Gentoo Samba build from using the compile_et in e2fsprogs-libs
++# to compile the error tables. This produces a compile error later on.
++#check_system_heimdal_binary("compile_et")
++#
++# As a precaution do the same for asn1_compile
++#check_system_heimdal_binary("asn1_compile")
index 7ac72a5ca81458d082e4c79675d1852b7072f771..c6b9bbe87e47390b7b69eb4475b0b8050dc21415 100644 (file)
                <flag name="client">Enables the client part</flag>
                <flag name="cluster">Enable support for clustering</flag>
                <flag name="dmapi">Enable support for DMAPI. This currently works only in combination with XFS.</flag>
+               <flag name="gpg">Use <pkg>app-crypt/gpgme</pkg> for AD DC</flag>
                <flag name="iprint">Enabling iPrint technology by Novell</flag>
                <flag name="quota">Enables support for user quotas</flag>
+               <flag name="system-heimdal">Use <pkg>app-crypt/heimdal</pkg> instead of
+                       bundled heimdal.</flag>
                <flag name="system-mitkrb5">Use <pkg>app-crypt/mit-krb5</pkg> instead of
                        <pkg>app-crypt/heimdal</pkg>.</flag>
                <flag name="winbind">Enables support for the winbind auth daemon</flag>
similarity index 78%
rename from net-fs/samba/samba-4.5.2.ebuild
rename to net-fs/samba/samba-4.5.4.ebuild
index a4d2b1aa0a09db90ff4bc2faee1613dd5d4686b0..e0a0e03065db5622dd8f1be4e2f336d638fbda8e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -25,8 +25,8 @@ LICENSE="GPL-3"
 
 SLOT="0"
 
-IUSE="acl addc addns ads client cluster cups dmapi fam gnutls iprint
-ldap pam quota selinux syslog +system-mitkrb5 systemd test winbind zeroconf"
+IUSE="acl addc addns ads client cluster cups dmapi fam gnutls gpg iprint ldap pam
+quota selinux syslog system-heimdal +system-mitkrb5 systemd test winbind zeroconf"
 
 MULTILIB_WRAPPED_HEADERS=(
        /usr/include/samba-4.0/policy.h
@@ -47,17 +47,17 @@ CDEPEND="${PYTHON_DEPS}
        dev-libs/libbsd[${MULTILIB_USEDEP}]
        dev-libs/iniparser:0
        dev-libs/popt[${MULTILIB_USEDEP}]
-       sys-libs/readline:=
-       virtual/libiconv
        dev-python/subunit[${PYTHON_USEDEP},${MULTILIB_USEDEP}]
        sys-apps/attr[${MULTILIB_USEDEP}]
-       sys-libs/libcap
        >=sys-libs/ldb-1.1.27[ldap(+)?,${MULTILIB_USEDEP}]
+       sys-libs/libcap
        sys-libs/ncurses:0=[${MULTILIB_USEDEP}]
+       sys-libs/readline:0=
        >=sys-libs/talloc-2.1.8[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
        >=sys-libs/tdb-1.3.10[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
        >=sys-libs/tevent-0.9.31-r1[${MULTILIB_USEDEP}]
        sys-libs/zlib[${MULTILIB_USEDEP}]
+       virtual/libiconv
        pam? ( virtual/pam )
        acl? ( virtual/acl )
        addns? ( net-dns/bind-tools[gssapi] )
@@ -65,11 +65,14 @@ CDEPEND="${PYTHON_DEPS}
        cups? ( net-print/cups )
        dmapi? ( sys-apps/dmapi )
        fam? ( virtual/fam )
-       gnutls? ( dev-libs/libgcrypt:0
-               >=net-libs/gnutls-1.4.0 )
+       gnutls? (
+               dev-libs/libgcrypt:0
+               >=net-libs/gnutls-1.4.0
+       )
+       gpg? ( app-crypt/gpgme )
        ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
+       system-heimdal? ( >=app-crypt/heimdal-1.5[-ssl,${MULTILIB_USEDEP}] )
        system-mitkrb5? ( app-crypt/mit-krb5[${MULTILIB_USEDEP}] )
-       !system-mitkrb5? ( >=app-crypt/heimdal-1.5[-ssl,${MULTILIB_USEDEP}] )
        systemd? ( sys-apps/systemd:0= )"
 DEPEND="${CDEPEND}
        virtual/pkgconfig"
@@ -81,12 +84,15 @@ RDEPEND="${CDEPEND}
 
 REQUIRED_USE="addc? ( gnutls !system-mitkrb5 )
        ads? ( acl gnutls ldap )
+       gpg? ( addc )
+       ?? ( system-heimdal system-mitkrb5 )
        ${PYTHON_REQUIRED_USE}"
 
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
        "${FILESDIR}/${PN}-4.4.0-pam.patch"
+       "${FILESDIR}/${PN}-4.5.1-compile_et_fix.patch"
 )
 
 #CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)"
@@ -99,7 +105,9 @@ SHAREDMODS=""
 pkg_setup() {
        python-single-r1_pkg_setup
        if use cluster ; then
-               SHAREDMODS="${SHAREDMODS}idmap_rid,idmap_tdb2,idmap_ad"
+               SHAREDMODS="idmap_rid,idmap_tdb2,idmap_ad"
+       elif use ads ; then
+               SHAREDMODS="idmap_ad"
        fi
 }
 
@@ -107,15 +115,28 @@ src_prepare() {
        default
 
        # install the patches from tarball(s)
-       eapply "${WORKDIR}/patches/"
+       eapply "${WORKDIR}/patches"
 
        # ugly hackaround for bug #592502
        cp /usr/include/tevent_internal.h "${S}"/lib/tevent/ || die
 
+       sed -e 's:<gpgme\.h>:<gpgme/gpgme.h>:' \
+               -i source4/dsdb/samdb/ldb_modules/password_hash.c \
+               || die
+
+       # Friggin' WAF shit
        multilib_copy_sources
 }
 
 multilib_src_configure() {
+       # when specifying libs for samba build you must append NONE to the end to 
+       # stop it automatically including things
+       local bundled_libs="NONE"
+       if use addc && ! use system-heimdal ; then
+               bundled_libs="heimbase,heimntlm,hdb,kdc,krb5,wind,gssapi,hcrypto,hx509,roken,asn1,com_err,NONE"
+               #bundled_libs="heimdal,NONE"
+       fi
+
        local myconf=()
        myconf=(
                --enable-fhs
@@ -123,7 +144,7 @@ multilib_src_configure() {
                --localstatedir="${EPREFIX}/var"
                --with-modulesdir="${EPREFIX}/usr/$(get_libdir)/samba"
                --with-piddir="${EPREFIX}/run/${PN}"
-               --bundled-libraries=NONE
+               --bundled-libraries="${bundled_libs}"
                --builtin-libraries=NONE
                --disable-rpath
                --disable-rpath-install
@@ -136,12 +157,12 @@ multilib_src_configure() {
                        $(usex addc '' '--without-ad-dc')
                        $(use_with addns dnsupdate)
                        $(use_with ads)
-                       $(usex ads '--with-shared-modules=idmap_ad' '')
                        $(use_with cluster cluster-support)
                        $(use_enable cups)
                        $(use_with dmapi)
                        $(use_with fam)
                        $(use_enable gnutls)
+                       $(use_with gpg gpgme)
                        $(use_enable iprint)
                        $(use_with ldap)
                        $(use_with pam)
@@ -167,6 +188,7 @@ multilib_src_configure() {
                        --without-dmapi
                        --without-fam
                        --disable-gnutls
+                       --without-gpgme
                        --disable-iprint
                        $(use_with ldap)
                        --without-pam
@@ -205,6 +227,15 @@ multilib_src_install() {
                insinto /etc/samba
                doins examples/smb.conf.default
 
+               # Fix paths in example file (#603964)
+               sed \
+                       -e '/log file =/s@/usr/local/samba/var/@/var/log/samba/@' \
+                       -e '/include =/s@/usr/local/samba/lib/@/etc/samba/@' \
+                       -e '/path =/s@/usr/local/samba/lib/@/var/lib/samba/@' \
+                       -e '/path =/s@/usr/local/samba/@/var/lib/samba/@' \
+                       -e '/path =/s@/usr/spool/samba@/var/spool/samba@' \
+                       -i "${ED%/}"/etc/samba/smb.conf.default || die
+
                # Install init script and conf.d file
                newinitd "${CONFDIR}/samba4.initd-r1" samba
                newconfd "${CONFDIR}/samba4.confd" samba
@@ -232,6 +263,6 @@ pkg_postinst() {
 
        elog "For further information and migration steps make sure to read "
        elog "http://samba.org/samba/history/${P}.html "
-       elog "http://samba.org/samba/history/${PN}-4.2.0.html and"
+       elog "http://samba.org/samba/history/${PN}-4.5.0.html and"
        elog "http://wiki.samba.org/index.php/Samba4/HOWTO "
 }
diff --git a/net-fs/samba/samba-4.6.0_rc1.ebuild b/net-fs/samba/samba-4.6.0_rc1.ebuild
new file mode 100644 (file)
index 0000000..093f6f7
--- /dev/null
@@ -0,0 +1,269 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE='threads(+),xml(+)'
+
+inherit python-single-r1 waf-utils multilib-minimal linux-info systemd eutils
+
+MY_PV="${PV/_rc/rc}"
+MY_P="${PN}-${MY_PV}"
+
+SRC_PATH="stable"
+[[ ${PV} = *_rc* ]] && SRC_PATH="rc"
+
+SRC_URI="mirror://samba/${SRC_PATH}/${MY_P}.tar.gz
+       https://dev.gentoo.org/~polynomial-c/samba-disable-python-patches-4.6.0_rc1.tar.xz"
+[[ ${PV} = *_rc* ]] || \
+KEYWORDS="~amd64 ~hppa ~x86"
+
+DESCRIPTION="Samba Suite Version 4"
+HOMEPAGE="http://www.samba.org/"
+LICENSE="GPL-3"
+
+SLOT="0"
+
+IUSE="acl addc addns ads client cluster cups dmapi fam gnutls gpg iprint ldap pam
+quota selinux syslog system-heimdal +system-mitkrb5 systemd test winbind zeroconf"
+
+MULTILIB_WRAPPED_HEADERS=(
+       /usr/include/samba-4.0/policy.h
+       /usr/include/samba-4.0/dcerpc_server.h
+       /usr/include/samba-4.0/ctdb.h
+       /usr/include/samba-4.0/ctdb_client.h
+       /usr/include/samba-4.0/ctdb_protocol.h
+       /usr/include/samba-4.0/ctdb_private.h
+       /usr/include/samba-4.0/ctdb_typesafe_cb.h
+       /usr/include/samba-4.0/ctdb_version.h
+)
+
+# sys-apps/attr is an automagic dependency (see bug #489748)
+CDEPEND="${PYTHON_DEPS}
+       >=app-arch/libarchive-3.1.2[${MULTILIB_USEDEP}]
+       dev-lang/perl:=
+       dev-libs/libaio[${MULTILIB_USEDEP}]
+       dev-libs/libbsd[${MULTILIB_USEDEP}]
+       dev-libs/iniparser:0
+       dev-libs/popt[${MULTILIB_USEDEP}]
+       dev-python/subunit[${PYTHON_USEDEP},${MULTILIB_USEDEP}]
+       >=dev-util/cmocka-1.0.0[${MULTILIB_USEDEP}]
+       sys-apps/attr[${MULTILIB_USEDEP}]
+       >=sys-libs/ldb-1.1.27[ldap(+)?,${MULTILIB_USEDEP}]
+       sys-libs/libcap
+       sys-libs/ncurses:0=[${MULTILIB_USEDEP}]
+       sys-libs/readline:0=
+       >=sys-libs/talloc-2.1.8[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
+       >=sys-libs/tdb-1.3.10[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
+       >=sys-libs/tevent-0.9.31-r1[${MULTILIB_USEDEP}]
+       sys-libs/zlib[${MULTILIB_USEDEP}]
+       virtual/libiconv
+       pam? ( virtual/pam )
+       acl? ( virtual/acl )
+       addns? ( net-dns/bind-tools[gssapi] )
+       cluster? ( !dev-db/ctdb )
+       cups? ( net-print/cups )
+       dmapi? ( sys-apps/dmapi )
+       fam? ( virtual/fam )
+       gnutls? (
+               dev-libs/libgcrypt:0
+               >=net-libs/gnutls-1.4.0
+       )
+       gpg? ( app-crypt/gpgme )
+       ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
+       system-heimdal? ( >=app-crypt/heimdal-1.5[-ssl,${MULTILIB_USEDEP}] )
+       system-mitkrb5? ( app-crypt/mit-krb5[${MULTILIB_USEDEP}] )
+       systemd? ( sys-apps/systemd:0= )"
+DEPEND="${CDEPEND}
+       virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+       client? ( net-fs/cifs-utils[ads?] )
+       selinux? ( sec-policy/selinux-samba )
+       !dev-perl/Parse-Yapp
+"
+
+REQUIRED_USE="addc? ( gnutls !system-mitkrb5 )
+       ads? ( acl gnutls ldap )
+       gpg? ( addc )
+       ?? ( system-heimdal system-mitkrb5 )
+       ${PYTHON_REQUIRED_USE}"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-4.4.0-pam.patch"
+       "${FILESDIR}/${PN}-4.5.1-compile_et_fix.patch"
+)
+
+#CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)"
+CONFDIR="${FILESDIR}/4.4"
+
+WAF_BINARY="${S}/buildtools/bin/waf"
+
+SHAREDMODS=""
+
+pkg_setup() {
+       python-single-r1_pkg_setup
+       if use cluster ; then
+               SHAREDMODS="idmap_rid,idmap_tdb2,idmap_ad"
+       elif use ads ; then
+               SHAREDMODS="idmap_ad"
+       fi
+}
+
+src_prepare() {
+       default
+
+       # install the patches from tarball(s)
+       eapply "${WORKDIR}/patches"
+
+       # ugly hackaround for bug #592502
+       cp /usr/include/tevent_internal.h "${S}"/lib/tevent/ || die
+
+       sed -e 's:<gpgme\.h>:<gpgme/gpgme.h>:' \
+               -i source4/dsdb/samdb/ldb_modules/password_hash.c \
+               || die
+
+       # Friggin' WAF shit
+       multilib_copy_sources
+}
+
+multilib_src_configure() {
+       # when specifying libs for samba build you must append NONE to the end to 
+       # stop it automatically including things
+       local bundled_libs="NONE"
+       if use addc && ! use system-heimdal ; then
+               bundled_libs="heimbase,heimntlm,hdb,kdc,krb5,wind,gssapi,hcrypto,hx509,roken,asn1,com_err,NONE"
+               #bundled_libs="heimdal,NONE"
+       fi
+
+       local myconf=()
+       myconf=(
+               --enable-fhs
+               --sysconfdir="${EPREFIX}/etc"
+               --localstatedir="${EPREFIX}/var"
+               --with-modulesdir="${EPREFIX}/usr/$(get_libdir)/samba"
+               --with-piddir="${EPREFIX}/run/${PN}"
+               --bundled-libraries="${bundled_libs}"
+               --builtin-libraries=NONE
+               --disable-rpath
+               --disable-rpath-install
+               --nopyc
+               --nopyo
+       )
+       if multilib_is_native_abi ; then
+               myconf+=(
+                       $(use_with acl acl-support)
+                       $(usex addc '' '--without-ad-dc')
+                       $(use_with addns dnsupdate)
+                       $(use_with ads)
+                       $(use_with cluster cluster-support)
+                       $(use_enable cups)
+                       $(use_with dmapi)
+                       $(use_with fam)
+                       $(use_enable gnutls)
+                       $(use_with gpg gpgme)
+                       $(use_enable iprint)
+                       $(use_with ldap)
+                       $(use_with pam)
+                       $(usex pam "--with-pammodulesdir=${EPREFIX}/$(get_libdir)/security" '')
+                       $(use_with quota quotas)
+                       $(use_with syslog)
+                       $(use_with systemd)
+                       $(usex system-mitkrb5 '--with-system-mitkrb5' '')
+                       $(use_with winbind)
+                       $(usex test '--enable-selftest' '')
+                       $(use_enable zeroconf avahi)
+                       --with-shared-modules=${SHAREDMODS}
+               )
+       else
+               myconf+=(
+                       --without-acl-support
+                       --without-ad-dc
+                       --without-dnsupdate
+                       --without-ads
+                       --disable-avahi
+                       --without-cluster-support
+                       --disable-cups
+                       --without-dmapi
+                       --without-fam
+                       --disable-gnutls
+                       --without-gpgme
+                       --disable-iprint
+                       $(use_with ldap)
+                       --without-pam
+                       --without-quotas
+                       --without-syslog
+                       --without-systemd
+                       $(usex system-mitkrb5 '--with-system-mitkrb5' '')
+                       --without-winbind
+                       --disable-python
+               )
+       fi
+
+       CPPFLAGS="-I${SYSROOT}${EPREFIX}/usr/include/et ${CPPFLAGS}" \
+               waf-utils_src_configure ${myconf[@]}
+}
+
+multilib_src_install() {
+       waf-utils_src_install
+
+       # Make all .so files executable
+       find "${D}" -type f -name "*.so" -exec chmod +x {} +
+
+       if multilib_is_native_abi; then
+               # install ldap schema for server (bug #491002)
+               if use ldap ; then
+                       insinto /etc/openldap/schema
+                       doins examples/LDAP/samba.schema
+               fi
+
+               # create symlink for cups (bug #552310)
+               if use cups ; then
+                       dosym /usr/bin/smbspool /usr/libexec/cups/backend/smb
+               fi
+
+               # install example config file
+               insinto /etc/samba
+               doins examples/smb.conf.default
+
+               # Fix paths in example file (#603964)
+               sed \
+                       -e '/log file =/s@/usr/local/samba/var/@/var/log/samba/@' \
+                       -e '/include =/s@/usr/local/samba/lib/@/etc/samba/@' \
+                       -e '/path =/s@/usr/local/samba/lib/@/var/lib/samba/@' \
+                       -e '/path =/s@/usr/local/samba/@/var/lib/samba/@' \
+                       -e '/path =/s@/usr/spool/samba@/var/spool/samba@' \
+                       -i "${ED%/}"/etc/samba/smb.conf.default || die
+
+               # Install init script and conf.d file
+               newinitd "${CONFDIR}/samba4.initd-r1" samba
+               newconfd "${CONFDIR}/samba4.confd" samba
+
+               systemd_dotmpfilesd "${FILESDIR}"/samba.conf
+               systemd_dounit "${FILESDIR}"/nmbd.service
+               systemd_dounit "${FILESDIR}"/smbd.{service,socket}
+               systemd_newunit "${FILESDIR}"/smbd_at.service 'smbd@.service'
+               systemd_dounit "${FILESDIR}"/winbindd.service
+               systemd_dounit "${FILESDIR}"/samba.service
+       fi
+}
+
+multilib_src_test() {
+       if multilib_is_native_abi ; then
+               "${WAF_BINARY}" test || die "test failed"
+       fi
+}
+
+pkg_postinst() {
+       ewarn "Be aware the this release contains the best of all of Samba's"
+       ewarn "technology parts, both a file server (that you can reasonably expect"
+       ewarn "to upgrade existing Samba 3.x releases to) and the AD domain"
+       ewarn "controller work previously known as 'samba4'."
+
+       elog "For further information and migration steps make sure to read "
+       elog "http://samba.org/samba/history/${P}.html "
+       elog "http://samba.org/samba/history/${PN}-4.5.0.html and"
+       elog "http://wiki.samba.org/index.php/Samba4/HOWTO "
+}