blob: 0d83e900ce1620f12933af67ac49163a29469ba7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/bin/bash
if [ -z "$1" ]; then
CHOST=armv4tl-softfloat-linux-gnueabi
else
CHOST="$1"
fi
PKGCONFDIR="/usr/${CHOST}/usr/lib/pkgconfig"
echo -e "Checking pkgconfig files in \033[1;36m${PKGCONFDIR}\033[0m"
# Change to target pkgconfig dir
cd "${PKGCONFDIR}"
# Find packages with invalid exec_prefix
execpkgs=$(grep '^exec_prefix=/usr' *.pc | cut -d: -f1)
# Find packages with corrupted libdir entry
incpkgs=$(grep '^includedir=' *.pc | grep -v 'includedir=${prefix}/include' | cut -d: -f1)
# Find packages with corrupted libdir entry
libpkgs=$(grep '^libdir=' *.pc | grep -v 'libdir=${exec_prefix}/lib' | cut -d: -f1)
# Unify the packages so we are sure that every package is printed only once
pcfiles=$(echo "${execpkgs} ${incpkgs} ${libpkgs}" | tr ' ' '\n' | sort -u)
# Find the corresponding packages and mark what's wrong with the pc files
pkgs=""
for f in ${pcfiles}; do
# Collect flags that denote in which way the pc file is wrong.
flags=""
if $(echo "$execpkgs" | grep -q "${f}"); then
flags="${flags}E"
else
flags="${flags}_"
fi
if $(echo "$incpkgs" | grep -q "${f}"); then
flags="${flags}I"
else
flags="${flags}_"
fi
if $(echo "$libpkgs" | grep -q "${f}"); then
flags="${flags}L"
else
flags="${flags}_"
fi
# Find the package that corresponds
pkgs="${pkgs}$(ROOT="/usr/${CHOST}" qfile "${f}" | sed -e "s%(.*/%(${PKGCONFDIR}/%g") [${flags}]:"
done
# Beautify the output by sorting it
pkgs=$(echo $pkgs | tr ':' '\n' | sort | tr ' ' ':')
# Print the packages...
for pkg in ${pkgs}; do
p=$(echo "${pkg}" | cut -d':' -f1)
f=$(echo "${pkg}" | cut -d':' -f2)
g=$(echo "${pkg}" | cut -d':' -f3)
# Print it babe!
echo " Corrupted file found in package: ${g} ${p} ${f}"
done
|