summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/samba/samba_4.7.8.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-connectivity/samba/samba_4.7.8.bb')
-rw-r--r--meta-networking/recipes-connectivity/samba/samba_4.7.8.bb316
1 files changed, 316 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/samba/samba_4.7.8.bb b/meta-networking/recipes-connectivity/samba/samba_4.7.8.bb
new file mode 100644
index 000000000..593ff57be
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba_4.7.8.bb
@@ -0,0 +1,316 @@
1HOMEPAGE = "https://www.samba.org/"
2SECTION = "console/network"
3
4LICENSE = "GPL-3.0+ & LGPL-3.0+ & GPL-2.0+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
6 file://${COREBASE}/meta/files/common-licenses/LGPL-3.0;md5=bfccfe952269fff2b407dd11f2f3083b \
7 file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 "
8
9SAMBA_MIRROR = "http://samba.org/samba/ftp"
10MIRRORS += "\
11${SAMBA_MIRROR} http://mirror.internode.on.net/pub/samba \n \
12${SAMBA_MIRROR} http://www.mirrorservice.org/sites/ftp.samba.org \n \
13"
14
15SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
16 file://16-do-not-check-xsltproc-manpages.patch \
17 file://20-do-not-import-target-module-while-cross-compile.patch \
18 file://21-add-config-option-without-valgrind.patch \
19 file://0001-packaging-Avoid-timeout-for-nmbd-if-started-offline-.patch \
20 file://0006-avoid-using-colon-in-the-checking-msg.patch \
21 file://netdb_defines.patch \
22 file://glibc_only.patch \
23 file://iconv-4.7.0.patch \
24 file://dnsserver-4.7.0.patch \
25 file://smb_conf-4.7.0.patch \
26 file://volatiles.03_samba \
27 "
28SRC_URI_append_libc-musl = " \
29 file://samba-pam.patch \
30 file://samba-4.3.9-remove-getpwent_r.patch \
31 "
32
33SRC_URI[md5sum] = "16b70fda54cf84521ed976a0856430cc"
34SRC_URI[sha256sum] = "ca6fca9d7e248bcaa55c54bdcc115eeed10660074da5c54a2b78dd3cccc604de"
35
36UPSTREAM_CHECK_REGEX = "samba\-(?P<pver>4\.7(\.\d+)+).tar.gz"
37
38inherit systemd waf-samba cpan-base perlnative update-rc.d
39# remove default added RDEPENDS on perl
40RDEPENDS_${PN}_remove = "perl"
41
42DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb libbsd libaio libpam"
43
44inherit distro_features_check
45REQUIRED_DISTRO_FEATURES = "pam"
46
47DEPENDS_append_libc-musl = " libtirpc"
48CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
49LDFLAGS_append_libc-musl = " -ltirpc"
50
51LSB = ""
52LSB_linuxstdbase = "lsb"
53
54INITSCRIPT_NAME = "samba"
55INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
56
57SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind"
58SYSTEMD_SERVICE_${PN}-base = "nmb.service smb.service"
59SYSTEMD_SERVICE_${PN}-ad-dc = "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'samba.service', '', d)}"
60SYSTEMD_SERVICE_winbind = "winbind.service"
61
62# There are prerequisite settings to enable ad-dc, so disable the service by default.
63# Reference:
64# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
65SYSTEMD_AUTO_ENABLE_${PN}-ad-dc = "disable"
66
67# Use krb5. Build active domain controller.
68#
69PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \
70 acl ad-dc cups gnutls ldap mitkrb5 \
71"
72
73RDEPENDS_${PN}-base += "${LSB}"
74RDEPENDS_${PN}-ctdb-tests += "bash util-linux-getopt"
75
76PACKAGECONFIG[acl] = "--with-acl-support,--without-acl-support,acl"
77PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin"
78PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups"
79PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
80PACKAGECONFIG[sasl] = ",,cyrus-sasl"
81PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
82PACKAGECONFIG[dmapi] = "--with-dmapi,--without-dmapi,dmapi"
83PACKAGECONFIG[zeroconf] = "--enable-avahi,--disable-avahi,avahi"
84PACKAGECONFIG[valgrind] = ",--without-valgrind,valgrind,"
85PACKAGECONFIG[lttng] = "--with-lttng, --without-lttng,lttng-ust"
86PACKAGECONFIG[archive] = "--with-libarchive, --without-libarchive, libarchive"
87
88# Building the AD (Active Directory) DC (Domain Controller) requires GnuTLS,
89# And ad-dc doesn't work with mitkrb5 for versions prior to 4.7.0 according to:
90# http://samba.2283325.n4.nabble.com/samba-4-6-6-Unknown-dependency-kdc-in-service-kdc-objlist-td4722096.html
91# So the working combination is:
92# 1) ad-dc: enable, gnutls: enable, mitkrb5: disable
93# 2) ad-dc: disable, gnutls: enable/disable, mitkrb5: enable
94#
95# We are now at 4.7.0, so take the above with a grain of salt. We do not need to know where
96# krb5kdc is unless ad-dc is enabled, but we tell configure anyhow.
97#
98PACKAGECONFIG[ad-dc] = ",--without-ad-dc,,"
99PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
100PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5 --with-system-mitkdc=/usr/sbin/krb5kdc,,krb5,"
101
102SAMBA4_IDMAP_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2"
103SAMBA4_PDB_MODULES="pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4"
104SAMBA4_AUTH_MODULES="auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4"
105SAMBA4_MODULES="${SAMBA4_IDMAP_MODULES},${SAMBA4_PDB_MODULES},${SAMBA4_AUTH_MODULES}"
106
107# These libraries are supposed to replace others supplied by packages, but decorate the names of
108# .so files so there will not be a conflict. This is not done consistantly, so be very careful
109# when adding to this list.
110#
111SAMBA4_LIBS="heimdal,cmocka,NONE"
112
113EXTRA_OECONF += "--enable-fhs \
114 --with-piddir=/run \
115 --with-sockets-dir=/run/samba \
116 --with-modulesdir=${libdir}/samba \
117 --with-lockdir=${localstatedir}/lib/samba \
118 --with-cachedir=${localstatedir}/lib/samba \
119 --disable-rpath-install \
120 --with-shared-modules=${SAMBA4_MODULES} \
121 --bundled-libraries=${SAMBA4_LIBS} \
122 ${@oe.utils.conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \
123 --with-cluster-support \
124 --with-profiling-data \
125 --with-libiconv=${STAGING_DIR_HOST}${prefix} \
126 --with-pam --with-pammodulesdir=${base_libdir}/security \
127 "
128
129LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
130
131do_install_append() {
132 for section in 1 5 7; do
133 install -d ${D}${mandir}/man$section
134 install -m 0644 ctdb/doc/*.$section ${D}${mandir}/man$section
135 done
136 for section in 1 5 7 8; do
137 install -d ${D}${mandir}/man$section
138 install -m 0644 docs/manpages/*.$section ${D}${mandir}/man$section
139 done
140
141 install -d ${D}${systemd_system_unitdir}
142 install -m 0644 packaging/systemd/*.service ${D}${systemd_system_unitdir}
143 sed -e 's,\(ExecReload=\).*\(/kill\),\1${base_bindir}\2,' \
144 -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \
145 -i ${D}${systemd_system_unitdir}/*.service
146
147 if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ]; then
148 rm -f ${D}${systemd_system_unitdir}/samba.service
149 fi
150
151 install -d ${D}${sysconfdir}/tmpfiles.d
152 install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf
153 echo "d ${localstatedir}/log/samba 0755 root root -" \
154 >> ${D}${sysconfdir}/tmpfiles.d/samba.conf
155 install -d ${D}${sysconfdir}/init.d
156 install -m 0755 packaging/sysv/samba.init ${D}${sysconfdir}/init.d/samba
157 sed -e 's,/opt/samba/bin,${sbindir},g' \
158 -e 's,/opt/samba/smb.conf,${sysconfdir}/samba/smb.conf,g' \
159 -e 's,/opt/samba/log,${localstatedir}/log/samba,g' \
160 -e 's,/etc/init.d/samba.server,${sysconfdir}/init.d/samba,g' \
161 -e 's,/usr/bin,${base_bindir},g' \
162 -i ${D}${sysconfdir}/init.d/samba
163
164 install -d ${D}${sysconfdir}/samba
165 echo "127.0.0.1 localhost" > ${D}${sysconfdir}/samba/lmhosts
166 install -m644 packaging/RHEL/setup/smb.conf ${D}${sysconfdir}/samba/smb.conf
167 install -D -m 644 ${WORKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/03_samba
168
169 install -d ${D}${sysconfdir}/default
170 install -m644 packaging/systemd/samba.sysconfig ${D}${sysconfdir}/default/samba
171
172 # install ctdb config file and test cases
173 install -D -m 0644 ${S}/ctdb/tests/onnode/nodes ${D}${sysconfdir}/ctdb/nodes
174 # the items are from ctdb/tests/run_tests.sh
175 for d in onnode takeover tool eventscripts cunit simple complex; do
176 testdir=${D}${datadir}/ctdb-tests/$d
177 install -d $testdir
178 cp ${S}/ctdb/tests/$d/*.sh $testdir
179 cp -r ${S}/ctdb/tests/$d/scripts ${S}/ctdb/tests/$d/stubs $testdir || true
180 done
181
182 # fix file-rdeps qa warning
183 if [ -f ${D}${bindir}/onnode ]; then
184 sed -i 's:\(#!/bin/\)bash:\1sh:' ${D}${bindir}/onnode
185 fi
186
187 chmod 0750 ${D}${sysconfdir}/sudoers.d
188 rm -rf ${D}/run ${D}${localstatedir}/run ${D}${localstatedir}/log
189}
190
191PACKAGES =+ "${PN}-python ${PN}-pidl \
192 ${PN}-dsdb-modules ${PN}-testsuite registry-tools \
193 winbind \
194 ${PN}-common ${PN}-base ${PN}-ad-dc ${PN}-ctdb-tests \
195 smbclient ${PN}-client ${PN}-server ${PN}-test"
196
197python samba_populate_packages() {
198 def module_hook(file, pkg, pattern, format, basename):
199 pn = d.getVar('PN', True)
200 d.appendVar('RRECOMMENDS_%s-base' % pn, ' %s' % pkg)
201
202 mlprefix = d.getVar('MLPREFIX', True) or ''
203 pam_libdir = d.expand('${base_libdir}/security')
204 pam_pkgname = mlprefix + 'pam-plugin%s'
205 do_split_packages(d, pam_libdir, '^pam_(.*)\.so$', pam_pkgname, 'PAM plugin for %s', extra_depends='', prepend=True)
206
207 libdir = d.getVar('libdir', True)
208 do_split_packages(d, libdir, '^lib(.*)\.so\..*$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True, allow_links=True)
209 pkglibdir = '%s/samba' % libdir
210 do_split_packages(d, pkglibdir, '^lib(.*)\.so$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True)
211 moduledir = '%s/samba/auth' % libdir
212 do_split_packages(d, moduledir, '^(.*)\.so$', 'samba-auth-%s', 'Samba %s authentication backend', hook=module_hook, extra_depends='', prepend=True)
213 moduledir = '%s/samba/pdb' % libdir
214 do_split_packages(d, moduledir, '^(.*)\.so$', 'samba-pdb-%s', 'Samba %s password backend', hook=module_hook, extra_depends='', prepend=True)
215}
216
217PACKAGESPLITFUNCS_prepend = "samba_populate_packages "
218PACKAGES_DYNAMIC = "samba-auth-.* samba-pdb-.*"
219
220RDEPENDS_${PN} += "${PN}-base ${PN}-python ${PN}-dsdb-modules"
221RDEPENDS_${PN}-python += "pytalloc python-tdb"
222
223FILES_${PN}-base = "${sbindir}/nmbd \
224 ${sbindir}/smbd \
225 ${sysconfdir}/init.d \
226 ${localstatedir}/lib/samba \
227 ${localstatedir}/nmbd \
228 ${localstatedir}/spool/samba \
229 ${systemd_system_unitdir}/nmb.service \
230 ${systemd_system_unitdir}/smb.service"
231
232FILES_${PN}-ad-dc = "${sbindir}/samba \
233 ${systemd_system_unitdir}/samba.service \
234 ${libdir}/krb5/plugins/kdb/samba.so \
235 "
236RDEPENDS_${PN}-ad-dc = "krb5-kdc"
237
238FILES_${PN}-ctdb-tests = "${bindir}/ctdb_run_tests \
239 ${bindir}/ctdb_run_cluster_tests \
240 ${sysconfdir}/ctdb/nodes \
241 ${datadir}/ctdb-tests \
242 ${datadir}/ctdb/tests \
243 "
244
245FILES_${BPN}-common = "${sysconfdir}/default \
246 ${sysconfdir}/samba \
247 ${sysconfdir}/tmpfiles.d \
248"
249
250FILES_${PN} += "${libdir}/vfs/*.so \
251 ${libdir}/charset/*.so \
252 ${libdir}/*.dat \
253 ${libdir}/auth/*.so \
254"
255
256FILES_${PN}-dsdb-modules = "${libdir}/samba/ldb"
257
258FILES_${PN}-testsuite = "${bindir}/gentest \
259 ${bindir}/locktest \
260 ${bindir}/masktest \
261 ${bindir}/ndrdump \
262 ${bindir}/smbtorture"
263
264FILES_registry-tools = "${bindir}/regdiff \
265 ${bindir}/regpatch \
266 ${bindir}/regshell \
267 ${bindir}/regtree"
268
269FILES_winbind = "${sbindir}/winbindd \
270 ${bindir}/wbinfo \
271 ${bindir}/ntlm_auth \
272 ${libdir}/samba/idmap \
273 ${libdir}/samba/nss_info \
274 ${libdir}/winbind_krb5_locator.so \
275 ${sysconfdir}/init.d/winbind \
276 ${systemd_system_unitdir}/winbind.service"
277
278FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
279
280FILES_smbclient = "${bindir}/cifsdd \
281 ${bindir}/rpcclient \
282 ${bindir}/smbcacls \
283 ${bindir}/smbclient \
284 ${bindir}/smbcquotas \
285 ${bindir}/smbget \
286 ${bindir}/smbspool \
287 ${bindir}/smbtar \
288 ${bindir}/smbtree \
289 ${libdir}/samba/smbspool_krb5_wrapper"
290
291RDEPENDS_${PN}-pidl_append = " perl"
292FILES_${PN}-pidl = "${bindir}/pidl ${datadir}/perl5/Parse"
293
294RDEPENDS_${PN}-client = "\
295 smbclient \
296 winbind \
297 registry-tools \
298 ${PN}-pidl \
299 "
300
301ALLOW_EMPTY_${PN}-client = "1"
302
303RDEPENDS_${PN}-server = "\
304 ${PN} \
305 winbind \
306 registry-tools \
307 "
308
309ALLOW_EMPTY_${PN}-server = "1"
310
311RDEPENDS_${PN}-test = "\
312 ${PN}-ctdb-tests \
313 ${PN}-testsuite \
314 "
315
316ALLOW_EMPTY_${PN}-test = "1"