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-disable-python-patches-4.2.12.tar.xz"
18 [[ ${PV} = *_rc* ]] || \
21 DESCRIPTION="Samba Suite Version 4"
22 HOMEPAGE="https://www.samba.org/"
27 IUSE="acl addc addns ads aio avahi client cluster cups dmapi fam gnutls iprint
28 ldap pam quota selinux syslog +system-mitkrb5 systemd test winbind"
30 MULTILIB_WRAPPED_HEADERS=(
31 /usr/include/samba-4.0/policy.h
32 /usr/include/samba-4.0/dcerpc_server.h
33 /usr/include/samba-4.0/ctdb.h
34 /usr/include/samba-4.0/ctdb_client.h
35 /usr/include/samba-4.0/ctdb_protocol.h
36 /usr/include/samba-4.0/ctdb_private.h
37 /usr/include/samba-4.0/ctdb_typesafe_cb.h
38 /usr/include/samba-4.0/ctdb_version.h
41 # sys-apps/attr is an automagic dependency (see bug #489748)
42 CDEPEND="${PYTHON_DEPS}
43 >=app-arch/libarchive-3.1.2[${MULTILIB_USEDEP}]
45 dev-libs/libbsd[${MULTILIB_USEDEP}]
47 dev-libs/popt[${MULTILIB_USEDEP}]
50 dev-python/subunit[${PYTHON_USEDEP},${MULTILIB_USEDEP}]
51 net-libs/libnsl:=[${MULTILIB_USEDEP}]
52 >=net-libs/socket_wrapper-1.1.2[${MULTILIB_USEDEP}]
53 sys-apps/attr[${MULTILIB_USEDEP}]
55 >=sys-libs/ldb-1.1.24[ldap(+)?,${MULTILIB_USEDEP}]
56 sys-libs/ncurses:0=[${MULTILIB_USEDEP}]
57 >=sys-libs/nss_wrapper-1.0.2[${MULTILIB_USEDEP}]
58 >=sys-libs/ntdb-1.0[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
59 >=sys-libs/talloc-2.1.2[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
60 >=sys-libs/tdb-1.3.6[python,${PYTHON_USEDEP},${MULTILIB_USEDEP}]
61 >=sys-libs/tevent-0.9.28[${MULTILIB_USEDEP}]
62 >=sys-libs/uid_wrapper-1.0.1[${MULTILIB_USEDEP}]
63 sys-libs/zlib[${MULTILIB_USEDEP}]
65 addns? ( net-dns/bind-tools[gssapi] )
66 aio? ( dev-libs/libaio )
71 cups? ( net-print/cups )
72 dmapi? ( sys-apps/dmapi )
74 gnutls? ( dev-libs/libgcrypt:0
75 >=net-libs/gnutls-1.4.0 )
76 ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
78 system-mitkrb5? ( app-crypt/mit-krb5[${MULTILIB_USEDEP}] )
79 !system-mitkrb5? ( >=app-crypt/heimdal-1.5[-ssl,${MULTILIB_USEDEP}] )
80 systemd? ( sys-apps/systemd:0= )"
84 client? ( net-fs/cifs-utils[ads?] )
85 selinux? ( sec-policy/selinux-samba )
89 REQUIRED_USE="addc? ( gnutls !system-mitkrb5 )
90 ads? ( acl gnutls ldap )
91 ${PYTHON_REQUIRED_USE}"
93 S="${WORKDIR}/${MY_P}"
96 "${FILESDIR}/${PN}-4.2.3-heimdal_compilefix.patch"
97 "${FILESDIR}/${PN}-4.2.7-pam.patch"
98 "${FILESDIR}/${PN}-glibc-2.26-no_rpc.patch" #637320
101 CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)"
103 WAF_BINARY="${S}/buildtools/bin/waf"
108 python-single-r1_pkg_setup
110 if ! linux_config_exists || ! linux_chkconfig_present AIO; then
111 ewarn "You must enable AIO support in your kernel config, "
112 ewarn "to be able to support asynchronous I/O. "
113 ewarn "You can find it at"
115 ewarn "General Support"
116 ewarn " Enable AIO support "
118 ewarn "and recompile your kernel..."
121 if use cluster ; then
122 SHAREDMODS="${SHAREDMODS}idmap_rid,idmap_tdb2,idmap_ad"
127 epatch "${PATCHES[@]}"
129 # install the patches from tarball(s)
130 EPATCH_SUFFIX="patch" \
132 epatch "${WORKDIR}/patches"
136 multilib_copy_sources
139 multilib_src_configure() {
145 --with-modulesdir=/usr/$(get_libdir)/samba
146 --with-piddir=/run/${PN}
147 --bundled-libraries=NONE
148 --builtin-libraries=NONE
150 --disable-rpath-install
154 if multilib_is_native_abi ; then
156 $(use_with acl acl-support)
157 $(usex addc '' '--without-ad-dc')
158 $(use_with addns dnsupdate)
160 $(usex ads '--with-shared-modules=idmap_ad' '')
161 $(use_with aio aio-support)
163 $(use_with cluster cluster-support)
171 $(use_with pam pam_smbpass)
172 $(usex pam "--with-pammodulesdir=/$(get_libdir)/security" '')
173 $(use_with quota quotas)
176 $(usex system-mitkrb5 '--with-system-mitkrb5' '')
178 $(usex test '--enable-selftest' '')
179 --with-shared-modules=${SHAREDMODS}
183 --without-acl-support
187 --without-aio-support
189 --without-cluster-support
197 --without-pam_smbpass
201 $(usex system-mitkrb5 '--with-system-mitkrb5' '')
207 CPPFLAGS="-I${SYSROOT}/usr/include/et ${CPPFLAGS}" \
208 waf-utils_src_configure ${myconf[@]}
211 multilib_src_install() {
212 waf-utils_src_install
214 # Make all .so files executable
215 find "${D}" -type f -name "*.so" -exec chmod +x {} +
217 if multilib_is_native_abi; then
218 # install ldap schema for server (bug #491002)
220 insinto /etc/openldap/schema
221 doins examples/LDAP/samba.schema
224 # create symlink for cups (bug #552310)
226 dosym /usr/bin/smbspool /usr/libexec/cups/backend/smb
229 # install example config file
231 doins examples/smb.conf.default
233 # Install init script and conf.d file
234 newinitd "${CONFDIR}/samba4.initd-r1" samba
235 newconfd "${CONFDIR}/samba4.confd" samba
237 systemd_dotmpfilesd "${FILESDIR}"/samba.conf
238 systemd_dounit "${FILESDIR}"/nmbd.service
239 systemd_dounit "${FILESDIR}"/smbd.{service,socket}
240 systemd_newunit "${FILESDIR}"/smbd_at.service 'smbd@.service'
241 systemd_dounit "${FILESDIR}"/winbindd.service
242 systemd_dounit "${FILESDIR}"/samba.service
246 multilib_src_test() {
247 if multilib_is_native_abi ; then
248 "${WAF_BINARY}" test || die "test failed"
253 ewarn "Be aware the this release contains the best of all of Samba's"
254 ewarn "technology parts, both a file server (that you can reasonably expect"
255 ewarn "to upgrade existing Samba 3.x releases to) and the AD domain"
256 ewarn "controller work previously known as 'samba4'."
258 elog "For further information and migration steps make sure to read "
259 elog "https://www.samba.org/samba/history/${P}.html "
260 elog "https://www.samba.org/samba/history/${PN}-4.2.0.html and"
261 elog "https://wiki.samba.org/index.php/Samba4/HOWTO "