aboutsummaryrefslogtreecommitdiff
path: root/sbopkglint.d/95-pkgconfig.t.sh
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-11-05 02:49:01 -0500
committerB. Watson <urchlay@slackware.uk>2024-11-05 02:49:01 -0500
commit4a1c976088fb5de4d6fc90410cf157a48ea56f34 (patch)
treecb4d94b8fd653e67f11800c738fc5202497b939d /sbopkglint.d/95-pkgconfig.t.sh
parent5e9481388d3d3cf810d0d8d7a9535466424c54b6 (diff)
downloadsbo-maintainer-tools-4a1c976088fb5de4d6fc90410cf157a48ea56f34.tar.gz
sbopkglint: tighten up .pc file checks
Diffstat (limited to 'sbopkglint.d/95-pkgconfig.t.sh')
-rw-r--r--sbopkglint.d/95-pkgconfig.t.sh33
1 files changed, 25 insertions, 8 deletions
diff --git a/sbopkglint.d/95-pkgconfig.t.sh b/sbopkglint.d/95-pkgconfig.t.sh
index 64156bb..ac0f182 100644
--- a/sbopkglint.d/95-pkgconfig.t.sh
+++ b/sbopkglint.d/95-pkgconfig.t.sh
@@ -17,9 +17,10 @@
# note: quite a few .pc files don't use the standard variables like
# libdir. it's not required, so we can't just check for that. have to
# actually run pkg-config --cflags and --libs... but we have to
-# rip any 'Requires:' line out first, because otherwise, pkg-config
-# would pull in the flags/libs from any package mentioned there (if
-# installed), or else complain that it doesn't exist.
+# rip any 'Requires:' or 'Requires.private:' line out first, because
+# otherwise, pkg-config would pull in the flags/libs from any package
+# mentioned there (if installed), or else complain that it doesn't
+# exist.
check_libinc_dir() {
local type=$1
@@ -30,6 +31,13 @@ check_libinc_dir() {
#echo "===> $flag"
dir="$( printf "%s" $flag | tail -c+3 )"
+ case "$dir" in
+ /usr/local*)
+ warn "$file references $type dir $dir; /usr/local is incorrect"
+ return
+ ;;
+ esac
+
[ -d $PKG/$dir ] || warn "$file references $type dir $dir, but it's missing from the package"
}
@@ -87,26 +95,35 @@ check_pc_file() {
return
fi
- grep -v '^Requires:' $file > $tmpfile
+ grep -v '^Requires' $file > $tmpfile
# the environment stuff keeps pkg-config from stripping out
# -L/usr/lib or -L/usr/lib64 on the grounds that it's a system dir.
+ # GtkD's .pc file has --libs output like -L-lgstreamerd-3 -L-L/usr/lib64/,
+ # which turn out to be not C flags but D flags for dmd. handled with
+ # sed, below.
for flag in xxx \
$( env PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
PKG_CONFIG_SYSTEM_LIBRARY_PATH=1 \
pkg-config --short-errors --libs --cflags $tmpfile )
do
- ## echo "===> $flag"
+ flag="$( printf "%s" $flag | sed '/^-L=*-/s,^-L=*,,' )"
case $flag in
xxx) ;; # skip (it's just there in case there are no flags at all)
- -L/usr/$bad)
+ -L/usr/$bad|-L/usr/$bad/)
warn "$file has /usr/$bad for libdir, should be /usr/$good"
;;
+ -L/usr/$good|-L/usr/$good/)
+ ;; # OK
-L*) check_libinc_dir library "$flag" "$file"
;;
- -I*) check_libinc_dir include "$flag" "$file"
+ -I/usr/include|-I/usr/include/)
+ ;; # OK
+ -I/usr/local*) check_libinc_dir include "$flag" "$file"
+ ;;
+ -I*) ## check_libinc_dir include "$flag" "$file" # don't be picky about include dirs
;;
- *) ;; # skip any other flags (-lwhatever, -Dwhatever, etc)
+ *) ;; # skip any other flags (-lwhatever, -Dwhatever, etc)
esac
done