blob: 7574aefb4d9d2f0ca698019bad393aee8e1f69f2 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001SECTION = "console/network"
2
3LICENSE = "GPL-3.0+ & LGPL-3.0+ & GPL-2.0+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
5 file://${COREBASE}/meta/files/common-licenses/LGPL-3.0;md5=bfccfe952269fff2b407dd11f2f3083b \
6 file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 "
7
8SAMBA_MIRROR = "http://samba.org/samba/ftp"
9MIRRORS += "\
10${SAMBA_MIRROR} http://mirror.internode.on.net/pub/samba \n \
11${SAMBA_MIRROR} http://www.mirrorservice.org/sites/ftp.samba.org \n \
12"
13
14SRC_URI = "${SAMBA_MIRROR}/stable/samba-${PV}.tar.gz \
15 file://00-fix-typos-in-man-pages.patch \
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://volatiles.03_samba \
24 "
25SRC_URI_append_libc-musl = " \
26 file://samba-4.2.7-pam.patch \
27 file://samba-4.3.9-remove-getpwent_r.patch \
28 "
29SRC_URI[md5sum] = "461def8190ffc651fd8458b24ca2a622"
30SRC_URI[sha256sum] = "927afcc16e444718985e3952de92d34e7b776b9ca0238179d866da18a6441c35"
31
32inherit systemd waf-samba cpan-base perlnative update-rc.d
33# remove default added RDEPENDS on perl
34RDEPENDS_${PN}_remove = "perl"
35
36DEPENDS += "readline virtual/libiconv zlib popt libtalloc libtdb libtevent libldb krb5 libbsd libaio libpam"
37DEPENDS_append_libc-musl = " libtirpc"
38CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
39LDFLAGS_append_libc-musl = " -ltirpc"
40
41LSB = ""
42LSB_linuxstdbase = "lsb"
43
44INITSCRIPT_NAME = "samba"
45INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
46
47SYSTEMD_PACKAGES = "${PN}-base winbind"
48SYSTEMD_SERVICE_${PN}-base = "nmb.service smb.service"
49SYSTEMD_SERVICE_winbind = "winbind.service"
50
51PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd zeroconf', d)} \
52 acl cups ldap \
53"
54
55RDEPENDS_${PN}-base += "${LSB}"
56RDEPENDS_${PN}-ctdb-tests += "bash util-linux-getopt"
57
58PACKAGECONFIG[acl] = "--with-acl-support,--without-acl-support,acl"
59PACKAGECONFIG[fam] = "--with-fam,--without-fam,gamin"
60PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups"
61PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
62PACKAGECONFIG[sasl] = ",,cyrus-sasl"
63PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
64PACKAGECONFIG[dmapi] = "--with-dmapi,--without-dmapi,dmapi"
65PACKAGECONFIG[zeroconf] = "--enable-avahi,--disable-avahi,avahi"
66PACKAGECONFIG[valgrind] = ",--without-valgrind,valgrind,"
67PACKAGECONFIG[lttng] = "--with-lttng, --without-lttng,lttng-ust"
68PACKAGECONFIG[archive] = "--with-libarchive, --without-libarchive, libarchive"
69
70
71SAMBA4_IDMAP_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2"
72SAMBA4_PDB_MODULES="pdb_tdbsam,${@bb.utils.contains('PACKAGECONFIG', 'ldap', 'pdb_ldap,', '', d)}pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4"
73SAMBA4_AUTH_MODULES="auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4"
74SAMBA4_MODULES="${SAMBA4_IDMAP_MODULES},${SAMBA4_PDB_MODULES},${SAMBA4_AUTH_MODULES}"
75
76SAMBA4_LIBS="heimdal,!zlib,!popt,!talloc,!pytalloc,!pytalloc-util,!tevent,!pytevent,!tdb,!pytdb,!ldb,!pyldb"
77
78EXTRA_OECONF += "--enable-fhs \
79 --with-piddir=/run \
80 --with-sockets-dir=/run/samba \
81 --with-modulesdir=${libdir}/samba \
82 --with-lockdir=${localstatedir}/lib/samba \
83 --with-cachedir=${localstatedir}/lib/samba \
84 --disable-gnutls \
85 --disable-rpath-install \
86 --with-shared-modules=${SAMBA4_MODULES} \
87 --bundled-libraries=${SAMBA4_LIBS} \
88 --with-system-mitkrb5 \
89 --without-ad-dc \
90 ${@base_conditional('TARGET_ARCH', 'x86_64', '', '--disable-glusterfs', d)} \
91 --with-cluster-support \
92 --with-profiling-data \
93 --with-libiconv=${STAGING_DIR_HOST}${prefix} \
94 --with-pam --with-pammodulesdir=${base_libdir}/security \
95 "
96
97LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
98
99do_install_append() {
100 for section in 1 5 7; do
101 install -d ${D}${mandir}/man$section
102 install -m 0644 ctdb/doc/*.$section ${D}${mandir}/man$section
103 done
104 for section in 1 5 7 8; do
105 install -d ${D}${mandir}/man$section
106 install -m 0644 docs/manpages/*.$section ${D}${mandir}/man$section
107 done
108
109 install -d ${D}${systemd_system_unitdir}
110 install -m 0644 packaging/systemd/*.service ${D}${systemd_system_unitdir}
111 sed -e 's,\(ExecReload=\).*\(/kill\),\1${base_bindir}\2,' \
112 -e 's,/etc/sysconfig/samba,${sysconfdir}/default/samba,' \
113 -i ${D}${systemd_system_unitdir}/*.service
114
115 install -d ${D}${sysconfdir}/tmpfiles.d
116 install -m644 packaging/systemd/samba.conf.tmp ${D}${sysconfdir}/tmpfiles.d/samba.conf
117 echo "d ${localstatedir}/log/samba 0755 root root -" \
118 >> ${D}${sysconfdir}/tmpfiles.d/samba.conf
119 if [ "${LSB}" = "lsb" ]; then
120 install -d ${D}${sysconfdir}/init.d
121 install -m 0755 packaging/LSB/samba.sh ${D}${sysconfdir}/init.d/samba
122 else
123 install -d ${D}${sysconfdir}/init.d
124 install -m 0755 packaging/sysv/samba.init ${D}${sysconfdir}/init.d/samba
125 sed -e 's,/opt/samba/bin,${sbindir},g' \
126 -e 's,/opt/samba/smb.conf,${sysconfdir}/samba/smb.conf,g' \
127 -e 's,/opt/samba/log,${localstatedir}/log/samba,g' \
128 -e 's,/etc/init.d/samba.server,${sysconfdir}/init.d/samba,g' \
129 -e 's,/usr/bin,${base_bindir},g' \
130 -i ${D}${sysconfdir}/init.d/samba
131 fi
132
133 install -d ${D}${sysconfdir}/samba
134 echo "127.0.0.1 localhost" > ${D}${sysconfdir}/samba/lmhosts
135 install -m644 packaging/LSB/smb.conf ${D}${sysconfdir}/samba/smb.conf
136 install -D -m 644 ${WORKDIR}/volatiles.03_samba ${D}${sysconfdir}/default/volatiles/03_samba
137
138 install -d ${D}${sysconfdir}/default
139 install -m644 packaging/systemd/samba.sysconfig ${D}${sysconfdir}/default/samba
140
141 # install ctdb config file and test cases
142 install -D -m 0644 ${S}/ctdb/tests/onnode/nodes ${D}${sysconfdir}/ctdb/nodes
143 # the items are from ctdb/tests/run_tests.sh
144 for d in onnode takeover tool eventscripts cunit simple complex; do
145 testdir=${D}${datadir}/ctdb-tests/$d
146 install -d $testdir
147 cp ${S}/ctdb/tests/$d/*.sh $testdir
148 cp -r ${S}/ctdb/tests/$d/scripts ${S}/ctdb/tests/$d/stubs $testdir || true
149 done
150
151 # fix file-rdeps qa warning
152 if [ -f ${D}${bindir}/onnode ]; then
153 sed -i 's:\(#!/bin/\)bash:\1sh:' ${D}${bindir}/onnode
154 fi
155
156 chmod 0750 ${D}${sysconfdir}/sudoers.d
157 rm -rf ${D}/run ${D}${localstatedir}/run ${D}${localstatedir}/log
158}
159
160PACKAGES =+ "${PN}-python ${PN}-pidl \
161 ${PN}-dsdb-modules ${PN}-testsuite registry-tools \
162 winbind \
163 ${PN}-common ${PN}-base ${PN}-ctdb-tests \
164 smbclient"
165
166python samba_populate_packages() {
167 def module_hook(file, pkg, pattern, format, basename):
168 pn = d.getVar('PN', True)
169 d.appendVar('RRECOMMENDS_%s-base' % pn, ' %s' % pkg)
170
171 mlprefix = d.getVar('MLPREFIX', True) or ''
172 pam_libdir = d.expand('${base_libdir}/security')
173 pam_pkgname = mlprefix + 'pam-plugin%s'
174 do_split_packages(d, pam_libdir, '^pam_(.*)\.so$', pam_pkgname, 'PAM plugin for %s', extra_depends='', prepend=True)
175
176 libdir = d.getVar('libdir', True)
177 do_split_packages(d, libdir, '^lib(.*)\.so\..*$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True, allow_links=True)
178 pkglibdir = '%s/samba' % libdir
179 do_split_packages(d, pkglibdir, '^lib(.*)\.so$', 'lib%s', 'Samba %s library', extra_depends='${PN}-common', prepend=True)
180 moduledir = '%s/samba/auth' % libdir
181 do_split_packages(d, moduledir, '^(.*)\.so$', 'samba-auth-%s', 'Samba %s authentication backend', hook=module_hook, extra_depends='', prepend=True)
182 moduledir = '%s/samba/pdb' % libdir
183 do_split_packages(d, moduledir, '^(.*)\.so$', 'samba-pdb-%s', 'Samba %s password backend', hook=module_hook, extra_depends='', prepend=True)
184}
185
186PACKAGESPLITFUNCS_prepend = "samba_populate_packages "
187
188RDEPENDS_${PN} += "${PN}-base"
189
190FILES_${PN}-base = "${sbindir}/nmbd \
191 ${sbindir}/smbd \
192 ${sysconfdir}/init.d \
193 ${localstatedir}/lib/samba \
194 ${localstatedir}/nmbd \
195 ${localstatedir}/spool/samba \
196 ${systemd_system_unitdir}/nmb.service \
197 ${systemd_system_unitdir}/samba.service \
198 ${systemd_system_unitdir}/smb.service"
199
200FILES_${PN}-ctdb-tests = "${bindir}/ctdb_run_tests \
201 ${bindir}/ctdb_run_cluster_tests \
202 ${sysconfdir}/ctdb/nodes \
203 ${datadir}/ctdb-tests \
204 ${datadir}/ctdb/tests \
205 "
206
207FILES_${BPN}-common = "${sysconfdir}/default \
208 ${sysconfdir}/samba \
209 ${sysconfdir}/tmpfiles.d \
210"
211
212FILES_${PN} += "${libdir}/vfs/*.so \
213 ${libdir}/charset/*.so \
214 ${libdir}/*.dat \
215 ${libdir}/auth/*.so \
216"
217
218FILES_${PN}-dsdb-modules = "${libdir}/samba/ldb"
219
220FILES_${PN}-testsuite = "${bindir}/gentest \
221 ${bindir}/locktest \
222 ${bindir}/masktest \
223 ${bindir}/ndrdump \
224 ${bindir}/smbtorture"
225
226FILES_registry-tools = "${bindir}/regdiff \
227 ${bindir}/regpatch \
228 ${bindir}/regshell \
229 ${bindir}/regtree"
230
231FILES_winbind = "${sbindir}/winbindd \
232 ${bindir}/wbinfo \
233 ${bindir}/ntlm_auth \
234 ${libdir}/samba/idmap \
235 ${libdir}/samba/nss_info \
236 ${libdir}/winbind_krb5_locator.so \
237 ${sysconfdir}/init.d/winbind \
238 ${systemd_system_unitdir}/winbind.service"
239
240FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
241
242FILES_smbclient = "${bindir}/cifsdd \
243 ${bindir}/rpcclient \
244 ${bindir}/smbcacls \
245 ${bindir}/smbclient \
246 ${bindir}/smbcquotas \
247 ${bindir}/smbget \
248 ${bindir}/smbspool \
249 ${bindir}/smbtar \
250 ${bindir}/smbtree \
251 ${libdir}/samba/smbspool_krb5_wrapper"
252
253RDEPENDS_${PN}-pidl_append = " perl"
254FILES_${PN}-pidl = "${bindir}/pidl ${datadir}/perl5/Parse"