Viktor Dukhovni:
> On Wed, Jul 09, 2014 at 12:27:19PM -0400, Wietse Venema wrote:
>
> > Viktor Dukhovni:
> > > > - $(SHLIB_LD) -o $(LIB) $(OBJS)
> > > > + $(SHLIB_LD) -o $(LIB) $(OBJS) $(SYSLIBS)
> > ...
> > > Wietse wanted to avoid $(SYSLIBS) when linking the shared libraries,
> > > and removed them from SHLIB_LD line, but they are indeed not optional
> > > in many cases.
> >
> > This breaks when $(SYSLIBS) contains a non-shared library (libfoo.a).
> >
> > Working around that will require extra scripting in makedefs, to
> > eliminate non-shared libraries from the $(SHLIB_LD) command lines.
>
> One might simply declare this to be pilot error.
I want to be able to specify "AUXLIBS=/some/where/libwhatever.a".
> It is difficult to imagine what libraries might be needed to link
> Postfix executables
Here is a patch that creates a SYSLIBS subset without *.a, specifically
for building Postfix shared libraries.
Wietse
diff -cr --exclude='*.[hc]' /var/tmp/postfix-2.12-20140703/makedefs ./makedefs
*** /var/tmp/postfix-2.12-20140703/makedefs 2014-07-01 17:37:17.000000000
-0400
--- ./makedefs 2014-07-09 14:15:52.000000000 -0400
***************
*** 926,931 ****
--- 926,932 ----
SHLIB_CFLAGS=
SHLIB_SUFFIX=
SHLIB_LD=:
+ SHLIB_SYSLIBS=
SHLIB_RPATH=
SHLIB_ENV=
LIB_PREFIX=
***************
*** 984,989 ****
--- 985,1005 ----
done;;
esac
+ # Remove static libraries from SYSLIBS when building shared objects,
+ # Can't use the shell "case" patterns to detect names ending in *.a.
+
+ case "$shared" in
+ yes) SHLIB_SYSLIBS=`${AWK} '
+ BEGIN { wc = split("'"$SYSLIBS"'", words)
+ for (n = 1; n <= wc; n++)
+ if (words[n] !~ /\.a$/)
+ printf(" %s", words[n])
+ }
+ '`
+ esac
+
+ # Finally...
+
sed 's/ */ /g' <<EOF
# System-dependent settings and compiler/linker overrides.
SYSTYPE = $SYSTYPE
***************
*** 1009,1014 ****
--- 1025,1031 ----
SHLIB_DIR = $shlib_directory
SHLIB_ENV = $SHLIB_ENV
SHLIB_LD = $SHLIB_LD
+ SHLIB_SYSLIBS = $SHLIB_SYSLIBS
SHLIB_RPATH = $SHLIB_RPATH
# Switch between dynamicmaps.cf plugins and hard-linked databases.
NON_PLUGIN_MAP_OBJ = $NON_PLUGIN_MAP_OBJ
diff -cr --exclude='*.[hc]' /var/tmp/postfix-2.12-20140703/src/dns/Makefile.in
./src/dns/Makefile.in
*** /var/tmp/postfix-2.12-20140703/src/dns/Makefile.in 2014-04-18
16:22:33.000000000 -0400
--- ./src/dns/Makefile.in 2014-07-09 14:07:58.000000000 -0400
***************
*** 33,39 ****
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(OBJS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)
--- 33,39 ----
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(OBJS) $(SHLIB_SYSLIBS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)
diff -cr --exclude='*.[hc]'
/var/tmp/postfix-2.12-20140703/src/global/Makefile.in ./src/global/Makefile.in
*** /var/tmp/postfix-2.12-20140703/src/global/Makefile.in 2014-06-21
21:03:52.000000000 -0400
--- ./src/global/Makefile.in 2014-07-09 14:07:30.000000000 -0400
***************
*** 138,144 ****
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(OBJS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)
--- 138,144 ----
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(OBJS) $(SHLIB_SYSLIBS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)
diff -cr --exclude='*.[hc]'
/var/tmp/postfix-2.12-20140703/src/master/Makefile.in ./src/master/Makefile.in
*** /var/tmp/postfix-2.12-20140703/src/master/Makefile.in 2014-05-23
21:16:32.000000000 -0400
--- ./src/master/Makefile.in 2014-07-09 14:08:19.000000000 -0400
***************
*** 44,50 ****
$(LIB): $(LIB_OBJ)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(LIB_OBJ)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)/$(LIB)
--- 44,50 ----
$(LIB): $(LIB_OBJ)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(LIB_OBJ) $(SHLIB_SYSLIBS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)/$(LIB)
diff -cr --exclude='*.[hc]' /var/tmp/postfix-2.12-20140703/src/util/Makefile.in
./src/util/Makefile.in
*** /var/tmp/postfix-2.12-20140703/src/util/Makefile.in 2014-06-21
21:03:36.000000000 -0400
--- ./src/util/Makefile.in 2014-07-09 14:06:46.000000000 -0400
***************
*** 143,149 ****
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(OBJS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)
--- 143,149 ----
$(LIB): $(OBJS)
$(AR) $(ARFL) $(LIB) $?
$(RANLIB) $(LIB)
! $(SHLIB_LD) -o $(LIB) $(OBJS) $(SHLIB_SYSLIBS)
$(LIB_DIR)/$(LIB): $(LIB)
cp $(LIB) $(LIB_DIR)