| 9 | | for pkg in $(cd "/usr/${CHOST}/usr/lib/pkgconfig" && grep libdir= *.pc | grep -v 'libdir=${exec_prefix}/lib' | cut -d: -f1); do |
| 10 | | echo -n "Corrupted pkg-config file found in package: " |
| 11 | | ROOT="/usr/${CHOST}" qfile "${pkg}" |
| | 9 | PKGCONFDIR="/usr/${CHOST}/usr/lib/pkgconfig" |
| | 10 | |
| | 11 | echo -e "Checking pkgconfig files in \033[1;36m${PKGCONFDIR}\033[0m" |
| | 12 | |
| | 13 | # Change to target pkgconfig dir |
| | 14 | cd "${PKGCONFDIR}" |
| | 15 | |
| | 16 | # Find packages with invalid exec_prefix |
| | 17 | execpkgs=$(grep '^exec_prefix=/usr' *.pc | cut -d: -f1) |
| | 18 | |
| | 19 | # Find packages with corrupted libdir entry |
| | 20 | incpkgs=$(grep '^includedir=' *.pc | grep -v 'includedir=${prefix}/include' | cut -d: -f1) |
| | 21 | |
| | 22 | # Find packages with corrupted libdir entry |
| | 23 | libpkgs=$(grep '^libdir=' *.pc | grep -v 'libdir=${exec_prefix}/lib' | cut -d: -f1) |
| | 24 | |
| | 25 | # Unify the packages so we are sure that every package is printed only once |
| | 26 | pcfiles=$(echo "${execpkgs} ${incpkgs} ${libpkgs}" | tr ' ' '\n' | sort -u) |
| | 27 | |
| | 28 | # Find the corresponding packages and mark what's wrong with the pc files |
| | 29 | pkgs="" |
| | 30 | for f in ${pcfiles}; do |
| | 31 | # Collect flags that denote in which way the pc file is wrong. |
| | 32 | flags="" |
| | 33 | if $(echo "$execpkgs" | grep -q "${f}"); then |
| | 34 | flags="${flags}E" |
| | 35 | else |
| | 36 | flags="${flags}_" |
| | 37 | fi |
| | 38 | if $(echo "$incpkgs" | grep -q "${f}"); then |
| | 39 | flags="${flags}I" |
| | 40 | else |
| | 41 | flags="${flags}_" |
| | 42 | fi |
| | 43 | if $(echo "$libpkgs" | grep -q "${f}"); then |
| | 44 | flags="${flags}L" |
| | 45 | else |
| | 46 | flags="${flags}_" |
| | 47 | fi |
| | 48 | |
| | 49 | # Find the package that corresponds |
| | 50 | pkgs="${pkgs}$(ROOT="/usr/${CHOST}" qfile "${f}" | sed -e "s%(.*/%(${PKGCONFDIR}/%g") [${flags}]:" |