]> git.sesse.net Git - vlc/commitdiff
contrib: helper to merge Libs and Libs.private in pkg-config files
authorRémi Denis-Courmont <remi@remlab.net>
Tue, 6 Mar 2012 16:48:29 +0000 (18:48 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Tue, 6 Mar 2012 16:51:32 +0000 (18:51 +0200)
pkg-config is unable to autodetect whether a package is linked
statically or not. This helper just moves Libs.private into Libs
manually in case only a static library is built. Most if not all of
contribs are built that way.

contrib/src/main.mak
contrib/src/pkg-static.sh [new file with mode: 0755]

index 5de6d559d37c6897fca940fc097ba745e920a90b..3982f432cea094f92fd36a0da12ab391f1a76306 100644 (file)
@@ -278,6 +278,7 @@ UNPACK = $(RM) -R $@ \
        $(foreach f,$(filter %.zip,$^), && unzip $(f))
 UNPACK_DIR = $(basename $(basename $(notdir $<)))
 APPLY = (cd $(UNPACK_DIR) && patch -p1) <
+pkg_static = (cd $(UNPACK_DIR) && ../../src/pkg-static.sh $(1))
 MOVE = mv $(UNPACK_DIR) $@ && touch $@
 
 AUTOMAKE_DATA_DIRS=$(abspath $(dir $(shell which automake))/../share/automake*)
diff --git a/contrib/src/pkg-static.sh b/contrib/src/pkg-static.sh
new file mode 100755 (executable)
index 0000000..25c2af7
--- /dev/null
@@ -0,0 +1,29 @@
+#! /bin/sh
+# Copyright (C) 2012 Rémi Denis-Courmont
+# This file is distributed under the same license as the vlc package.
+
+if test -z "$1" || test -n "$2"; then
+       echo "Usage: $0 <file.pc>" >&2
+       echo "Merges the pkg-config Libs.private stanza into Libs stanza." >&2
+       exit 1
+fi
+
+exec <"$1" >"$1.tmp" || exit $?
+
+PUBLIC=""
+PRIVATE=""
+
+while read LINE; do
+       pub="${LINE#Libs:}"
+       priv="${LINE#Libs.private:}"
+       if test "$pub" != "$LINE"; then
+               PUBLIC="$pub"
+       elif test "$priv" != "$LINE"; then
+               PRIVATE="$priv"
+       else
+               echo "$LINE"
+       fi
+done
+echo "Libs: $PUBLIC $PRIVATE"
+
+mv -f -- "$1.tmp" "$1"