Blame midipix/pedeps.sh

8ab160
#!/bin/bash
8ab160
8ab160
perk=/usr/bin/perk
8ab160
test -x $perk || {
8ab160
    cat > /dev/null
8ab160
    exit 0
8ab160
}
8ab160
8ab160
[ $# -ge 1 ] || {
8ab160
    cat > /dev/null
8ab160
    exit 0
8ab160
}
8ab160
8ab160
case $1 in
8ab160
-P|--provides)
8ab160
    while read filename ; do
8ab160
    case "${filename}" in
8ab160
    *.so*)
025b2a
	if [ -L "${filename}" ]; then
87962c
		# Skip symlink files
87962c
		continue
87962c
	fi
8ab160
	# Print the name of the library with correct multilibbing
8ab160
	DIR="`dirname ${filename}`"
8ab160
	FILE="`basename ${filename}`"
8ab160
	if [[ $DIR =~ "/lib64" ]]; then
025b2a
		printf "%s(64bit)\n" "${FILE}"
8ab160
	fi
8ab160
	if [[ $DIR =~ "/lib32" ]]; then
025b2a
		printf "%s(32bit)\n" "${FILE}"
8ab160
	fi
8ab160
    esac
8ab160
    done
8ab160
    ;;
8ab160
-R|--requires)
8ab160
    while read filename ; do
8ab160
	# Print the name of the library with correct multilibbing
8ab160
	DIR="`dirname ${filename}`"
8ab160
	FILE="`basename ${filename}`"
8ab160
	PEDEPS="`perk -d ${filename}`"
8ab160
	readarray -t DEPS <<<"$PEDEPS"
8ab160
	if [[ $DIR =~ "/lib64" ]]; then
87962c
		for dep in "${DEPS[@]}"
8ab160
		do
025b2a
			printf "%s(64bit)\n" "${dep}"
8ab160
		done
8ab160
	fi
8ab160
	if [[ $DIR =~ "/lib32" ]]; then
87962c
		for dep in "${DEPS[@]}"
8ab160
		do
025b2a
			printf "%s(32bit)\n" "${dep}"
8ab160
		done
8ab160
	fi
8ab160
    done
8ab160
    ;;
8ab160
esac
8ab160
exit 0