From patchwork Sun Apr 6 20:29:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 337288 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 5ABC81400CB for ; Mon, 7 Apr 2014 06:30:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 68E5687CAD; Sun, 6 Apr 2014 20:29:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m6IXgVQPhXFP; Sun, 6 Apr 2014 20:29:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 9E25D87CAB; Sun, 6 Apr 2014 20:29:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 0A51A1C0C4B for ; Sun, 6 Apr 2014 20:29:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0322F8B3FD for ; Sun, 6 Apr 2014 20:29:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id peCoSM5Y6-cU for ; Sun, 6 Apr 2014 20:29:55 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp2.ngi.it (smtp2.ngi.it [88.149.128.113]) by whitealder.osuosl.org (Postfix) with ESMTP id 766BA8B3D3 for ; Sun, 6 Apr 2014 20:29:54 +0000 (UTC) Received: from localhost.localdomain (unknown [100.68.96.41]) by smtp2.ngi.it (Postfix) with ESMTP id 121962121D; Sun, 6 Apr 2014 22:29:51 +0200 (CEST) From: Luca Ceresoli To: buildroot@uclibc.org Date: Sun, 6 Apr 2014 22:29:17 +0200 Message-Id: <1396816157-1828-1-git-send-email-luca@lucaceresoli.net> X-Mailer: git-send-email 1.8.3.2 Cc: thomas.petazzoni@free-electrons.com, Luca Ceresoli , Bernd Kuhls Subject: [Buildroot] [PATCH] exim: use a more standard build-time configuration X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Buildroot currently ships a very minimal build configuration file for exim, which disables most optional features. This is not coherent with the runtime configuration file, taken verbatim from the exim distribution, which enables some of these features. The visible symptom is an error during boot that prevents exim from starting: Exim configuration error in line 541 of /etc/exim/configure: router dnslookup: cannot find router driver "dnslookup" In order to fix this problem, we change the way exim is configured at build time. Instead of blindly copying a minimal Buildroot-provided configuration file, we now copy the exim-provided one and then tweak it to change the needed options. This actually makes the configuration closer to standard exim. As the amount of tweaking is remarkable, we also define a few macros to make it easier and more readable. This new approach was suggested by Bernd Kuhls. Reported-By: Thomas Petazzoni Signed-off-by: Luca Ceresoli Cc: Bernd Kuhls --- Note: although this patch fixes a problem and cleans up things, I am not totally satisfied with it. It enables many optional features that are not enabled in products where I use exim. If I used this version of the exim package the executable would become larger without any advantage for my use case. So I will consider producing a follow-up patch in the future to allow (de)activating some options via kconfig. This is in line with previous discussion with Bernd, and I would appreciate his comments on this proposal. Nevertheless I'm sending this patch right now because it fixes a problem, and it's IMO an overall improvement. --- package/exim/exim.mk | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/package/exim/exim.mk b/package/exim/exim.mk index 3e8404b..bfb138e 100644 --- a/package/exim/exim.mk +++ b/package/exim/exim.mk @@ -11,15 +11,42 @@ EXIM_LICENSE = GPLv2+ EXIM_LICENSE_FILES = LICENCE EXIM_DEPENDENCIES = pcre berkeleydb -# These echos seem to be the sanest way to feed CC and CFLAGS to exim +# Modify a variable value. It must already exist in the file, either +# commented or not. +define exim-config-change # variable-name, variable-value + $(SED) 's,^[#[:space:]]*$1[[:space:]]*=.*$$,$1=$2,' \ + $(@D)/Local/Makefile +endef + +# Comment-out a variable. Has no effect if it does not exits. +define exim-config-unset # variable-name + $(SED) 's,^\([[:space:]]*$1[[:space:]]*=.*$$\),# \1,' \ + $(@D)/Local/Makefile +endef + +# Add a variable definition. It must not already exist in the file, +# otherwise it would be defined twice with potentially different values. +define exim-config-add # variable-name, variable-value + echo "$1=$2" >>$(@D)/Local/Makefile +endef + define EXIM_CONFIGURE_CMDS - $(INSTALL) -m 0644 -D package/exim/Local-Makefile $(@D)/Local/Makefile - echo "CC=$(TARGET_CC)" >>$(@D)/Local/Makefile - echo "CFLAGS=$(TARGET_CFLAGS)" >>$(@D)/Local/Makefile - echo "AR=$(TARGET_AR) cq" >>$(@D)/Local/Makefile - echo "RANLIB=$(TARGET_RANLIB)" >>$(@D)/Local/Makefile - echo "HOSTCC=$(HOSTCC)" >>$(@D)/Local/Makefile - echo "HOSTCFLAGS=$(HOSTCFLAGS)" >>$(@D)/Local/Makefile + $(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) + $(call exim-config-change,EXIM_USER,ref:exim) + $(call exim-config-change,EXIM_GROUP,mail) + $(call exim-config-change,TRANSPORT_LMTP,yes) + $(call exim-config-change,PCRE_LIBS,-lpcre) + $(call exim-config-change,PCRE_CONFIG,no) + $(call exim-config-change,HAVE_ICONV,no) + $(call exim-config-unset,EXIM_MONITOR) + $(call exim-config-add,CC,$(TARGET_CC)) + $(call exim-config-add,CFLAGS,$(TARGET_CFLAGS)) + $(call exim-config-add,AR,$(TARGET_AR) cq) + $(call exim-config-add,RANLIB,$(TARGET_RANLIB)) + $(call exim-config-add,HOSTCC,$(HOSTCC)) + $(call exim-config-add,HOSTCFLAGS,$(HOSTCFLAGS)) endef # "The -j (parallel) flag must not be used with make"