summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-02-12 14:15:45 -0800
committerUli Schlachter <psychon@znc.in>2014-03-22 14:44:52 +0100
commit32de4c4213a49c61127c6957ea05fef3e5355291 (patch)
tree2c802732e826ea7018a7262e0c138db07b21903d
parent1f6cd9f1fcd3c07d323b678292c9cb00ae1f7504 (diff)
Validate .pc file Requires lines
This walks through the .pc.in files and makes sure all of the Requires lines express sufficient dependency information. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r--Makefile.am8
-rwxr-xr-xcheck-pc-requires70
2 files changed, 77 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 387c2f2..e912489 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,8 +86,14 @@ pkgconfig_DATA += xcb-xvmc.pc
endif
+AM_TESTS_ENVIRONMENT = \
+ AM_SRCDIR=${srcdir}
+
+TESTS=check-pc-requires
+
EXTRA_DIST = \
tools/README \
tools/api_conv.pl \
tools/constants \
-autogen.sh
+autogen.sh \
+$(TESTS)
diff --git a/check-pc-requires b/check-pc-requires
new file mode 100755
index 0000000..0fd9c65
--- /dev/null
+++ b/check-pc-requires
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+case "$AM_SRCDIR" in
+"")
+ AM_SRCDIR="."
+ ;;
+*)
+ ;;
+esac
+
+fix=n
+status=0
+case "$1" in
+"-fix")
+ fix=y
+ ;;
+esac
+
+for inc in src/*.h; do
+ package=xcb-`basename $inc .h`
+ pcin="$AM_SRCDIR"/$package.pc.in
+ if [ -f $pcin ]; then
+ included=`grep '# *include' $inc |
+ sed -e 's/[^<"]*[<"]//' -e 's/[>"]//' |
+ grep -v 'xcb.h\|xproto.h'`
+ requires=`grep '^Requires:' $pcin`
+ missing=""
+ for i in $included; do
+ ibase=`basename $i .h`
+ r="xcb-$ibase"
+ rpcin="$AM_SRCDIR"/$r.pc.in
+ if [ -f $rpcin ]; then
+ m="$r"
+ for has in $requires; do
+ if [ $has = $r ]; then
+ m=""
+ fi
+ done
+ case "$m" in
+ "")
+ ;;
+ *)
+ case "$missing" in
+ "")
+ missing=$m
+ ;;
+ *)
+ missing="$missing $m"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ case "$missing" in
+ "")
+ ;;
+ *)
+ if [ "$fix" = "y" ]; then
+ echo $package adding dependency on $missing
+ sed -i '/^Requires:/s/$/ '"$missing"'/' $pcin
+ else
+ echo $package missing $missing
+ status=1
+ fi
+ ;;
+ esac
+ fi
+done
+exit $status