app-crypt/signing-party: ppc stable wrt bug #653570
[gentoo.git] / net-fs / samba / samba-4.2.14.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
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-disable-python-patches-4.2.12.tar.xz"
18 [[ ${PV} = *_rc* ]] || \
19 KEYWORDS="hppa"
20
21 DESCRIPTION="Samba Suite Version 4"
22 HOMEPAGE="https://www.samba.org/"
23 LICENSE="GPL-3"
24
25 SLOT="0"
26
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"
29
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
39 )
40
41 # sys-apps/attr is an automagic dependency (see bug #489748)
42 CDEPEND="${PYTHON_DEPS}
43         >=app-arch/libarchive-3.1.2[${MULTILIB_USEDEP}]
44         dev-lang/perl:=
45         dev-libs/libbsd[${MULTILIB_USEDEP}]
46         dev-libs/iniparser:0
47         dev-libs/popt[${MULTILIB_USEDEP}]
48         sys-libs/readline:=
49         virtual/libiconv
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}]
54         sys-libs/libcap
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}]
64         acl? ( virtual/acl )
65         addns? ( net-dns/bind-tools[gssapi] )
66         aio? ( dev-libs/libaio )
67         cluster? (
68                 net-libs/rpcsvc-proto
69                 !dev-db/ctdb
70         )
71         cups? ( net-print/cups )
72         dmapi? ( sys-apps/dmapi )
73         fam? ( virtual/fam )
74         gnutls? ( dev-libs/libgcrypt:0
75                 >=net-libs/gnutls-1.4.0 )
76         ldap? ( net-nds/openldap[${MULTILIB_USEDEP}] )
77         pam? ( virtual/pam )
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= )"
81 DEPEND="${CDEPEND}
82         virtual/pkgconfig"
83 RDEPEND="${CDEPEND}
84         client? ( net-fs/cifs-utils[ads?] )
85         selinux? ( sec-policy/selinux-samba )
86         !dev-perl/Parse-Yapp
87 "
88
89 REQUIRED_USE="addc? ( gnutls !system-mitkrb5 )
90         ads? ( acl gnutls ldap )
91         ${PYTHON_REQUIRED_USE}"
92
93 S="${WORKDIR}/${MY_P}"
94
95 PATCHES=(
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
99 )
100
101 CONFDIR="${FILESDIR}/$(get_version_component_range 1-2)"
102
103 WAF_BINARY="${S}/buildtools/bin/waf"
104
105 SHAREDMODS=""
106
107 pkg_setup() {
108         python-single-r1_pkg_setup
109         if use aio ; then
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"
114                         ewarn
115                         ewarn "General Support"
116                         ewarn " Enable AIO support "
117                         ewarn
118                         ewarn "and recompile your kernel..."
119                 fi
120         fi
121         if use cluster ; then
122                 SHAREDMODS="${SHAREDMODS}idmap_rid,idmap_tdb2,idmap_ad"
123         fi
124 }
125
126 src_prepare() {
127         epatch "${PATCHES[@]}"
128
129         # install the patches from tarball(s)
130         EPATCH_SUFFIX="patch" \
131         EPATCH_FORCE="yes" \
132         epatch "${WORKDIR}/patches"
133
134         # Allow user patches
135         epatch_user
136         multilib_copy_sources
137 }
138
139 multilib_src_configure() {
140         local myconf=()
141         myconf=(
142                 --enable-fhs
143                 --sysconfdir=/etc
144                 --localstatedir=/var
145                 --with-modulesdir=/usr/$(get_libdir)/samba
146                 --with-piddir=/run/${PN}
147                 --bundled-libraries=NONE
148                 --builtin-libraries=NONE
149                 --disable-rpath
150                 --disable-rpath-install
151                 --nopyc
152                 --nopyo
153         )
154         if multilib_is_native_abi ; then
155                 myconf+=(
156                         $(use_with acl acl-support)
157                         $(usex addc '' '--without-ad-dc')
158                         $(use_with addns dnsupdate)
159                         $(use_with ads)
160                         $(usex ads '--with-shared-modules=idmap_ad' '')
161                         $(use_with aio aio-support)
162                         $(use_enable avahi)
163                         $(use_with cluster cluster-support)
164                         $(use_enable cups)
165                         $(use_with dmapi)
166                         $(use_with fam)
167                         $(use_enable gnutls)
168                         $(use_enable iprint)
169                         $(use_with ldap)
170                         $(use_with pam)
171                         $(use_with pam pam_smbpass)
172                         $(usex pam "--with-pammodulesdir=/$(get_libdir)/security" '')
173                         $(use_with quota quotas)
174                         $(use_with syslog)
175                         $(use_with systemd)
176                         $(usex system-mitkrb5 '--with-system-mitkrb5' '')
177                         $(use_with winbind)
178                         $(usex test '--enable-selftest' '')
179                         --with-shared-modules=${SHAREDMODS}
180                 )
181         else
182                 myconf+=(
183                         --without-acl-support
184                         --without-ad-dc
185                         --without-dnsupdate
186                         --without-ads
187                         --without-aio-support
188                         --disable-avahi
189                         --without-cluster-support
190                         --disable-cups
191                         --without-dmapi
192                         --without-fam
193                         --disable-gnutls
194                         --disable-iprint
195                         $(use_with ldap)
196                         --without-pam
197                         --without-pam_smbpass
198                         --without-quotas
199                         --without-syslog
200                         --without-systemd
201                         $(usex system-mitkrb5 '--with-system-mitkrb5' '')
202                         --without-winbind
203                         --disable-python
204                 )
205         fi
206
207         CPPFLAGS="-I${SYSROOT}/usr/include/et ${CPPFLAGS}" \
208                 waf-utils_src_configure ${myconf[@]}
209 }
210
211 multilib_src_install() {
212         waf-utils_src_install
213
214         # Make all .so files executable
215         find "${D}" -type f -name "*.so" -exec chmod +x {} +
216
217         if multilib_is_native_abi; then
218                 # install ldap schema for server (bug #491002)
219                 if use ldap ; then
220                         insinto /etc/openldap/schema
221                         doins examples/LDAP/samba.schema
222                 fi
223
224                 # create symlink for cups (bug #552310)
225                 if use cups ; then
226                         dosym /usr/bin/smbspool /usr/libexec/cups/backend/smb
227                 fi
228
229                 # install example config file
230                 insinto /etc/samba
231                 doins examples/smb.conf.default
232
233                 # Install init script and conf.d file
234                 newinitd "${CONFDIR}/samba4.initd-r1" samba
235                 newconfd "${CONFDIR}/samba4.confd" samba
236
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
243         fi
244 }
245
246 multilib_src_test() {
247         if multilib_is_native_abi ; then
248                 "${WAF_BINARY}" test || die "test failed"
249         fi
250 }
251
252 pkg_postinst() {
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'."
257
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 "
262 }