b85279357403f9a7a38ace6250aa3b6df016878c
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / exim / exim.mk
1 ################################################################################
2 #
3 # exim
4 #
5 ################################################################################
6
7 EXIM_VERSION = 4.85
8 EXIM_SOURCE = exim-$(EXIM_VERSION).tar.bz2
9 EXIM_SITE = ftp://ftp.exim.org/pub/exim/exim4
10 EXIM_LICENSE = GPLv2+
11 EXIM_LICENSE_FILES = LICENCE
12 EXIM_DEPENDENCIES = pcre berkeleydb host-pkgconf
13
14 # Modify a variable value. It must already exist in the file, either
15 # commented or not.
16 define exim-config-change # variable-name, variable-value
17         $(SED) 's,^[#[:space:]]*$1[[:space:]]*=.*$$,$1=$2,' \
18                 $(@D)/Local/Makefile
19 endef
20
21 # Comment-out a variable. Has no effect if it does not exits.
22 define exim-config-unset # variable-name
23         $(SED) 's,^\([[:space:]]*$1[[:space:]]*=.*$$\),# \1,' \
24                 $(@D)/Local/Makefile
25 endef
26
27 # Add a variable definition. It must not already exist in the file,
28 # otherwise it would be defined twice with potentially different values.
29 define exim-config-add # variable-name, variable-value
30         echo "$1=$2" >>$(@D)/Local/Makefile
31 endef
32
33 define EXIM_USE_CUSTOM_CONFIG_FILE
34         $(INSTALL) -m 0644 $(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE) \
35                 $(@D)/Local/Makefile
36 endef
37
38 define EXIM_USE_DEFAULT_CONFIG_FILE
39         $(INSTALL) -m 0644 $(@D)/src/EDITME $(@D)/Local/Makefile
40         $(call exim-config-change,BIN_DIRECTORY,/usr/sbin)
41         $(call exim-config-change,CONFIGURE_FILE,/etc/exim/configure)
42         $(call exim-config-change,EXIM_USER,ref:exim)
43         $(call exim-config-change,EXIM_GROUP,mail)
44         $(call exim-config-change,TRANSPORT_LMTP,yes)
45         $(call exim-config-change,PCRE_LIBS,-lpcre)
46         $(call exim-config-change,PCRE_CONFIG,no)
47         $(call exim-config-change,HAVE_ICONV,no)
48         $(call exim-config-unset,EXIM_MONITOR)
49         $(call exim-config-change,AUTH_PLAINTEXT,yes)
50         $(call exim-config-change,AUTH_CRAM_MD5,yes)
51 endef
52
53 ifeq ($(BR2_PACKAGE_DOVECOT),y)
54 EXIM_DEPENDENCIES += dovecot
55 define EXIM_USE_DEFAULT_CONFIG_FILE_DOVECOT
56         $(call exim-config-change,AUTH_DOVECOT,yes)
57 endef
58 endif
59
60 ifeq ($(BR2_PACKAGE_CLAMAV),y)
61 EXIM_DEPENDENCIES += clamav
62 define EXIM_USE_DEFAULT_CONFIG_FILE_CLAMAV
63         $(call exim-config-change,WITH_CONTENT_SCAN,yes)
64 endef
65 endif
66
67 ifeq ($(BR2_PACKAGE_OPENSSL),y)
68 EXIM_DEPENDENCIES += openssl
69 define EXIM_USE_DEFAULT_CONFIG_FILE_OPENSSL
70         $(call exim-config-change,SUPPORT_TLS,yes)
71         $(call exim-config-change,USE_OPENSSL_PC,openssl)
72 endef
73 endif
74
75 define EXIM_CONFIGURE_TOOLCHAIN
76         $(call exim-config-add,CC,$(TARGET_CC))
77         $(call exim-config-add,CFLAGS,$(TARGET_CFLAGS))
78         $(call exim-config-add,AR,$(TARGET_AR) cq)
79         $(call exim-config-add,RANLIB,$(TARGET_RANLIB))
80         $(call exim-config-add,HOSTCC,$(HOSTCC))
81         $(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS))
82         $(EXIM_REMOVE_LIBNSL_FROM_MAKEFILE)
83 endef
84
85 ifneq ($(call qstrip,$(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE)),)
86 define EXIM_CONFIGURE_CMDS
87         $(EXIM_USE_CUSTOM_CONFIG_FILE)
88         $(EXIM_CONFIGURE_TOOLCHAIN)
89 endef
90 else # CUSTOM_CONFIG
91 define EXIM_CONFIGURE_CMDS
92         $(EXIM_USE_DEFAULT_CONFIG_FILE)
93         $(EXIM_USE_DEFAULT_CONFIG_FILE_DOVECOT)
94         $(EXIM_USE_DEFAULT_CONFIG_FILE_CLAMAV)
95         $(EXIM_USE_DEFAULT_CONFIG_FILE_OPENSSL)
96         $(EXIM_CONFIGURE_TOOLCHAIN)
97 endef
98 endif # CUSTOM_CONFIG
99
100 # exim needs a bit of love to build statically
101 ifeq ($(BR2_STATIC_LIBS),y)
102 EXIM_STATIC_FLAGS = LFLAGS="-pthread --static"
103 endif
104
105 # "The -j (parallel) flag must not be used with make"
106 # (http://www.exim.org/exim-html-current/doc/html/spec_html/ch04.html)
107 define EXIM_BUILD_CMDS
108         $(TARGET_MAKE_ENV) build=br $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS)
109 endef
110
111 # Need to replicate the LFLAGS in install, as exim still wants to build
112 # something when installing...
113 define EXIM_INSTALL_TARGET_CMDS
114         DESTDIR=$(TARGET_DIR) INSTALL_ARG="-no_chown -no_symlink" build=br \
115           $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) install
116         chmod u+s $(TARGET_DIR)/usr/sbin/exim
117 endef
118
119 define EXIM_USERS
120         exim 88 mail 8 * - - - exim
121 endef
122
123 define EXIM_INSTALL_INIT_SYSV
124         $(INSTALL) -D -m 755 package/exim/S86exim \
125                 $(TARGET_DIR)/etc/init.d/S86exim
126 endef
127
128 $(eval $(generic-package))