1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python2_7 )
6 PYTHON_REQ_USE='threads(+),xml(+)'
8 inherit python-single-r1 waf-utils multilib-minimal linux-info systemd eutils
14 [[ ${PV} = *_rc* ]] && SRC_PATH="rc"
16 SRC_URI="mirror://samba/${SRC_PATH}/${MY_P}.tar.gz
17 https://dev.gentoo.org/~polynomial-c/samba-4.5.11-disable-python-patches.tar.xz"
18 [[ ${PV} = *_rc* ]] || \
19 KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ppc ppc64 sparc x86"
21 DESCRIPTION="Samba Suite Version 4"
22 HOMEPAGE="http://www.samba.org/"
27 IUSE="acl addc addns ads client cluster cups dmapi fam gnutls gpg iprint ldap pam
28 quota selinux syslog system-heimdal +system-mitkrb5 systemd test winbind zeroconf"
30 # the test suite is messed, it uses system-installed samba
31 # bits instead of what was built, tests things disabled via use
32 # flags, and generally just fails to work in a way ebuilds could
33 # rely on in its current state
36 MULTILIB_WRAPPED_HEADERS=(
37 /usr/include/samba-4.0/policy.h
38 /usr/include/samba-4.0/dcerpc_server.h
39 /usr/include/samba-4.0/ctdb.h
40 /usr/include/samba-4.0/ctdb_client.h
41 /usr/include/samba-4.0/ctdb_protocol.h
42 /usr/include/samba-4.0/ctdb_private.h
43 /usr/include/samba-4.0/ctdb_typesafe_cb.h
44 /usr/include/samba-4.0/ctdb_version.h
47 # sys-apps/attr is an automagic dependency (see bug #489748)
48 CDEPEND="${PYTHON_DEPS}
49 >=app-arch/libarchive-3.1.2[${MULTILIB_USEDEP}]
51 dev-libs/libaio[${MULTILIB_USEDEP}]
52 dev-libs/libbsd[${MULTILIB_USEDEP}]
54 dev-libs/popt[${MULTILIB_USEDEP}]
55 dev-python/subunit[${PYTHON_USEDEP},${MULTILIB_USEDEP}]
56 net-libs/libnsl:=[${MULTILIB_USEDEP}]
57 sys-apps/attr[${MULTILIB_USEDEP}]
58 >=sys-libs/ldb-1.1.27[ldap(+)?,python(+),${MULTILIB_USEDEP}]
59 <sys-libs/ldb-1.1.30[ldap(+)?,python(+),${MULTILIB_USEDEP}]
61 sys-libs/ncurses:0=[${MULTILIB_USEDEP}]
63 >=sys-libs/talloc-2.1.8[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
64 >=sys-libs/tdb-1.3.10[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
65 >=sys-libs/tevent-0.9.31-r1[${MULTILIB_USEDEP}]
66 sys-libs/zlib[${MULTILIB_USEDEP}]
70 addns? ( net-dns/bind-tools[gssapi] )
75 cups? ( net-print/cups )
76 dmapi? ( sys-apps/dmapi )
80 >=net-libs/gnutls-1.4.0
82 gpg? ( app-crypt/gpgme )
83 ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
84 system-heimdal? ( >=app-crypt/heimdal-1.5[-ssl,${MULTILIB_USEDEP}] )
85 system-mitkrb5? ( app-crypt/mit-krb5[${MULTILIB_USEDEP}] )
86 systemd? ( sys-apps/systemd:0= )"
88 app-text/docbook-xsl-stylesheets
92 >=sys-libs/nss_wrapper-1.1.3
93 >=net-dns/resolv_wrapper-1.1.4
94 >=net-libs/socket_wrapper-1.1.7
95 >=sys-libs/uid_wrapper-1.2.1
98 client? ( net-fs/cifs-utils[ads?] )
99 selinux? ( sec-policy/selinux-samba )
104 addc? ( gnutls !system-mitkrb5 )
105 ads? ( acl gnutls ldap )
108 ?? ( system-heimdal system-mitkrb5 )
109 ${PYTHON_REQUIRED_USE}"
111 S="${WORKDIR}/${MY_P}"
114 "${FILESDIR}/${PN}-4.4.0-pam.patch"
115 "${FILESDIR}/${PN}-4.5.1-compile_et_fix.patch"
116 "${FILESDIR}/${PN}-glibc-2.26-no_rpc.patch" #637320
119 #CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)"
120 CONFDIR="${FILESDIR}/4.4"
122 WAF_BINARY="${S}/buildtools/bin/waf"
127 python-single-r1_pkg_setup
128 if use cluster ; then
129 SHAREDMODS="idmap_rid,idmap_tdb2,idmap_ad"
131 SHAREDMODS="idmap_ad"
138 # install the patches from tarball(s)
139 eapply "${WORKDIR}/patches"
141 # ugly hackaround for bug #592502
142 cp /usr/include/tevent_internal.h "${S}"/lib/tevent/ || die
144 sed -e 's:<gpgme\.h>:<gpgme/gpgme.h>:' \
145 -i source4/dsdb/samdb/ldb_modules/password_hash.c \
149 multilib_copy_sources
152 multilib_src_configure() {
153 # when specifying libs for samba build you must append NONE to the end to
154 # stop it automatically including things
155 local bundled_libs="NONE"
156 if ! use system-heimdal && ! use system-mitkrb5 ; then
157 bundled_libs="heimbase,heimntlm,hdb,kdc,krb5,wind,gssapi,hcrypto,hx509,roken,asn1,com_err,NONE"
163 --sysconfdir="${EPREFIX}/etc"
164 --localstatedir="${EPREFIX}/var"
165 --with-modulesdir="${EPREFIX}/usr/$(get_libdir)/samba"
166 --with-piddir="${EPREFIX}/run/${PN}"
168 --bundled-libraries="${bundled_libs}"
169 --builtin-libraries=NONE
171 --disable-rpath-install
176 if multilib_is_native_abi ; then
178 $(use_with acl acl-support)
179 $(usex addc '' '--without-ad-dc')
180 $(use_with addns dnsupdate)
182 $(use_with cluster cluster-support)
187 $(use_with gpg gpgme)
191 $(usex pam "--with-pammodulesdir=${EPREFIX}/$(get_libdir)/security" '')
192 $(use_with quota quotas)
195 $(usex system-mitkrb5 '--with-system-mitkrb5' '')
197 $(usex test '--enable-selftest' '')
198 $(use_enable zeroconf avahi)
199 --with-shared-modules=${SHAREDMODS}
203 --without-acl-support
208 --without-cluster-support
220 $(usex system-mitkrb5 '--with-system-mitkrb5' '')
226 CPPFLAGS="-I${SYSROOT}${EPREFIX}/usr/include/et ${CPPFLAGS}" \
227 waf-utils_src_configure ${myconf[@]}
230 multilib_src_compile() {
231 waf-utils_src_compile
234 multilib_src_install() {
235 waf-utils_src_install
237 # Make all .so files executable
238 find "${D}" -type f -name "*.so" -exec chmod +x {} +
240 if multilib_is_native_abi; then
241 # install ldap schema for server (bug #491002)
243 insinto /etc/openldap/schema
244 doins examples/LDAP/samba.schema
247 # create symlink for cups (bug #552310)
249 dosym ../../../bin/smbspool /usr/libexec/cups/backend/smb
252 # install example config file
254 doins examples/smb.conf.default
256 # Fix paths in example file (#603964)
258 -e '/log file =/s@/usr/local/samba/var/@/var/log/samba/@' \
259 -e '/include =/s@/usr/local/samba/lib/@/etc/samba/@' \
260 -e '/path =/s@/usr/local/samba/lib/@/var/lib/samba/@' \
261 -e '/path =/s@/usr/local/samba/@/var/lib/samba/@' \
262 -e '/path =/s@/usr/spool/samba@/var/spool/samba@' \
263 -i "${ED%/}"/etc/samba/smb.conf.default || die
265 # Install init script and conf.d file
266 newinitd "${CONFDIR}/samba4.initd-r1" samba
267 newconfd "${CONFDIR}/samba4.confd" samba
269 systemd_dotmpfilesd "${FILESDIR}"/samba.conf
270 systemd_dounit "${FILESDIR}"/nmbd.service
271 systemd_dounit "${FILESDIR}"/smbd.{service,socket}
272 systemd_newunit "${FILESDIR}"/smbd_at.service 'smbd@.service'
273 systemd_dounit "${FILESDIR}"/winbindd.service
274 systemd_dounit "${FILESDIR}"/samba.service
278 multilib_src_test() {
279 if multilib_is_native_abi ; then
280 "${WAF_BINARY}" test || die "test failed"
285 ewarn "Be aware the this release contains the best of all of Samba's"
286 ewarn "technology parts, both a file server (that you can reasonably expect"
287 ewarn "to upgrade existing Samba 3.x releases to) and the AD domain"
288 ewarn "controller work previously known as 'samba4'."
290 elog "For further information and migration steps make sure to read "
291 elog "http://samba.org/samba/history/${P}.html "
292 elog "http://samba.org/samba/history/${PN}-4.5.0.html and"
293 elog "http://wiki.samba.org/index.php/Samba4/HOWTO "