summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/samba/samba_4.19.8.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-connectivity/samba/samba_4.19.8.bb')
-rw-r--r--meta-networking/recipes-connectivity/samba/samba_4.19.8.bb363
1 files changed, 363 insertions, 0 deletions
diff --git a/meta-networking/recipes-connectivity/samba/samba_4.19.8.bb b/meta-networking/recipes-connectivity/samba/samba_4.19.8.bb
new file mode 100644
index 0000000000..0213d131e5
--- /dev/null
+++ b/meta-networking/recipes-connectivity/samba/samba_4.19.8.bb
@@ -0,0 +1,363 @@
1HOMEPAGE = "https://www.samba.org/"
2SECTION = "console/network"
3
4LICENSE = "GPL-3.0-or-later & LGPL-3.0-or-later & GPL-2.0-or-later"
5LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
6 file://${COREBASE}/meta/files/common-licenses/LGPL-3.0-or-later;md5=c51d3eef3be114124d11349ca0d7e117 \
7 file://${COREBASE}/meta/files/common-licenses/GPL-2.0-or-later;md5=fed54355545ffd980b814dab4a3b312c"
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
15export PYTHONHASHSEED = "1"
16
17SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
18 file://smb.conf \
19 file://volatiles.03_samba \
20 file://0001-Don-t-check-xsltproc-manpages.patch \
21 file://0002-do-not-import-target-module-while-cross-compile.patch \
22 file://0003-Add-config-option-without-valgrind.patch \
23 file://0004-Add-options-to-configure-the-use-of-libbsd.patch \
24 file://0005-Fix-pyext_PATTERN-for-cross-compilation.patch \
25 file://0006-smbtorture-skip-test-case-tfork_cmd_send.patch \
26 file://0007-Deleted-settiong-of-python-to-fix-the-install-confli.patch \
27 file://9aa5c43315d83c19514251a11c4fba5a137f2821.patch \
28 "
29
30SRC_URI:append:libc-musl = " \
31 file://samba-pam.patch \
32 file://samba-4.3.9-remove-getpwent_r.patch \
33 "
34
35SRC_URI[sha256sum] = "1aeff76c207f383477ce4badebd154691c408d2e15b01b333c85eb775468ddf6"
36
37UPSTREAM_CHECK_REGEX = "samba\-(?P<pver>4\.19(\.\d+)+).tar.gz"
38
39inherit systemd waf-samba cpan-base perlnative update-rc.d perl-version pkgconfig
40
41CVE_STATUS[CVE-2011-2411] = "not-applicable-platform: vulnerable only on HP NonStop Servers"
42
43# remove default added RDEPENDS on perl
44RDEPENDS:${PN}:remove = "perl"
45
46DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb libaio libpam libtasn1 libtasn1-native jansson libparse-yapp-perl-native gnutls cmocka"
47
48inherit features_check
49REQUIRED_DISTRO_FEATURES = "pam"
50
51DEPENDS:append:libc-musl = " libtirpc"
52CFLAGS:append:libc-musl = " -I${STAGING_INCDIR}/tirpc"
53LDFLAGS:append:libc-musl = " -ltirpc"
54
55COMPATIBLE_HOST:riscv32 = "null"
56
57INITSCRIPT_NAME = "samba"
58INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
59
60SYSTEMD_PACKAGES = "${PN}-base ${PN}-ad-dc winbind ctdb"
61SYSTEMD_SERVICE:${PN}-base = "nmb.service smb.service"
62SYSTEMD_SERVICE:${PN}-ad-dc = "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'samba.service', '', d)}"
63SYSTEMD_SERVICE:winbind = "winbind.service"
64SYSTEMD_SERVICE:ctdb = "ctdb.service"
65
66# There are prerequisite settings to enable ad-dc, so disable the service by default.
67# Reference:
68# https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
69SYSTEMD_AUTO_ENABLE:${PN}-ad-dc = "disable"
70
71#cross_compile cannot use preforked process, since fork process earlier than point subproces.popen
72#to cross Popen
73export WAF_NO_PREFORK = "yes"
74
75# Use krb5. Build active domain controller.
76#
77PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \
78 acl cups ldap mitkrb5 \
79"
80
81PACKAGECONFIG[acl] = "--with-acl-support,--without-acl-support,acl"
82PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin"
83PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups"
84PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
85PACKAGECONFIG[sasl] = ",,cyrus-sasl"
86PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
87PACKAGECONFIG[dmapi] = "--with-dmapi,--without-dmapi,dmapi"
88PACKAGECONFIG[zeroconf] = "--enable-avahi,--disable-avahi,avahi"
89PACKAGECONFIG[valgrind] = "--with-valgrind,--without-valgrind,valgrind"
90PACKAGECONFIG[lttng] = "--with-lttng,--without-lttng,lttng-ust"
91PACKAGECONFIG[archive] = "--with-libarchive,--without-libarchive,libarchive"
92PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind"
93PACKAGECONFIG[gpgme] = "--with-gpgme,--without-gpgme,gpgme"
94PACKAGECONFIG[lmdb] = ",--without-ldb-lmdb,lmdb"
95PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
96PACKAGECONFIG[ad-dc] = "--with-experimental-mit-ad-dc,--without-ad-dc,python3-markdown python3-dnspython,"
97PACKAGECONFIG[mitkrb5] = "--with-system-mitkrb5 --with-system-mitkdc=/usr/sbin/krb5kdc,,krb5,"
98
99SAMBA4_IDMAP_MODULES = "idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2"
100SAMBA4_PDB_MODULES = "pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4"
101SAMBA4_AUTH_MODULES = "auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4"
102SAMBA4_MODULES = "${SAMBA4_IDMAP_MODULES},${SAMBA4_PDB_MODULES},${SAMBA4_AUTH_MODULES}"
103
104# These libraries are supposed to replace others supplied by packages, but decorate the names of
105# .so files so there will not be a conflict. This is not done consistantly, so be very careful
106# when adding to this list.
107#
108SAMBA4_LIBS = "heimdal,NONE"
109
110EXTRA_OECONF += "--enable-fhs \
111 --with-piddir=/run \
112 --with-sockets-dir=/run/samba \
113 --with-modulesdir=${libdir}/samba \
114 --with-privatelibdir=${libdir}/samba \
115 --with-lockdir=${localstatedir}/lib/samba \
116 --with-cachedir=${localstatedir}/lib/samba \
117 --disable-rpath-install \
118 --disable-rpath \
119 --with-shared-modules=${SAMBA4_MODULES} \
120 --bundled-libraries=${SAMBA4_LIBS} \
121 ${@oe.utils.conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \
122 --with-cluster-support \
123 --with-profiling-data \
124 --with-libiconv=${STAGING_DIR_HOST}${prefix} \
125 --with-pam --with-pammodulesdir=${base_libdir}/security \
126 --pythondir=${PYTHON_SITEPACKAGES_DIR} \
127 "
128
129LDFLAGS += "-Wl,-z,relro,-z,now"
130
131do_configure:append() {
132 cd ${S}/pidl/
133 perl Makefile.PL PREFIX=${prefix}
134 sed -e 's,VENDORPREFIX)/lib/perl,VENDORPREFIX)/${baselib}/perl,g' \
135 -e 's,PERLPREFIX)/lib/perl,PERLPREFIX)/${baselib}/perl,g' -i Makefile
136}
137
138do_compile:append() {
139 oe_runmake -C ${S}/pidl
140}
141
142do_install:append() {
143 for section in 1 5 7; do
144 install -d ${D}${mandir}/man$section
145 install -m 0644 ctdb/doc/*.$section ${D}${mandir}/man$section
146 done
147 for section in 1 5 7 8; do
148 install -d ${D}${mandir}/man$section
149 install -m 0644 docs/manpages/*.$section ${D}${mandir}/man$section
150 done
151
152 install -d ${D}${systemd_system_unitdir}
153 install -m 0644 ${S}/bin/default/packaging/systemd/*.service ${D}${systemd_system_unitdir}/
154 sed -e 's,\(ExecReload=\).*\(/kill\),\1${base_bindir}\2,' \
155 -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \
156 -i ${D}${systemd_system_unitdir}/*.service
157
158 if [ "${@bb.utils.contains('PACKAGECONFIG', 'ad-dc', 'yes', 'no', d)}" = "no" ]; then
159 rm -f ${D}${systemd_system_unitdir}/samba.service
160 fi
161
162 install -d ${D}${sysconfdir}/tmpfiles.d
163 install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf
164 echo "d ${localstatedir}/log/samba 0755 root root -" \
165 >> ${D}${sysconfdir}/tmpfiles.d/samba.conf
166 install -d ${D}${sysconfdir}/init.d
167 install -m 0755 packaging/sysv/samba.init ${D}${sysconfdir}/init.d/samba
168 sed -e 's,/opt/samba/bin,${sbindir},g' \
169 -e 's,/opt/samba/smb.conf,${sysconfdir}/samba/smb.conf,g' \
170 -e 's,/opt/samba/log,${localstatedir}/log/samba,g' \
171 -e 's,/etc/init.d/samba.server,${sysconfdir}/init.d/samba,g' \
172 -e 's,/usr/bin,${base_bindir},g' \
173 -i ${D}${sysconfdir}/init.d/samba
174
175 install -d ${D}${sysconfdir}/samba
176 echo "127.0.0.1 localhost" > ${D}${sysconfdir}/samba/lmhosts
177 install -m644 ${UNPACKDIR}/smb.conf ${D}${sysconfdir}/samba/smb.conf
178 install -D -m 644 ${UNPACKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/03_samba
179
180 install -d ${D}${sysconfdir}/default
181 install -m644 packaging/systemd/samba.sysconfig ${D}${sysconfdir}/default/samba
182
183 # the items are from ctdb/tests/run_tests.sh
184 for d in cunit eventd eventscripts onnode shellcheck takeover takeover_helper tool; do
185 testdir=${D}${datadir}/ctdb-tests/UNIT/$d
186 install -d $testdir
187 cp ${S}/ctdb/tests/UNIT/$d/*.sh $testdir
188 cp -r ${S}/ctdb/tests/UNIT/$d/scripts ${S}/ctdb/tests/UNIT/$d/stubs $testdir || true
189 done
190
191 # fix file-rdeps qa warning
192 if [ -f ${D}${bindir}/onnode ]; then
193 sed -i 's:\(#!/bin/\)bash:\1sh:' ${D}${bindir}/onnode
194 fi
195
196 chmod 0750 ${D}${sysconfdir}/sudoers.d || true
197 rm -rf ${D}/run ${D}${localstatedir}/run ${D}${localstatedir}/log
198
199 for f in samba-gpupdate samba_upgradedns samba_spnupdate samba_kcc samba_dnsupdate samba_downgrade_db; do
200 if [ -f "${D}${sbindir}/$f" ]; then
201 sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${sbindir}/$f
202 fi
203 done
204 if [ -f "${D}${bindir}/samba-tool" ]; then
205 sed -i -e 's,${PYTHON},/usr/bin/env python3,g' ${D}${bindir}/samba-tool
206 fi
207
208 oe_runmake -C ${S}/pidl DESTDIR=${D} install_vendor
209 find ${D}${libdir}/perl5/ -type f -name "perllocal.pod" -delete
210 find ${D}${libdir}/perl5/ -type f -name ".packlist" -delete
211 sed -i -e '1s,#!.*perl,#!${bindir}/env perl,' ${D}${bindir}/pidl
212}
213
214PACKAGES =+ "${PN}-python3 ${PN}-pidl \
215 ${PN}-dsdb-modules ${PN}-testsuite registry-tools \
216 winbind ctdb ctdb-tests \
217 ${PN}-common ${PN}-base ${PN}-ad-dc \
218 smbclient ${PN}-client ${PN}-server ${PN}-test"
219
220python samba_populate_packages() {
221 def module_hook(file, pkg, pattern, format, basename):
222 pn = d.getVar('PN')
223 d.appendVar('RRECOMMENDS:%s-base' % pn, ' %s' % pkg)
224
225 mlprefix = d.getVar('MLPREFIX') or ''
226 pam_libdir = d.expand('${base_libdir}/security')
227 pam_pkgname = mlprefix + 'pam-plugin%s'
228 do_split_packages(d, pam_libdir, r'^pam_(.*)\.so$', pam_pkgname, 'PAM plugin for %s', extra_depends='', prepend=True)
229
230 libdir = d.getVar('libdir')
231 do_split_packages(d, libdir, r'^lib(.*)\.so\..*$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True, allow_links=True)
232 pkglibdir = '%s/samba' % libdir
233 do_split_packages(d, pkglibdir, r'^lib(.*)\.so$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True)
234 moduledir = '%s/samba/auth' % libdir
235 do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-auth-%s', 'Samba %s authentication backend', hook=module_hook, extra_depends='', prepend=True)
236 moduledir = '%s/samba/pdb' % libdir
237 do_split_packages(d, moduledir, r'^(.*)\.so$', 'samba-pdb-%s', 'Samba %s password backend', hook=module_hook, extra_depends='', prepend=True)
238}
239
240PACKAGESPLITFUNCS:prepend = "samba_populate_packages "
241PACKAGES_DYNAMIC = "samba-auth-.* samba-pdb-.*"
242
243RDEPENDS:${PN} += "${PN}-base ${PN}-python3 ${PN}-dsdb-modules python3"
244RDEPENDS:${PN}-python3 += "pytalloc python3-tdb pyldb"
245
246FILES:${PN}-base = "${sbindir}/nmbd \
247 ${sbindir}/smbd \
248 ${sysconfdir}/init.d \
249 ${systemd_system_unitdir}/nmb.service \
250 ${systemd_system_unitdir}/smb.service"
251
252FILES:${PN}-ad-dc = "${sbindir}/samba \
253 ${systemd_system_unitdir}/samba.service \
254 ${libdir}/krb5/plugins/kdb/samba.so \
255"
256
257RDEPENDS:${PN}-ad-dc = "krb5-kdc"
258
259FILES:ctdb = "${bindir}/ctdb \
260 ${bindir}/ctdb_diagnostics \
261 ${bindir}/ltdbtool \
262 ${bindir}/onnode \
263 ${bindir}/ping_pong \
264 ${sbindir}/ctdbd \
265 ${datadir}/ctdb \
266 ${libexecdir}/ctdb \
267 ${localstatedir}/lib/ctdb \
268 ${sysconfdir}/ctdb \
269 ${sysconfdir}/sudoers.d/ctdb \
270 ${systemd_system_unitdir}/ctdb.service \
271"
272
273FILES:ctdb-tests = "${bindir}/ctdb_run_tests \
274 ${bindir}/ctdb_run_cluster_tests \
275 ${datadir}/ctdb-tests \
276 ${datadir}/ctdb/tests \
277"
278
279RDEPENDS:ctdb-tests += "bash util-linux-getopt ctdb"
280
281FILES:${BPN}-common = "${sysconfdir}/default \
282 ${sysconfdir}/samba \
283 ${sysconfdir}/tmpfiles.d \
284 ${localstatedir}/lib/samba \
285 ${localstatedir}/spool/samba \
286"
287
288FILES:${PN} += "${libdir}/vfs/*.so \
289 ${libdir}/charset/*.so \
290 ${libdir}/*.dat \
291 ${libdir}/auth/*.so \
292"
293
294FILES:${PN}-dsdb-modules = "${libdir}/samba/ldb"
295
296FILES:${PN}-testsuite = "${bindir}/gentest \
297 ${bindir}/locktest \
298 ${bindir}/masktest \
299 ${bindir}/ndrdump \
300 ${bindir}/smbtorture"
301
302FILES:registry-tools = "${bindir}/regdiff \
303 ${bindir}/regpatch \
304 ${bindir}/regshell \
305 ${bindir}/regtree"
306
307FILES:winbind = "${sbindir}/winbindd \
308 ${bindir}/wbinfo \
309 ${bindir}/ntlm_auth \
310 ${libdir}/samba/idmap \
311 ${libdir}/samba/nss_info \
312 ${libdir}/winbind_krb5_locator.so \
313 ${libdir}/winbind-krb5-localauth.so \
314 ${sysconfdir}/init.d/winbind \
315 ${systemd_system_unitdir}/winbind.service"
316
317FILES:${PN}-python3 = "${PYTHON_SITEPACKAGES_DIR}"
318
319FILES:smbclient = "${bindir}/cifsdd \
320 ${bindir}/rpcclient \
321 ${bindir}/smbcacls \
322 ${bindir}/smbclient \
323 ${bindir}/smbcquotas \
324 ${bindir}/smbget \
325 ${bindir}/smbspool \
326 ${bindir}/smbtar \
327 ${bindir}/smbtree \
328 ${libexecdir}/samba/smbspool_krb5_wrapper"
329
330FILES:${PN}-pidl = "${bindir}/pidl \
331 ${libdir}/perl5 \
332 "
333RDEPENDS:${PN}-pidl += "perl perl-modules libparse-yapp-perl"
334
335RDEPENDS:${PN}-client = "\
336 smbclient \
337 winbind \
338 registry-tools \
339 ${PN}-pidl \
340 "
341
342ALLOW_EMPTY:${PN}-client = "1"
343
344RDEPENDS:${PN}-server = "\
345 ${PN} \
346 winbind \
347 registry-tools \
348 "
349
350ALLOW_EMPTY:${PN}-server = "1"
351
352RDEPENDS:${PN}-test = "\
353 ctdb-tests \
354 ${PN}-testsuite \
355 "
356
357pkg_postinst:${PN}-common() {
358 if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
359 ${sysconfdir}/init.d/populate-volatile.sh update
360 fi
361}
362
363ALLOW_EMPTY:${PN}-test = "1"