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