Welcome to little lamb

Code » comain » commit f60aa7f

Actually provide a way to set libs.static, cflags, ..

author Olivier Brunel
2023-07-23 10:06:58 UTC
committer Olivier Brunel
2023-07-23 10:57:08 UTC
parent da77ede04d1914b908226e0cbba41d594d993978

Actually provide a way to set libs.static, cflags, ..

..cflags.static, ldflags & ldflags.static for our libs. Also override
libs if needed (still defaults to -l$name)

Also use that when building the project itself.

configure +24 -4
mkcmn +8 -1

diff --git a/configure b/configure
index 69b4dd5..ae927d6 100755
--- a/configure
+++ b/configure
@@ -822,6 +822,26 @@ for lib in src/lib*; do
     nb_deps=$((nb_deps + 1))
     eval "idx$lib=$nb_deps"
     eval "deps$nb_deps=$lib"
+    if test -e meta/lib$lib.libs; then
+        eval "libs$lib=\"$(cat meta/lib$lib.libs)\""
+    else
+        eval "libs$lib=-l$lib"
+    fi
+    if test -e meta/lib$lib.libs.static; then
+        eval "libsA$lib=\"$(cat meta/lib$lib.libs.static)\""
+    fi
+    if test -e meta/lib$lib.cflags; then
+        eval "cflags$lib=\"$(cat meta/lib$lib.cflags)\""
+    fi
+    if test -e meta/lib$lib.cflags.static; then
+        eval "cflagsA$lib=\"$(cat meta/lib$lib.cflags.static)\""
+    fi
+    if test -e meta/lib$lib.ldflags; then
+        eval "ldflags$lib=\"$(cat meta/lib$lib.ldflags)\""
+    fi
+    if test -e meta/lib$lib.ldflags.static; then
+        eval "ldflagsA$lib=\"$(cat meta/lib$lib.ldflags.static)\""
+    fi
     # in case there was a --set-shared/--set-static for it
     link=$(eval echo \$link$lib)
     # if not, we shall default to static (if built)
@@ -833,13 +853,13 @@ for lib in src/lib*; do
         fi
     fi
     if test $link -eq 1; then
-        eval "libs$lib=lib$lib.so"
+        VPATHS="$VPATHS
+vpath lib$lib.so ."
     else
-        eval "libs$lib=lib$lib.a"
+        VPATHS="$VPATHS
+vpath lib$lib.a ."
     fi
     eval "cppflags$lib=\"-isystem src/lib$lib/include\""
-    VPATHS="$VPATHS
-vpath lib$lib.a ."
 done
 
 # not sure this really matters, so long as both are mentioned it will be the
diff --git a/mkcmn b/mkcmn
index 77a0203..efd1ec1 100755
--- a/mkcmn
+++ b/mkcmn
@@ -9,7 +9,14 @@ n="$(expr substr "$d" 14 ${#d})"
 
 test -e "$d" || mkdir -p "$d"
 cp meta/version "$d"
-echo -l$n > "$d/libs"
+echo -l$n > "$d/libs" # default
+set libs libs.static cflags cflags.static ldflags ldflags.static
+for ext; do
+    if test -e meta/lib$n.$ext; then
+        cp meta/lib$n.$ext "$d/$ext"
+    fi
+done
+
 if test -d meta/deps; then
     rm -rf "$d/deps"
     mkdir "$d/deps"