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