pkg-static.sh 929 Bytes
Newer Older
1 2 3 4 5 6
#! /bin/sh
# Copyright (C) 2012 Rémi Denis-Courmont
# This file is distributed under the same license as the vlc package.

if test -z "$1" || test -n "$2"; then
	echo "Usage: $0 <file.pc>" >&2
7
	echo "Merges the pkg-config {Requires/Libs}.private stanza into {Requires/Libs} stanzas." >&2
8 9 10 11 12
	exit 1
fi

exec <"$1" >"$1.tmp" || exit $?

13 14 15 16
LIBS_PUBLIC=""
LIBS_PRIVATE=""
REQUIRES_PUBLIC=""
REQUIRES_PRIVATE=""
17 18

while read LINE; do
19 20 21 22 23 24 25 26 27 28 29 30
	lpub="${LINE#Libs:}"
	lpriv="${LINE#Libs.private:}"
	rpub="${LINE#Requires:}"
	rpriv="${LINE#Requires.private:}"
	if test "$lpub" != "$LINE"; then
		LIBS_PUBLIC="$lpub"
	elif test "$lpriv" != "$LINE"; then
		LIBS_PRIVATE="$lpriv"
	elif test "$rpub" != "$LINE"; then
		REQUIRES_PUBLIC="$rpub"
	elif test "$rpriv" != "$LINE"; then
		REQUIRES_PRIVATE="$rpriv"
31 32 33 34
	else
		echo "$LINE"
	fi
done
35 36
echo "Libs: $LIBS_PUBLIC $LIBS_PRIVATE"
echo "Requires: $REQUIRES_PUBLIC $REQUIRES_PRIVATE"
37 38

mv -f -- "$1.tmp" "$1"