Files
ThirdParty-common/etc/relocateQt
mark d55ae084d4 ENH: generalize and improve pkgconfig editing
- now handles both lib/pkgconfig and lib64/pkgconfig locations
- also adjust includedir= and libdir= entries
2017-01-20 13:32:31 +01:00

102 lines
3.2 KiB
Bash
Executable File

#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# etc/relocateQt
#
# Description
# Change prefix when relocating QT installation
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Run from third-party (parent) directory only
wmakeCheckPwd -q "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : current directory is not \$WM_THIRD_PARTY_DIR"
echo " Check your OpenFOAM environment and installation"
exit 1
}
. etc/tools/ThirdPartyFunctions
. etc/tools/QtFunctions
#------------------------------------------------------------------------------
unset qtVERSION # No default version
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [qt-VERSION]
options:
-force Create qt.conf and edit pkgconfig to use \${prefix}
-help
Adjust prefix in qt.conf and pkgconfig files after relocating third-party
with a QT installation.
* adjust relocation prefix for $qtVERSION
USAGE
exit 1
}
#------------------------------------------------------------------------------
unset forceOpt
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-f | -force)
forceOpt=true
;;
-qt-[1-9]* | [1-9]* | qt-*)
# -qt-VERSION, VERSION, qt-VERSION, qt-everywhere-opensource-src-VERSION
qtVERSION="${1%%/}";
qtVERSION="${qtVERSION##*-}"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
#------------------------------------------------------------------------------
QT_ARCH_PATH=$installBASE/qt-$qtVERSION
[ -n "$qtVERSION" ] || die "No QT version specified"
[ -d "$QT_ARCH_PATH" ] || die "No QT installation"
if [ "${forceOpt:-false}" = true ]
then
# Create qt.conf and adjust locations to use '${prefix}' internally
finalizeQt
fi
pkgconfigNewPrefix $QT_ARCH_PATH
# -----------------------------------------------------------------------------