|
Kylie McClain |
51bef4 |
# slibtool
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
`slibtool` is an independent reimplementation of the commonly used libtool,
|
|
Kylie McClain |
51bef4 |
written in C. `slibtool` is designed to be a clean, fast, easy-to-use
|
|
Kylie McClain |
51bef4 |
libtool drop-in replacement, and is accordingly aimed at package authors,
|
|
Kylie McClain |
51bef4 |
distro developers, and system integrators. `slibtool` maintains compatibility
|
|
Kylie McClain |
51bef4 |
with libtool in nearly every aspect of the tool's functionality as well as
|
|
Kylie McClain |
51bef4 |
semantics, leaving out (or turning into no-ops) only a small number of
|
|
Kylie McClain |
51bef4 |
features that are no longer needed on modern systems.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
Being a compiled binary, and although not primarily written for the sake of
|
|
Kylie McClain |
51bef4 |
performance, building a package with `slibtool` is often faster than with its
|
|
Kylie McClain |
51bef4 |
script-based counterpart. The resulting performance gain would normally vary
|
|
Kylie McClain |
51bef4 |
between packages, and is most noticeable in builds that invoke libtool a large
|
|
Kylie McClain |
51bef4 |
number of times, and which are characterized by the short compilation time of
|
|
Kylie McClain |
51bef4 |
individual translation units.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
## Requirements for building slibtool
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
- a C toolchain, consisting of...
|
|
Kylie McClain |
51bef4 |
- a C compiler such as gcc, clang, or [cparser].
|
|
Kylie McClain |
51bef4 |
- The compiler should support -std=c99.
|
|
Kylie McClain |
51bef4 |
- The system's libc should support -D_XOPEN_SOURCE=700.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
## Usage
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
With most packages, simply adding `LIBTOOL=slibtool` to the `make` invocation
|
|
Kylie McClain |
51bef4 |
should suffice. To have `slibtool` operate in debug mode (outputting a colorized
|
|
Kylie McClain |
51bef4 |
raw argument vector), use `LIBTOOL=dlibtool` instead, or alternatively add
|
|
Kylie McClain |
51bef4 |
`--debug` to the libtool flags inside of your Makefile.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
### Corner cases
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
Some programs which make heavy use of recursive `make` are known to drop the
|
|
Kylie McClain |
51bef4 |
`LIBTOOL` value at some point in the process, and as such you may additionally
|
|
Kylie McClain |
51bef4 |
need to export the environment variable; `export MAKE="make LIBTOOL=slibtool"`.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
`slibtool` additionally installs two symlinks that are the equivalent of
|
|
Kylie McClain |
51bef4 |
`-disable-shared` and `-disable-static`, named `slibtool-static` and
|
|
Kylie McClain |
51bef4 |
`slibtool-shared`, respectively. These symlinks should be used when building
|
|
Kylie McClain |
51bef4 |
packages that have the above switches hard-coded into the generated libtool
|
|
Kylie McClain |
51bef4 |
script; two examples of such packages are `binutils` and `gdb`, which both have
|
|
Kylie McClain |
51bef4 |
shared library builds disabled by default. A quick way to determine whether this
|
|
Kylie McClain |
51bef4 |
invocation form is appropriate is to run `./libtool --features` from the build
|
|
Kylie McClain |
51bef4 |
directory, then check whether the output has either shared or static library
|
|
Kylie McClain |
51bef4 |
builds disabled.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
## Differences from GNU libtool
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
While `slibtool` aims to be compatible with all common usages of libtool, there
|
|
Kylie McClain |
51bef4 |
are a few differences at the implementation level that should be noted.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
- `-rpath` argument values are passed to the compiler and linker as needed only;
|
|
Kylie McClain |
51bef4 |
`-rpath` is often [mis]used by libtool to add redundant paths to a program's
|
|
Kylie McClain |
51bef4 |
linker search path. When using slibtool, `-rpath` argument values are only
|
|
Kylie McClain |
51bef4 |
forwarded to the compiler and linker when pointing to non-default linker
|
|
Kylie McClain |
51bef4 |
directories, and are accordingly filtered out when pointing to default library
|
|
Kylie McClain |
51bef4 |
locations (i.e. `/usr/lib`, `/lib`, and so on).
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
- no-ops
|
|
Kylie McClain |
51bef4 |
- `-R`, which adds a path to the generated program's run-time search path;
|
|
Kylie McClain |
51bef4 |
this switch is currently not needed, and is accordingly ignored.
|
|
Kylie McClain |
51bef4 |
- `-export-symbols`, which exports symbols listed in a given file, and
|
|
Kylie McClain |
51bef4 |
`-export-symbols-regex`, which exports symbols matching a regex;
|
|
Kylie McClain |
51bef4 |
both are unimplemented because similar functionality has long been
|
|
Kylie McClain |
51bef4 |
provided by the compiler or toolchain; `gcc` has supported setting ELF
|
|
Kylie McClain |
51bef4 |
visibility since v4.0, for instance, and PE import library support is
|
|
Kylie McClain |
51bef4 |
provided by slibtool via the --output-def linker switch and a subsequent
|
|
Kylie McClain |
51bef4 |
invocation of dlltool.
|
|
Kylie McClain |
51bef4 |
- `-no-install`, which considers the executable wrapper to be optional;
|
|
Kylie McClain |
51bef4 |
this switch is not needed on modern systems, and is accordingly ignored.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
- No `libltdl`.
|
|
Kylie McClain |
51bef4 |
libltdl is nowadays no longer needed; it serves to provide a `dlopen()`
|
|
Kylie McClain |
51bef4 |
functionality on systems which do not offer it, i.e. HP-UX and BeOS,
|
|
Kylie McClain |
51bef4 |
however since neither HP-UX nor BeOS is currently supported by slibtool,
|
|
Kylie McClain |
51bef4 |
there exists no urgent need to provide equivalent functionality.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
## Development
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
Major changes to slibtool should be discussed on [#midipix] prior to pursuing
|
|
Kylie McClain |
51bef4 |
a considerable effort, and patches should be sent, gpg-signed, to the project
|
|
Kylie McClain |
51bef4 |
maintainer; before hacking on slibtool, please take a moment of your time and
|
|
Kylie McClain |
51bef4 |
read the [CONTRIB] document.
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
Before finalizing your changes, please consider building at least once with
|
|
Kylie McClain |
51bef4 |
`cparser` as the compiler. cparser is excellent at catching logical errors
|
|
Kylie McClain |
51bef4 |
and semantic flaws, and at the time of this writing is capable of spotting
|
|
Kylie McClain |
51bef4 |
some errors that go unnoticed by the other major open source compilers.
|
|
Kylie McClain |
51bef4 |
For a few examples of such errors, see commits [94d109f], [1142bf2], and
|
|
Kylie McClain |
51bef4 |
[55c95a8].
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
## License
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
`slibtool` is distributed under a permissive [MIT license].
|
|
Kylie McClain |
51bef4 |
|
|
Kylie McClain |
51bef4 |
[MIT license]: http://git.midipix.org/cgit.cgi/slibtool/tree/COPYING.SLIBTOOL
|
|
Kylie McClain |
51bef4 |
[libltdl]: https://www.gnu.org/software/libtool/manual/html_node/Using-libltdl.html#Using-libltdl
|
|
Kylie McClain |
51bef4 |
[dlopen()]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dlopen.html
|
|
Kylie McClain |
51bef4 |
[CONTRIB]: http://git.midipix.org/cgit.cgi/slibtool/tree/CONTRIB
|
|
Kylie McClain |
51bef4 |
[libtool]: https://www.gnu.org/software/libtool/
|
|
Kylie McClain |
51bef4 |
[#midipix]: irc://irc.freenode.net/#midipix
|
|
Kylie McClain |
51bef4 |
[cparser]: http://pp.ipd.kit.edu/git/cparser/
|
|
Kylie McClain |
51bef4 |
[94d109f]: http://git.midipix.org/cgit.cgi/slibtool/commit/?id=94d109fa418c024c214a50d645624e2e2935e6d1
|
|
Kylie McClain |
51bef4 |
[1142bf2]: http://git.midipix.org/cgit.cgi/slibtool/commit/?id=1142bf2e13f411cf967c1ed8b4060d7829eb13bb
|
|
Kylie McClain |
51bef4 |
[55c95a8]: http://git.midipix.org/cgit.cgi/slibtool/commit/?id=55c95a829928ae9f053678a58a2145276cad9c08
|