Bundling
A common task for software developers is to make their projects more accessible to non-developers, for example by creating binary releases.
clang-build
carries the following opinion:
non-system packages should work on their own, i.e. they should
bring their own dependencies with them. This means that a
redistributable bundle can simply be a zip archive.
Build-folder binary bundleβ
You can use the --bundle
flag to tell clang-build
to gather all
dependencies of executable and shared library targets next to them
into their respective build folders. They should then be usable on
their own, i.e. without manually gathering additional binaries.
For example, the binary build folders on Linux may then look as follows:
build
βββ myexe/default/bin
| βββ myexe
| βββ libA.so
| βββ libB.so
βββ libA/default/bin
| βββ libA.so
| βββ libB.so
βββ libB/default/bin
βββ libB.so
On Linux and OSX, the -rpath
flag is automatically used to cause
those targets to search for dependencies in their own directory.
Regardless of whether you use Linux, OSX or Windows, you can then run your executables without having to make sure that the right dependencies are found.
Redistributable bundleβ
This feature is still experimental and not fully implemented
A redistributable bundle is what someone would need to run an executable or use a library. A main purpose is to create a bundle which will make it easy for someone to create e.g. a system package or an installer out of it.
Each target gathers from itself and its dependencies, depending on its type:
- For an executable
- the executable
- shared library dependencies
- runtime files (config, resource, shaders, ...)
- For a shared library
- the shared library
- shared library dependencies
- own header files and those of dependencies
- usage instructions (compiler/linker flags)
- For a static library
- the static library
- shared library dependencies
- own header files and those of dependencies
- usage instructions (compiler/linker flags)
- For a header only library
- own header files and those of dependencies
- usage instructions (compiler/linker flags)
On OSX, this will be a .app
folder.
On Linux and Windows, this will be a regular folder with a structure
build/myexe/default/redistributable
βββ README.md
βββ bin
| βββ myexe
| βββ libA.so
| βββ libB.so
βββ res
βββ config.toml
βββ img
βββ logo.icns
βββ background.png
build/libA/default/redistributable
βββ instructions.toml
βββ README.md
βββ bin
| βββ libA.so
| βββ libB.so
βββ include
βββ libA
| βββ libA.hpp
βββ libB
βββ libB.hpp