Subject: pkg/23587: buildlink2 broken when X11BASE is LOCALBASE
To: None <gnats-bugs@gnats.netbsd.org>
From: None <reed@reedmedia.net>
List: netbsd-bugs
Date: 11/28/2003 02:19:27
>Number: 23587
>Category: pkg
>Synopsis: buildlink2 broken when X11BASE is LOCALBASE
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Nov 28 10:20:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.6.1_STABLE
>Organization:
http://bsd.reedmedia.net/
>Environment:
System: NetBSD rainier.reedmedia.net 1.6.1_STABLE NetBSD 1.6.1_STABLE (GENERIC) #0: Tue Aug 12 02:52:57 PDT 2003 reed@rainier.reedmedia.net:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
When X11BASE is set to same as LOCALBASE and the package does
not have USE_X11 defined, then buildlinking is broken.
The -I includes are all stripped out.
And there are two buildlinking directories.
The work/.buildlink directory contains the .*_buildlink_done files,
and the work/.buildlink-x11 directory contains the actual links.
mk/bsd.buildlink2.mk assumes that X11BASE is different than LOCALBASE.
I noticed this problem on two different systems:
- Linux with X11BASE set to LOCALBASE which is /usr
- NetBSD with X11BASE set to LOCALBASE which is ${HOME}/pkg
I don't want to use xpkgwedge. I do not want to have an
/usr/X11R6 directory. I was using xpkgwedge, but I was told
that using xpkgwedge when LOCALBASE is X11BASE is detrimental.
I noticed this with various different packages.
>How-To-Repeat:
Set X11BASE to LOCALBASE and start building some packages using
buildlinking but do not use USE_X11.
For example try to build wip/libXau or
cd archivers/dact
make USE_BZIP2=YES buildlink
ls -la work
>Fix:
I don't know if the following is perfect. But it works for me
when using X11BASE the same and when it is different.
Index: mk/buildlink2/bsd.buildlink2.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink2/bsd.buildlink2.mk,v
retrieving revision 1.100
diff -b -u -r1.100 bsd.buildlink2.mk
--- mk/buildlink2/bsd.buildlink2.mk 2003/10/18 18:24:56 1.100
+++ mk/buildlink2/bsd.buildlink2.mk 2003/11/28 09:41:34
@@ -196,8 +196,12 @@
#
_LT_ARCHIVE_TRANSFORM_SED= \
-e "s|$/usr\(/lib/[^ ]*\.la\)|${BUILDLINK_DIR}\1|g" \
- -e "s|${LOCALBASE}\(/lib/[^ ]*\.la\)|${BUILDLINK_DIR}\1|g" \
+ -e "s|${LOCALBASE}\(/lib/[^ ]*\.la\)|${BUILDLINK_DIR}\1|g"
+
+.if ${LOCALBASE} != ${X11BASE}
+_LT_ARCHIVE_TRANSFORM_SED+= \
-e "s|${X11BASE}\(/lib/[^ ]*\.la\)|${BUILDLINK_DIR}\1|g"
+.endif
_LT_ARCHIVE_TRANSFORM= \
${SED} ${_LT_ARCHIVE_TRANSFORM_SED} $${file} > $${dest}
@@ -243,14 +247,14 @@
if [ ! -f $${cookie} ]; then \
${ECHO_BUILDLINK_MSG} "Linking ${.TARGET:S/-buildlink//} files into ${BUILDLINK_DIR}."; \
${MKDIR} ${BUILDLINK_DIR}; \
+ buildlink_dir="${BUILDLINK_DIR}"; \
+ if [ "${X11BASE}" != "${LOCALBASE}" ] ; then \
case "${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}" in \
${X11BASE}) \
buildlink_dir="${BUILDLINK_X11_DIR}"; \
;; \
- *) \
- buildlink_dir="${BUILDLINK_DIR}"; \
- ;; \
esac; \
+ fi; \
pkg_prefix=; \
if [ -n "${BUILDLINK_PKGBASE.${.TARGET:S/-buildlink//}}" ]; then \
pkg_prefix=`${PKG_INFO} -qp ${BUILDLINK_PKGBASE.${.TARGET:S/-buildlink//}} | ${AWK} '{ sub("${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}", "", $$2); sub("/", "", $$2); print $$2; exit }'`/; \
@@ -338,25 +342,31 @@
#
# Convert direct paths to shared libraries into "-Ldir -llib" equivalents.
#
+.if ${X11BASE} != ${LOCALBASE}
_BLNK_TRANSFORM+= p:${X11BASE}
+.endif
_BLNK_TRANSFORM+= p:${LOCALBASE}
_BLNK_TRANSFORM+= p:/usr/lib
#
# Convert direct paths to static libraries in ${LOCALBASE} or ${X11BASE}
# into references into ${BUILDLINK_DIR}.
#
+.if ${X11BASE} != ${LOCALBASE}
_BLNK_TRANSFORM+= static:${X11BASE}:${_BLNK_MANGLE_DIR.BUILDLINK_X11_DIR}
+.endif
_BLNK_TRANSFORM+= static:${LOCALBASE}:${_BLNK_MANGLE_DIR.BUILDLINK_DIR}
#
# Transform references into ${X11BASE} into ${BUILDLINK_X11_DIR} but if
# the package doesn't use X11, then just remove these references altogether.
#
+.if ${X11BASE} != ${LOCALBASE}
.if defined(USE_X11)
_BLNK_TRANSFORM+= I:${X11BASE}:${_BLNK_MANGLE_DIR.BUILDLINK_X11_DIR}
_BLNK_TRANSFORM+= L:${X11BASE}:${_BLNK_MANGLE_DIR.BUILDLINK_X11_DIR}
.else
_BLNK_TRANSFORM+= r:${X11BASE}
.endif
+.endif
#
# Transform references into ${LOCALBASE} into ${BUILDLINK_DIR}.
#
@@ -902,8 +912,10 @@
_BLNK_CHECK_PATTERNS+= -e "-I${LOCALBASE}/[a-rt-z]"
_BLNK_CHECK_PATTERNS+= -e "-L${LOCALBASE}/[a-rt-z]"
+.if ${X11BASE} != ${LOCALBASE}
_BLNK_CHECK_PATTERNS+= -e "-I${X11BASE}/"
_BLNK_CHECK_PATTERNS+= -e "-L${X11BASE}/"
+.endif
buildlink-check:
@if [ -f ${_BLNK_WRAP_LOG} ]; then \
>Release-Note:
>Audit-Trail:
>Unformatted: