Subject: Re: bmake and bootstrap and own.mk and MKCONF
To: Jeremy C. Reed <reed@reedmedia.net>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-pkg
Date: 10/08/2005 11:56:33
On Thu, 6 Oct 2005 15:04:44 -0700 (PDT), "Jeremy C. Reed" writes:
>Please use http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/bootstrap/bmake/ to
>see the commit messages for information about most of these changes.
ok I see why the IFS change was made, but I'd like to investigate
that further. Does anyone have access to a unixware machine?
I'd like to see the output of :
set -x
X=one:two:three
echo got `IFS=:; echo $X`; echo
echo got `(IFS=:; echo $X)`; echo
x=`IFS=:; echo $X`
echo got $x; echo
>@@ -32,7 +32,8 @@ esac
> # Great! Solaris keeps moving arch(1)
> # we need this here, and it is not always available...
> Which() {
>- for d in `IFS=:; echo ${2:-$PATH}`
>+ pathcomponents=`IFS=:; echo ${2:-$PATH}`
>+ for d in ${pathcomponents}
> do
> test -x $d/$1 && { echo $d/$1; break; }
> done
I haven't done the above. I'd rather use `()` if that solves the
problem.
>diff -pruN tmp/bmake/makefile.boot.in devel/bmake/files/makefile.boot.in
>--- tmp/bmake/makefile.boot.in 2004-05-08 10:56:10.000000000 -0700
>+++ devel/bmake/files/makefile.boot.in 2005-09-17 14:26:30.000000000 -0700
>@@ -22,7 +22,7 @@ OBJ=arch.o buf.o compat.o cond.o dir.o f
>
> BMAKE_ENV= CC="$(CC)" MAKEFLAGS= MAKESYSPATH=`pwd`/mk:${MKSRC}:${MK}:${DEFAU
>LT_MAKESYSPATH}
>
>-bootstrap: bmake.boot .mk.done
>+bootstrap: bmake.boot
> ${BMAKE_ENV} ./bmake.boot -f Makefile
> ${BMAKE_ENV} `pwd`/bmake -f Makefile test
I haven't done this one either as this would break non-pkgsrc
bootstrap. I've made a different change which may help you out (see
below), but if it doesn't I don't see any problem with leaving this as
a pkgsrc specific patch - doesn't affect the binary which is built.
>diff -pruN tmp/bmake/trace.h devel/bmake/files/trace.h
>--- tmp/bmake/trace.h 2001-03-05 13:02:25.000000000 -0800
>+++ devel/bmake/files/trace.h 2005-09-16 16:44:59.000000000 -0700
>@@ -47,7 +47,7 @@ typedef enum {
> MAKEERROR,
> JOBSTART,
> JOBEND,
>- MAKEINTR,
>+ MAKEINTR
> } TrEvent;
I plan to commit this one to make as well.
>diff -pruN tmp/bmake/var.c devel/bmake/files/var.c
>--- tmp/bmake/var.c 2005-09-03 15:15:09.000000000 -0700
>+++ devel/bmake/files/var.c 2005-09-16 16:48:52.000000000 -0700
>@@ -125,7 +125,16 @@ __RCSID("$NetBSD: var.c,v 1.100 2005/08/
>
> #ifndef NO_REGEX
> #include <sys/types.h>
>+#include <nbcompat/nbconfig.h>
>+/* bmake supplies its own <sys/cdefs.h> so this header is always present. */
>+#ifndef HAVE_SYS_CDEFS_H
>+#define HAVE_SYS_CDEFS_H 1
>+#endif
>+#if HAVE_REGEX_H
> #include <regex.h>
>+#else
>+#include <nbcompat/regex.h>
>+#endif
I haven't done this one either as it is netbsd/pkgsrc? specific.
Again I don't think there should be a problem with keeping this a
pkgsrc specific patch.
--sjg
Just as a heads-up, these are the changes I currently have in mind,
I'm only listing the ones related to yours which are different.
I've tested boot-strap (not pkgsrc, just the bare bmake distribution)
on NetBSD, FreeBSD, SunOS and Linux
Index: Makefile.in
===================================================================
RCS file: /h/cvsroot/bmake/Makefile.in,v
retrieving revision 1.61
diff -u -p -r1.61 Makefile.in
--- Makefile.in 3 Sep 2005 23:06:32 -0000 1.61
+++ Makefile.in 8 Oct 2005 18:22:39 -0000
@@ -22,7 +22,7 @@ srcdir= @srcdir@
CC?= @CC@
# Base version on src date
-BMAKE_VERSION= 20050901
+BMAKE_VERSION= 20051001
# knowing when it was built is also handy
BUILD_DATE!= date +%Y%m%d
MAKE_VERSION:= bmake-${BMAKE_VERSION} build-${BUILD_DATE}
@@ -32,7 +32,9 @@ MACHINE_ARCH=@machine_arch@
CFLAGS+= -I. -I${srcdir} @DEFS@ @CPPFLAGS@ ${XDEFS} -DMAKE_NATIVE
CFLAGS+= ${CFLAGS_${.TARGET:T}}
CFLAGS_main.o= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
+LDFLAFS= @LDFLAGS@
LIBOBJS= @LIBOBJS@
+LDADD= @LDADD@
.PATH: ${srcdir}
.PATH: ${srcdir}/lst.lib
@@ -40,6 +42,9 @@ LIBOBJS= @LIBOBJS@
OS!= uname -s
ARCH!= uname -p 2>/dev/null || uname -m
+# list of OS's which are derrived from BSD4.4
+isBSD44= NetBSD FreeBSD OpenBSD DragonFly
+
.if ${OS} == "NetBSD"
# Don't set these for anyone else since we don't know what the effect may be.
# On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
@@ -51,7 +56,7 @@ SUBDIR= PSD.doc
.endif
.endif
-.if (${OS} != "NetBSD" && ${OS} != "FreeBSD" && ${OS} != "OpenBSD")
+.if empty(isBSD44:M${OS})
# XXX not sure if we still want this given that configure
# lets us force or not the definition of MACHINE.
CFLAGS_main.o+= "-DFORCE_MACHINE=\"${MACHINE}\""
@@ -105,7 +110,7 @@ ${MAN}: make.1
BINDIR= ${prefix}/bin
MANDIR= ${prefix}/man
-.if ${OS} == "FreeBSD" || ${OS} == "OpenBSD"
+.if "${OS}" != "NetBSD" && !empty(isBSD44:M${OS})
# freebsd's bsd.man.mk works differently
MAN1=${MAN}
MANDIR= ${prefix}/man/man
Index: configure.in
===================================================================
RCS file: /h/cvsroot/bmake/configure.in,v
retrieving revision 1.23
diff -u -p -r1.23 configure.in
--- configure.in 28 Sep 2003 20:47:50 -0000 1.23
+++ configure.in 8 Oct 2005 18:28:57 -0000
@@ -282,6 +282,7 @@ AC_SUBST(force_machine)
AC_SUBST(machine_arch)
AC_SUBST(mksrc)
AC_SUBST(INSTALL)
+AC_SUBST(LDADD)
AC_SUBST(GCC)
AC_SUBST(diff_u)
AC_OUTPUT(Makefile makefile.boot lst.lib/makefile.boot unit-tests/Makefile)
Index: machine.sh
===================================================================
RCS file: /h/cvsroot/bmake/machine.sh,v
retrieving revision 1.14
diff -u -p -r1.14 machine.sh
--- machine.sh 11 Jul 2003 06:16:35 -0000 1.14
+++ machine.sh 8 Oct 2005 18:20:31 -0000
@@ -58,6 +58,14 @@ SunOS)
HP-UX)
MACHINE_ARCH=`IFS="/-."; set $machine; echo $1`
;;
+Interix)
+ MACHINE=i386
+ MACHINE_ARCH=i386
+ ;;
+UnixWare)
+ OSREL=`uname -v`
+ OSMAJOR=`IFS=.; set $OSREL; echo $1`
+ ;;
Linux)
case "$machine" in
i?86) MACHINE_ARCH=i386;;# does anyone really care about 686 vs 586?
Index: main.c
===================================================================
RCS file: /h/cvsroot/bmake/main.c,v
retrieving revision 1.41
diff -u -p -r1.41 main.c
--- main.c 3 Sep 2005 22:13:17 -0000 1.41
+++ main.c 8 Oct 2005 16:40:29 -0000
@@ -1136,7 +1136,16 @@ ReadMakefile(ClientData p, ClientData q
Parse_File("(stdin)", stdin);
Var_Set("MAKEFILE", "", VAR_GLOBAL, 0);
} else {
+#ifdef __INTERIX
+ /*
+ * XXX Hack from tv:
+ * This system has broken filesystem support - can't
+ * always distinguish b/w [Mm]akefile.
+ */
+ setMAKEFILE = FALSE;
+#else
setMAKEFILE = strcmp(fname, ".depend");
+#endif
/* if we've chdir'd, rebuild the path name */
if (strcmp(curdir, objdir) && *fname != '/') {
Index: makefile.boot.in
===================================================================
RCS file: /h/cvsroot/bmake/makefile.boot.in,v
retrieving revision 1.26
diff -u -p -r1.26 makefile.boot.in
--- makefile.boot.in 8 May 2004 17:55:31 -0000 1.26
+++ makefile.boot.in 8 Oct 2005 18:28:10 -0000
@@ -33,14 +33,14 @@ bmake: bmake.boot
bmake.boot: ${OBJ}
(cd lst.lib; $(MAKE) -f makefile.boot CC="$(CC)" CFLAGS="-I.. -I../${srcdir} -I${srcdir} ${CFLAGS}" )
- ${CC} *.o lst.lib/*.o -o $@ @LIBS@
+ ${CC} *.o lst.lib/*.o -o $@ @LDFLAGS@ @LIBS@
rm -f *.[ado] */*.[ado]
.mk.done:
@if test -s ${MKSRC}/install-mk; then \
sh ${MKSRC}/install-mk -v -m 644 `pwd`/mk ${USE_OS}; \
- elif test ! -s /usr/share/mk/sys.mk; then \
+ elif test ! -s /usr/share/mk/sys.mk -a ! -s ${MK}/sys.mk; then \
echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false; \
fi
@touch $@