File wxWidgets-find-wx-requires of Package wxWidgets.import4971

#! /bin/bash
# convert libwxfoo()() to libwxfoo(variant)()() for libraries inside wx libdir
#
# Notes:
# - We do not use ldd, it fails to detect uninstalled libraries in the sysroot.

# - The script is not able to recognize exact variant of wx libraries.
#   It expects, that it corresponds with just-installed devel packages.

shopt -s nullglob
RPM_BUILD_ROOT=$1

/usr/lib/rpm/find-requires |\
	while read ; do
		case "$REPLY" in
		 *'('*')' | *'('*')('*')' )
			SONAME=${REPLY%%(*}
			NOT_WX=true
			for DIR in /usr/lib*/wx-*-* /usr/lib*/wx-*-*/wx/* "$RPM_BUILD_ROOT"/usr/lib*/wx-*-* "$RPM_BUILD_ROOT"/usr/lib*/wx-*-*/wx/* ; do
				if test -f "$DIR/$SONAME" ; then
					VARIANT=${DIR#*/usr/lib*/wx-*-}
					VARIANT=${VARIANT%%/*}
					echo "$SONAME($VARIANT)${REPLY#$SONAME}"
					NOT_WX=false
					break
				fi
			done
			if $NOT_WX ; then
				echo "$REPLY"
			fi
			;;
		* )
			echo "$REPLY"
			;;
		esac
	done