package/python-simplejson: bump version to 3.8.2
[buildroot-gz.git] / package / exim / exim.mk
blobed7d16975f2642aeed09bb1103b8fedd36fa1e37
1 ################################################################################
3 # exim
5 ################################################################################
7 EXIM_VERSION = 4.87
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
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
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
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
33 define EXIM_USE_CUSTOM_CONFIG_FILE
34 $(INSTALL) -m 0644 $(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE) \
35 $(@D)/Local/Makefile
36 endef
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
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
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
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
75 # only glibc provides libnsl, remove -lnsl for all other toolchains
76 # http://bugs.exim.org/show_bug.cgi?id=1564
77 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
78 define EXIM_REMOVE_LIBNSL_FROM_MAKEFILE
79 $(SED) 's/-lnsl//g' $(@D)/OS/Makefile-Linux
80 endef
81 endif
83 # musl does not provide struct ip_options nor struct ip_opts (but it is
84 # available with both glibc and uClibc)
85 ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
86 define EXIM_FIX_IP_OPTIONS_FOR_MUSL
87 $(SED) 's/#define GLIBC_IP_OPTIONS/#define DARWIN_IP_OPTIONS/' \
88 $(@D)/OS/os.h-Linux
89 endef
90 endif
92 define EXIM_CONFIGURE_TOOLCHAIN
93 $(call exim-config-add,CC,$(TARGET_CC))
94 $(call exim-config-add,CFLAGS,$(TARGET_CFLAGS))
95 $(call exim-config-add,AR,$(TARGET_AR) cq)
96 $(call exim-config-add,RANLIB,$(TARGET_RANLIB))
97 $(call exim-config-add,HOSTCC,$(HOSTCC))
98 $(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS))
99 $(EXIM_REMOVE_LIBNSL_FROM_MAKEFILE)
100 $(EXIM_FIX_IP_OPTIONS_FOR_MUSL)
101 endef
103 ifneq ($(call qstrip,$(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE)),)
104 define EXIM_CONFIGURE_CMDS
105 $(EXIM_USE_CUSTOM_CONFIG_FILE)
106 $(EXIM_CONFIGURE_TOOLCHAIN)
107 endef
108 else # CUSTOM_CONFIG
109 define EXIM_CONFIGURE_CMDS
110 $(EXIM_USE_DEFAULT_CONFIG_FILE)
111 $(EXIM_USE_DEFAULT_CONFIG_FILE_DOVECOT)
112 $(EXIM_USE_DEFAULT_CONFIG_FILE_CLAMAV)
113 $(EXIM_USE_DEFAULT_CONFIG_FILE_OPENSSL)
114 $(EXIM_CONFIGURE_TOOLCHAIN)
115 endef
116 endif # CUSTOM_CONFIG
118 # exim needs a bit of love to build statically
119 ifeq ($(BR2_STATIC_LIBS),y)
120 EXIM_STATIC_FLAGS = LFLAGS="-pthread --static"
121 endif
123 # "The -j (parallel) flag must not be used with make"
124 # (http://www.exim.org/exim-html-current/doc/html/spec_html/ch04.html)
125 define EXIM_BUILD_CMDS
126 $(TARGET_MAKE_ENV) build=br $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS)
127 endef
129 # Need to replicate the LFLAGS in install, as exim still wants to build
130 # something when installing...
131 define EXIM_INSTALL_TARGET_CMDS
132 DESTDIR=$(TARGET_DIR) INSTALL_ARG="-no_chown -no_symlink" build=br \
133 $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) install
134 chmod u+s $(TARGET_DIR)/usr/sbin/exim
135 endef
137 define EXIM_USERS
138 exim 88 mail 8 * - - - exim
139 endef
141 define EXIM_INSTALL_INIT_SYSV
142 $(INSTALL) -D -m 755 package/exim/S86exim \
143 $(TARGET_DIR)/etc/init.d/S86exim
144 endef
146 define EXIM_INSTALL_INIT_SYSTEMD
147 $(INSTALL) -D -m 644 package/exim/exim.service \
148 $(TARGET_DIR)/usr/lib/systemd/system/exim.service
149 mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
150 ln -sf ../../../../usr/lib/systemd/system/exim.service \
151 $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/exim.service
152 endef
154 $(eval $(generic-package))