Subject: Re: PREVIOUSTOOLDIR question
To: Luke Mewburn <lukem@NetBSD.org>
From: Martin Weber <Ephaeton@gmx.net>
List: tech-toolchain
Date: 03/17/2004 08:54:00
On Wed, Mar 17, 2004 at 09:45:20AM +1100, Luke Mewburn wrote:
> On Tue, Mar 16, 2004 at 10:38:47PM +0100, Martin Weber wrote:
>   | Hoi tool wizards,
>   | (...)
>   |  # ./build.sh -T /usr/tools -M /space/obj -D /usr/dest distribution
>   | 
>   | ...and the first thing it does is realize that PREVIOUSTOOLDIR (= '')
>   | is not TOOLDIR (= /usr/tools), and begins with building the tools 
>   | again ? (Cleaning stuff, dependall, now it's sitting somewhere in gcc).
> 
> This doesn't occur in the general case.  Do you have any mk.conf
> settings, environment variables, or other build.sh options you're
> using and not displaying, that may affect the build?

I haven't set anything explicitely in the environment, the relevant
(.ifndef BSD_PKG_MK and outside) mk.conf entries boil down to:

TOOLDIR=/usr/tools
USE_INET6=NO
MKOBJDIRS=yes

.ifndef BSD_PKG_MK
USE_XF86_4=yes
.else
# ...
.endif

> What does
> 	# ./build.sh -T /usr/tools -M /space/obj -D /usr/dest params
> show?

===> build.sh command: ./build.sh -T /usr/tools -M /space/obj -D /usr/dest params
===> build.sh started: Wed Mar 17 08:45:48 CET 2004
===> MACHINE:          i386
===> MACHINE_ARCH:     i386
===> TOOLDIR path:     /usr/tools
===> DESTDIR path:     /usr/dest
===> RELEASEDIR path:  /space/obj/usr/src/releasedir
===> makewrapper:      /usr/tools/bin/nbmake-i386
===> Updated /usr/tools/bin/nbmake-i386
(cd /usr/src/etc && /usr/tools/bin/nbmake params)
           BSDOBJDIR = '/usr/obj'
           BSDSRCDIR = '/usr/src'
             BUILDID = (undefined)
             DESTDIR = '/usr/dest'
  EXTERNAL_TOOLCHAIN = (undefined)
     INSTALLWORLDDIR = (undefined)
         KERNARCHDIR = 'arch/i386'
         KERNCONFDIR = '/usr/src/sys/arch/i386/conf'
          KERNOBJDIR = '/space/obj/usr/src/sys/arch/i386/compile'
          KERNSRCDIR = '/usr/src/sys'
             MACHINE = 'i386'
        MACHINE_ARCH = 'i386'
                MAKE = '/usr/tools/bin/nbmake'
            MAKECONF = '/etc/mk.conf'
           MAKEFLAGS = ' -d e -m /usr/src/share/mk HOST_OSTYPE=NetBSD-1.6ZI-i386 MKOBJDIRS=yes USETOOLS=yes _SRC_TOP_=/usr/src _SRC_TOP_OBJ_=/space/obj/usr/src'
          MAKEOBJDIR = (undefined)
    MAKEOBJDIRPREFIX = '/space/obj'
         MAKEVERBOSE = '2'
               MKBFD = 'yes'
          MKCATPAGES = 'yes'
            MKCRYPTO = 'yes'
       MKCRYPTO_IDEA = 'no'
       MKCRYPTO_MDC2 = 'no'
        MKCRYPTO_RC5 = 'no'
               MKCVS = 'yes'
               MKDOC = 'yes'
       MKDYNAMICROOT = 'yes'
               MKGCC = 'yes'
           MKGCCCMDS = 'yes'
               MKGDB = 'yes'
            MKHESIOD = 'yes'
           MKHOSTOBJ = (undefined)
              MKHTML = 'yes'
            MKIEEEFP = 'yes'
              MKINFO = 'yes'
         MKKERBEROS4 = 'yes'
          MKKERBEROS = 'yes'
           MKLINKLIB = 'yes'
              MKLINT = 'yes'
               MKMAN = 'yes'
              MKMANZ = 'no'
               MKNLS = 'yes'
               MKOBJ = 'yes'
           MKOBJDIRS = 'yes'
               MKPIC = 'yes'
        MKPICINSTALL = 'yes'
            MKPICLIB = 'yes'
           MKPOSTFIX = 'yes'
           MKPROFILE = 'yes'
          MKSENDMAIL = 'yes'
             MKSHARE = 'yes'
              MKSKEY = 'yes'
         MKSOFTFLOAT = 'no'
         MKSTATICLIB = 'yes'
          MKUNPRIVED = 'no'
            MKUPDATE = 'no'
              MKUUCP = 'yes'
               MKX11 = 'no'
                MKYP = 'yes'
          NBUILDJOBS = (undefined)
        NETBSDSRCDIR = '/usr/src'
          NOCLEANDIR = (undefined)
       NODISTRIBDIRS = (undefined)
          NOINCLUDES = (undefined)
          OBJMACHINE = (undefined)
          RELEASEDIR = '/space/obj/usr/src/releasedir'
   TOOLCHAIN_MISSING = 'no'
             TOOLDIR = '/usr/tools'
            USETOOLS = 'yes'
      USR_OBJMACHINE = (undefined)
           X11SRCDIR = '/usr/xsrc'
===> Successful make params
===> build.sh started: Wed Mar 17 08:45:48 CET 2004
===> build.sh ended:   Wed Mar 17 08:46:19 CET 2004
===> Summary of results:
	 build.sh command: ./build.sh -T /usr/tools -M /space/obj -D /usr/dest params
	 build.sh started: Wed Mar 17 08:45:48 CET 2004
	 MACHINE:          i386
	 MACHINE_ARCH:     i386
	 TOOLDIR path:     /usr/tools
	 DESTDIR path:     /usr/dest
	 RELEASEDIR path:  /space/obj/usr/src/releasedir
	 makewrapper:      /usr/tools/bin/nbmake-i386
	 Updated /usr/tools/bin/nbmake-i386
	 Successful make params
	 build.sh started: Wed Mar 17 08:45:48 CET 2004
	 build.sh ended:   Wed Mar 17 08:46:19 CET 2004
===> .

> (...)
>   | PREVIOUSTOOLDIR is not documented in BUILDING btw. Nor in UPDATING.
>   | Can the not-source-code-diver please get a short doc on this, please ?
> 
> PREVIOUSTOOLDIR was implemented to prevent the issues where the
> the path to TOOLDIR has changed; in that case the tools should be
> cleaned & rebuilt because there were problems with some tools
> (including groff, if I recall correctly) hard-coding paths under
> TOOLDIR and these programs were breaking when TOOLDIR was changed
> (e.g, when the host uname changes after a kernel version bump
> and you're using the default TOOLDIR).

Ah, I see, thank you for the explanation.

> For some reason your "PREVIOUSTOOLDIR" file isn't getting built
> in the correct location; it should be in the .OBJDIR of src/tools.

I found it in /space/obj/usr/src/tools/PREVIOUSTOOLDIR, containing 
"/usr/tools". I'm not sure if it's from the `tools' build or from
the `distribution' rebuilding it, given the (m)time of it, I'd assume
the latter.

Thanks for your time,

-Martin