diff options
-rwxr-xr-x | tools/fix-fixed-pc-files | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/fix-fixed-pc-files b/tools/fix-fixed-pc-files new file mode 100755 index 0000000..c39ac3b --- /dev/null +++ b/tools/fix-fixed-pc-files @@ -0,0 +1,42 @@ +#!/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 which were "fixed" by previous versions of the +# crossdev-wrappers. In the new version the prefix is prefixed +# with the SYSROOT automatically. +pcfiles=$(grep "^prefix=/usr/${CHOST}" *.pc | cut -d: -f1) + +# Find the corresponding packages and put them in a list +pkgs="" +printpkgs="" +for f in ${pcfiles}; do + pkgs="${pkgs} $(ROOT="/usr/${CHOST}" qfile --nocolor "${f}" | cut -d' ' -f1)" + printpkgs="${printpkgs} $(ROOT="/usr/${CHOST}" qfile "${f}" | cut -d' ' -f1)" +done + +# Beautify the output by sorting it uniquely +pkgs=$(echo $pkgs | tr ' ' '\n' | sort -u | tr '\n' ' ') +printpkgs=$(echo $printpkgs | tr ' ' '\n' | sort -u) + +# Print the packages... +for pkg in ${printpkgs}; do + echo " Need to remerge package: ${pkg}" +done + +# Finally, remerge the packages +read -p "Do you really want to remerge these packages (y/n)? " +[ "$REPLY" == "y" ] \ + && emerge-${CHOST} --verbose --keep-going ${pkgs} \ + || echo "Aborting..." |