mirror of
https://gitlab.com/spectre.app/cli.git
synced 2024-11-01 02:41:44 +01:00
Adopt pkg-config for more reliable library detection.
[IMPROVED] Using pkg-config we can more reliably find and use installed dependency libraries on the system.
This commit is contained in:
parent
8d6d670197
commit
26c01a5eaa
2 changed files with 13 additions and 6 deletions
2
api
2
api
|
@ -1 +1 @@
|
|||
Subproject commit 06243e2673ffa4b050c957276d6cb18b0feb981f
|
||||
Subproject commit 1d7c4a7986d35403dadb29d0d7d67a6c092ad42d
|
17
build
17
build
|
@ -186,13 +186,20 @@ cc() (
|
|||
### DEPENDENCIES
|
||||
use() {
|
||||
local option=$1 requisite=$2 lib=$3; shift 3
|
||||
local enabled=${!option}
|
||||
local enabled=${!option} found=0 _cflags _ldflags
|
||||
|
||||
if (( enabled )); then
|
||||
if haslib "$lib"; then
|
||||
for lib in "$lib" "$@"; do
|
||||
haslib "$lib" && ldflags+=( -l"$lib" )
|
||||
done
|
||||
for lib in "$lib" "$@"; do
|
||||
if _cflags=$(pkg-config --cflags "$lib" 2>/dev/null) && _ldflags=$(pkg-config --libs "$lib" 2>/dev/null); then
|
||||
cflags+=( $_cflags ) ldflags+=( $_ldflags ); found=1
|
||||
elif _cflags=$(pkg-config --cflags "lib$lib" 2>/dev/null) && _ldflags=$(pkg-config --libs "lib$lib" 2>/dev/null); then
|
||||
cflags+=( $_cflags ) ldflags+=( $_ldflags ); found=1
|
||||
elif haslib "$lib"; then
|
||||
ldflags+=( -l"$lib" ); found=1
|
||||
fi
|
||||
done
|
||||
|
||||
if (( found )); then
|
||||
echo "INFO: Enabled $option (lib$lib)."
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue