On 2011-01-24 at 13:27 +0000, Dennis Davis wrote:
> # To build a module dynamically, you'll need to define CFLAGS_DYNAMIC for
> # your platform. Eg:
> # CFLAGS_DYNAMIC=-shared -rdynamic
> # CFLAGS_DYNAMIC=-shared -rdynamic -fPIC
>
> in src/EDITME are misleading. You need to provide a value for
> CFLAGS_DYNAMIC as scripts/lookups-Makefile insists on it. Although
> setting:
>
> CFLAGS_DYNAMIC=
This is a mistake on my part, as things got shuffled around. When
lookups-Makefile became mandatory, I should have changed that condition
and just made it exit true.
> This release candidate fails to build on Solaris5.10 and, so far,
> it's scripts/lookups-Makefile that's the problem. I'd guess that
> this script was imported from some Linux box where /bin/sh is a
> version of bash. This script make assumptions about the shell
> scripting language available that simply aren't true for the more
> primitive /bin/sh on Solaris.
No, it's written by me on a FreeBSD box where /bin/sh is a POSIX sh and
does assume POSIX. POSIX mandates -q for grep and the tr syntax used is
correct POSIX. There are no bash extensions and no GNU assumptions in
lookups-Makefile.
In fact, this script exists precisely to avoid GNUisms; the original
dynamic lookups patch assumed GNU make, which meant that I could no
longer build Exim, since OS/Makefile-FreeBSD assumes BSD make, so Exim
had conflicting syntaxes in on Makefile. This script exists to work
around the non-portability of "export" in Makefiles.
> The scripts/lookups-Makefile also make assumptions about:
>
> (1) The grep command. The "-q" argument isn't available with the
> Solaris version of grep.
>
> (2) The syntax of the tr command. You can't write:
>
> tr A-Z a-z
>
> on Solaris. It needs to be:
>
> tr [A-Z] [a-z]
I forget, and don't have a Solaris box to test on -- does /usr/xpg4/bin
contain a POSIX-compliant tr and grep?
How about the attached patch, does it resolve the issues for you? If
not, do you have any recommendations? I could code up an early section,
using even more portable sh, to deal with Solaris explicitly. What's
reported by { uname -s } ?
Thanks for testing this -- I'm glad to get some feedback. :)
-Phil
From 45c4d4f8c7dc010485db19b3569a15774853f168 Mon Sep 17 00:00:00 2001
From: Phil Pennock <pdp@???>
Date: Mon, 24 Jan 2011 09:06:34 -0500
Subject: [PATCH] Compatibility fixes for dynlookup makefile builder.
Don't abort if CFLAGS_DYNAMIC not defined. Oops!
Attempt to get a POSIX environment on Solaris.
Problems reported by: Dennis Davis
---
src/scripts/lookups-Makefile | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/scripts/lookups-Makefile b/src/scripts/lookups-Makefile
index 7f2dd1b..959d49e 100755
--- a/src/scripts/lookups-Makefile
+++ b/src/scripts/lookups-Makefile
@@ -2,6 +2,15 @@
# We turn the configure-built build-$foo/lookups/Makefile.predynamic into Makefile
+if [ -x /usr/xpg4/bin/sh ] && [ -z "EXIM_BLOCK_XPG4_LOOP" ]
+then
+ EXIM_BLOCK_XPG4_LOOP=yes
+ export EXIM_BLOCK_XPG4_LOOP
+ PATH="/usr/xpg4/bin:$PATH"
+ export PATH
+ exec /usr/xpg4/bin/sh "$@"
+fi
+
input=lookups/Makefile.predynamic
target=lookups/Makefile
defs_source=Makefile
@@ -15,10 +24,10 @@ tab=' '
if grep -q "^CFLAGS_DYNAMIC[ $tab]*=" "$defs_source"
then
# we have a definition, we're good to go
- : # noop (true) statement for bash compatibility
+ enable_dynamic=yes
else
echo >&2 "Missing CFLAGS_DYNAMIC inhibits building dynamic module lookup"
- exit 1
+ enable_dynamic=''
fi
tmp="$target.t"
@@ -46,6 +55,10 @@ emit_module_rule() {
if want_dynamic "$lookup_name"
then
+ if [ -z "$enable_dynamic" ]; then
+ echo >&2 "Inhibited dynamic modules prevents building dynamic $lookup_name"
+ exit 1
+ fi
echo "MODS += ${mod_name}.so"
grep "^LOOKUP_${lookup_name}_" "$defs_source"
echo "LOOKUP_${mod_name}_INCLUDE = \$(LOOKUP_${lookup_name}_INCLUDE)"
--
1.7.3.5