]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/samba4/samba4.mk
6f3207fb6416d07ee2e883fdf8f3e723decacbd2
[coffee/buildroot.git] / package / samba4 / samba4.mk
1 ################################################################################
2 #
3 # samba4
4 #
5 ################################################################################
6
7 SAMBA4_VERSION = 4.7.4
8 SAMBA4_SITE = https://download.samba.org/pub/samba/stable
9 SAMBA4_SOURCE = samba-$(SAMBA4_VERSION).tar.gz
10 SAMBA4_INSTALL_STAGING = YES
11 SAMBA4_LICENSE = GPL-3.0+
12 SAMBA4_LICENSE_FILES = COPYING
13 SAMBA4_DEPENDENCIES = \
14         host-e2fsprogs host-heimdal host-python \
15         e2fsprogs popt python zlib \
16         $(if $(BR2_PACKAGE_LIBAIO),libaio) \
17         $(if $(BR2_PACKAGE_LIBCAP),libcap) \
18         $(if $(BR2_PACKAGE_READLINE),readline) \
19         $(TARGET_NLS_DEPENDENCIES)
20 SAMBA4_CFLAGS = $(TARGET_CFLAGS)
21 SAMBA4_LDFLAGS = $(TARGET_LDFLAGS)
22 SAMBA4_CONF_ENV = \
23         CFLAGS="$(SAMBA4_CFLAGS)" \
24         LDFLAGS="$(SAMBA4_LDFLAGS)"
25
26 ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
27 SAMBA4_CFLAGS += `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`
28 SAMBA4_LDFLAGS += `$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`
29 SAMBA4_DEPENDENCIES += libtirpc host-pkgconf
30 endif
31
32 ifeq ($(BR2_PACKAGE_ACL),y)
33 SAMBA4_CONF_OPTS += --with-acl-support
34 SAMBA4_DEPENDENCIES += acl
35 else
36 SAMBA4_CONF_OPTS += --without-acl-support
37 endif
38
39 ifeq ($(BR2_PACKAGE_CUPS),y)
40 SAMBA4_CONF_ENV += CUPS_CONFIG="$(STAGING_DIR)/usr/bin/cups-config"
41 SAMBA4_CONF_OPTS += --enable-cups
42 SAMBA4_DEPENDENCIES += cups
43 else
44 SAMBA4_CONF_OPTS += --disable-cups
45 endif
46
47 ifeq ($(BR2_PACKAGE_DBUS),y)
48 SAMBA4_DEPENDENCIES += dbus
49 endif
50
51 ifeq ($(BR2_PACKAGE_DBUS)$(BR2_PACKAGE_AVAHI_DAEMON),yy)
52 SAMBA4_CONF_OPTS += --enable-avahi
53 SAMBA4_DEPENDENCIES += avahi
54 else
55 SAMBA4_CONF_OPTS += --disable-avahi
56 endif
57
58 ifeq ($(BR2_PACKAGE_GAMIN),y)
59 SAMBA4_CONF_OPTS += --with-fam
60 SAMBA4_DEPENDENCIES += gamin
61 else
62 SAMBA4_CONF_OPTS += --without-fam
63 endif
64
65 ifeq ($(BR2_PACKAGE_GNUTLS),y)
66 SAMBA4_CONF_OPTS += --enable-gnutls
67 SAMBA4_DEPENDENCIES += gnutls
68 else
69 SAMBA4_CONF_OPTS += --disable-gnutls
70 endif
71
72 ifeq ($(BR2_PACKAGE_NCURSES),y)
73 SAMBA4_CONF_ENV += NCURSES_CONFIG="$(STAGING_DIR)/usr/bin/$(NCURSES_CONFIG_SCRIPTS)"
74 SAMBA4_DEPENDENCIES += ncurses
75 else
76 SAMBA4_CONF_OPTS += --without-regedit
77 endif
78
79 # The ctdb tests (cluster) need bash and take up some space
80 # They're normally intended for debugging so remove them
81 define SAMBA4_REMOVE_CTDB_TESTS
82         rm -rf $(TARGET_DIR)/usr/lib/ctdb-tests
83         rm -rf $(TARGET_DIR)/usr/share/ctdb-tests
84         rm -f $(TARGET_DIR)/usr/bin/ctdb_run_*tests
85 endef
86 SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_REMOVE_CTDB_TESTS
87
88 define SAMBA4_CONFIGURE_CMDS
89         $(INSTALL) -m 0644 package/samba4/samba4-cache.txt $(@D)/cache.txt;
90         echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt;
91         (cd $(@D); \
92                 PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \
93                 python_LDFLAGS="" \
94                 python_LIBDIR="" \
95                 $(TARGET_CONFIGURE_OPTS) \
96                 $(SAMBA4_CONF_ENV) \
97                 ./buildtools/bin/waf configure \
98                         --prefix=/usr \
99                         --sysconfdir=/etc \
100                         --localstatedir=/var \
101                         --with-libiconv=$(STAGING_DIR)/usr \
102                         --enable-fhs \
103                         --cross-compile \
104                         --cross-answers=$(@D)/cache.txt \
105                         --hostcc=gcc \
106                         --disable-rpath \
107                         --disable-rpath-install \
108                         --disable-iprint \
109                         --without-pam \
110                         --without-dmapi \
111                         --disable-glusterfs \
112                         --with-cluster-support \
113                         --bundled-libraries='!asn1_compile,!compile_et' \
114                         $(SAMBA4_CONF_OPTS) \
115         )
116 endef
117
118 define SAMBA4_BUILD_CMDS
119         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
120 endef
121
122 define SAMBA4_INSTALL_STAGING_CMDS
123         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
124 endef
125
126 define SAMBA4_INSTALL_TARGET_CMDS
127         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
128 endef
129
130 ifeq ($(BR2_PACKAGE_SAMBA4_AD_DC),)
131 SAMBA4_CONF_OPTS += --without-ad-dc
132 endif
133
134 ifeq ($(BR2_PACKAGE_SAMBA4_ADS),y)
135 SAMBA4_CONF_OPTS += --with-ads --with-ldap --with-shared-modules=idmap_ad
136 SAMBA4_DEPENDENCIES += openldap
137 else
138 SAMBA4_CONF_OPTS += --without-ads --without-ldap
139 endif
140
141 ifeq ($(BR2_PACKAGE_SAMBA4_SMBTORTURE),)
142 define SAMBA4_REMOVE_SMBTORTURE
143         rm -f $(TARGET_DIR)/usr/bin/smbtorture
144 endef
145 SAMBA4_POST_INSTALL_TARGET_HOOKS += SAMBA4_REMOVE_SMBTORTURE
146 endif
147
148 define SAMBA4_INSTALL_INIT_SYSV
149         $(INSTALL) -m 0755 -D package/samba4/S91smb \
150                 $(TARGET_DIR)/etc/init.d/S91smb
151 endef
152
153 define SAMBA4_INSTALL_INIT_SYSTEMD
154         $(INSTALL) -D -m 644 $(@D)/packaging/systemd/nmb.service \
155                 $(TARGET_DIR)/usr/lib/systemd/system/nmb.service
156         $(INSTALL) -D -m 644 $(@D)/packaging/systemd/smb.service \
157                 $(TARGET_DIR)/usr/lib/systemd/system/smb.service
158         $(INSTALL) -D -m 644 $(@D)/packaging/systemd/winbind.service \
159                 $(TARGET_DIR)/usr/lib/systemd/system/winbind.service
160         mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
161         ln -sf ../../../../usr/lib/systemd/system/nmb.service \
162                 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/nmb.service
163         ln -sf ../../../../usr/lib/systemd/system/smb.service \
164                 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/smb.service
165         ln -sf ../../../../usr/lib/systemd/system/winbind.service \
166                 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/winbind.service
167         $(INSTALL) -D -m 644 $(@D)/packaging/systemd/samba.conf.tmp \
168                 $(TARGET_DIR)/usr/lib/tmpfiles.d/samba.conf
169         printf "d /var/log/samba  755 root root\n" >>$(TARGET_DIR)/usr/lib/tmpfiles.d/samba.conf
170 endef
171
172 $(eval $(generic-package))