README
research for libsigrok drivers list construction (bug 1433,
spotted by broken LTO builds, turned into no-linker-magic later)
this README is a short summary, the NOTES.txt file has more details
warning to testers, note about compatibility: this repo experiments
with several approaches to the construction of the drivers list,
some of them not stable yet, or not portable enough -- when in doubt
then check the constructors-only version as of commit 75c4a1518306,
to not get affected by non-operational linker section support code
fresh checkout might have to create configure script first
$ autoreconf -i
out of source build recommended, to hold
several configuration variants in parallel:
$ mkdir build && cd build
build with or without LTO support enabled:
$ ../configure
$ env CFLAGS=-flto LDFLAGS=-flto ../configure
build with drivers enabled/disabled (up to five, enabled by default)
$ ../configure --disable-driver2
then
$ make && ./app_combo
curious users want to dump the driver list content
$ make dump
for cross builds:
... similar sequence, but slightly modified ...
$ ../configure --host=...
...
$ make install DESTDIR=`pwd`/output
(other machine) > ./output/usr/bin/app_combo
example for multiple parallel configurations:
$ git clone git://repo.or.cz/autotool-experiments.git
$ cd autotools-experiments
$ autoreconf -i
$ mkdir build-empty && pushd build-empty
$ ../configure --disable-driver1 --disable-driver2 --disable-driver3 --disable-driver4 --disable-driver5 --disable-driver6 --disable-driver7 --disable-driver8
$ popd
$ mkdir build-empty-lto && pushd build-empty-lto
$ env CFLAGS=-flto LDFLAGS=-flto ../configure --disable-driver1 --disable-driver2 --disable-driver3 --disable-driver4 --disable-driver5 --disable-driver6 --disable-driver7 --disable-driver8
$ popd
$ mkdir build-some && pushd build-some
$ ../configure --disable-driver1 --enable-driver2 --enable-driver3 --disable-driver4 --disable-driver5
$ popd
$ mkdir build-some-lto && pushd build-some-lto
$ env CFLAGS=-flto LDFLAGS=-flto ../configure --disable-driver1 --enable-driver2 --enable-driver3 --disable-driver4 --disable-driver5
$ popd
$ mkdir build-all && pushd build-all
$ ../configure --enable-driver1 --enable-driver2 --enable-driver3 --enable-driver4 --enable-driver5 --enable-driver6 --enable-driver7 --enable-driver8
$ popd
$ mkdir build-all-lto && pushd build-all-lto
$ env CFLAGS=-flto LDFLAGS=-flto ../configure --enable-driver1 --enable-driver2 --enable-driver3 --enable-driver4 --enable-driver5 --enable-driver6 --enable-driver7 --enable-driver8
$ popd
$ DIRS="build-empty build-empty-lto build-some build-some-lto build-all build-all-lto"
$ for D in $DIRS; do make -C $D; done
$ for D in $DIRS; do echo "directory $D"; ./$D/app_combo; echo ""; done
$ for D in $DIRS; do make -C $D dump; done
when cmake is preferred over autotools:
$ mkdir build && cd build
$ cmake ..
$ cmake --build . && ./app_combo
to adjust the configurations or cross build:
$ cmake -DWITH_LTO=ON .
$ cmake -DWITH_LTO=OFF .
$ cmake -DWITH_DRIVER_3=OFF -DWITH_DRIVER_5=OFF .
$ ccmake .
$ i686-w64-mingw32.static-cmake ..