Skip to content
Snippets Groups Projects
Commit d55ae084 authored by mark's avatar mark
Browse files

ENH: generalize and improve pkgconfig editing

- now handles both lib/pkgconfig and lib64/pkgconfig locations
- also adjust includedir= and libdir= entries
parent e3190722
Branches
Tags
1 merge request!4Merge develop into master for v1706 release
...@@ -96,6 +96,6 @@ then ...@@ -96,6 +96,6 @@ then
# Create qt.conf and adjust locations to use '${prefix}' internally # Create qt.conf and adjust locations to use '${prefix}' internally
finalizeQt finalizeQt
fi fi
pkgconfigSetPrefix $QT_ARCH_PATH pkgconfigNewPrefix $QT_ARCH_PATH
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
...@@ -249,75 +249,99 @@ NOT_FOUND ...@@ -249,75 +249,99 @@ NOT_FOUND
# #
# Change prefix=... and Prefix=... in pkgconfig # Set a new prefix=... in pkgconfig files
# #
pkgconfigSetPrefix() pkgconfigNewPrefix()
{ {
local dir="$1" local dir="${1%%/}"
local nfiles
if [ -n "$dir" -a -d "$dir/lib/pkgconfig" ] if [ -n "$dir" -a -d "$dir" ]
then then
( # Require absolute path, but use logical (not physical) location
cd $dir/lib/pkgconfig || exit [ "${dir}" != "${dir#/}" ] || dir=$(cd $dir 2>/dev/null && /bin/pwd -L)
# Strip sub-level
case "$dir" in (*/pkgconfig) dir="${dir%/*}";; esac
# Strip a level
case "$dir" in (*/lib | */lib64 | */bin) dir="${dir%/*}";; esac
fi
# Verify that the prefix path is valid
# Warning (not an error) - thus no special return code
[ -n "$dir" -a -d "$dir" ] || {
echo "Warning: invalid prefix directory: $dir" 1>&2
return 0
}
echo "Set pkgconfig prefix : $dir" echo "Set pkgconfig prefix : $dir"
echo " files ... lib/pkgconfig/*.pc"
for i in *.pc local nfiles
for libdir in lib/pkgconfig lib64/pkgconfig
do
unset nfiles
[ -d "$dir/$libdir" ] || continue
for i in $dir/$libdir/*.pc
do do
if [ -f "$i" ] if [ -f "$i" ]
then then
nfiles="x$nfiles" nfiles="x$nfiles"
sed -i \ sed -i -e 's@^\(prefix=\).*$@\1'"$dir@" $i
-e 's@^\([Pp]refix=\).*$@\1'"$dir@" \
$i
fi fi
done done
echo " edited ${#nfiles} files" echo " $libdir/*.pc (edited ${#nfiles})"
) done
else
echo "Error: incorrect prefix value: $dir" 1>&2
return 1
fi
} }
# #
# Adjust pkgconfig information # Adjust pkgconfig information to use '${prefix} where possible instead
# to generalize *location=, -I/... and -L/... # of directory paths.
# to use ${prefix} #
# Adjusts includedir=, libdir=, -I/... and -L/... and
# any *_location= entries (QT)
# #
pkgconfigAdjust() pkgconfigAdjust()
{ {
local dir="$1" local dir="${1%%/}"
local nfiles
if [ -n "$dir" -a -d "$dir/lib/pkgconfig" ] if [ -n "$dir" -a -d "$dir" ]
then then
( # Require absolute path, but use logical (not physical) location
cd $dir/lib/pkgconfig || exit [ "${dir}" != "${dir#/}" ] || dir=$(cd $dir 2>/dev/null && /bin/pwd -L)
# Strip sub-level
case "$dir" in (*/pkgconfig) dir="${dir%/*}";; esac
# Strip a level
case "$dir" in (*/lib | */lib64 | */bin) dir="${dir%/*}";; esac
fi
echo "Adjust pkgconfig locations : $dir" # Verify that the prefix path is valid
echo " files ... lib/pkgconfig/*.pc" # Warning (not an error) - thus no special return code
[ -n "$dir" -a -d "$dir" ] || {
echo "Warning: invalid prefix directory: $dir" 1>&2
return 0
}
for i in *.pc echo "Adjust pkgconfig locations : $dir"
local nfiles
for libdir in lib/pkgconfig lib64/pkgconfig
do
unset nfiles
[ -d "$dir/$libdir" ] || continue
for i in $dir/$libdir/*.pc
do do
if [ -f "$i" ] if [ -f "$i" ]
then then
nfiles="x$nfiles" nfiles="x$nfiles"
sed -i \ sed -i \
-e 's@\(location=\)'"$dir/"'@\1${prefix}/@' \ -e 's@^\(includedir=\)'"$dir/"'@\1${prefix}/@' \
-e 's@\(-[IL]\)'"$dir/"'@\1${prefix}/@g' \ -e 's@^\(libdir=\)'"$dir/"'@\1${prefix}/@' \
-e 's@\(_location=\)'"$dir/"'@\1${prefix}/@' \
-e 's@\(-[IL]\)'"$dir/"'@\1${prefix}/@g' \
$i $i
fi fi
done done
echo " edited ${#nfiles} files" echo " $libdir/*.pc (edited ${#nfiles})"
) done
else
echo "Error: incorrect prefix value: $dir" 1>&2
return 1
fi
} }
...@@ -350,8 +374,6 @@ downloadFile() ...@@ -350,8 +374,6 @@ downloadFile()
# $2 = TARGET DIRECTORY (optional) # $2 = TARGET DIRECTORY (optional)
cpMakeFiles() cpMakeFiles()
{ {
set +x
[ "$#" -eq 1 -o "$#" -eq 2 ] || { [ "$#" -eq 1 -o "$#" -eq 2 ] || {
echo "cpMakeFiles called with incorrect number of arguments $@" echo "cpMakeFiles called with incorrect number of arguments $@"
return 1 return 1
...@@ -383,8 +405,6 @@ cpMakeFiles() ...@@ -383,8 +405,6 @@ cpMakeFiles()
cp $wmakeFiles/$i $dst/$d/Make/$b cp $wmakeFiles/$i $dst/$d/Make/$b
fi fi
done done
set -x
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment