diff options
author | joerg <joerg> | 2010-04-24 21:10:29 +0000 |
---|---|---|
committer | joerg <joerg> | 2010-04-24 21:10:29 +0000 |
commit | 4b1d32ef5069b1b52b943568449e8516cbf73421 (patch) | |
tree | 39c8a7b624fe92a7b5a8e8af58c737135f40fe43 /devel | |
parent | a9e2633b87b7546b5c53455a0b2c08e7466fcaaa (diff) | |
download | pkgsrc-4b1d32ef5069b1b52b943568449e8516cbf73421.tar.gz |
Merge for bmake-20100423
Diffstat (limited to 'devel')
-rw-r--r-- | devel/bmake/files/ChangeLog | 35 | ||||
-rw-r--r-- | devel/bmake/files/Makefile.in | 12 | ||||
-rw-r--r-- | devel/bmake/files/bmake.1 | 8 | ||||
-rw-r--r-- | devel/bmake/files/bmake.cat1 | 5 | ||||
-rwxr-xr-x | devel/bmake/files/boot-strap | 104 | ||||
-rw-r--r-- | devel/bmake/files/compat.c | 8 | ||||
-rw-r--r-- | devel/bmake/files/job.c | 30 | ||||
-rw-r--r-- | devel/bmake/files/main.c | 60 | ||||
-rw-r--r-- | devel/bmake/files/make.1 | 8 | ||||
-rw-r--r-- | devel/bmake/files/make.h | 10 | ||||
-rw-r--r-- | devel/bmake/files/unit-tests/Makefile.in | 18 | ||||
-rw-r--r-- | devel/bmake/files/unit-tests/test.exp | 16 | ||||
-rw-r--r-- | devel/bmake/files/var.c | 17 |
13 files changed, 253 insertions, 78 deletions
diff --git a/devel/bmake/files/ChangeLog b/devel/bmake/files/ChangeLog index f32afd9ade0..559a28514f6 100644 --- a/devel/bmake/files/ChangeLog +++ b/devel/bmake/files/ChangeLog @@ -1,3 +1,38 @@ +2010-04-23 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile.in (MAKE_VERSION): bump version to 20100423 + Merge with NetBSD make, pick up + o updated unit tests for Haiku (this time for sure). + * boot-strap: based on patch from joerg + honor --with-default-sys-path better. + * boot-strap: remove mention of --with-prefix-sys-path + +2010-04-22 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile.in (MAKE_VERSION): bump version to 20100422 + * Merge with NetBSD make, pick up + o fix for vfork() on Darwin. + o fix for bogus $TMPDIR. + o set .MAKE.MODE=compat for -B + o set .MAKE.JOBS=max_jobs for -j max_jobs + o allow unit-tests to run without any *.mk + o unit-tests/modmisc be more conservative in dirs presumed to exist. + * boot-strap: ignore /usr/share/mk except on NetBSD. + * unit-tests/Makefile.in: set LANG=C when running unit-tests to + ensure sort(1) behaves as expected. + +2010-04-21 Simon J. Gerraty <sjg@bad.crufty.net> + + * boot-strap: add FindHereOrAbove so we can use -m .../mk + +2010-04-20 Simon J. Gerraty <sjg@bad.crufty.net> + + * Makefile.in (MAKE_VERSION): bump version to 20100420 + * Merge with NetBSD make, pick up + o fix for variable realpath() behavior. + we have to stat(2) the result to be sure. + o fix for .export (all) when nested vars use :sh + 2010-04-14 Simon J. Gerraty <sjg@bad.crufty.net> * Makefile.in (MAKE_VERSION): bump version to 20100414 diff --git a/devel/bmake/files/Makefile.in b/devel/bmake/files/Makefile.in index a0598e91e4e..e3d051693c2 100644 --- a/devel/bmake/files/Makefile.in +++ b/devel/bmake/files/Makefile.in @@ -1,7 +1,7 @@ -# $NetBSD: Makefile.in,v 1.15 2010/04/20 13:37:49 joerg Exp $ +# $NetBSD: Makefile.in,v 1.16 2010/04/24 21:10:29 joerg Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 -# $Id: Makefile.in,v 1.15 2010/04/20 13:37:49 joerg Exp $ +# $Id: Makefile.in,v 1.16 2010/04/24 21:10:29 joerg Exp $ PROG= bmake SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \ @@ -21,7 +21,7 @@ srcdir= @srcdir@ CC?= @CC@ # Base version on src date -MAKE_VERSION= 20100414 +MAKE_VERSION= 20100423 MACHINE=@machine@ MACHINE_ARCH=@machine_arch@ DEFAULT_SYS_PATH = @default_sys_path@ @@ -132,8 +132,4 @@ DPADD+=${LIBUTIL} # A simple unit-test driver to help catch regressions accept test: -.if ${OS} != "SunOS" && empty(OS:MIRIX*) && empty(OS:MAIX*) - cd ${.CURDIR}/unit-tests && ${.MAKE:S,^./,${.CURDIR}/,} TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET} -.else - true -.endif + cd ${.CURDIR}/unit-tests && ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET} diff --git a/devel/bmake/files/bmake.1 b/devel/bmake/files/bmake.1 index 5f8fb6db979..370deb5d22a 100644 --- a/devel/bmake/files/bmake.1 +++ b/devel/bmake/files/bmake.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: bmake.1,v 1.4 2010/04/20 13:37:49 joerg Exp $ +.\" $NetBSD: bmake.1,v 1.5 2010/04/24 21:10:29 joerg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd April 14, 2010 +.Dd April 21, 2010 .Dt MAKE 1 .Os .Sh NAME @@ -659,6 +659,10 @@ from which generated dependencies are read. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . +.It Va .MAKE.JOBS +The argument to the +.Fl j +option. .It Va .MAKE.JOB.PREFIX If .Nm diff --git a/devel/bmake/files/bmake.cat1 b/devel/bmake/files/bmake.cat1 index 4ffbaf0e5cb..4cac6dd3d39 100644 --- a/devel/bmake/files/bmake.cat1 +++ b/devel/bmake/files/bmake.cat1 @@ -401,6 +401,8 @@ VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS _._M_A_K_E_._E_X_P_O_R_T_E_D The list of variables exported by bbmmaakkee. + _._M_A_K_E_._J_O_B_S The argument to the --jj option. + _._M_A_K_E_._J_O_B_._P_R_E_F_I_X If bbmmaakkee is run with _j then output for each target is prefixed with a token `--- target ---' the first part of @@ -1165,3 +1167,6 @@ HHIISSTTOORRYY portability to other platforms. NetBSD 5.0 April 14, 2010 NetBSD 5.0 +======= +NetBSD 5.0_STABLE April 21, 2010 NetBSD 5.0_STABLE +>>>>>>> 1.1.1.5 diff --git a/devel/bmake/files/boot-strap b/devel/bmake/files/boot-strap index db32c6fb932..f349114357f 100755 --- a/devel/bmake/files/boot-strap +++ b/devel/bmake/files/boot-strap @@ -48,15 +48,12 @@ # --with-default-sys-path="syspath" # set an explicit default "syspath" which is where bmake # will look for sys.mk and friends. -# -# --with-prefix-sys-path="syspath" -# prefix the built in default syspath with "syspath" # # AUTHOR: # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: boot-strap,v 1.6 2010/04/20 13:37:49 joerg Exp $ +# $Id: boot-strap,v 1.7 2010/04/24 21:10:29 joerg Exp $ # # @(#) Copyright (c) 2001 Simon J. Gerraty # @@ -104,6 +101,7 @@ source_rc() { } CONFIGURE_ARGS= +MAKESYSPATH= # pick a useful default prefix (for me at least ;-) for prefix in /opt/$HOST_TARGET "$HOME/$HOST_TARGET" /usr/pkg /usr/local "" do @@ -116,23 +114,33 @@ quiet=: source_rc .bmake-boot-strap.rc . "$Mydir/.." "$HOME" +get_optarg() { + expr "x$1" : "x[^=]*=\\(.*\\)" +} + while : do case "$1" in --) shift; break;; --prefix) prefix="$2"; shift;; - --prefix=*) prefix=`IFS="="; set -- "$1"; echo "$2"`;; - --src=*) srcdir=`IFS="="; set -- "$1"; echo "$2"`;; - --with-mksrc=*|--mksrc=*) mksrc=`IFS="="; set -- "$1"; echo "$2"`;; - --share=*) share_dir=`IFS="="; set -- "$1"; echo "$2"`;; + --prefix=*) prefix=`get_optarg "$1"`;; + --src=*) srcdir=`get_optarg "$1"`;; + --with-mksrc=*|--mksrc=*) mksrc=`get_optarg "$1"`;; + --share=*) share_dir=`get_optarg "$1"`;; --share) share_dir="$2"; shift;; + --with-default-sys-path=*) + CONFIGURE_ARGS="$1" + MAKESYSPATH=`get_optarg "$1"`;; + --with-default-sys-path) + CONFIGURE_ARGS="$1 $2" + MAKESYSPATH="$2"; shift;; -s|--src) srcdir="$2"; shift;; -m|--mksrc) mksrc="$2"; shift;; -o|--objdir) objdir="$2"; shift;; -q) quiet=;; -c) source_rc "$2"; shift;; --*) CONFIGURE_ARGS="$CONFIGURE_ARGS $1";; - *=*) eval "$1"; export `IFS="="; set -- "$1"; echo "$1"`;; + *=*) eval "$1"; export `expr "x$1" : "x\\(.[^=]\\)=.*"`;; *) break;; esac shift @@ -164,12 +172,70 @@ GetDir() { done } +FindHereOrAbove() { + ( + _t=-s + while : + do + case "$1" in + -C) cd "$2"; shift; shift;; + -?) _t=$1; shift;; + *) break;; + esac + done + case "$1" in + /*) # we shouldn't be here + [ $_t "$1" ] && echo "$1" + return + ;; + .../*) want=`echo "$1" | sed 's,^.../*,,'`;; + *) want="$1";; + esac + here=`'pwd'` + while : + do + if [ $_t "./$want" ]; then + echo "$here/$want" + return + fi + cd .. + here=`'pwd'` + case "$here" in + /) return;; + esac + done + ) +} + +# is $1 missing from $2 (or PATH) ? +no_path() { + eval "__p=\$${2:-PATH}" + case ":$__p:" in *:"$1":*) return 1;; *) return 0;; esac +} + +# if $1 exists and is not in path, append it +add_path () { + case "$1" in + -?) t=$1; shift;; + *) t=-d;; + esac + case "$2,$1" in + MAKESYSPATH,.../*) ;; + *) [ $t ${1:-.} ] || return;; + esac + no_path $* && eval ${2:-PATH}="$__p${__p:+:}$1" +} + + srcdir=`GetDir /bmake "$srcdir" "$2" "$Mydir" ./bmake* "$Mydir"/../bmake*` [ -d "${srcdir:-/dev/null}" ] || Usage case "$mksrc" in none|-) # we don't want it mksrc= ;; +.../*) # find here or above + mksrc=`FindHereOrAbove -C "$Mydir" -d "$mksrc"` + ;; *) # guess we want mksrc... mksrc=`GetDir /mk "$mksrc" "$3" ./mk* "$srcdir"/mk* "$srcdir"/../mk*` [ -d "${mksrc:-/dev/null}" ] || Usage "Use '-m none' to build without mksrc" @@ -186,6 +252,7 @@ objdir=`'pwd'` ShareDir() { case "/$1" in + /) [ -d /share ] || return;; */$HOST_TARGET) if [ -d "$1/../share" ]; then echo `dirname "$1"`/share @@ -200,22 +267,31 @@ share_dir="${share_dir:-`ShareDir $prefix`}" AddConfigure --prefix= "$prefix" case "$CONFIGURE_ARGS" in -*--with-prefix-sys-path*) ;; # skip -*) AddConfigure --with-default-sys-path= "$share_dir/mk";; +*--with-*-sys-path*) ;; # skip +*) [ "$share_dir" ] && AddConfigure --with-default-sys-path= "$share_dir/mk";; esac if [ "$mksrc" ]; then AddConfigure --with-mksrc= "$mksrc" # not all cc's support this - export CFLAGS_MF= + CFLAGS_MF= CFLAGS_MD= + export CFLAGS_MF CFLAGS_MD fi $srcdir/configure $CONFIGURE_ARGS || exit 1 chmod 755 make-bootstrap.sh || exit 1 ./make-bootstrap.sh || exit 1 -MAKESYSPATH="$share_dir/mk:/usr/share/mk" +if [ -z "$MAKESYSPATH" ]; then + add_path "${share_dir:-...}/mk" MAKESYSPATH + case "$HOST_TARGET" in + netbsd*) add_path /usr/share/mk MAKESYSPATH;; + esac +fi if [ -s "${mksrc:-/dev/null}/install-mk" ]; then sh "${mksrc}/install-mk" "$objdir/mk" - MAKESYSPATH=".../mk:${MAKESYSPATH}" + case "$MAKESYSPATH" in + .../mk*) ;; + *) MAKESYSPATH=".../mk:${MAKESYSPATH}";; + esac fi export MAKESYSPATH ./bmake test || exit 1 diff --git a/devel/bmake/files/compat.c b/devel/bmake/files/compat.c index 0b15689a20b..49effd09a84 100644 --- a/devel/bmake/files/compat.c +++ b/devel/bmake/files/compat.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.6 2010/04/20 13:37:49 joerg Exp $ */ +/* $NetBSD: compat.c,v 1.7 2010/04/24 21:10:29 joerg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: compat.c,v 1.6 2010/04/20 13:37:49 joerg Exp $"; +static char rcsid[] = "$NetBSD: compat.c,v 1.7 2010/04/24 21:10:29 joerg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: compat.c,v 1.6 2010/04/20 13:37:49 joerg Exp $"); +__RCSID("$NetBSD: compat.c,v 1.7 2010/04/24 21:10:29 joerg Exp $"); #endif #endif /* not lint */ #endif @@ -358,7 +358,7 @@ again: /* * Fork and execute the single command. If the fork fails, we abort. */ - cpid = vfork(); + cpid = vFork(); if (cpid < 0) { Fatal("Could not fork"); } diff --git a/devel/bmake/files/job.c b/devel/bmake/files/job.c index b91379f619f..b84c97c12cc 100644 --- a/devel/bmake/files/job.c +++ b/devel/bmake/files/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.9 2010/04/20 13:37:49 joerg Exp $ */ +/* $NetBSD: job.c,v 1.10 2010/04/24 21:10:29 joerg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.9 2010/04/20 13:37:49 joerg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.10 2010/04/24 21:10:29 joerg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.9 2010/04/20 13:37:49 joerg Exp $"); +__RCSID("$NetBSD: job.c,v 1.10 2010/04/24 21:10:29 joerg Exp $"); #endif #endif /* not lint */ #endif @@ -355,8 +355,6 @@ static sigset_t caught_signals; /* Set of signals we handle */ #define KILLPG(pid, sig) killpg((pid), (sig)) #endif -static char *tmpdir; /* directory name, always ending with "/" */ - static void JobChildSig(int); static void JobContinueSig(int); static Job *JobFindPid(int, int); @@ -1315,7 +1313,7 @@ JobExec(Job *job, char **argv) /* Pre-emptively mark job running, pid still zero though */ job->job_state = JOB_ST_RUNNING; - cpid = vfork(); + cpid = vFork(); if (cpid == -1) Punt("Cannot vfork: %s", strerror(errno)); @@ -1569,11 +1567,7 @@ JobStart(GNode *gn, int flags) } JobSigLock(&mask); - tfile = bmake_malloc(strlen(tmpdir) + sizeof(TMPPAT)); - strcpy(tfile, tmpdir); - strcat(tfile, TMPPAT); - if ((tfd = mkstemp(tfile)) == -1) - Punt("Could not create temporary file %s", strerror(errno)); + tfd = mkTempFile(TMPPAT, &tfile); if (!DEBUG(SCRIPT)) (void)eunlink(tfile); JobSigUnlock(&mask); @@ -2136,8 +2130,6 @@ void Job_Init(void) { GNode *begin; /* node for commands to do at the very start */ - const char *p; - size_t len; /* Allocate space for all the job info */ job_table = bmake_malloc(maxJobs * sizeof *job_table); @@ -2150,18 +2142,6 @@ Job_Init(void) lastNode = NULL; - /* set tmpdir, and ensure that it ends with "/" */ - p = getenv("TMPDIR"); - if (p == NULL || *p == '\0') { - p = _PATH_TMP; - } - len = strlen(p); - tmpdir = bmake_malloc(len + 2); - strcpy(tmpdir, p); - if (tmpdir[len - 1] != '/') { - strcat(tmpdir, "/"); - } - if (maxJobs == 1) { /* * If only one job can run at a time, there's no need for a banner, diff --git a/devel/bmake/files/main.c b/devel/bmake/files/main.c index cac8ac30cc5..b480fddf72d 100644 --- a/devel/bmake/files/main.c +++ b/devel/bmake/files/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.7 2010/04/20 13:37:49 joerg Exp $ */ +/* $NetBSD: main.c,v 1.8 2010/04/24 21:10:29 joerg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.7 2010/04/20 13:37:49 joerg Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.8 2010/04/24 21:10:29 joerg Exp $"; #else #include <sys/cdefs.h> #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.7 2010/04/20 13:37:49 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.8 2010/04/24 21:10:29 joerg Exp $"); #endif #endif /* not lint */ #endif @@ -187,6 +187,7 @@ static char curdir[MAXPATHLEN + 1]; /* startup directory */ static char objdir[MAXPATHLEN + 1]; /* where we chdir'ed to */ char *progname; /* the program name */ char *makeDependfile; +pid_t myPid; Boolean forceJobs = FALSE; @@ -396,6 +397,7 @@ rearg: case 'B': compatMake = TRUE; Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL); + Var_Set(MAKE_MODE, "compat", VAR_GLOBAL, 0); break; case 'C': if (chdir(argvalue) == -1) { @@ -511,6 +513,7 @@ rearg: } Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL); Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL); + Var_Set(".MAKE.JOBS", argvalue, VAR_GLOBAL, 0); maxJobTokens = maxJobs; break; case 'k': @@ -873,6 +876,8 @@ main(int argc, char **argv) #endif } + myPid = getpid(); /* remember this for vFork() */ + /* * Just in case MAKEOBJDIR wants us to do something tricky. */ @@ -932,7 +937,7 @@ main(int argc, char **argv) p1 = argv[0]; } else { p1 = realpath(argv[0], mdpath); - if (!p1 || *p1 != '/') { + if (!p1 || *p1 != '/' || stat(p1, &sb) < 0) { p1 = argv[0]; /* realpath failed */ } } @@ -954,7 +959,7 @@ main(int argc, char **argv) ep = "0"; } Var_Set(MAKE_LEVEL, ep, VAR_GLOBAL, 0); - snprintf(tmp, sizeof(tmp), "%u", getpid()); + snprintf(tmp, sizeof(tmp), "%u", myPid); Var_Set(".MAKE.PID", tmp, VAR_GLOBAL, 0); snprintf(tmp, sizeof(tmp), "%u", getppid()); Var_Set(".MAKE.PPID", tmp, VAR_GLOBAL, 0); @@ -1633,7 +1638,7 @@ Cmd_Exec(const char *cmd, const char **errnum) /* * Fork */ - switch (cpid = vfork()) { + switch (cpid = vFork()) { case 0: /* * Close input side of pipe @@ -1996,3 +2001,46 @@ Main_ExportMAKEFLAGS(Boolean first) #endif } } + +/* + * Create and open a temp file using "pattern". + * If "fnamep" is provided set it to a copy of the filename created. + * Otherwise unlink the file once open. + */ +int +mkTempFile(const char *pattern, char **fnamep) +{ + static char *tmpdir = NULL; + char tfile[MAXPATHLEN]; + int fd; + + if (!pattern) + pattern = TMPPAT; + + if (!tmpdir) { + struct stat st; + + /* + * Honor $TMPDIR but only if it is valid. + * Ensure it ends with /. + */ + tmpdir = Var_Subst(NULL, "${TMPDIR:tA:U" _PATH_TMP "}/", VAR_GLOBAL, 0); + if (stat(tmpdir, &st) < 0 || !S_ISDIR(st.st_mode)) { + free(tmpdir); + tmpdir = bmake_strdup(_PATH_TMP); + } + } + if (pattern[0] == '/') { + snprintf(tfile, sizeof(tfile), "%s", pattern); + } else { + snprintf(tfile, sizeof(tfile), "%s%s", tmpdir, pattern); + } + if ((fd = mkstemp(tfile)) < 0) + Punt("Could not create temporary file %s: %s", tfile, strerror(errno)); + if (fnamep) { + *fnamep = bmake_strdup(tfile); + } else { + unlink(tfile); /* we just want the descriptor */ + } + return fd; +} diff --git a/devel/bmake/files/make.1 b/devel/bmake/files/make.1 index 79017efa55f..fb1db46cce0 100644 --- a/devel/bmake/files/make.1 +++ b/devel/bmake/files/make.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.5 2010/04/20 13:37:49 joerg Exp $ +.\" $NetBSD: make.1,v 1.6 2010/04/24 21:10:29 joerg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd April 14, 2010 +.Dd April 21, 2010 .Dt MAKE 1 .Os .Sh NAME @@ -659,6 +659,10 @@ from which generated dependencies are read. .It Va .MAKE.EXPORTED The list of variables exported by .Nm . +.It Va .MAKE.JOBS +The argument to the +.Fl j +option. .It Va .MAKE.JOB.PREFIX If .Nm diff --git a/devel/bmake/files/make.h b/devel/bmake/files/make.h index 182724b7a7f..f2878037a9a 100644 --- a/devel/bmake/files/make.h +++ b/devel/bmake/files/make.h @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.4 2010/04/20 13:37:49 joerg Exp $ */ +/* $NetBSD: make.h,v 1.5 2010/04/24 21:10:29 joerg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -411,6 +411,13 @@ extern Lst defIncPath; /* The default include path. */ extern char *progname; /* The program name */ extern char *makeDependfile; /* .depend */ +/* + * We cannot vfork() in a child of vfork(). + * Most systems do not enforce this but some do. + */ +#define vFork() ((getpid() == myPid) ? vfork() : fork()) +extern pid_t myPid; + #define MAKEFLAGS ".MAKEFLAGS" #define MAKEOVERRIDES ".MAKEOVERRIDES" #define MAKE_JOB_PREFIX ".MAKE.JOB.PREFIX" /* prefix for job target output */ @@ -466,6 +473,7 @@ void Check_Cwd(const char **); void PrintOnError(GNode *, const char *); void Main_ExportMAKEFLAGS(Boolean); Boolean Main_SetObjdir(const char *); +int mkTempFile(const char *, char **); #ifdef __GNUC__ #define UNCONST(ptr) ({ \ diff --git a/devel/bmake/files/unit-tests/Makefile.in b/devel/bmake/files/unit-tests/Makefile.in index dc39670524c..488cd4d68f8 100644 --- a/devel/bmake/files/unit-tests/Makefile.in +++ b/devel/bmake/files/unit-tests/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.5 2010/04/20 13:37:49 joerg Exp $ +# $Id: Makefile.in,v 1.6 2010/04/24 21:10:29 joerg Exp $ # -# $NetBSD: Makefile.in,v 1.5 2010/04/20 13:37:49 joerg Exp $ +# $NetBSD: Makefile.in,v 1.6 2010/04/24 21:10:29 joerg Exp $ # # Unit tests for make(1) # The main targets are: @@ -57,11 +57,19 @@ ${SUBFILES}: clean: rm -f *.out *.fail *.core -.include <bsd.obj.mk> +.-include <bsd.obj.mk> TEST_MAKE?= ${.MAKE} -TOOL_SED ?= sed -TOOL_TR ?= tr +TOOL_SED?= sed +TOOL_TR?= tr + +# ensure consistent results from sort(1) +LANG= C +.export LANG + +# ensure consistent results from sort(1) +LANG= C +.export LANG # The driver. # We always pretend .MAKE was called 'make' diff --git a/devel/bmake/files/unit-tests/test.exp b/devel/bmake/files/unit-tests/test.exp index 660e28982ca..347bb9f2409 100644 --- a/devel/bmake/files/unit-tests/test.exp +++ b/devel/bmake/files/unit-tests/test.exp @@ -33,12 +33,14 @@ UT_FU=fubar UT_TEST=export UT_ZOO=hoopie UT_ALL=even this gets exported +UT_BADDIR=unit-tests UT_DOLLAR=This is $UT_FU UT_F=fine UT_FOO=foobar is fubar UT_FU=fubar UT_NO=all UT_OK=good +UT_OKDIR=unit-tests UT_TEST=export-all UT_ZOO=hoopie At first, I am @@ -110,14 +112,14 @@ LIB=e X_LIBS:M${LIB${LIB:tu}} is "/tmp/libe.a" LIB=e X_LIBS:M*/lib${LIB}.a is "/tmp/libe.a" LIB=e X_LIBS:M*/lib${LIB}.a:tu is "/TMP/LIBE.A" Mscanner=OK -path=':/bin:/usr/bin::/sbin:/usr/sbin:.:/home/user/bin:.' -path='/bin:/usr/bin:/sbin:/usr/sbin:/home/user/bin' -path='/bin:/usr/bin:/sbin:/usr/sbin:/homes/user/bin' -path='/bin':'/usr/bin':'/sbin':'/usr/sbin':'/home/user/bin' -path='/bin':'/usr/bin':'/sbin':'/usr/sbin':'/homes/user/bin' +path=':/bin:/tmp::/:.:/no/such/dir:.' +path='/bin:/tmp:/:/no/such/dir' +path='/bin:/tmp:/:/no/such/dir' +path='/bin':'/tmp':'/':'/no/such/dir' +path='/bin':'/tmp':'/':'/no/such/dir' path_/usr/xbin=/opt/xbin/ -paths=/bin /usr/bin /sbin /usr/sbin /homes/user/bin /opt/xbin -PATHS=/BIN /USR/BIN /SBIN /USR/SBIN /HOMES/USER/BIN /OPT/XBIN +paths=/bin /tmp / /no/such/dir /opt/xbin +PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN LIST = one two three four five six seven eight nine ten LIST:O = eight five four nine one seven six ten three two LIST:Ox = Ok diff --git a/devel/bmake/files/var.c b/devel/bmake/files/var.c index 54150fd6fd1..8b26a152128 100644 --- a/devel/bmake/files/var.c +++ b/devel/bmake/files/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.6 2010/04/20 13:37:49 joerg Exp $ */ +/* $NetBSD: var.c,v 1.7 2010/04/24 21:10:29 joerg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.6 2010/04/20 13:37:49 joerg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.7 2010/04/24 21:10:29 joerg Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.6 2010/04/20 13:37:49 joerg Exp $"); +__RCSID("$NetBSD: var.c,v 1.7 2010/04/24 21:10:29 joerg Exp $"); #endif #endif /* not lint */ #endif @@ -123,6 +123,7 @@ __RCSID("$NetBSD: var.c,v 1.6 2010/04/20 13:37:49 joerg Exp $"); * XXX: There's a lot of duplication in these functions. */ +#include <sys/stat.h> #ifndef NO_REGEX #include <sys/types.h> #include <regex.h> @@ -590,6 +591,13 @@ Var_Export1(const char *name, int parent) v->flags |= (VAR_EXPORTED|VAR_REEXPORT); return 1; } + if (v->flags & VAR_IN_USE) { + /* + * We recursed while exporting in a child. + * This isn't going to end well, just skip it. + */ + return 0; + } n = snprintf(tmp, sizeof(tmp), "${%s}", name); if (n < (int)sizeof(tmp)) { val = Var_Subst(NULL, tmp, VAR_GLOBAL, 0); @@ -1870,6 +1878,7 @@ VarRealpath(GNode *ctx __unused, Var_Parse_State *vpstate, char *word, Boolean addSpace, Buffer *buf, void *patternp __unused) { + struct stat st; char rbuf[MAXPATHLEN]; char *rp; @@ -1878,7 +1887,7 @@ VarRealpath(GNode *ctx __unused, Var_Parse_State *vpstate, } addSpace = TRUE; rp = realpath(word, rbuf); - if (rp && *rp == '/') + if (rp && *rp == '/' && stat(rp, &st) == 0) word = rp; Buf_AddBytes(buf, strlen(word), word); |