Subject: pkg/35433: PKGSRC_COMPILER (1 vs list) and libtool
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 01/16/2007 17:35:00
>Number:         35433
>Category:       pkg
>Synopsis:       PKGSRC_COMPILER (1 vs list) and libtool
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 16 17:35:00 +0000 2007
>Originator:     Dan McMahill
>Release:        NetBSD 2.0_STABLE
System: NetBSD bondage 2.0_STABLE NetBSD 2.0_STABLE (BONDAGE) #0: Tue Mar 29 13:12:53 EST 2005 dan@bondage:/export/disk2/netbsd-2/obj/alpha/sys/arch/alpha/compile/BONDAGE alpha
Architecture: alpha
Machine: alpha

Currently it is not clear from some of the pkgsrc documentation if
PKGSRC_COMPILER is only allowed to be a single setting like


or if you can give a list in order of preference like

PKGSRC_COMPILER="sunpro gcc"

The advantage of having a list is that you can default to using (for example)
sunpro and for some packages which may not build with sunpro, they can be
marked as 

NOT_FOR_COMPILER=       sunpro

and then you build them with gcc.

However if you just try to give a list, the current pkgsrc framework doesn't seem to quite
get you there but it is close.

You need the following 2 changes:

RCS file: /cvsroot/pkgsrc/mk/misc/,v
retrieving revision 1.3
diff -u -2 -r1.3
--- misc/   3 Dec 2006 21:58:20 -0000       1.3
+++ misc/   16 Jan 2007 17:22:45 -0000
@@ -26,11 +26,16 @@
 _CBBH_MSGS.ncomp=      "This package is not available for these compilers: "${NOT_FOR_COMPILER:Q}"."
+.if defined(NOT_FOR_COMPILER)
+_CBBH.ncomp=           no
 _CBBH.ncomp=           yes
 .for c in ${NOT_FOR_COMPILER}
 .  for pc in ${PKGSRC_COMPILER}
 # The left-hand side of the == operator must be a "real" variable.
 _c:= ${c}
-.    if ${_c} == ${pc}
-_CBBH.ncomp=           no
+.    if ${_c} != ${pc}
+_CBBH.ncomp=           yes
 .    endif
 .  endfor

this changes the logic to say "fail if we don't have any compilers listed in PKGSRC_COMPILER
which are not listed in NOT_FOR_COMPILER" instead of "fail if any compiler listed in PKGSRC_COMPILER
is listed in NOT_FOR_COMPILER".

Then you need to change a bunch of PKGSRC_COMPILER to _PKGSRC_COMPILER like

RCS file: /cvsroot/pkgsrc/mk/wrapper/,v
retrieving revision 1.60
diff -u -2 -r1.60
--- wrapper/      26 Nov 2006 14:42:17 -0000      1.60
+++ wrapper/      16 Jan 2007 17:22:45 -0000
@@ -217,5 +217,5 @@
 .endfor        # _WRAPPEES
-.if !empty(PKGSRC_COMPILER:Maix-xlc)
+.if !empty(_PKGSRC_COMPILER:Maix-xlc)
 _WRAP_CMD_SINK.CC=     ${WRAPPER_TMPDIR}/cmd-sink-aix-xlc
@@ -223,5 +223,5 @@
-.if !empty(PKGSRC_COMPILER:Micc)
+.if !empty(_PKGSRC_COMPILER:Micc)
 .  if !empty(CC_VERSION:M8.1) || !empty(CC_VERSION:M9.0)
 _WRAP_CMD_SINK.CC=     ${WRAPPER_TMPDIR}/cmd-sink-icc81-cc
@@ -237,5 +237,5 @@
the full patch isn't included, but you just make the same change for
all the various compilers.

Now things are very close to working.

If you list PKGSRC_COMPILER="sunpro gcc" you'll default to sunpro.
If a particular package has NOT_FOR_COMPILER=sunpro, you'll fall over
to gcc.  The catch is libtool.

You really must build 1 libtool for each compiler and pick the right
libtool based on which compiler is building a particular pacakge.

Maybe there needs to be a devel/libtool-base-{gcc,sunpro,mipspro, ...}
where each of these just sets 1 variable and includes a Makefile.common
(so we dont' have a nightmare to maintain).  Then the compiler framework
would be need to be sure and always grab the correct libtool for the
compiler picked for a particular package.


use PKGSRC_COMPILER=gcc, find that you have problems with some packages
(mozilla) and wish that you were using suns compiler since it produces
faster code.  use PKGSRC_COMPILER=sunpro and find some packages are rather
broken without gcc.  use PKGSRC_COMPILER="sunpro gcc" and find you can't.


apply the attached patches and deal with the libtool issue.