diff options
| -rw-r--r-- | sbopkglint.d/95-pkgconfig.t.sh | 33 |
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 |
