Fix a problem with MAKE_VERSION being undefined on case-insentive filesystems. On case-insensitive filesystems such as MacOS, two files (Makefile and makefile, which is created by configure from makefile.in) collide. Only the former defines MAKE_VERSION, but it is replaced by the latter. Consequently, MAKE_VERSION is defined as an empty string on these systems. This patch is the result of a discussion on tech-pkg (see the thread following http://mail-index.netbsd.org/tech-pkg/2017/08/13/msg018629.html) and is based upon code incorporated into bmake v20170812.diff -r1.7 -r1.8 pkgsrc/devel/bmake/files/FILES
(brook)
@@ -1,20 +1,21 @@ | @@ -1,20 +1,21 @@ | |||
1 | ChangeLog | 1 | ChangeLog | |
2 | FILES | 2 | FILES | |
3 | Makefile | 3 | Makefile | |
4 | Makefile.config.in | 4 | Makefile.config.in | |
5 | PSD.doc/Makefile | 5 | PSD.doc/Makefile | |
6 | PSD.doc/tutorial.ms | 6 | PSD.doc/tutorial.ms | |
7 | README | 7 | README | |
8 | VERSION | |||
8 | aclocal.m4 | 9 | aclocal.m4 | |
9 | arch.c | 10 | arch.c | |
10 | bmake.1 | 11 | bmake.1 | |
11 | bmake.cat1 | 12 | bmake.cat1 | |
12 | boot-strap | 13 | boot-strap | |
13 | bsd.after-import.mk | 14 | bsd.after-import.mk | |
14 | buf.c | 15 | buf.c | |
15 | buf.h | 16 | buf.h | |
16 | compat.c | 17 | compat.c | |
17 | cond.c | 18 | cond.c | |
18 | config.h.in | 19 | config.h.in | |
19 | configure | 20 | configure | |
20 | configure.in | 21 | configure.in |
@@ -1,17 +1,14 @@ | @@ -1,17 +1,14 @@ | |||
1 | # $Id: Makefile,v 1.2 2015/05/19 22:01:19 joerg Exp $ | 1 | # $Id: Makefile,v 1.3 2017/08/15 15:54:06 brook Exp $ | |
2 | ||||
3 | # Base version on src date | |||
4 | MAKE_VERSION= 20150505 | |||
5 | 2 | |||
6 | PROG= bmake | 3 | PROG= bmake | |
7 | 4 | |||
8 | SRCS= \ | 5 | SRCS= \ | |
9 | arch.c \ | 6 | arch.c \ | |
10 | buf.c \ | 7 | buf.c \ | |
11 | compat.c \ | 8 | compat.c \ | |
12 | cond.c \ | 9 | cond.c \ | |
13 | dir.c \ | 10 | dir.c \ | |
14 | for.c \ | 11 | for.c \ | |
15 | hash.c \ | 12 | hash.c \ | |
16 | job.c \ | 13 | job.c \ | |
17 | main.c \ | 14 | main.c \ | |
@@ -47,26 +44,28 @@ SRCS+= \ | @@ -47,26 +44,28 @@ SRCS+= \ | |||
47 | lstInit.c \ | 44 | lstInit.c \ | |
48 | lstInsert.c \ | 45 | lstInsert.c \ | |
49 | lstIsAtEnd.c \ | 46 | lstIsAtEnd.c \ | |
50 | lstIsEmpty.c \ | 47 | lstIsEmpty.c \ | |
51 | lstLast.c \ | 48 | lstLast.c \ | |
52 | lstMember.c \ | 49 | lstMember.c \ | |
53 | lstNext.c \ | 50 | lstNext.c \ | |
54 | lstOpen.c \ | 51 | lstOpen.c \ | |
55 | lstPrev.c \ | 52 | lstPrev.c \ | |
56 | lstRemove.c \ | 53 | lstRemove.c \ | |
57 | lstReplace.c \ | 54 | lstReplace.c \ | |
58 | lstSucc.c | 55 | lstSucc.c | |
59 | 56 | |||
57 | .-include "VERSION" | |||
58 | ||||
60 | # this file gets generated by configure | 59 | # this file gets generated by configure | |
61 | .-include "Makefile.config" | 60 | .-include "Makefile.config" | |
62 | 61 | |||
63 | .if !empty(LIBOBJS) | 62 | .if !empty(LIBOBJS) | |
64 | SRCS+= ${LIBOBJS:T:.o=.c} | 63 | SRCS+= ${LIBOBJS:T:.o=.c} | |
65 | .endif | 64 | .endif | |
66 | 65 | |||
67 | # just in case | 66 | # just in case | |
68 | prefix?= /usr | 67 | prefix?= /usr | |
69 | srcdir?= ${.CURDIR} | 68 | srcdir?= ${.CURDIR} | |
70 | 69 | |||
71 | DEFAULT_SYS_PATH?= ${prefix}/share/mk | 70 | DEFAULT_SYS_PATH?= ${prefix}/share/mk | |
72 | 71 |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $Id: bsd.after-import.mk,v 1.2 2015/05/19 22:01:19 joerg Exp $ | 1 | # $Id: bsd.after-import.mk,v 1.3 2017/08/15 15:54:06 brook Exp $ | |
2 | 2 | |||
3 | # This makefile is for use when integrating bmake into a BSD build | 3 | # This makefile is for use when integrating bmake into a BSD build | |
4 | # system. Use this makefile after importing bmake. | 4 | # system. Use this makefile after importing bmake. | |
5 | # It will bootstrap the new version, | 5 | # It will bootstrap the new version, | |
6 | # capture the generated files we need, and add an after-import | 6 | # capture the generated files we need, and add an after-import | |
7 | # target to allow the process to be easily repeated. | 7 | # target to allow the process to be easily repeated. | |
8 | 8 | |||
9 | # The goal is to allow the benefits of autoconf without | 9 | # The goal is to allow the benefits of autoconf without | |
10 | # the overhead of running configure. | 10 | # the overhead of running configure. | |
11 | 11 | |||
12 | all: _makefile | 12 | all: _makefile | |
13 | all: after-import | 13 | all: after-import | |
14 | 14 | |||
@@ -46,26 +46,27 @@ BOOTSTRAP_ARGS = \ | @@ -46,26 +46,27 @@ BOOTSTRAP_ARGS = \ | |||
46 | --share /usr/share | 46 | --share /usr/share | |
47 | 47 | |||
48 | .if !empty(DEFAULT_SYS_PATH) | 48 | .if !empty(DEFAULT_SYS_PATH) | |
49 | BOOTSTRAP_ARGS += --with-default-sys-path='${DEFAULT_SYS_PATH}' | 49 | BOOTSTRAP_ARGS += --with-default-sys-path='${DEFAULT_SYS_PATH}' | |
50 | .endif | 50 | .endif | |
51 | 51 | |||
52 | # run boot-strap with minimal influence | 52 | # run boot-strap with minimal influence | |
53 | bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE} | 53 | bootstrap: ${BMAKE_SRC}/boot-strap ${MAKEFILE} | |
54 | HOME=/ ${BMAKE_SRC}/boot-strap -o ${HOST_OS} ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS} | 54 | HOME=/ ${BMAKE_SRC}/boot-strap -o ${HOST_OS} ${BOOTSTRAP_ARGS} ${BOOTSTRAP_XTRAS} | |
55 | touch ${.TARGET} | 55 | touch ${.TARGET} | |
56 | 56 | |||
57 | # Makefiles need a little more tweaking than say config.h | 57 | # Makefiles need a little more tweaking than say config.h | |
58 | MAKEFILE_SED = sed -e '/^MACHINE/d' \ | 58 | MAKEFILE_SED = sed -e '/^MACHINE/d' \ | |
59 | -e '/include.*VERSION/d' \ | |||
59 | -e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \ | 60 | -e '/^PROG/ { s,=,?=,;s,bmake,$${.CURDIR:T},; }' \ | |
60 | -e 's,^.-include,.sinclude,' \ | 61 | -e 's,^.-include,.sinclude,' \ | |
61 | -e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \ | 62 | -e '/^\..*include *</ { s,<,<bsd.,;/autoconf/d; }' \ | |
62 | -e 's,${SRCTOP},$${SRCTOP},g' | 63 | -e 's,${SRCTOP},$${SRCTOP},g' | |
63 | 64 | |||
64 | # These are the simple files we want to capture | 65 | # These are the simple files we want to capture | |
65 | configured_files= config.h Makefile.config unit-tests/Makefile | 66 | configured_files= config.h Makefile.config unit-tests/Makefile | |
66 | 67 | |||
67 | after-import: bootstrap ${MAKEFILE} | 68 | after-import: bootstrap ${MAKEFILE} | |
68 | .for f in ${configured_files:M*.[ch]} | 69 | .for f in ${configured_files:M*.[ch]} | |
69 | @echo Capturing $f | 70 | @echo Capturing $f | |
70 | @mkdir -p ${${.CURDIR}/$f:L:H} | 71 | @mkdir -p ${${.CURDIR}/$f:L:H} | |
71 | @(echo '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f | 72 | @(echo '/* $$${HOST_OS}$$ */'; cat ${HOST_OS}/$f) > ${.CURDIR}/$f |
@@ -1,15 +1,17 @@ | @@ -1,15 +1,17 @@ | |||
1 | # things set by configure | 1 | # things set by configure | |
2 | 2 | |||
3 | _MAKE_VERSION=@_MAKE_VERSION@ | |||
4 | ||||
3 | prefix= @prefix@ | 5 | prefix= @prefix@ | |
4 | srcdir= @srcdir@ | 6 | srcdir= @srcdir@ | |
5 | CC?= @CC@ | 7 | CC?= @CC@ | |
6 | MACHINE= @machine@ | 8 | MACHINE= @machine@ | |
7 | MACHINE_ARCH= @machine_arch@ | 9 | MACHINE_ARCH= @machine_arch@ | |
8 | DEFAULT_SYS_PATH= @default_sys_path@ | 10 | DEFAULT_SYS_PATH= @default_sys_path@ | |
9 | 11 | |||
10 | CPPFLAGS+= @CPPFLAGS@ | 12 | CPPFLAGS+= @CPPFLAGS@ | |
11 | CFLAGS+= ${CPPFLAGS} @DEFS@ | 13 | CFLAGS+= ${CPPFLAGS} @DEFS@ | |
12 | LDFLAGS= @LDFLAGS@ | 14 | LDFLAGS= @LDFLAGS@ | |
13 | LIBOBJS= @LIBOBJS@ | 15 | LIBOBJS= @LIBOBJS@ | |
14 | LDADD= @LIBS@ | 16 | LDADD= @LIBS@ | |
15 | USE_META= @use_meta@ | 17 | USE_META= @use_meta@ |
# keep this compatible with sh and make
_MAKE_VERSION=20150505
@@ -581,26 +581,27 @@ ac_includes_default="\ | @@ -581,26 +581,27 @@ ac_includes_default="\ | |||
581 | # include <strings.h> | 581 | # include <strings.h> | |
582 | #endif | 582 | #endif | |
583 | #ifdef HAVE_INTTYPES_H | 583 | #ifdef HAVE_INTTYPES_H | |
584 | # include <inttypes.h> | 584 | # include <inttypes.h> | |
585 | #endif | 585 | #endif | |
586 | #ifdef HAVE_STDINT_H | 586 | #ifdef HAVE_STDINT_H | |
587 | # include <stdint.h> | 587 | # include <stdint.h> | |
588 | #endif | 588 | #endif | |
589 | #ifdef HAVE_UNISTD_H | 589 | #ifdef HAVE_UNISTD_H | |
590 | # include <unistd.h> | 590 | # include <unistd.h> | |
591 | #endif" | 591 | #endif" | |
592 | 592 | |||
593 | ac_subst_vars='LTLIBOBJS | 593 | ac_subst_vars='LTLIBOBJS | |
594 | _MAKE_VERSION | |||
594 | filemon_h | 595 | filemon_h | |
595 | use_meta | 596 | use_meta | |
596 | diff_u | 597 | diff_u | |
597 | GCC | 598 | GCC | |
598 | INSTALL | 599 | INSTALL | |
599 | default_sys_path | 600 | default_sys_path | |
600 | mksrc | 601 | mksrc | |
601 | machine_arch | 602 | machine_arch | |
602 | force_machine | 603 | force_machine | |
603 | machine | 604 | machine | |
604 | LIBOBJS | 605 | LIBOBJS | |
605 | bmake_path_max | 606 | bmake_path_max | |
606 | ac_exe_suffix | 607 | ac_exe_suffix | |
@@ -2253,26 +2254,28 @@ ac_cpp='$CPP $CPPFLAGS' | @@ -2253,26 +2254,28 @@ ac_cpp='$CPP $CPPFLAGS' | |||
2253 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | 2254 | ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' | |
2254 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | 2255 | ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' | |
2255 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | 2256 | ac_compiler_gnu=$ac_cv_c_compiler_gnu | |
2256 | 2257 | |||
2257 | 2258 | |||
2258 | ac_config_headers="$ac_config_headers config.h" | 2259 | ac_config_headers="$ac_config_headers config.h" | |
2259 | 2260 | |||
2260 | 2261 | |||
2261 | case "$srcdir" in | 2262 | case "$srcdir" in | |
2262 | /*) ;; | 2263 | /*) ;; | |
2263 | *) srcdir=`cd $srcdir && pwd`;; | 2264 | *) srcdir=`cd $srcdir && pwd`;; | |
2264 | esac | 2265 | esac | |
2265 | 2266 | |||
2267 | . $srcdir/VERSION | |||
2268 | ||||
2266 | 2269 | |||
2267 | # Check whether --with-defshell was given. | 2270 | # Check whether --with-defshell was given. | |
2268 | if test "${with_defshell+set}" = set; then : | 2271 | if test "${with_defshell+set}" = set; then : | |
2269 | withval=$with_defshell; case "${withval}" in | 2272 | withval=$with_defshell; case "${withval}" in | |
2270 | yes) as_fn_error "bad value ${withval} given for bmake DEFSHELL" "$LINENO" 5 ;; | 2273 | yes) as_fn_error "bad value ${withval} given for bmake DEFSHELL" "$LINENO" 5 ;; | |
2271 | no) ;; | 2274 | no) ;; | |
2272 | *) case "$with_defshell" in | 2275 | *) case "$with_defshell" in | |
2273 | sh) DEFSHELL_INDEX=DEFSHELL_INDEX_SH;; # it's the default anyway | 2276 | sh) DEFSHELL_INDEX=DEFSHELL_INDEX_SH;; # it's the default anyway | |
2274 | ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;; | 2277 | ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;; | |
2275 | csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; # kidding right? | 2278 | csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; # kidding right? | |
2276 | *) defshell_path=$with_defshell;; # better be sh compatible! | 2279 | *) defshell_path=$with_defshell;; # better be sh compatible! | |
2277 | esac | 2280 | esac | |
2278 | ;; | 2281 | ;; |
@@ -1,29 +1,32 @@ | @@ -1,29 +1,32 @@ | |||
1 | dnl | 1 | dnl | |
2 | dnl RCSid: | 2 | dnl RCSid: | |
3 | dnl $Id: configure.in,v 1.13 2015/05/19 22:01:19 joerg Exp $ | 3 | dnl $Id: configure.in,v 1.14 2017/08/15 15:54:06 brook Exp $ | |
4 | dnl | 4 | dnl | |
5 | dnl Process this file with autoconf to produce a configure script | 5 | dnl Process this file with autoconf to produce a configure script | |
6 | dnl | 6 | dnl | |
7 | AC_PREREQ(2.50) | 7 | AC_PREREQ(2.50) | |
8 | AC_INIT([bmake], [20140214], [sjg@NetBSD.org]) | 8 | AC_INIT([bmake], [20140214], [sjg@NetBSD.org]) | |
9 | AC_CONFIG_HEADERS(config.h) | 9 | AC_CONFIG_HEADERS(config.h) | |
10 | 10 | |||
11 | dnl make srcdir absolute | 11 | dnl make srcdir absolute | |
12 | case "$srcdir" in | 12 | case "$srcdir" in | |
13 | /*) ;; | 13 | /*) ;; | |
14 | *) srcdir=`cd $srcdir && pwd`;; | 14 | *) srcdir=`cd $srcdir && pwd`;; | |
15 | esac | 15 | esac | |
16 | 16 | |||
17 | dnl get _MAKE_VERSION | |||
18 | . $srcdir/VERSION | |||
19 | ||||
17 | dnl | 20 | dnl | |
18 | AC_ARG_WITH(defshell, | 21 | AC_ARG_WITH(defshell, | |
19 | [ --with-defshell=SHELL use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions], | 22 | [ --with-defshell=SHELL use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions], | |
20 | [case "${withval}" in | 23 | [case "${withval}" in | |
21 | yes) AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;; | 24 | yes) AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;; | |
22 | no) ;; | 25 | no) ;; | |
23 | *) case "$with_defshell" in | 26 | *) case "$with_defshell" in | |
24 | sh) DEFSHELL_INDEX=DEFSHELL_INDEX_SH;; # it's the default anyway | 27 | sh) DEFSHELL_INDEX=DEFSHELL_INDEX_SH;; # it's the default anyway | |
25 | ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;; | 28 | ksh) DEFSHELL_INDEX=DEFSHELL_INDEX_KSH;; | |
26 | csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; # kidding right? | 29 | csh) DEFSHELL_INDEX=DEFSHELL_INDEX_CSH;; # kidding right? | |
27 | *) defshell_path=$with_defshell;; # better be sh compatible! | 30 | *) defshell_path=$with_defshell;; # better be sh compatible! | |
28 | esac | 31 | esac | |
29 | ;; | 32 | ;; | |
@@ -365,24 +368,25 @@ if test -n "$DEFSHELL_INDEX"; then | @@ -365,24 +368,25 @@ if test -n "$DEFSHELL_INDEX"; then | |||
365 | AC_DEFINE_UNQUOTED(DEFSHELL_INDEX, $DEFSHELL_INDEX, Shell spec to use by default) | 368 | AC_DEFINE_UNQUOTED(DEFSHELL_INDEX, $DEFSHELL_INDEX, Shell spec to use by default) | |
366 | fi | 369 | fi | |
367 | dnl | 370 | dnl | |
368 | AC_SUBST(machine) | 371 | AC_SUBST(machine) | |
369 | AC_SUBST(force_machine) | 372 | AC_SUBST(force_machine) | |
370 | AC_SUBST(machine_arch) | 373 | AC_SUBST(machine_arch) | |
371 | AC_SUBST(mksrc) | 374 | AC_SUBST(mksrc) | |
372 | AC_SUBST(default_sys_path) | 375 | AC_SUBST(default_sys_path) | |
373 | AC_SUBST(INSTALL) | 376 | AC_SUBST(INSTALL) | |
374 | AC_SUBST(GCC) | 377 | AC_SUBST(GCC) | |
375 | AC_SUBST(diff_u) | 378 | AC_SUBST(diff_u) | |
376 | AC_SUBST(use_meta) | 379 | AC_SUBST(use_meta) | |
377 | AC_SUBST(filemon_h) | 380 | AC_SUBST(filemon_h) | |
381 | AC_SUBST(_MAKE_VERSION) | |||
378 | AC_OUTPUT(makefile Makefile.config make-bootstrap.sh unit-tests/Makefile) | 382 | AC_OUTPUT(makefile Makefile.config make-bootstrap.sh unit-tests/Makefile) | |
379 | 383 | |||
380 | cat <<EOF | 384 | cat <<EOF | |
381 | 385 | |||
382 | You can now run | 386 | You can now run | |
383 | 387 | |||
384 | sh ./make-bootstrap.sh | 388 | sh ./make-bootstrap.sh | |
385 | 389 | |||
386 | to produce a fully functional bmake. | 390 | to produce a fully functional bmake. | |
387 | 391 | |||
388 | EOF | 392 | EOF |
@@ -3,27 +3,27 @@ | @@ -3,27 +3,27 @@ | |||
3 | set -e | 3 | set -e | |
4 | 4 | |||
5 | srcdir=@srcdir@ | 5 | srcdir=@srcdir@ | |
6 | 6 | |||
7 | DEFAULT_SYS_PATH="@default_sys_path@" | 7 | DEFAULT_SYS_PATH="@default_sys_path@" | |
8 | 8 | |||
9 | case "@use_meta@" in | 9 | case "@use_meta@" in | |
10 | yes) XDEFS="-DUSE_META ${XDEFS}";; | 10 | yes) XDEFS="-DUSE_META ${XDEFS}";; | |
11 | esac | 11 | esac | |
12 | 12 | |||
13 | CC="@CC@" | 13 | CC="@CC@" | |
14 | CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@" | 14 | CFLAGS="@CFLAGS@ -I. -I${srcdir} @DEFS@ @CPPFLAGS@ -DMAKE_NATIVE ${XDEFS} -DBMAKE_PATH_MAX=@bmake_path_max@" | |
15 | 15 | |||
16 | MAKE_VERSION=`sed -n '/^MAKE_VERSION=/s,.*=[^0-9]*,,p' $srcdir/Makefile` | 16 | MAKE_VERSION=@_MAKE_VERSION@ | |
17 | 17 | |||
18 | MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \ | 18 | MDEFS="-DMAKE_VERSION=\"$MAKE_VERSION\" \ | |
19 | -D@force_machine@MACHINE=\"@machine@\" -DPKGSRC_MACHINE_ARCH=\"@machine_arch@\" \ | 19 | -D@force_machine@MACHINE=\"@machine@\" -DPKGSRC_MACHINE_ARCH=\"@machine_arch@\" \ | |
20 | -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"" | 20 | -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"" | |
21 | 21 | |||
22 | 22 | |||
23 | LDFLAGS="@LDFLAGS@" | 23 | LDFLAGS="@LDFLAGS@" | |
24 | LIBS="@LIBS@" | 24 | LIBS="@LIBS@" | |
25 | 25 | |||
26 | do_compile2() { | 26 | do_compile2() { | |
27 | obj="$1"; shift | 27 | obj="$1"; shift | |
28 | src="$1"; shift | 28 | src="$1"; shift | |
29 | echo ${CC} -c ${CFLAGS} "$@" -o "$obj" "$src" | 29 | echo ${CC} -c ${CFLAGS} "$@" -o "$obj" "$src" |