open-plc-utils: new package
[buildroot-gz.git] / package / exim / exim.mk
blobf39445d73b2a410617f291bcbfaf960cd4bd6dc0
1 ################################################################################
3 # exim
5 ################################################################################
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
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 endef
51 ifeq ($(BR2_PACKAGE_DOVECOT),y)
52 EXIM_DEPENDENCIES += dovecot
53 define EXIM_USE_DEFAULT_CONFIG_FILE_DOVECOT
54 $(call exim-config-change,AUTH_DOVECOT,yes)
55 endef
56 endif
58 ifeq ($(BR2_PACKAGE_CLAMAV),y)
59 EXIM_DEPENDENCIES += clamav
60 define EXIM_USE_DEFAULT_CONFIG_FILE_CLAMAV
61 $(call exim-config-change,WITH_CONTENT_SCAN,yes)
62 endef
63 endif
65 # this specific toolchain lacks libnsl
66 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_2014_12),y)
67 define EXIM_REMOVE_LIBNSL_FROM_MAKEFILE
68 $(SED) 's/-lnsl//g' $(@D)/OS/Makefile-Linux
69 endef
70 endif
72 define EXIM_CONFIGURE_TOOLCHAIN
73 $(call exim-config-add,CC,$(TARGET_CC))
74 $(call exim-config-add,CFLAGS,$(TARGET_CFLAGS))
75 $(call exim-config-add,AR,$(TARGET_AR) cq)
76 $(call exim-config-add,RANLIB,$(TARGET_RANLIB))
77 $(call exim-config-add,HOSTCC,$(HOSTCC))
78 $(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS))
79 $(EXIM_REMOVE_LIBNSL_FROM_MAKEFILE)
80 endef
82 ifneq ($(call qstrip,$(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE)),)
83 define EXIM_CONFIGURE_CMDS
84 $(EXIM_USE_CUSTOM_CONFIG_FILE)
85 $(EXIM_CONFIGURE_TOOLCHAIN)
86 endef
87 else # CUSTOM_CONFIG
88 define EXIM_CONFIGURE_CMDS
89 $(EXIM_USE_DEFAULT_CONFIG_FILE)
90 $(EXIM_USE_DEFAULT_CONFIG_FILE_DOVECOT)
91 $(EXIM_USE_DEFAULT_CONFIG_FILE_CLAMAV)
92 $(EXIM_CONFIGURE_TOOLCHAIN)
93 endef
94 endif # CUSTOM_CONFIG
96 # exim needs a bit of love to build statically
97 ifeq ($(BR2_STATIC_LIBS),y)
98 EXIM_STATIC_FLAGS = LFLAGS="-pthread --static"
99 endif
101 # "The -j (parallel) flag must not be used with make"
102 # (http://www.exim.org/exim-html-current/doc/html/spec_html/ch04.html)
103 define EXIM_BUILD_CMDS
104 build=br $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS)
105 endef
107 # Need to replicate the LFLAGS in install, as exim still wants to build
108 # something when installing...
109 define EXIM_INSTALL_TARGET_CMDS
110 DESTDIR=$(TARGET_DIR) INSTALL_ARG="-no_chown -no_symlink" build=br \
111 $(MAKE1) -C $(@D) $(EXIM_STATIC_FLAGS) install
112 chmod u+s $(TARGET_DIR)/usr/sbin/exim
113 endef
115 define EXIM_USERS
116 exim 88 mail 8 * - - - exim
117 endef
119 define EXIM_INSTALL_INIT_SYSV
120 $(INSTALL) -D -m 755 package/exim/S86exim \
121 $(TARGET_DIR)/etc/init.d/S86exim
122 endef
124 $(eval $(generic-package))