Lines Matching +full:build +full:- +full:in
1 # Build chapter
4 POSIX-compliant system.
6 To accomplish that, a POSIX-compatible, custom `configure.sh` script is used to
7 select build options, compiler, and compiler flags and generate a `Makefile`.
22 ./configure.sh -h
23 ./configure.sh --help
36 See [Build Environment Variables][4] for a more detailed description of all
37 accepted environment variables and [Build Options][5] for more detail about all
38 accepted build options.
45 However, if you wish to build it yourself, this `bc` can be built using Visual
48 Unfortunately, only one build configuration (besides Debug or Release) is
57 In Visual Studio, open up the solution file (`bc.sln` for `bc`, or `bcl.sln` for
58 the library), select the desired configuration, and build.
62 To build with MSBuild, first, *be sure that you are using the MSBuild that comes
65 To build `bc`, run the following from the root directory:
68 msbuild -property:Configuration=<config> vs/bc.sln
73 To build the library, run the following from the root directory:
76 msbuild -property:Configuration=<config> vs/bcl.sln
81 ## POSIX-Compatible Systems
84 because many build options are supported.
86 ### Out-of-Source Builds
88 Out-of-source builds are done by calling `configure.sh` from the directory where
89 the build will happen. The `Makefile` is generated into that directory, and the
90 build can happen normally from there.
92 For example, if the source is in `bc`, the build should happen in `build`, then
100 ***WARNING***: The path to `configure.sh` from the build directory must not have
105 To cross-compile this `bc`, an appropriate compiler must be present and assigned
107 though `HOSTCC` is prioritized). This is in order to bootstrap core file(s), if
117 `HOST_CC` will work in exactly the same way.
122 uses `CFLAGS` (see [Build Environment Variables][4] for more details).
125 produces code for the host system. See [Build Environment Variables][4] for more
131 ### Build Environment Variables
136 `EXECPREFIX`, `LONG_BIT`, `GEN_HOST`, and `GEN_EMU` environment variables in
140 More detail on what those environment variables do can be found in the following
149 If there is a space in the basename of the compiler, the items after the first
150 space are assumed to be compiler flags, and in that case, the flags are
157 C compiler for the host system, used only in [cross compiling][6]. Must be
160 If there is a space in the basename of the compiler, the items after the first
161 space are assumed to be compiler flags, and in that case, the flags are
168 Command-line flags that will be passed verbatim to `CC`.
174 Command-line flags that will be passed verbatim to `HOSTCC` or `HOST_CC`.
180 Command-line flags for the C preprocessor. These are also passed verbatim to
187 Command-line flags for the linker. These are also passed verbatim to both
204 Can be overridden by passing the `--prefix` option to `configure.sh`.
224 The directory to install binaries in.
226 Can be overridden by passing the `--bindir` option to `configure.sh`.
232 The directory to install header files in.
234 Can be overridden by passing the `--includedir` option to `configure.sh`.
240 The directory to install libraries in.
242 Can be overridden by passing the `--libdir` option to `configure.sh`.
248 The root directory to install data files in.
250 Can be overridden by passing the `--datarootdir` option to `configure.sh`.
256 The directory to install data files in.
258 Can be overridden by passing the `--datadir` option to `configure.sh`.
264 The directory to install manpages in.
266 Can be overridden by passing the `--mandir` option to `configure.sh`.
272 The directory to install Section 1 manpages in. Because both `bc` and `dc` are
275 Can be overridden by passing the `--man1dir` option to `configure.sh`.
281 The directory to install Section 3 manpages in.
283 Can be overridden by passing the `--man3dir` option to `configure.sh`.
305 The number of bits in a C `long` type. This is mostly for the embedded space.
307 This `bc` uses `long`s internally for overflow checking. In C99, a `long` is
308 required to be 32 bits. For this reason, on 8-bit and 16-bit microcontrollers,
311 For most normal desktop systems, setting this is unnecessary, except that 32-bit
312 platforms with 64-bit longs may want to set it to `32`.
328 literal in C99 (and it could be added to in the future), and `gen/strgen.sh`
330 production-ready compilers, this limit probably is not enforced, but it could
335 or a non-existent value, will cause the build system to compile and run
347 ### Build Options
349 This `bc` comes with several build options, all of which are enabled by default.
358 --option arg
359 --option=arg
364 To quickly get a release build of a `bc` and `dc` that is (by default)
365 compatible with the BSD `bc` and `dc`, use the `-p` or `--predefined-build-type`
369 ./configure.sh -pBSD
370 ./configure.sh --predefined-build-type=BSD
375 To quickly get a release build of a `bc` and `dc` that is (by default)
376 compatible with the GNU `bc` and `dc`, use the `-p` or `--predefined-build-type`
380 ./configure.sh -pGNU
381 ./configure.sh --predefined-build-type=GNU
388 To build the math library, use the following commands for the configure step:
391 ./configure.sh -a
392 ./configure.sh --library
401 To build an optimized version of the library, users can pass optimization
402 options to `configure.sh` or include them in `CFLAGS`.
404 The library API can be found in `manuals/bcl.3.md` or `man bcl` once the library
411 To build `bc` only (no `dc`), use any one of the following commands for the
415 ./configure.sh -b
416 ./configure.sh --bc-only
417 ./configure.sh -D
418 ./configure.sh --disable-dc
428 To build `dc` only (no `bc`), use either one of the following commands for the
432 ./configure.sh -d
433 ./configure.sh --dc-only
434 ./configure.sh -B
435 ./configure.sh --disable-bc
445 To disable hisory, pass either the `-H` flag or the `--disable-history` option
449 ./configure.sh -H
450 ./configure.sh --disable-history
455 ***WARNING***: Of all of the code in the `bc`, this is the only code that is not
459 This option affects the [build type][7].
463 History support can be provided by editline, in order to implement `vi`-like
466 To enable editline support, pass either the `-e` flag or the `--enable-editline`
470 ./configure.sh -e
471 ./configure.sh --enable-editline
478 This option is only used if it is after any other `-e`/`--enable-editline`
479 options, any `-r`/`--enable-readline` options, and any
480 `-i`/`--enable-internal-history` options.
484 History support can be provided by readline, in order to implement `vi`-like
487 To enable readline support, pass either the `-r` flag or the `--enable-readline`
491 ./configure.sh -r
492 ./configure.sh --enable-readline
499 This option is only used if it is after any other `-r`/`--enable-readline`
500 options, any `-e`/`--enable-editline` options, and any
501 `-i`/`--enable-internal-history` options.
508 However, if `-p` option is used, then this option can be useful for selecting
509 the internal history regardless of what the predefined build has.
511 To enable the internal history, pass either the `-i` flag or the
512 `--enable-internal-history` option to `configure.sh` as follows:
515 ./configure.sh -i
516 ./configure.sh --enable-internal-history
520 `-i`/`--enable-internal-history` options, any `-e`/`--enable-editline` options,
521 and any `-r`/`--enable-readline` options.
525 To disable locale support (use only English), pass either the `-N` flag or the
526 `--disable-nls` option to `configure.sh`, as follows:
529 ./configure.sh -N
530 ./configure.sh --disable-nls
538 This option affects the [build type][7].
558 The assignment versions of the above operators are not available in `dc`, but
561 In addition, this `bc` has the option of outputting in scientific notation or
562 engineering notation. It can also take input in scientific or engineering
563 notation. On top of that, it has a pseudo-random number generator. (See the
567 pseudo-random number generator can be disabled by passing either the `-E` flag
568 or the `--disable-extra-math` option to `configure.sh`, as follows:
571 ./configure.sh -E
572 ./configure.sh --disable-extra-math
578 the pseudo-random number generator are. More information about the functions can
579 be found in the Extended Library section of the full manual.
581 This option affects the [build type][7].
587 the `-k` flag or the `--karatsuba-len` option to `configure.sh` as follows:
590 ./configure.sh -k32
591 ./configure.sh --karatsuba-len 32
609 To set a default to **on**, use the `-s` or `--set-default-on` option to
613 ./configure.sh -s bc.banner
614 ./configure.sh --set-default-on=bc.banner
619 To set a default to **off**, use the `-S` or `--set-default-off` option to
623 ./configure.sh -S bc.banner
624 ./configure.sh --set-default-off=bc.banner
631 turned **on** for a non-zero integer, and **off** for zero.
641 | | banner when in | | |
643 | --------------- | -------------------- | ------------ | -------------------- |
646 | | exiting, when in | | |
648 | --------------- | -------------------- | ------------ | -------------------- |
651 | | exiting, when in | | |
653 | --------------- | -------------------- | ------------ | -------------------- |
657 | --------------- | -------------------- | ------------ | -------------------- |
661 | --------------- | -------------------- | ------------ | -------------------- |
664 | | in tty mode. | | |
665 | --------------- | -------------------- | ------------ | -------------------- |
668 | | in tty mode. | | |
669 | --------------- | -------------------- | ------------ | -------------------- |
673 | | given with the -e or | | |
674 | | -f options. | | |
675 | --------------- | -------------------- | ------------ | -------------------- |
679 | | given with the -e or | | |
680 | | -f options. | | |
681 | --------------- | -------------------- | ------------ | -------------------- |
688 | --------------- | -------------------- | ------------ | -------------------- |
695 | --------------- | -------------------- | ------------ | -------------------- |
704 The relevant `autotools`-style install options are supported in `configure.sh`:
706 * `--prefix`
707 * `--bindir`
708 * `--datarootdir`
709 * `--datadir`
710 * `--mandir`
711 * `--man1dir`
712 * `--man3dir`
717 ./configure.sh --prefix=/usr
732 ***WARNING***: If any long command-line options are used, the long form of all
733 other command-line options must be used. Mixing long and short options is not
738 To disable installing manpages, pass either the `-M` flag or the
739 `--disable-man-pages` option to `configure.sh` as follows:
742 ./configure.sh -M
743 ./configure.sh --disable-man-pages
752 the locales that exist on the system. The `-l` flag or `--install-all-locales`
754 have, regardless. To enable that behavior, you can pass the `-l` flag or the
755 `--install-all-locales` option to `configure.sh`, as follows:
758 ./configure.sh -l
759 ./configure.sh --install-all-locales
773 optimization level available in `CC` to `configure.sh` with the `-O` flag or
774 `--opt` option, as follows:
777 ./configure.sh -O3
778 ./configure.sh --opt 3
783 The build and install can then be run as normal:
794 CFLAGS="-march=native -msse4" ./configure.sh -O3
799 Building with link-time optimization (`-flto` in clang) can further increase the
802 I do ***NOT*** recommend building with `-march=native`; doing so reduces this
805 Manual stripping is not necessary; non-debug builds are automatically stripped
806 in the link stage.
811 and if no extra `CFLAGS` are given) can be enabled with either the `-g` flag or
812 the `--debug` option, as follows:
815 ./configure.sh -g
816 ./configure.sh --debug
821 The build and install can then be run as normal:
830 By default, when `bc` and `dc` are not built in debug mode, the binaries are
831 stripped. Stripping can be disabled with either the `-T` or the
832 `--disable-strip` option, as follows:
835 ./configure.sh -T
836 ./configure.sh --disable-strip
841 The build and install can then be run as normal:
848 ### Build Type
850 `bc` and `dc` have 8 build types, affected by the [History][8], [NLS (Locale
851 Support)][9], and [Extra Math][10] build options.
853 The build types are as follows:
864 These build types correspond to the generated manuals in `manuals/bc` and
869 When built with both calculators, all available features, and `-Os` using
871 isn't much for what is contained in the binary, but if necessary, it can be
878 can be reduced (for a build with both calculators) to 119.9 kb (119,866 bytes).
884 almost already in the form that it is executed in, while `bc` has to not only
887 * `dc` does not have much extra code in the interpreter.
888 * History has a lot of const data for supporting `UTF-8` terminals.
889 * History pulls in a bunch of more code from the `libc`.
900 * Extra math support includes support for a pseudo-random number generator,
901 including the code to convert a series of pseudo-random numbers into a number
912 `musl-clang` using `clang` `9.0.1`) as the compiler and using `-Os`
936 This `bc`, if built, assumes a working, GNU-compatible `bc`, installed on the
937 system and in the `PATH`, to generate some tests, unless the `-G` flag or
938 `--disable-generated-tests` option is given to `configure.sh`, as follows:
941 ./configure.sh -G
942 ./configure.sh --disable-generated-tests
945 After running `configure.sh`, build and run tests as follows:
952 This `dc` also assumes a working, GNU-compatible `dc`, installed on the system
953 and in the `PATH`, to generate some tests, unless one of the above options is
956 To generate test coverage, pass the `-c` flag or the `--coverage` option to
960 ./configure.sh -c
961 ./configure.sh --coverage
971 Some tests are problematic, in that they can cause `SIGKILL` on FreeBSD or
975 To disable problematic tests, pass the `-P` flag or the
976 `--disable-problematic-tests` option to `configure.sh` as follows:
979 ./configure.sh -P
980 ./configure.sh --disable-problematic-tests
987 [3]: https://www.musl-libc.org/
988 [4]: #build-environment-variables
989 [5]: #build-options
990 [6]: #cross-compiling
991 [7]: #build-type
993 [9]: #nls-locale-support
994 [10]: #extra-math