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