samba_4.10.10.bb 14 KB

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