Subject: pkg/20331: build of rpm2pkg doesn't find rpmlib.h
To: None <gnats-bugs@gnats.netbsd.org>
From: None <pavel.cahyna@st.mff.cuni.cz>
List: netbsd-bugs
Date: 02/13/2003 06:57:39
>Number:         20331
>Category:       pkg
>Synopsis:       build of rpm2pkg doesn't find rpmlib.h
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 13 06:58:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Pavel Cahyna
>Release:        1.6_STABLE
>Organization:
>Environment:
NetBSD omega 1.6_STABLE NetBSD 1.6_STABLE (GENERIC) #0: Fri Nov 22 12:41:51 MET 
2002     bouyer@java:/home/tmp/alpha/obj/sys/arch/alpha/compile/GENERIC alpha
>Description:
when trying building rpm2pkg (with rpm properly installed) I get:
/usr/pkgsrc/pkgtools/rpm2pkg$ make
===> Building for rpm2pkg-1.3
/obj/pkg/work./pkgtools/rpm2pkg/work/.buildlink/bin/cc -O2 -mcpu=ev4 -mieee -I/usr/pkg/include  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -o /obj/pkg/work./pkgtools/rpm2pkg/work/rpm2pkg  /usr/pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c -lrpm -lintl -lz
/usr/pkgsrc/pkgtools/rpm2pkg/files/rpm2pkg.c:18: rpmlib.h: No such file or directory
...

rpmlib.h is actually located in /usr/pkg/include/rpm, note that this
directory is not included by -L... parameters in the compilation command above.

In fact, the Makefile tries to add ${BUILDLINK_CPPFLAGS.rpm} to CFLAGS
but BUILDLINK_CPPFLAGS.rpm is defined in ../../misc/rpm/buildlink2.mk
and this file is included only after setting CFLAGS, so it doesn't do 
what's intended.
>How-To-Repeat:
see above.
>Fix:
apply the following patch to /usr/pkgsrc/pkgtools/rpm2pkg/Makefile:

--- Makefile.orig       Tue Dec 10 12:15:49 2002
+++ Makefile    Thu Feb 13 15:05:10 2003
@@ -15,6 +15,8 @@
 NO_CHECKSUM=   YES
 WRKSRC=                ${WRKDIR}
 
+.include "../../misc/rpm/buildlink2.mk"
+
 CFLAGS+=       ${BUILDLINK_CPPFLAGS.rpm}
 LIBS=          -lrpm -lintl -lz
 
@@ -27,6 +29,5 @@
        ${INSTALL_MAN} ${FILESDIR}/rpm2pkg.8 ${PREFIX}/man/man8
 
 .include "../../devel/zlib/buildlink2.mk"
-.include "../../misc/rpm/buildlink2.mk"
 
 .include "../../mk/bsd.pkg.mk"
>Release-Note:
>Audit-Trail:
>Unformatted: