app-crypt/signing-party: ppc stable wrt bug #653570
[gentoo.git] / net-fs / samba / samba-4.5.16.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python2_7 )
6 PYTHON_REQ_USE='threads(+),xml(+)'
7
8 inherit python-single-r1 waf-utils multilib-minimal linux-info systemd eutils
9
10 MY_PV="${PV/_rc/rc}"
11 MY_P="${PN}-${MY_PV}"
12
13 SRC_PATH="stable"
14 [[ ${PV} = *_rc* ]] && SRC_PATH="rc"
15
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"
20
21 DESCRIPTION="Samba Suite Version 4"
22 HOMEPAGE="http://www.samba.org/"
23 LICENSE="GPL-3"
24
25 SLOT="0"
26
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"
29
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
34 RESTRICT="test"
35
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
45 )
46
47 # sys-apps/attr is an automagic dependency (see bug #489748)
48 CDEPEND="${PYTHON_DEPS}
49         >=app-arch/libarchive-3.1.2[${MULTILIB_USEDEP}]
50         dev-lang/perl:=
51         dev-libs/libaio[${MULTILIB_USEDEP}]
52         dev-libs/libbsd[${MULTILIB_USEDEP}]
53         dev-libs/iniparser:0
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}]
60         sys-libs/libcap
61         sys-libs/ncurses:0=[${MULTILIB_USEDEP}]
62         sys-libs/readline:0=
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}]
67         virtual/libiconv
68         pam? ( virtual/pam )
69         acl? ( virtual/acl )
70         addns? ( net-dns/bind-tools[gssapi] )
71         cluster? (
72                 net-libs/rpcsvc-proto
73                 !dev-db/ctdb
74         )
75         cups? ( net-print/cups )
76         dmapi? ( sys-apps/dmapi )
77         fam? ( virtual/fam )
78         gnutls? (
79                 dev-libs/libgcrypt:0
80                 >=net-libs/gnutls-1.4.0
81         )
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= )"
87 DEPEND="${CDEPEND}
88         app-text/docbook-xsl-stylesheets
89         dev-libs/libxslt
90         virtual/pkgconfig
91         test? (
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
96         )"
97 RDEPEND="${CDEPEND}
98         client? ( net-fs/cifs-utils[ads?] )
99         selinux? ( sec-policy/selinux-samba )
100         !dev-perl/Parse-Yapp
101 "
102
103 REQUIRED_USE="
104         addc? ( gnutls !system-mitkrb5 )
105         ads? ( acl gnutls ldap )
106         cluster? ( ads )
107         gpg? ( addc )
108         ?? ( system-heimdal system-mitkrb5 )
109         ${PYTHON_REQUIRED_USE}"
110
111 S="${WORKDIR}/${MY_P}"
112
113 PATCHES=(
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
117 )
118
119 #CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)"
120 CONFDIR="${FILESDIR}/4.4"
121
122 WAF_BINARY="${S}/buildtools/bin/waf"
123
124 SHAREDMODS=""
125
126 pkg_setup() {
127         python-single-r1_pkg_setup
128         if use cluster ; then
129                 SHAREDMODS="idmap_rid,idmap_tdb2,idmap_ad"
130         elif use ads ; then
131                 SHAREDMODS="idmap_ad"
132         fi
133 }
134
135 src_prepare() {
136         default
137
138         # install the patches from tarball(s)
139         eapply "${WORKDIR}/patches"
140
141         # ugly hackaround for bug #592502
142         cp /usr/include/tevent_internal.h "${S}"/lib/tevent/ || die
143
144         sed -e 's:<gpgme\.h>:<gpgme/gpgme.h>:' \
145                 -i source4/dsdb/samdb/ldb_modules/password_hash.c \
146                 || die
147
148         # Friggin' WAF shit
149         multilib_copy_sources
150 }
151
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"
158         fi
159
160         local myconf=()
161         myconf=(
162                 --enable-fhs
163                 --sysconfdir="${EPREFIX}/etc"
164                 --localstatedir="${EPREFIX}/var"
165                 --with-modulesdir="${EPREFIX}/usr/$(get_libdir)/samba"
166                 --with-piddir="${EPREFIX}/run/${PN}"
167                 --without-lttng
168                 --bundled-libraries="${bundled_libs}"
169                 --builtin-libraries=NONE
170                 --disable-rpath
171                 --disable-rpath-install
172                 --nopyc
173                 --nopyo
174                 --disable-cephfs
175         )
176         if multilib_is_native_abi ; then
177                 myconf+=(
178                         $(use_with acl acl-support)
179                         $(usex addc '' '--without-ad-dc')
180                         $(use_with addns dnsupdate)
181                         $(use_with ads)
182                         $(use_with cluster cluster-support)
183                         $(use_enable cups)
184                         $(use_with dmapi)
185                         $(use_with fam)
186                         $(use_enable gnutls)
187                         $(use_with gpg gpgme)
188                         $(use_enable iprint)
189                         $(use_with ldap)
190                         $(use_with pam)
191                         $(usex pam "--with-pammodulesdir=${EPREFIX}/$(get_libdir)/security" '')
192                         $(use_with quota quotas)
193                         $(use_with syslog)
194                         $(use_with systemd)
195                         $(usex system-mitkrb5 '--with-system-mitkrb5' '')
196                         $(use_with winbind)
197                         $(usex test '--enable-selftest' '')
198                         $(use_enable zeroconf avahi)
199                         --with-shared-modules=${SHAREDMODS}
200                 )
201         else
202                 myconf+=(
203                         --without-acl-support
204                         --without-ad-dc
205                         --without-dnsupdate
206                         --without-ads
207                         --disable-avahi
208                         --without-cluster-support
209                         --disable-cups
210                         --without-dmapi
211                         --without-fam
212                         --disable-gnutls
213                         --without-gpgme
214                         --disable-iprint
215                         $(use_with ldap)
216                         --without-pam
217                         --without-quotas
218                         --without-syslog
219                         --without-systemd
220                         $(usex system-mitkrb5 '--with-system-mitkrb5' '')
221                         --without-winbind
222                         --disable-python
223                 )
224         fi
225
226         CPPFLAGS="-I${SYSROOT}${EPREFIX}/usr/include/et ${CPPFLAGS}" \
227                 waf-utils_src_configure ${myconf[@]}
228 }
229
230 multilib_src_compile() {
231         waf-utils_src_compile
232 }
233
234 multilib_src_install() {
235         waf-utils_src_install
236
237         # Make all .so files executable
238         find "${D}" -type f -name "*.so" -exec chmod +x {} +
239
240         if multilib_is_native_abi; then
241                 # install ldap schema for server (bug #491002)
242                 if use ldap ; then
243                         insinto /etc/openldap/schema
244                         doins examples/LDAP/samba.schema
245                 fi
246
247                 # create symlink for cups (bug #552310)
248                 if use cups ; then
249                         dosym ../../../bin/smbspool /usr/libexec/cups/backend/smb
250                 fi
251
252                 # install example config file
253                 insinto /etc/samba
254                 doins examples/smb.conf.default
255
256                 # Fix paths in example file (#603964)
257                 sed \
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
264
265                 # Install init script and conf.d file
266                 newinitd "${CONFDIR}/samba4.initd-r1" samba
267                 newconfd "${CONFDIR}/samba4.confd" samba
268
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
275         fi
276 }
277
278 multilib_src_test() {
279         if multilib_is_native_abi ; then
280                 "${WAF_BINARY}" test || die "test failed"
281         fi
282 }
283
284 pkg_postinst() {
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'."
289
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 "
294 }