xref: /OK3568_Linux_fs/buildroot/package/samba4/samba4.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# samba4
4#
5################################################################################
6
7SAMBA4_VERSION = 4.14.10
8SAMBA4_SITE = https://download.samba.org/pub/samba/stable
9SAMBA4_SOURCE = samba-$(SAMBA4_VERSION).tar.gz
10SAMBA4_INSTALL_STAGING = YES
11SAMBA4_LICENSE = GPL-3.0+
12SAMBA4_LICENSE_FILES = COPYING
13SAMBA4_CPE_ID_VENDOR = samba
14SAMBA4_CPE_ID_PRODUCT = samba
15SAMBA4_SELINUX_MODULES = samba
16SAMBA4_DEPENDENCIES = \
17	host-e2fsprogs host-flex host-heimdal host-nfs-utils \
18	host-perl host-perl-parse-yapp host-python3 \
19	cmocka e2fsprogs gnutls popt zlib \
20	$(if $(BR2_PACKAGE_LIBAIO),libaio) \
21	$(if $(BR2_PACKAGE_LIBCAP),libcap) \
22	$(if $(BR2_PACKAGE_READLINE),readline) \
23	$(TARGET_NLS_DEPENDENCIES)
24SAMBA4_CFLAGS = $(TARGET_CFLAGS)
25SAMBA4_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
26SAMBA4_CONF_ENV = \
27	CFLAGS="$(SAMBA4_CFLAGS)" \
28	LDFLAGS="$(SAMBA4_LDFLAGS)" \
29	XSLTPROC=false \
30	WAF_NO_PREFORK=1
31
32SAMBA4_PYTHON = PYTHON="$(HOST_DIR)/bin/python3"
33ifeq ($(BR2_PACKAGE_PYTHON3),y)
34SAMBA4_PYTHON += PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
35SAMBA4_DEPENDENCIES += python3
36else
37SAMBA4_CONF_OPTS += --disable-python
38endif
39
40ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
41SAMBA4_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
42SAMBA4_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
43SAMBA4_DEPENDENCIES += libtirpc host-pkgconf
44endif
45
46ifeq ($(BR2_PACKAGE_ACL),y)
47SAMBA4_CONF_OPTS += --with-acl-support
48SAMBA4_DEPENDENCIES += acl
49else
50SAMBA4_CONF_OPTS += --without-acl-support
51endif
52
53ifeq ($(BR2_PACKAGE_CUPS),y)
54SAMBA4_CONF_ENV += CUPS_CONFIG="$(STAGING_DIR)/usr/bin/cups-config"
55SAMBA4_CONF_OPTS += --enable-cups
56SAMBA4_DEPENDENCIES += cups
57else
58SAMBA4_CONF_OPTS += --disable-cups
59endif
60
61ifeq ($(BR2_PACKAGE_DBUS),y)
62SAMBA4_DEPENDENCIES += dbus
63SAMBA4_SHARED_MODULES += vfs_snapper
64else
65SAMBA4_SHARED_MODULES += !vfs_snapper
66endif
67
68ifeq ($(BR2_PACKAGE_DBUS)$(BR2_PACKAGE_AVAHI_DAEMON),yy)
69SAMBA4_CONF_OPTS += --enable-avahi
70SAMBA4_DEPENDENCIES += avahi
71else
72SAMBA4_CONF_OPTS += --disable-avahi
73endif
74
75ifeq ($(BR2_PACKAGE_GAMIN),y)
76SAMBA4_CONF_OPTS += --with-fam
77SAMBA4_DEPENDENCIES += gamin
78else
79SAMBA4_CONF_OPTS += --without-fam
80endif
81
82ifeq ($(BR2_PACKAGE_LIBARCHIVE),y)
83SAMBA4_CONF_OPTS += --with-libarchive
84SAMBA4_DEPENDENCIES += libarchive
85else
86SAMBA4_CONF_OPTS += --without-libarchive
87endif
88
89ifeq ($(BR2_PACKAGE_NCURSES),y)
90SAMBA4_CONF_ENV += NCURSES_CONFIG="$(STAGING_DIR)/usr/bin/$(NCURSES_CONFIG_SCRIPTS)"
91SAMBA4_DEPENDENCIES += ncurses
92else
93SAMBA4_CONF_OPTS += --without-regedit
94endif
95
96# The ctdb tests (cluster) need bash and take up some space
97# They're normally intended for debugging so remove them
98define SAMBA4_REMOVE_CTDB_TESTS
99	rm -rf $(TARGET_DIR)/usr/lib/ctdb-tests
100	rm -rf $(TARGET_DIR)/usr/share/ctdb-tests
101	rm -f $(TARGET_DIR)/usr/bin/ctdb_run_*tests
102endef
103SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_REMOVE_CTDB_TESTS
104
105define SAMBA4_CONFIGURE_CMDS
106	$(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt;
107	echo 'Checking whether fcntl supports setting/geting hints: $(if $(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_13),OK,NO)' >>$(@D)/cache.txt;
108	echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt;
109	(cd $(@D); \
110		$(SAMBA4_PYTHON) \
111		python_LDFLAGS="" \
112		python_LIBDIR="" \
113		PERL="$(HOST_DIR)/bin/perl" \
114		$(TARGET_CONFIGURE_OPTS) \
115		$(SAMBA4_CONF_ENV) \
116		./buildtools/bin/waf configure \
117			--prefix=/usr \
118			--sysconfdir=/etc \
119			--localstatedir=/var \
120			--with-libiconv=$(STAGING_DIR)/usr \
121			--enable-fhs \
122			--cross-compile \
123			--cross-answers=$(@D)/cache.txt \
124			--hostcc=gcc \
125			--disable-rpath \
126			--disable-rpath-install \
127			--disable-iprint \
128			--without-pam \
129			--without-dmapi \
130			--without-gpgme \
131			--without-ldb-lmdb \
132			--disable-glusterfs \
133			--with-cluster-support \
134			--bundled-libraries='!asn1_compile,!compile_et' \
135			--with-shared-modules=$(subst $(space),$(comma),$(strip $(SAMBA4_SHARED_MODULES))) \
136			$(SAMBA4_CONF_OPTS) \
137	)
138endef
139
140define SAMBA4_BUILD_CMDS
141	$(TARGET_MAKE_ENV) $(SAMBA4_PYTHON) $(MAKE) -C $(@D)
142endef
143
144define SAMBA4_INSTALL_STAGING_CMDS
145	$(TARGET_MAKE_ENV) $(SAMBA4_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
146endef
147
148define SAMBA4_INSTALL_TARGET_CMDS
149	$(TARGET_MAKE_ENV) $(SAMBA4_PYTHON) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
150endef
151
152ifeq ($(BR2_PACKAGE_SAMBA4_AD_DC),y)
153# host-python-dnspython and host-python-markdown are not strictly
154# needed on the host, but on the target. however, samba's configure
155# tests for their availability on the host.
156SAMBA4_DEPENDENCIES += \
157	jansson \
158	host-python-dnspython \
159	host-python-markdown \
160	python-dnspython \
161	python-markdown
162else
163SAMBA4_CONF_OPTS += --without-ad-dc --without-json
164endif
165
166ifeq ($(BR2_PACKAGE_SAMBA4_ADS),y)
167SAMBA4_CONF_OPTS += --with-ads --with-ldap
168SAMBA4_DEPENDENCIES += openldap
169SAMBA4_SHARED_MODULES += idmap_ad
170else
171SAMBA4_CONF_OPTS += --without-ads --without-ldap
172SAMBA4_SHARED_MODULES += !idmap_ad
173endif
174
175ifeq ($(BR2_PACKAGE_SAMBA4_SMBTORTURE),)
176define SAMBA4_REMOVE_SMBTORTURE
177	rm -f $(TARGET_DIR)/usr/bin/smbtorture
178endef
179SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_REMOVE_SMBTORTURE
180endif
181
182define SAMBA4_INSTALL_INIT_SYSV
183	$(INSTALL) -m 0755 -D package/samba4/S91smb \
184		$(TARGET_DIR)/etc/init.d/S91smb
185endef
186
187ifeq ($(BR2_INIT_SYSTEMD),y)
188SAMBA4_CONF_OPTS += --systemd-install-services
189SAMBA4_DEPENDENCIES += systemd
190endif
191
192define SAMBA4_INSTALL_INIT_SYSTEMD
193	$(INSTALL) -D -m 644 $(@D)/packaging/systemd/samba.conf.tmp \
194		$(TARGET_DIR)/usr/lib/tmpfiles.d/samba.conf
195	printf "d /var/log/samba  755 root root\n" >>$(TARGET_DIR)/usr/lib/tmpfiles.d/samba.conf
196endef
197
198$(eval $(generic-package))
199