svn commit: r368501 - in stable/12: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/manuals contrib/bc/manuals/bc contrib/bc/manuals/dc contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc co...
Stefan Eßer
se at FreeBSD.org
Thu Dec 10 08:48:06 UTC 2020
Author: se
Date: Thu Dec 10 08:48:03 2020
New Revision: 368501
URL: https://svnweb.freebsd.org/changeset/base/368501
Log:
MFC: r366318, r368072, r368080, r368097, r368387
Upgrade to version 3.2.3
Added:
stable/12/contrib/bc/exec-install.sh
- copied unchanged from r368072, head/contrib/bc/exec-install.sh
- copied unchanged from r368072, head/contrib/bc/include/bcl.h
- copied unchanged from r368072, head/contrib/bc/include/library.h
- copied unchanged from r368072, head/contrib/bc/manuals/bcl.3
stable/12/contrib/bc/manuals/bcl.3.md
- copied unchanged from r368072, head/contrib/bc/manuals/bcl.3.md
- copied unchanged from r368072, head/contrib/bc/manuals/header.txt
- copied unchanged from r368072, head/contrib/bc/manuals/header_bc.txt
- copied unchanged from r368072, head/contrib/bc/manuals/header_bcl.txt
- copied unchanged from r368072, head/contrib/bc/manuals/header_dc.txt
stable/12/contrib/bc/src/bc.c
- copied unchanged from r368072, head/contrib/bc/src/bc.c
stable/12/contrib/bc/src/bc_lex.c
- copied unchanged from r368072, head/contrib/bc/src/bc_lex.c
stable/12/contrib/bc/src/bc_parse.c
- copied unchanged from r368072, head/contrib/bc/src/bc_parse.c
stable/12/contrib/bc/src/dc.c
- copied unchanged from r368072, head/contrib/bc/src/dc.c
stable/12/contrib/bc/src/dc_lex.c
- copied unchanged from r368072, head/contrib/bc/src/dc_lex.c
stable/12/contrib/bc/src/dc_parse.c
- copied unchanged from r368072, head/contrib/bc/src/dc_parse.c
stable/12/contrib/bc/src/history.c
- copied unchanged from r368072, head/contrib/bc/src/history.c
- copied unchanged from r368072, head/contrib/bc/src/library.c
stable/12/contrib/bc/src/rand.c
- copied unchanged from r368072, head/contrib/bc/src/rand.c
- copied unchanged from r368072, head/contrib/bc/tests/bcl.c
Directory Properties:
stable/12/contrib/bc/include/bcl.h (props changed)
stable/12/contrib/bc/include/library.h (props changed)
stable/12/contrib/bc/manuals/bcl.3 (props changed)
stable/12/contrib/bc/manuals/header.txt (props changed)
stable/12/contrib/bc/manuals/header_bc.txt (props changed)
stable/12/contrib/bc/manuals/header_bcl.txt (props changed)
stable/12/contrib/bc/manuals/header_dc.txt (props changed)
stable/12/contrib/bc/src/library.c (props changed)
stable/12/contrib/bc/tests/bcl.c (props changed)
Deleted:
stable/12/contrib/bc/install.sh
stable/12/contrib/bc/src/bc/
stable/12/contrib/bc/src/dc/
stable/12/contrib/bc/src/history/
stable/12/contrib/bc/src/rand/
Modified:
stable/12/contrib/bc/.gitignore
stable/12/contrib/bc/Makefile.in
stable/12/contrib/bc/NEWS.md
stable/12/contrib/bc/README.md
stable/12/contrib/bc/configure.sh
stable/12/contrib/bc/gen/lib.bc
stable/12/contrib/bc/gen/strgen.c
stable/12/contrib/bc/gen/strgen.sh
stable/12/contrib/bc/include/bc.h
stable/12/contrib/bc/include/file.h
stable/12/contrib/bc/include/lex.h
stable/12/contrib/bc/include/num.h
stable/12/contrib/bc/include/parse.h
stable/12/contrib/bc/include/rand.h
stable/12/contrib/bc/include/status.h
stable/12/contrib/bc/include/vector.h
stable/12/contrib/bc/include/vm.h
stable/12/contrib/bc/manpage.sh
stable/12/contrib/bc/manuals/bc.1.md.in
stable/12/contrib/bc/manuals/bc/A.1
stable/12/contrib/bc/manuals/bc/A.1.md
stable/12/contrib/bc/manuals/bc/E.1
stable/12/contrib/bc/manuals/bc/E.1.md
stable/12/contrib/bc/manuals/bc/EH.1
stable/12/contrib/bc/manuals/bc/EH.1.md
stable/12/contrib/bc/manuals/bc/EHN.1
stable/12/contrib/bc/manuals/bc/EHN.1.md
stable/12/contrib/bc/manuals/bc/EHNP.1
stable/12/contrib/bc/manuals/bc/EHNP.1.md
stable/12/contrib/bc/manuals/bc/EHP.1
stable/12/contrib/bc/manuals/bc/EHP.1.md
stable/12/contrib/bc/manuals/bc/EN.1
stable/12/contrib/bc/manuals/bc/EN.1.md
stable/12/contrib/bc/manuals/bc/ENP.1
stable/12/contrib/bc/manuals/bc/ENP.1.md
stable/12/contrib/bc/manuals/bc/EP.1
stable/12/contrib/bc/manuals/bc/EP.1.md
stable/12/contrib/bc/manuals/bc/H.1
stable/12/contrib/bc/manuals/bc/H.1.md
stable/12/contrib/bc/manuals/bc/HN.1
stable/12/contrib/bc/manuals/bc/HN.1.md
stable/12/contrib/bc/manuals/bc/HNP.1
stable/12/contrib/bc/manuals/bc/HNP.1.md
stable/12/contrib/bc/manuals/bc/HP.1
stable/12/contrib/bc/manuals/bc/HP.1.md
stable/12/contrib/bc/manuals/bc/N.1
stable/12/contrib/bc/manuals/bc/N.1.md
stable/12/contrib/bc/manuals/bc/NP.1
stable/12/contrib/bc/manuals/bc/NP.1.md
stable/12/contrib/bc/manuals/bc/P.1
stable/12/contrib/bc/manuals/bc/P.1.md
stable/12/contrib/bc/manuals/build.md
stable/12/contrib/bc/manuals/dc.1.md.in
stable/12/contrib/bc/manuals/dc/A.1
stable/12/contrib/bc/manuals/dc/A.1.md
stable/12/contrib/bc/manuals/dc/E.1
stable/12/contrib/bc/manuals/dc/E.1.md
stable/12/contrib/bc/manuals/dc/EH.1
stable/12/contrib/bc/manuals/dc/EH.1.md
stable/12/contrib/bc/manuals/dc/EHN.1
stable/12/contrib/bc/manuals/dc/EHN.1.md
stable/12/contrib/bc/manuals/dc/EHNP.1
stable/12/contrib/bc/manuals/dc/EHNP.1.md
stable/12/contrib/bc/manuals/dc/EHP.1
stable/12/contrib/bc/manuals/dc/EHP.1.md
stable/12/contrib/bc/manuals/dc/EN.1
stable/12/contrib/bc/manuals/dc/EN.1.md
stable/12/contrib/bc/manuals/dc/ENP.1
stable/12/contrib/bc/manuals/dc/ENP.1.md
stable/12/contrib/bc/manuals/dc/EP.1
stable/12/contrib/bc/manuals/dc/EP.1.md
stable/12/contrib/bc/manuals/dc/H.1
stable/12/contrib/bc/manuals/dc/H.1.md
stable/12/contrib/bc/manuals/dc/HN.1
stable/12/contrib/bc/manuals/dc/HN.1.md
stable/12/contrib/bc/manuals/dc/HNP.1
stable/12/contrib/bc/manuals/dc/HNP.1.md
stable/12/contrib/bc/manuals/dc/HP.1
stable/12/contrib/bc/manuals/dc/HP.1.md
stable/12/contrib/bc/manuals/dc/N.1
stable/12/contrib/bc/manuals/dc/N.1.md
stable/12/contrib/bc/manuals/dc/NP.1
stable/12/contrib/bc/manuals/dc/NP.1.md
stable/12/contrib/bc/manuals/dc/P.1
stable/12/contrib/bc/manuals/dc/P.1.md
stable/12/contrib/bc/release.sh
stable/12/contrib/bc/src/args.c
stable/12/contrib/bc/src/data.c
stable/12/contrib/bc/src/file.c
stable/12/contrib/bc/src/lang.c
stable/12/contrib/bc/src/lex.c
stable/12/contrib/bc/src/main.c
stable/12/contrib/bc/src/num.c
stable/12/contrib/bc/src/opt.c
stable/12/contrib/bc/src/parse.c
stable/12/contrib/bc/src/program.c
stable/12/contrib/bc/src/read.c
stable/12/contrib/bc/src/vector.c
stable/12/contrib/bc/src/vm.c
stable/12/usr.bin/gh-bc/Makefile
Directory Properties:
stable/12/contrib/bc/tests/bc/stdin1.txt (props changed)
stable/12/contrib/bc/tests/bc/stdin1_results.txt (props changed)
stable/12/contrib/bc/tests/bc/stdin2.txt (props changed)
stable/12/contrib/bc/tests/bc/stdin2_results.txt (props changed)
Modified: stable/12/contrib/bc/.gitignore
==============================================================================
--- stable/12/contrib/bc/.gitignore Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/.gitignore Thu Dec 10 08:48:03 2020 (r368501)
@@ -9,6 +9,7 @@ bin/*bc
bin/*bc.exe
bin/*dc
bin/*dc.exe
+bin/bcl
bc.old
*.o
*.a
Modified: stable/12/contrib/bc/Makefile.in
==============================================================================
--- stable/12/contrib/bc/Makefile.in Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/Makefile.in Thu Dec 10 08:48:03 2020 (r368501)
@@ -29,33 +29,13 @@
#
.POSIX:
-VERSION = 3.1.5
+VERSION = 3.2.3
SRC = %%SRC%%
OBJ = %%OBJ%%
GCDA = %%GCDA%%
GCNO = %%GCNO%%
-BC_SRC = %%BC_SRC%%
-BC_OBJ = %%BC_OBJ%%
-BC_GCDA = %%BC_GCDA%%
-BC_GCNO = %%BC_GCNO%%
-
-DC_SRC = %%DC_SRC%%
-DC_OBJ = %%DC_OBJ%%
-DC_GCDA = %%DC_GCDA%%
-DC_GCNO = %%DC_GCNO%%
-
-HISTORY_SRC = %%HISTORY_SRC%%
-HISTORY_OBJ = %%HISTORY_OBJ%%
-HISTORY_GCDA = %%HISTORY_GCDA%%
-HISTORY_GCNO = %%HISTORY_GCNO%%
-
-RAND_SRC = %%RAND_SRC%%
-RAND_OBJ = %%RAND_OBJ%%
-RAND_GCDA = %%RAND_GCDA%%
-RAND_GCNO = %%RAND_GCNO%%
-
BC_ENABLED_NAME = BC_ENABLED
BC_ENABLED = %%BC_ENABLED%%
DC_ENABLED_NAME = DC_ENABLED
@@ -102,6 +82,13 @@ DC = dc
BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC)
DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
+LIB = libbcl
+LIB_NAME = $(LIB).a
+LIBBC = $(BIN)/$(LIB_NAME)
+BCL = bcl
+BCL_TEST = $(BIN)/$(BCL)
+BCL_TEST_C = tests/$(BCL).c
+
MANUALS = manuals
BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
BC_MANPAGE = $(MANUALS)/$(BC).1
@@ -109,16 +96,28 @@ BC_MD = $(BC_MANPAGE).md
DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1
DC_MANPAGE = $(MANUALS)/$(DC).1
DC_MD = $(DC_MANPAGE).md
+BCL_MANPAGE_NAME = bcl.3
+BCL_MANPAGE = $(MANUALS)/$(BCL_MANPAGE_NAME)
+BCL_MD = $(BCL_MANPAGE).md
MANPAGE_INSTALL_ARGS = -Dm644
+BINARY_INSTALL_ARGS = -Dm755
+BCL_HEADER_NAME = bcl.h
+BCL_HEADER = include/$(BCL_HEADER_NAME)
+
%%DESTDIR%%
BINDIR = %%BINDIR%%
+INCLUDEDIR = %%INCLUDEDIR%%
+LIBDIR = %%LIBDIR%%
MAN1DIR = %%MAN1DIR%%
+MAN3DIR = %%MAN3DIR%%
MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX)
EXEC = $(%%EXEC%%)
NLSPATH = %%NLSPATH%%
+BC_ENABLE_LIBRARY = %%LIBRARY%%
+
BC_ENABLE_HISTORY = %%HISTORY%%
BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH
BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%%
@@ -129,7 +128,7 @@ BC_LONG_BIT = %%LONG_BIT%%
RM = rm
MKDIR = mkdir
-INSTALL = ./install.sh
+INSTALL = ./exec-install.sh
SAFE_INSTALL = ./safe-install.sh
LINK = ./link.sh
MANPAGE = ./manpage.sh
@@ -148,7 +147,7 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_
CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT)
CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
-CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY)
+CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%%
LDFLAGS = %%LDFLAGS%%
@@ -157,21 +156,24 @@ HOSTCFLAGS = %%HOSTCFLAGS%%
CC = %%CC%%
HOSTCC = %%HOSTCC%%
-BC_LIB_C_ARGS = bc_lib bc.h bc_lib_name $(BC_ENABLED_NAME) 1
-BC_LIB2_C_ARGS = bc_lib2 bc.h bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1
+BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1
+BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1
-OBJS1 = $(OBJ) $(DC_OBJ) $(BC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(BC_HELP_O) $(DC_HELP_O)
-OBJS = $(OBJS1) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O)
-OBJ_TARGETS1 = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O)
-OBJ_TARGETS = $(OBJ_TARGETS1) $(BC_OBJ) $(DC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(OBJ)
+OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
+OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
-all: make_bin $(OBJ_TARGETS)
+all: %%ALL_PREREQ%%
+
+execs: make_bin $(OBJ_TARGETS)
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC)
%%LINK%%
+library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O)
+ ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ)
+
$(GEN_EXEC):
%%GEN_EXEC_TARGET%%
@@ -182,10 +184,10 @@ $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS)
$(BC_HELP_C): $(GEN_EXEC) $(BC_HELP)
- $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help bc.h "" $(BC_ENABLED_NAME)
+ $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME)
$(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
- $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help dc.h "" $(DC_ENABLED_NAME)
+ $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME)
make_bin:
$(MKDIR) -p $(BIN)
@@ -222,7 +224,7 @@ help:
check: test
-test: test_bc timeconst test_dc
+test: %%TESTS%%
test_bc:
%%BC_TEST%%
@@ -241,6 +243,12 @@ time_test_dc:
timeconst:
%%TIMECONST%%
+library_test: library
+ $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST)
+
+test_library: library_test
+ $(BCL_TEST)
+
valgrind: valgrind_bc valgrind_dc
valgrind_bc:
@@ -272,6 +280,7 @@ extra_math:
manpages:
$(MANPAGE) bc
$(MANPAGE) dc
+ $(MANPAGE) bcl
clean_gen:
@$(RM) -f $(GEN_EXEC)
@@ -279,10 +288,6 @@ clean_gen:
clean:%%CLEAN_PREREQS%%
@printf 'Cleaning files...\n'
@$(RM) -f $(OBJ)
- @$(RM) -f $(BC_OBJ)
- @$(RM) -f $(DC_OBJ)
- @$(RM) -f $(HISTORY_OBJ)
- @$(RM) -f $(RAND_OBJ)
@$(RM) -f $(BC_EXEC)
@$(RM) -f $(DC_EXEC)
@$(RM) -fr $(BIN)
@@ -343,9 +348,20 @@ install_bc_manpage:
install_dc_manpage:
$(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(DC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME)
-install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_PREREQS%%
+install_bcl_manpage:
+ $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BCL_MANPAGE) $(DESTDIR)$(MAN3DIR)/$(BCL_MANPAGE_NAME)
+
+install_bcl_header:
+ $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BCL_HEADER) $(DESTDIR)$(INCLUDEDIR)/$(BCL_HEADER_NAME)
+
+install_execs:
$(INSTALL) $(DESTDIR)$(BINDIR) "$(EXEC_SUFFIX)"
+install_library:
+ $(SAFE_INSTALL) $(BINARY_INSTALL_ARGS) $(LIBBC) $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
+
+install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_MAN_PREREQS%%%%INSTALL_PREREQS%%
+
uninstall_locales:
$(LOCALE_UNINSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR)
@@ -360,5 +376,14 @@ uninstall_dc_manpage:
uninstall_dc:
$(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX)
+
+uninstall_library:
+ $(RM) -f $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
+
+uninstall_bcl_header:
+ $(RM) -f $(DESTDIR)$(INCLUDEDIR)/$(BCL_HEADER_NAME)
+
+uninstall_bcl_manpage:
+ $(RM) -f $(DESTDIR)$(MAN3DIR)/$(BCL_MANPAGE_NAME)
uninstall:%%UNINSTALL_LOCALES_PREREQS%%%%UNINSTALL_MAN_PREREQS%%%%UNINSTALL_PREREQS%%
Modified: stable/12/contrib/bc/NEWS.md
==============================================================================
--- stable/12/contrib/bc/NEWS.md Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/NEWS.md Thu Dec 10 08:48:03 2020 (r368501)
@@ -1,5 +1,50 @@
# News
+## 3.2.3
+
+This is a production release that fixes a bug in `gen/strgen.sh`. I recently
+changed `gen/strgen.c`, but I did not change `gen/strgen.sh`.
+
+Users that do not use `gen/strgen.sh` do not need to upgrade.
+
+## 3.2.2
+
+This is a production release that fixes a portability bug in `configure.sh`. The
+bug was using the GNU `find` extension `-wholename`.
+
+## 3.2.1
+
+This is a production release that has one fix for `bcl(3)`. It is technically
+not a bug fix since the behavior is undefined, but the `BclNumber`s that
+`bcl_divmod()` returns will be set to `BCL_ERROR_INVALID_NUM` if there is an
+error. Previously, they were not set.
+
+## 3.2.0
+
+This is a production release that has one bug fix and a major addition.
+
+The bug fix was a missing `auto` variable in the bessel `j()` function in the
+math library.
+
+The major addition is a way to build a version of `bc`'s math code as a library.
+This is done with the `-a` option to `configure.sh`. The API for the library can
+be read in `./manuals/bcl.3.md` or `man bcl` once the library is installed with
+`make install`.
+
+This library was requested by developers before I even finished version 1.0, but
+I could not figure out how to do it until now.
+
+If the library has API breaking changes, the major version of `bc` will be
+incremented.
+
+## 3.1.6
+
+This is a production release that fixes a new warning from Clang 12 for FreeBSD
+and also removes some possible undefined behavior found by UBSan that compilers
+did not seem to take advantage of.
+
+Users do ***NOT*** need to upgrade, if they do not want to.
+
## 3.1.5
This is a production release that fixes the Chinese locales (which caused `bc`
Modified: stable/12/contrib/bc/README.md
==============================================================================
--- stable/12/contrib/bc/README.md Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/README.md Thu Dec 10 08:48:03 2020 (r368501)
@@ -107,6 +107,23 @@ other locations, use the `PREFIX` environment variable
`configure.sh` or pass the `--prefix=<prefix>` option to `configure.sh`. See the
[build manual][5], or run `./configure.sh --help`, for more details.
+### Library
+
+This `bc` does provide a way to build a math library with C bindings. This is
+done by the `-a` or `--library` options to `configure.sh`:
+
+```
+./configure.sh -a
+```
+
+When building the library, the executables are not built. For more information,
+see the [build manual][5].
+
+The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the
+library is installed.
+
+The library is built as `bin/libbcl.a`.
+
### Package and Distro Maintainers
#### Recommended Compiler
@@ -335,3 +352,4 @@ Folders:
[23]: https://svnweb.freebsd.org/base/head/contrib/bc/
[24]: https://bugs.freebsd.org/
[25]: https://reviews.freebsd.org/
+[26]: ./manuals/bcl.3.md
Modified: stable/12/contrib/bc/configure.sh
==============================================================================
--- stable/12/contrib/bc/configure.sh Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/configure.sh Thu Dec 10 08:48:03 2020 (r368501)
@@ -45,22 +45,27 @@ usage() {
_usage_val=0
fi
- printf 'usage: %s -h\n' "$script"
- printf ' %s --help\n' "$script"
- printf ' %s [-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script"
- printf ' %s \\\n' "$script"
- printf ' [--bc-only --disable-dc|--dc-only --disable-bc|--coverage] \\\n'
- printf ' [--debug --disable-extra-math --disable-generated-tests] \\\n'
- printf ' [--disable-history --disable-man-pages --disable-nls] \\\n'
- printf ' [--disable-prompt --disable-strip] [--install-all-locales] \\\n'
- printf ' [--opt=OPT_LEVEL] [--karatsuba-len=KARATSUBA_LEN] \\\n'
- printf ' [--prefix=PREFIX] [--bindir=BINDIR] [--datarootdir=DATAROOTDIR] \\\n'
- printf ' [--datadir=DATADIR] [--mandir=MANDIR] [--man1dir=MAN1DIR] \\\n'
- printf ' [--force] \\\n'
+ printf 'usage:\n'
+ printf ' %s -h\n' "$script"
+ printf ' %s --help\n' "$script"
+ printf ' %s [-a|-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script"
+ printf ' %s \\\n' "$script"
+ printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage]\\\n'
+ printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n'
+ printf ' [--disable-history --disable-man-pages --disable-nls] \\\n'
+ printf ' [--disable-prompt --disable-strip] [--install-all-locales] \\\n'
+ printf ' [--opt=OPT_LEVEL] [--karatsuba-len=KARATSUBA_LEN] \\\n'
+ printf ' [--prefix=PREFIX] [--bindir=BINDIR] [--datarootdir=DATAROOTDIR] \\\n'
+ printf ' [--datadir=DATADIR] [--mandir=MANDIR] [--man1dir=MAN1DIR] \\\n'
printf '\n'
+ printf ' -a, --library\n'
+ printf ' Build the libbc instead of the programs. This is meant to be used with\n'
+ printf ' Other software like programming languages that want to make use of the\n'
+ printf ' parsing and math capabilities. This option will install headers using\n'
+ printf ' `make install`.\n'
printf ' -b, --bc-only\n'
- printf ' Build bc only. It is an error if "-d", "--dc-only", "-B", or "--disable-bc"\n'
- printf ' are specified too.\n'
+ printf ' Build bc only. It is an error if "-d", "--dc-only", "-B", or\n'
+ printf ' "--disable-bc" are specified too.\n'
printf ' -B, --disable-bc\n'
printf ' Disable bc. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n'
printf ' are specified too.\n'
@@ -69,10 +74,10 @@ usage() {
printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n'
printf ' Requires a compiler that use gcc-compatible coverage options\n'
printf ' -d, --dc-only\n'
- printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n'
- printf ' are specified too.\n'
+ printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or\n'
+ printf ' "--disable-dc" are specified too.\n'
printf ' -D, --disable-dc\n'
- printf ' Disable dc. It is an error if "-d", "--dc-only" "-B", or "--disable-bc"\n'
+ printf ' Disable dc. It is an error if "-d", "--dc-only", "-B", or "--disable-bc"\n'
printf ' are specified too.\n'
printf ' -E, --disable-extra-math\n'
printf ' Disable extra math. This includes: "$" operator (truncate to integer),\n'
@@ -122,8 +127,14 @@ usage() {
printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n'
printf ' Default is "/usr/local".\n'
printf ' --bindir BINDIR\n'
- printf ' The directory to install binaries. Overrides "$BINDIR" if it exists.\n'
+ printf ' The directory to install binaries in. Overrides "$BINDIR" if it exists.\n'
printf ' Default is "$PREFIX/bin".\n'
+ printf ' --includedir INCLUDEDIR\n'
+ printf ' The directory to install headers in. Overrides "$INCLUDEDIR" if it\n'
+ printf ' exists. Default is "$PREFIX/include".\n'
+ printf ' --libdir LIBDIR\n'
+ printf ' The directory to install libraries in. Overrides "$LIBDIR" if it exists.\n'
+ printf ' Default is "$PREFIX/lib".\n'
printf ' --datarootdir DATAROOTDIR\n'
printf ' The root location for data files. Overrides "$DATAROOTDIR" if it exists.\n'
printf ' Default is "$PREFIX/share".\n'
@@ -136,6 +147,9 @@ usage() {
printf ' --man1dir MAN1DIR\n'
printf ' The location to install Section 1 manpages to. Overrides "$MAN1DIR" if\n'
printf ' it exists. Default is "$MANDIR/man1".\n'
+ printf ' --man3dir MAN3DIR\n'
+ printf ' The location to install Section 3 manpages to. Overrides "$MAN3DIR" if\n'
+ printf ' it exists. Default is "$MANDIR/man3".\n'
printf '\n'
printf 'In addition, the following environment variables are used:\n'
printf '\n'
@@ -157,12 +171,18 @@ usage() {
printf ' LDFLAGS Linker flags. Default is "".\n'
printf ' PREFIX The prefix to install to. Default is "/usr/local".\n'
printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n'
- printf ' BINDIR The directory to install binaries. Default is "$PREFIX/bin".\n'
+ printf ' BINDIR The directory to install binaries in. Default is "$PREFIX/bin".\n'
+ printf ' INCLUDEDIR The directory to install header files in. Default is\n'
+ printf ' "$PREFIX/include".\n'
+ printf ' LIBDIR The directory to install libraries in. Default is\n'
+ printf ' "$PREFIX/lib".\n'
printf ' DATAROOTDIR The root location for data files. Default is "$PREFIX/share".\n'
printf ' DATADIR The location for data files. Default is "$DATAROOTDIR".\n'
printf ' MANDIR The location to install manpages to. Default is "$DATADIR/man".\n'
printf ' MAN1DIR The location to install Section 1 manpages to. Default is\n'
printf ' "$MANDIR/man1".\n'
+ printf ' MAN3DIR The location to install Section 3 manpages to. Default is\n'
+ printf ' "$MANDIR/man3".\n'
printf ' NLSPATH The location to install locale catalogs to. Must be an absolute\n'
printf ' path (or contain one). This is treated the same as the POSIX\n'
printf ' definition of $NLSPATH (see POSIX environment variables for\n'
@@ -257,56 +277,55 @@ replace() {
substring_replace "$_replace_str" "%%$_replace_needle%%" "$_replace_replacement"
}
-gen_file_lists() {
+gen_file_list() {
- if [ "$#" -lt 3 ]; then
+ if [ "$#" -lt 1 ]; then
err_exit "Invalid number of args to $0"
fi
- _gen_file_lists_contents="$1"
+ _gen_file_list_contents="$1"
shift
- _gen_file_lists_filedir="$1"
- shift
+ p=$(pwd)
- _gen_file_lists_typ="$1"
- shift
+ cd "$scriptdir"
- # If there is an extra argument, and it
- # is zero, we keep the file lists empty.
- if [ "$#" -gt 0 ]; then
- _gen_file_lists_use="$1"
+ if [ "$#" -ge 1 ]; then
+
+ while [ "$#" -ge 1 ]; do
+ a="$1"
+ shift
+ args="$args ! -path src/${a}"
+ done
+
else
- _gen_file_lists_use="1"
+ args="-print"
fi
- _gen_file_lists_needle_src="${_gen_file_lists_typ}SRC"
- _gen_file_lists_needle_obj="${_gen_file_lists_typ}OBJ"
- _gen_file_lists_needle_gcda="${_gen_file_lists_typ}GCDA"
- _gen_file_lists_needle_gcno="${_gen_file_lists_typ}GCNO"
+ _gen_file_list_needle_src="SRC"
+ _gen_file_list_needle_obj="OBJ"
+ _gen_file_list_needle_gcda="GCDA"
+ _gen_file_list_needle_gcno="GCNO"
- if [ "$_gen_file_lists_use" -ne 0 ]; then
+ _gen_file_list_replacement=$(find src/ -depth -name "*.c" $args | tr '\n' ' ')
+ _gen_file_list_contents=$(replace "$_gen_file_list_contents" \
+ "$_gen_file_list_needle_src" "$_gen_file_list_replacement")
- _gen_file_lists_replacement=$(cd "$_gen_file_lists_filedir" && find . ! -name . -prune -name "*.c" | cut -d/ -f2 | sed "s@^@$_gen_file_lists_filedir/@g" | tr '\n' ' ')
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_src" "$_gen_file_lists_replacement")
+ _gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "c" "o")
+ _gen_file_list_contents=$(replace "$_gen_file_list_contents" \
+ "$_gen_file_list_needle_obj" "$_gen_file_list_replacement")
- _gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "c" "o")
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_obj" "$_gen_file_lists_replacement")
+ _gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "o" "gcda")
+ _gen_file_list_contents=$(replace "$_gen_file_list_contents" \
+ "$_gen_file_list_needle_gcda" "$_gen_file_list_replacement")
- _gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "o" "gcda")
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcda" "$_gen_file_lists_replacement")
+ _gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "gcda" "gcno")
+ _gen_file_list_contents=$(replace "$_gen_file_list_contents" \
+ "$_gen_file_list_needle_gcno" "$_gen_file_list_replacement")
- _gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "gcda" "gcno")
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcno" "$_gen_file_lists_replacement")
+ cd "$p"
- else
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_src" "")
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_obj" "")
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcda" "")
- _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcno" "")
- fi
-
- printf '%s\n' "$_gen_file_lists_contents"
+ printf '%s\n' "$_gen_file_list_contents"
}
bc_only=0
@@ -324,10 +343,12 @@ prompt=1
force=0
strip_bin=1
all_locales=0
+library=0
-while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do
+while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
case "$opt" in
+ a) library=1 ;;
b) bc_only=1 ;;
B) dc_only=1 ;;
c) coverage=1 ;;
@@ -352,6 +373,7 @@ while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do
LONG_OPTARG="${arg#*=}"
case $arg in
help) usage ;;
+ library) library=1 ;;
bc-only) bc_only=1 ;;
dc-only) dc_only=1 ;;
coverage) coverage=1 ;;
@@ -371,6 +393,20 @@ while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do
fi
BINDIR="$2"
shift ;;
+ includedir=?*) INCLUDEDIR="$LONG_OPTARG" ;;
+ includedir)
+ if [ "$#" -lt 2 ]; then
+ usage "No argument given for '--$arg' option"
+ fi
+ INCLUDEDIR="$2"
+ shift ;;
+ libdir=?*) LIBDIR="$LONG_OPTARG" ;;
+ libdir)
+ if [ "$#" -lt 2 ]; then
+ usage "No argument given for '--$arg' option"
+ fi
+ LIBDIR="$2"
+ shift ;;
datarootdir=?*) DATAROOTDIR="$LONG_OPTARG" ;;
datarootdir)
if [ "$#" -lt 2 ]; then
@@ -399,6 +435,13 @@ while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do
fi
MAN1DIR="$2"
shift ;;
+ man3dir=?*) MAN3DIR="$LONG_OPTARG" ;;
+ man3dir)
+ if [ "$#" -lt 2 ]; then
+ usage "No argument given for '--$arg' option"
+ fi
+ MAN3DIR="$2"
+ shift ;;
localedir=?*) LOCALEDIR="$LONG_OPTARG" ;;
localedir)
if [ "$#" -lt 2 ]; then
@@ -454,6 +497,12 @@ if [ "$bc_only" -eq 1 ] && [ "$dc_only" -eq 1 ]; then
usage "Can only specify one of -b(-D) or -d(-B)"
fi
+if [ "$library" -ne 0 ]; then
+ if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then
+ usage "Must not specify -b(-D) or -d(-B) when building the library"
+ fi
+fi
+
case $karatsuba_len in
(*[!0-9]*|'') usage "KARATSUBA_LEN is not a number" ;;
(*) ;;
@@ -529,6 +578,8 @@ link="@printf 'No link necessary\\\\n'"
main_exec="BC"
executable="BC_EXEC"
+tests="test_bc timeconst test_dc"
+
bc_test="@tests/all.sh bc $extra_math 1 $generate_tests 0 \$(BC_EXEC)"
bc_time_test="@tests/all.sh bc $extra_math 1 $generate_tests 1 \$(BC_EXEC)"
@@ -567,7 +618,8 @@ if [ "$bc_only" -eq 1 ]; then
dc_time_test="@printf 'No dc tests to run\\\\n'"
vg_dc_test="@printf 'No dc tests to run\\\\n'"
- install_prereqs=" install_bc_manpage"
+ install_prereqs=" install_execs"
+ install_man_prereqs=" install_bc_manpage"
uninstall_prereqs=" uninstall_bc"
uninstall_man_prereqs=" uninstall_bc_manpage"
@@ -590,7 +642,8 @@ elif [ "$dc_only" -eq 1 ]; then
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
- install_prereqs=" install_dc_manpage"
+ install_prereqs=" install_execs"
+ install_man_prereqs=" install_dc_manpage"
uninstall_prereqs=" uninstall_dc"
uninstall_man_prereqs=" uninstall_dc_manpage"
@@ -606,9 +659,18 @@ else
karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
- install_prereqs=" install_bc_manpage install_dc_manpage"
- uninstall_prereqs=" uninstall_bc uninstall_dc"
- uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage"
+ if [ "$library" -eq 0 ]; then
+ install_prereqs=" install_execs"
+ install_man_prereqs=" install_bc_manpage install_dc_manpage"
+ uninstall_prereqs=" uninstall_bc uninstall_dc"
+ uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage"
+ else
+ install_prereqs=" install_library install_bcl_header"
+ install_man_prereqs=" install_bcl_manpage"
+ uninstall_prereqs=" uninstall_library uninstall_bcl_header"
+ uninstall_man_prereqs=" uninstall_bcl_manpage"
+ tests="test_library"
+ fi
fi
@@ -664,6 +726,14 @@ if [ -z "${BINDIR+set}" ]; then
BINDIR="$PREFIX/bin"
fi
+if [ -z "${INCLUDEDIR+set}" ]; then
+ INCLUDEDIR="$PREFIX/include"
+fi
+
+if [ -z "${LIBDIR+set}" ]; then
+ LIBDIR="$PREFIX/lib"
+fi
+
if [ "$install_manpages" -ne 0 ] || [ "$nls" -ne 0 ]; then
if [ -z "${DATAROOTDIR+set}" ]; then
DATAROOTDIR="$PREFIX/share"
@@ -684,11 +754,25 @@ if [ "$install_manpages" -ne 0 ]; then
MAN1DIR="$MANDIR/man1"
fi
+ if [ -z "${MAN3DIR+set}" ]; then
+ MAN3DIR="$MANDIR/man3"
+ fi
+
else
- install_prereqs=""
+ install_man_prereqs=""
uninstall_man_prereqs=""
fi
+if [ "$library" -ne 0 ]; then
+ extra_math=1
+ nls=0
+ hist=0
+ prompt=0
+ ALL_PREREQ="library"
+else
+ ALL_PREREQ="execs"
+fi
+
if [ "$nls" -ne 0 ]; then
set +e
@@ -776,11 +860,11 @@ if [ "$hist" -eq 1 ]; then
printf 'Testing history...\n'
flags="-DBC_ENABLE_HISTORY=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc"
- flags="$flags -DBC_ENABLE_NLS=$nls"
+ flags="$flags -DBC_ENABLE_NLS=$nls -DBC_ENABLE_LIBRARY=0"
flags="$flags -DBC_ENABLE_EXTRA_MATH=$extra_math -I./include/"
flags="$flags -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700"
- "$CC" $CPPFLAGS $CFLAGS $flags -c "src/history/history.c" -o "$scriptdir/history.o" > /dev/null 2>&1
+ "$CC" $CPPFLAGS $CFLAGS $flags -c "src/history.c" -o "$scriptdir/history.o" > /dev/null 2>&1
err="$?"
@@ -804,7 +888,11 @@ if [ "$hist" -eq 1 ]; then
fi
-if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ]; then
+if [ "$library" -eq 1 ]; then
+ bc_lib=""
+fi
+
+if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ] && [ "$library" -eq 0 ]; then
BC_LIB2_O="\$(GEN_DIR)/lib2.o"
else
BC_LIB2_O=""
@@ -846,6 +934,33 @@ if [ "$manpage_args" = "" ]; then
manpage_args="A"
fi
+unneeded=""
+
+if [ "$hist" -eq 0 ]; then
+ unneeded="$unneeded history.c"
+fi
+
+if [ "$bc" -eq 0 ]; then
+ unneeded="$unneeded bc.c bc_lex.c bc_parse.c"
+fi
+
+if [ "$dc" -eq 0 ]; then
+ unneeded="$unneeded dc.c dc_lex.c dc_parse.c"
+fi
+
+if [ "$extra_math" -eq 0 ]; then
+ unneeded="$unneeded rand.c"
+fi
+
+if [ "$library" -ne 0 ]; then
+ unneeded="$unneeded args.c opt.c read.c file.c main.c"
+ unneeded="$unneeded lang.c lex.c parse.c program.c"
+ unneeded="$unneeded bc.c bc_lex.c bc_parse.c"
+ unneeded="$unneeded dc.c dc_lex.c dc_parse.c"
+else
+ unneeded="$unneeded library.c"
+fi
+
# Print out the values; this is for debugging.
if [ "$bc" -ne 0 ]; then
printf 'Building bc\n'
@@ -858,6 +973,7 @@ else
printf 'Not building dc\n'
fi
printf '\n'
+printf 'BC_ENABLE_LIBRARY=%s\n\n' "$library"
printf 'BC_ENABLE_HISTORY=%s\n' "$hist"
printf 'BC_ENABLE_EXTRA_MATH=%s\n' "$extra_math"
printf 'BC_ENABLE_NLS=%s\n' "$nls"
@@ -873,10 +989,13 @@ printf 'CPPFLAGS=%s\n' "$CPPFLAGS"
printf 'LDFLAGS=%s\n' "$LDFLAGS"
printf 'PREFIX=%s\n' "$PREFIX"
printf 'BINDIR=%s\n' "$BINDIR"
+printf 'INCLUDEDIR=%s\n' "$INCLUDEDIR"
+printf 'LIBDIR=%s\n' "$LIBDIR"
printf 'DATAROOTDIR=%s\n' "$DATAROOTDIR"
printf 'DATADIR=%s\n' "$DATADIR"
printf 'MANDIR=%s\n' "$MANDIR"
printf 'MAN1DIR=%s\n' "$MAN1DIR"
+printf 'MAN3DIR=%s\n' "$MAN3DIR"
printf 'NLSPATH=%s\n' "$NLSPATH"
printf 'EXECSUFFIX=%s\n' "$EXECSUFFIX"
printf 'EXECPREFIX=%s\n' "$EXECPREFIX"
@@ -892,16 +1011,17 @@ replacement='*** WARNING: Autogenerated from Makefile.
contents=$(replace "$contents" "$needle" "$replacement")
-contents=$(gen_file_lists "$contents" "$scriptdir/src" "")
-contents=$(gen_file_lists "$contents" "$scriptdir/src/bc" "BC_" "$bc")
-contents=$(gen_file_lists "$contents" "$scriptdir/src/dc" "DC_" "$dc")
-contents=$(gen_file_lists "$contents" "$scriptdir/src/history" "HISTORY_" "$hist")
-contents=$(gen_file_lists "$contents" "$scriptdir/src/rand" "RAND_" "$extra_math")
+if [ "$unneeded" = "" ]; then
+ contents=$(gen_file_list "$contents" "library.c")
+else
+ contents=$(gen_file_list "$contents" $unneeded)
+fi
contents=$(replace "$contents" "BC_ENABLED" "$bc")
contents=$(replace "$contents" "DC_ENABLED" "$dc")
contents=$(replace "$contents" "LINK" "$link")
+contents=$(replace "$contents" "LIBRARY" "$library")
contents=$(replace "$contents" "HISTORY" "$hist")
contents=$(replace "$contents" "EXTRA_MATH" "$extra_math")
contents=$(replace "$contents" "NLS" "$nls")
@@ -917,7 +1037,10 @@ contents=$(replace "$contents" "DESTDIR" "$destdir")
contents=$(replace "$contents" "EXECSUFFIX" "$EXECSUFFIX")
contents=$(replace "$contents" "EXECPREFIX" "$EXECPREFIX")
contents=$(replace "$contents" "BINDIR" "$BINDIR")
+contents=$(replace "$contents" "INCLUDEDIR" "$INCLUDEDIR")
+contents=$(replace "$contents" "LIBDIR" "$LIBDIR")
contents=$(replace "$contents" "MAN1DIR" "$MAN1DIR")
+contents=$(replace "$contents" "MAN3DIR" "$MAN3DIR")
contents=$(replace "$contents" "CFLAGS" "$CFLAGS")
contents=$(replace "$contents" "HOSTCFLAGS" "$HOSTCFLAGS")
contents=$(replace "$contents" "CPPFLAGS" "$CPPFLAGS")
@@ -927,15 +1050,19 @@ contents=$(replace "$contents" "HOSTCC" "$HOSTCC")
contents=$(replace "$contents" "COVERAGE_OUTPUT" "$COVERAGE_OUTPUT")
contents=$(replace "$contents" "COVERAGE_PREREQS" "$COVERAGE_PREREQS")
contents=$(replace "$contents" "INSTALL_PREREQS" "$install_prereqs")
+contents=$(replace "$contents" "INSTALL_MAN_PREREQS" "$install_man_prereqs")
contents=$(replace "$contents" "INSTALL_LOCALES" "$install_locales")
contents=$(replace "$contents" "INSTALL_LOCALES_PREREQS" "$install_locales_prereqs")
contents=$(replace "$contents" "UNINSTALL_MAN_PREREQS" "$uninstall_man_prereqs")
contents=$(replace "$contents" "UNINSTALL_PREREQS" "$uninstall_prereqs")
contents=$(replace "$contents" "UNINSTALL_LOCALES_PREREQS" "$uninstall_locales_prereqs")
+contents=$(replace "$contents" "ALL_PREREQ" "$ALL_PREREQ")
+
contents=$(replace "$contents" "EXECUTABLES" "$executables")
contents=$(replace "$contents" "MAIN_EXEC" "$main_exec")
contents=$(replace "$contents" "EXEC" "$executable")
+contents=$(replace "$contents" "TESTS" "$tests")
contents=$(replace "$contents" "BC_TEST" "$bc_test")
contents=$(replace "$contents" "BC_TIME_TEST" "$bc_time_test")
Copied: stable/12/contrib/bc/exec-install.sh (from r368072, head/contrib/bc/exec-install.sh)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/12/contrib/bc/exec-install.sh Thu Dec 10 08:48:03 2020 (r368501, copy of r368072, head/contrib/bc/exec-install.sh)
@@ -0,0 +1,63 @@
+#! /bin/sh
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+usage() {
+ printf "usage: %s install_dir exec_suffix\n" "$0" 1>&2
+ exit 1
+}
+
+script="$0"
+scriptdir=$(dirname "$script")
+
+. "$scriptdir/functions.sh"
+
+INSTALL="$scriptdir/safe-install.sh"
+
+test "$#" -ge 2 || usage
+
+installdir="$1"
+shift
+
+exec_suffix="$1"
+shift
+
+bindir="$scriptdir/bin"
+
+for exe in $bindir/*; do
+
+ base=$(basename "$exe")
+
+ if [ -L "$exe" ]; then
+ link=$(readlink "$exe")
+ "$INSTALL" -Dlm 755 "$link$exec_suffix" "$installdir/$base$exec_suffix"
+ else
+ "$INSTALL" -Dm 755 "$exe" "$installdir/$base$exec_suffix"
+ fi
+
+done
Modified: stable/12/contrib/bc/gen/lib.bc
==============================================================================
--- stable/12/contrib/bc/gen/lib.bc Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/gen/lib.bc Thu Dec 10 08:48:03 2020 (r368501)
@@ -173,7 +173,7 @@ define a(x){
return((m*a+r)/n)
}
define j(n,x){
- auto b,s,o,a,i,v,f
+ auto b,s,o,a,i,r,v,f
b=ibase
ibase=A
s=scale
Modified: stable/12/contrib/bc/gen/strgen.c
==============================================================================
--- stable/12/contrib/bc/gen/strgen.c Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/gen/strgen.c Thu Dec 10 08:48:03 2020 (r368501)
@@ -45,13 +45,14 @@
static const char* const bc_gen_header =
"// Copyright (c) 2018-2020 Gavin D. Howard and contributors.\n"
"// Licensed under the 2-clause BSD license.\n"
- "// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n";
+ "// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n";
-static const char* const bc_gen_include = "#include <%s>\n\n";
static const char* const bc_gen_label = "const char *%s = \"%s\";\n\n";
+static const char* const bc_gen_label_extern = "extern const char *%s;\n\n";
static const char* const bc_gen_ifdef = "#if %s\n";
static const char* const bc_gen_endif = "#endif // %s\n";
static const char* const bc_gen_name = "const char %s[] = {\n";
+static const char* const bc_gen_name_extern = "extern const char %s[];\n\n";
#define IO_ERR (1)
#define INVALID_INPUT_FILE (2)
@@ -62,7 +63,7 @@ static const char* const bc_gen_name = "const char %s[
int main(int argc, char *argv[]) {
FILE *in, *out;
- char *label, *define, *name, *include;
+ char *label, *define, *name;
int c, count, slashes, err = IO_ERR;
bool has_label, has_define, remove_tabs;
@@ -72,15 +73,14 @@ int main(int argc, char *argv[]) {
}
name = argv[3];
- include = argv[4];
- has_label = (argc > 5 && strcmp("", argv[5]) != 0);
- label = has_label ? argv[5] : "";
+ has_label = (argc > 4 && strcmp("", argv[4]) != 0);
+ label = has_label ? argv[4] : "";
- has_define = (argc > 6 && strcmp("", argv[6]) != 0);
- define = has_define ? argv[6] : "";
+ has_define = (argc > 5 && strcmp("", argv[5]) != 0);
+ define = has_define ? argv[5] : "";
- remove_tabs = (argc > 7);
+ remove_tabs = (argc > 6);
in = fopen(argv[1], "r");
if (!in) return INVALID_INPUT_FILE;
@@ -89,8 +89,9 @@ int main(int argc, char *argv[]) {
if (!out) goto out_err;
if (fprintf(out, bc_gen_header, argv[1]) < 0) goto err;
+ if (has_label && fprintf(out, bc_gen_label_extern, label) < 0) goto err;
+ if (fprintf(out, bc_gen_name_extern, name) < 0) goto err;
if (has_define && fprintf(out, bc_gen_ifdef, define) < 0) goto err;
- if (fprintf(out, bc_gen_include, include) < 0) goto err;
if (has_label && fprintf(out, bc_gen_label, label, argv[1]) < 0) goto err;
if (fprintf(out, bc_gen_name, name) < 0) goto err;
Modified: stable/12/contrib/bc/gen/strgen.sh
==============================================================================
--- stable/12/contrib/bc/gen/strgen.sh Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/gen/strgen.sh Thu Dec 10 08:48:03 2020 (r368501)
@@ -32,24 +32,24 @@ export LC_CTYPE=C
progname=${0##*/}
-if [ $# -lt 4 ]; then
- echo "usage: $progname input output name header [label [define [remove_tabs]]]"
+if [ $# -lt 3 ]; then
+ echo "usage: $progname input output name [label [define [remove_tabs]]]"
exit 1
fi
input="$1"
output="$2"
name="$3"
-header="$4"
-label="$5"
-define="$6"
-remove_tabs="$7"
+label="$4"
+define="$5"
+remove_tabs="$6"
exec < "$input"
exec > "$output"
if [ -n "$label" ]; then
nameline="const char *${label} = \"${input}\";"
+ labelexternline="extern const char *${label};"
fi
if [ -n "$define" ]; then
@@ -64,11 +64,14 @@ if [ -n "$remove_tabs" ]; then
fi
cat<<EOF
+// Copyright (c) 2018-2020 Gavin D. Howard and contributors.
// Licensed under the 2-clause BSD license.
// *** AUTOMATICALLY GENERATED FROM ${input}. DO NOT MODIFY. ***
${condstart}
-#include <${header}>
+$labelexternline
+
+extern const char $name[];
$nameline
Modified: stable/12/contrib/bc/include/bc.h
==============================================================================
--- stable/12/contrib/bc/include/bc.h Thu Dec 10 07:13:15 2020 (r368500)
+++ stable/12/contrib/bc/include/bc.h Thu Dec 10 08:48:03 2020 (r368501)
@@ -173,6 +173,10 @@ extern const BcParseNext bc_parse_next_elem;
extern const BcParseNext bc_parse_next_for;
extern const BcParseNext bc_parse_next_read;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list