|
|
1a1e15 |
A few words on sofort's tool-finding logic
|
|
|
1a1e15 |
==========================================
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# the goals of sofort's tool-finding logic are:
|
|
|
1a1e15 |
- follow a clear, transparent, and consistent logic
|
|
|
1a1e15 |
- allow users to easily specify per-build preferences
|
|
|
1a1e15 |
- allow distros to easily and cleanly use site-wide settings
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# three-way terminology:
|
|
|
1a1e15 |
- native machine: where make(1) will be running.
|
|
|
1a1e15 |
- host machine: where the package's program or libraries will execute.
|
|
|
1a1e15 |
- target machine: where code generated by the host package will execute.
|
|
|
1a1e15 |
|
|
|
1a1e15 |
! NOTE, however, that the host/target distinction is only relevant
|
|
|
1a1e15 |
when building a code-generating utility (e.g. a compiler), and that
|
|
|
1a1e15 |
the two are otherwise rather synonymous. Moreover, in practice it
|
|
|
1a1e15 |
is much more common to see configure scripts being invoked with a
|
|
|
1a1e15 |
--target=<machine> argument specifying the host, than with a
|
|
|
1a1e15 |
--host=<machine> argument.
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# invocation and names of binary tools:
|
|
|
1a1e15 |
- agnostic names (ar, nm, objdump, ...)
|
|
|
1a1e15 |
- branded names (llvm-ar, llvm-nm, llvm-objdump, ...)
|
|
|
1a1e15 |
- machine-prefixed agnostic names (x86_64-nt64-midipix-ar, ...)
|
|
|
1a1e15 |
- machine-prefixed branded names (x86_64-linux-gnu-gcc-ar, ...)
|
|
|
1a1e15 |
- machine-specifying branded tools, as in
|
|
|
1a1e15 |
llvm-ar --target=x86_64-linux.
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# cross-compilation: default search order:
|
|
|
1a1e15 |
- machine-prefixed agnostic tools
|
|
|
1a1e15 |
- machine-prefixed branded tools, starting with the prefix
|
|
|
1a1e15 |
most commonly associated with the selected compiler (that is,
|
|
|
1a1e15 |
``gcc'' when using gcc, and ``llvm'' when using clang)
|
|
|
1a1e15 |
- (machine-specifying) agnostic tools
|
|
|
1a1e15 |
- (machine-speficying) branded tools, starting once again with the
|
|
|
1a1e15 |
prefix most commonly associated with the selected compiler
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# native builds: default search order:
|
|
|
1a1e15 |
- agnostic tools
|
|
|
1a1e15 |
- machine-prefixed agnostic tools
|
|
|
1a1e15 |
- machine-prefixed branded tools
|
|
|
1a1e15 |
- branded tools
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# using an alternate search order:
|
|
|
1a1e15 |
- --toolchain=<prefix> (e.g. --toolchain=llvm) --> search for tools
|
|
|
1a1e15 |
that begin with <prefix> before searching for agnostic tools
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# restricting which tools may be searched:
|
|
|
1a1e15 |
- --zealous --> only search for agnostic tools
|
|
|
1a1e15 |
- --zealous=<prefix> --> only search for <prefix>-branded tools
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# per-tool overrides, by example of the ``ar'' tool:
|
|
|
1a1e15 |
- AR=ar --> set AR to $(command -v ar)
|
|
|
1a1e15 |
- AR=/path/to/ar --> set AR to the specified absolute path
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# consistency:
|
|
|
1a1e15 |
- in the above case of AR=ar, using $(command -v ar) ensures
|
|
|
1a1e15 |
that the same tool is used throughout the lifetime of the
|
|
|
1a1e15 |
build project.
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# host generated config file and variable names:
|
|
|
1a1e15 |
- ccenv/host.mk
|
|
|
1a1e15 |
- AR, NM, OBJDUMP, ...
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# native generated config file and variable names:
|
|
|
1a1e15 |
- ccenv/native.mk
|
|
|
1a1e15 |
- NATIVE_AR, NATIVE_NM, NATIVE_OBJDUMP, ...
|
|
|
1a1e15 |
|
|
|
1a1e15 |
|
|
|
1a1e15 |
# distro: site-wide preferences
|
|
|
1a1e15 |
- --ccenv=/path/to/site-specific/ccenv
|
|
|
1a1e15 |
- use the above to create ccenv as a symlink to
|
|
|
1a1e15 |
/path/to/site-specific/ccenv, and to accordingly
|
|
|
1a1e15 |
skip configure's tool-finding step.
|