#!/bin/sh -xe

PKG_INSTALL_PATH="${INSTALLED_PATH}"
if [ -z "$PKG_INSTALL_PATH" ]
then
    exit 2;
fi
echo $PKG_INSTALL_PATH

## adjust pkgconfig (.pc) file

PCs=`find "${PKG_INSTALL_PATH}" -name '*.pc'`

for pc in ${PCs}; do
    echo "$pc"

    LIBDIR=$(readlink -f $(dirname "${pc}")/../..)
    sed -i "/^prefix=/!b;c\prefix=${LIBDIR}" "${pc}"
done
