On Fri, Mar 08, 2002 at 11:13:46AM -0800, Luigi Rizzo wrote:
> The attached portion of the 1.100 -> 1.101 patch to src/share/mk/bsd.lib.mk
> (and a similar one in bsd.prog.mk 1.103 -> 1.104) broke cross builds
> of PicoBSD, specifically preventing the cross-environment header
> files to be found when building libraries/programs. You can reproduce
> this by doing
> 
>       picobsd --src HEAD/src --init -n -v
> 
> on a recently cvsupped HEAD tree.
> 
> I wonder, how does a "make world" get around this problem
> (so i can try to reproduce the 'fix' in the picobsd script) ?
> 
> @@ -37,11 +37,6 @@ SHLIB_NAME?= lib${LIB}.so.${SHLIB_MAJOR}
>  .endif
>  .endif
>  
> -.if defined(DESTDIR) && !defined(BOOTSTRAPPING)
> -CFLAGS+= -I${DESTDIR}/usr/include
> -CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
> -.endif
> -
>  .if defined(DEBUG_FLAGS)
>  CFLAGS+= ${DEBUG_FLAGS}
>  .endif

DESTDIR has been abused for build purposes for a long time while, by design,
it should have only affected the installation.  `buildworld' builds special
(cross) versions of compiler and tools that look things up under TOOLS_PREFIX.

As indicated in the commitlog for a relevant change to Makefile.inc1,v 1.240:

: (Attempt to move the "-nostdinc -I..." part of CFLAGS into the new CINCLUDES
: (modeled after a similar CXXINCLUDES) eventually failed because hard-coding
: ${WORLDTMP}/usr/include to be the first in the include list does not always
: work, e.g. lib/libbind.)

Because building of special versions of compiler and tools may not be easy
in picobsd, the following patch works around the problem in libbind and
should make things happy again:

Index: release/picobsd/build/picobsd
===================================================================
RCS file: /home/ncvs/src/release/picobsd/build/picobsd,v
retrieving revision 1.22
diff -u -p -r1.22 picobsd
--- release/picobsd/build/picobsd       8 Mar 2002 02:24:21 -0000       1.22
+++ release/picobsd/build/picobsd       11 Mar 2002 12:29:38 -0000
@@ -151,15 +151,15 @@ create_includes_and_libraries() {
     mkdir -p ${l_usrtree}/share/misc   # a few things go here
     mkdir -p ${l_usrtree}/lib          # libraries
     mkdir -p ${l_usrtree}/sbin         # some binaries
-    (cd ${SRC}; INCOWN=`id -un`  BINOWN=`id -un` DESTDIR=${SRC}/.. \
+    (cd ${SRC}; INCOWN=`id -un`  BINOWN=`id -un` DESTDIR=${l_usrtree}/.. \
                make -m ${SRC}/share/mk includes ) || fail $? includes
-    # libraries already have the include path in the Makefile
-    CFLAGS="-nostdinc" ; export CFLAGS
+    # Pick up the correct headers for libraries.
+    CFLAGS="-nostdinc -I${l_usrtree}/include" ; export CFLAGS
 
     (cd ${SRC}
        # $e is the invocation of make with correct environment
        e="MAKEOBJDIRPREFIX=${l_objtree}/picobsd/libraries \
-           INCOWN=`id -un` BINOWN=`id -un` DESTDIR=${SRC}/.. \
+           INCOWN=`id -un` BINOWN=`id -un` DESTDIR=${l_usrtree}/.. \
            make -m ${SRC}/share/mk \
                -DNOHTML -DNOINFO -DNOMAN -DNOSHARE -DNOFSCHG "
        # need to 'make obj' in a few places. This is very
Index: lib/libbind/Makefile
===================================================================
RCS file: /home/ncvs/src/lib/libbind/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- lib/libbind/Makefile        30 Nov 1999 04:40:54 -0000      1.5
+++ lib/libbind/Makefile        11 Mar 2002 12:29:38 -0000
@@ -2,9 +2,6 @@
 
 BIND_DIR=${.CURDIR}/../../contrib/bind
 
-# contrib/bind/include/* must not override any real system includes
-CFLAGS+= -I${BIND_DIR}/port/freebsd/include -I${BIND_DIR}/include
-
 LIB=   bind
 WANT_IRS=      for now
 
@@ -86,3 +83,6 @@ NOPIC=                        true
 INTERNALSTATICLIB=     true
 
 .include <bsd.lib.mk>
+
+# XXX contrib/bind/include/* must not override any real system includes
+CFLAGS:= -I${BIND_DIR}/port/freebsd/include -I${BIND_DIR}/include ${CFLAGS}


Cheers,
-- 
Ruslan Ermilov          Sysadmin and DBA,
[EMAIL PROTECTED]           Sunbay Software AG,
[EMAIL PROTECTED]          FreeBSD committer,
+380.652.512.251        Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to