Subject: pkg/11548: latest IS_BUILTIN_XPM breaks on XFree86 3.x
To: None <gnats-bugs@gnats.netbsd.org>
From: None <John.P.Darrow@wheaton.edu>
List: netbsd-bugs
Date: 11/22/2000 00:00:31
>Number:         11548
>Category:       pkg
>Synopsis:       latest IS_BUILTIN_XPM breaks on XFree86 3.x
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 22 00:00:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     John Darrow
>Release:        pkgsrc supped late 2000-11-21
>Organization:
	Wheaton College Computing Services
	Wheaton, IL
>Environment:
System: NetBSD jdarrowpiii.wheaton.edu 1.5 NetBSD 1.5 (JDARROW) #0: Mon Nov 20 12:31:08 CST 2000 jdarrow@jdarrowpiii.wheaton.edu:/var/src/sys/arch/i386/compile/JDARROW i386


>Description:

On a system with standard NetBSD xsrc (XFree86 3.x) and xpm not yet
installed, doing a 'make build-depends-list' in pkgsrc/graphics/xpm (or
any package which depends on xpm) results in an endless stream of
'xpm-3.4k'.  The following code analysis (indented to ease following
conditional flow) shows why:

# Check if we got Xpm distributed with XFree86 4.0 or newer or if we
# need to use the package.
.if defined(USE_XPM) || (${DISTNAME:Mxpm-*} != "")
    .if exists(${X11BASE}/include/X11/xpm.h)
        .if !defined(IS_BUILTIN_XPM)
            IS_BUILTIN_XPM!=	${EGREP} -c NormalLibXpm ${X11BASE}/lib/X11/config/X11.tmpl || ${TRUE}
            MAKEFLAGS+=		IS_BUILTIN_XPM=${IS_BUILTIN_XPM}
        .endif
        .if defined(USE_XPM)
            .if (${IS_BUILTIN_XPM} == "0")
                DEPENDS+=		xpm-3.4k:../../graphics/xpm
                XPMDIR_DEFAULT=		${X11PREFIX}
            .else
                XPMDIR_DEFAULT=		${X11BASE}
            .endif
        .elif (${IS_BUILTIN_XPM} != "0")
            IGNORE=			"The Xpm library is included in your X11 distribution."
        .endif
    .else
        DEPENDS+=		xpm-3.4k:../../graphics/xpm
        XPMDIR_DEFAULT=		${X11PREFIX}
    .endif
.endif	# USE_XPM

If the current package is xpm, the DISTNAME:Mxpm-* matches.  But if
X11BASE/include/X11/xpm.h doesn't exist (not XFree86 4.0, and either
xpm uninstalled or installed using xpkgwedge), the Makefile drops down
to the last else, thus setting DEPENDS to xpm.  Thus xpm depends on xpm,
which depends on xpm...

>How-To-Repeat:

Go to start building packages on nice new fast machine.  Do 'make
build-depends-list' as matter of course.  See endless loop.

>Fix:

The following seems to be the simplest fix to this specific problem.

--- /source/sup/current/pkgsrc/mk/bsd.pkg.mk	Tue Nov 21 06:12:21 2000
+++ /var/pkgsrc.orig/mk/bsd.pkg.mk	Wed Nov 22 01:41:32 2000
@@ -792,7 +792,7 @@
 .elif (${IS_BUILTIN_XPM} != "0")
 IGNORE=			"The Xpm library is included in your X11 distribution."
 .endif
-.else
+.elif defined(USE_XPM)
 DEPENDS+=		xpm-3.4k:../../graphics/xpm
 XPMDIR_DEFAULT=		${X11PREFIX}
 .endif

(Note that there could also be problems if xpkgwedge is installed _after_
xpm, as then this block of code would set XPMDIR_DEFAULT to LOCALBASE, even
though xpm is in X11BASE.  However, that problem is more widespread, and
also applies to MOTIFBASE, etc.  It is a vestige of attempting to allow
a mix of xpkgwedged and non-xpkgwedged USE_X11BASE packages to be installed,
and fixing it would probably require a lot of '.if exists', and is beyond
the scope of this pr.)
>Release-Note:
>Audit-Trail:
>Unformatted: