mle
mle copied to clipboard
Use lhelper to manage the vendor libraries
Simplifies the Makefile and remove the vendor directories to use instead lhelper to provides the external libraries.
I don't mean you should merge right away this PR except you really want to. I just would like to show you how my utility lhelper can be used to manage the external libraries, pcre2, lua and uthash.
The advantage it brings:
- simplified git clone (no recursive needed)
- smaller repositories without a vendor directory
- simplified Makefile that will automatically choose the libraries using pkg-config
- use an optimized build of each library with minimal options and static link by default
- can easily target any specific CPU architecture using the variables CPU_TYPE and CPU_TARGET
- easily create binary for official releases with minimal dependencies
- the same lhelper workflow works on Windows and macOS, the lhelper recipes are cross-platforms, built and tested on Windows and macOS too.
Lhelper will create an environment with the required libraries listed in the packages
variable in build.lhelper
. By default it will install the libraries for static linking and with minimal options.
There are two provided lhelper build files:
- build.lhelper will provide pcre2, lua 5.4 and uthash as static libraries
- build-system-deps.lhelper will provide only uthash and for pcre2 and lua the system provide dev packages will be used instead
To illustrate how minimal are the run-time dependencies of the executable, the binary I built using build.lhelper only needs the following dynamic libraries:
linux-vdso.so.1 (0x00007fffd05cd000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7d889d1000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7d889cb000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7d887d9000) /lib64/ld-linux-x86-64.so.2 (0x00007f7d88c26000)
so it does depend only on the system provided libc which is a pretty good compromise to work on most linux distributions.