diff mbox

[1/3] exim: allow using a custom configuration file

Message ID 1404489386-7523-2-git-send-email-luca@lucaceresoli.net
State Accepted
Headers show

Commit Message

Luca Ceresoli July 4, 2014, 3:56 p.m. UTC
exim has lots of options configurable before the build process. It's not
useful to have all of them exposed in Buildroot, yet users may need to tweak
them.

Allow the user to pass an entire configuration file to make exim totally
reconfigurable without bloating the Buildroot menus.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 package/exim/Config.in | 25 +++++++++++++++++++++++++
 package/exim/exim.mk   | 25 ++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/package/exim/Config.in b/package/exim/Config.in
index a71106b..fb41ccb 100644
--- a/package/exim/Config.in
+++ b/package/exim/Config.in
@@ -8,3 +8,28 @@  config BR2_PACKAGE_EXIM
 	  Cambridge for use on Unix systems connected to the Internet.
 
 	  http://www.exim.org/
+
+if BR2_PACKAGE_EXIM
+
+config BR2_PACKAGE_EXIM_CUSTOM_CONFIG
+	bool "Use a custom configuration file for exim"
+	help
+	  By default Buildroot generates configuration file for exim with
+	  reasonable settings.
+	  Enable this option if you want to override the configuration file
+	  generated by Buildroot with a customized file. Then set the path
+	  to your configuration file in BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE.
+
+config BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE
+	string "Custom configuration file for exim"
+	depends on BR2_PACKAGE_EXIM_CUSTOM_CONFIG
+	help
+	  Specify a file to use as the exim configuration file.
+
+	  This file shall comply with the syntax defined in the exim
+	  documentation (http://www.exim.org/docs.html).
+	  Buildroot will generate a configuration file composed of the
+	  content of the file you provide plus the toolchain-related
+	  settings needed for cross-compilation.
+
+endif
diff --git a/package/exim/exim.mk b/package/exim/exim.mk
index 0f9c6af..2e51a0d 100644
--- a/package/exim/exim.mk
+++ b/package/exim/exim.mk
@@ -30,7 +30,12 @@  define exim-config-add # variable-name, variable-value
 	echo "$1=$2" >>$(@D)/Local/Makefile
 endef
 
-define EXIM_CONFIGURE_CMDS
+define EXIM_USE_CUSTOM_CONFIG_FILE
+	$(INSTALL) -m 0644 $(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE) \
+		$(@D)/Local/Makefile
+endef
+
+define EXIM_USE_DEFAULT_CONFIG_FILE
 	$(INSTALL) -m 0644 $(@D)/src/EDITME $(@D)/Local/Makefile
 	$(call exim-config-change,BIN_DIRECTORY,/usr/sbin)
 	$(call exim-config-change,CONFIGURE_FILE,/etc/exim/configure)
@@ -41,6 +46,9 @@  define EXIM_CONFIGURE_CMDS
 	$(call exim-config-change,PCRE_CONFIG,no)
 	$(call exim-config-change,HAVE_ICONV,no)
 	$(call exim-config-unset,EXIM_MONITOR)
+endef
+
+define EXIM_CONFIGURE_TOOLCHAIN
 	$(call exim-config-add,CC,$(TARGET_CC))
 	$(call exim-config-add,CFLAGS,$(TARGET_CFLAGS))
 	$(call exim-config-add,AR,$(TARGET_AR) cq)
@@ -49,6 +57,21 @@  define EXIM_CONFIGURE_CMDS
 	$(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS))
 endef
 
+ifeq ($(BR2_PACKAGE_EXIM_CUSTOM_CONFIG),y)
+ifeq ($(call qstrip,$(BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE)),)
+$(error No exim configuration file specified, check your BR2_PACKAGE_EXIM_CUSTOM_CONFIG_FILE setting)
+endif
+define EXIM_CONFIGURE_CMDS
+	$(EXIM_USE_CUSTOM_CONFIG_FILE)
+	$(EXIM_CONFIGURE_TOOLCHAIN)
+endef
+else # CUSTOM_CONFIG
+define EXIM_CONFIGURE_CMDS
+	$(EXIM_USE_DEFAULT_CONFIG_FILE)
+	$(EXIM_CONFIGURE_TOOLCHAIN)
+endef
+endif # CUSTOM_CONFIG
+
 # exim needs a bit of love to build statically
 ifeq ($(BR2_PREFER_STATIC_LIB),y)
 EXIM_STATIC_FLAGS = LFLAGS="-pthread --static"