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