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

ENH: add pkgconf editing into ThirdPartyFunctions

- allows reuse for other packages using pkgconf
parent 907e04f3
No related branches found
No related tags found
1 merge request!4Merge develop into master for v1706 release
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -29,7 +29,7 @@
# Change prefix when relocating QT installation
#
#------------------------------------------------------------------------------
qtVERSION=4.8.7
unset qtVERSION # No default version
#------------------------------------------------------------------------------
# Run from third-party directory only
......@@ -42,13 +42,12 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
. etc/tools/ThirdPartyFunctions
. etc/tools/QtFunctions
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [VERSION]
usage: ${0##*/} [OPTION] [qt-VERSION]
options:
-force Create qt.conf and edit pkgconfig to use \${prefix}
-help
......@@ -62,9 +61,9 @@ USAGE
exit 1
}
#------------------------------------------------------------------------------
unset forceOpt
# parse options
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
......@@ -89,11 +88,14 @@ 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
changePrefix
pkgconfigSetPrefix $QT_ARCH_PATH
# ----------------------------------------------------------------- end-of-file
# -----------------------------------------------------------------------------
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -26,6 +26,7 @@
#
# Description
# Functions for helping relocate a QT installation
# To be loaded *after* etc/tools/ThirdPartyFunctions
#
#------------------------------------------------------------------------------
......@@ -35,114 +36,33 @@
#
createQtConf()
{
echo "create:"
echo " $QT_ARCH_PATH/bin/qt.conf"
local confFile="$QT_ARCH_PATH/bin/qt.conf"
[ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" ] || {
echo "Error: QT_ARCH_PATH not correctly set"
return
}
echo "[Paths]" > $QT_ARCH_PATH/bin/qt.conf
echo "Prefix=$QT_ARCH_PATH" >> $QT_ARCH_PATH/bin/qt.conf
}
if [ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" ]
then
/bin/cat << QT_CONF > $confFile
[Paths]
Prefix=$QT_ARCH_PATH
QT_CONF
echo " created qt.conf"
#
# Adjust pkgconfig information
# to generalize *location=, -L/... and -I/...
# to use ${prefix}
#
adjustPkgConfig()
{
echo "edit pkgconfig:"
echo " $QT_ARCH_PATH/lib/pkgconfig/*.pc"
[ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/lib/pkgconfig" ] || {
else
echo "Error: QT_ARCH_PATH not correctly set"
return
}
(
cd $QT_ARCH_PATH/lib/pkgconfig || exit
unset nfiles
for i in *.pc
do
if [ -f "$i" ]
then
nfiles="x$nfiles"
sed -i \
-e 's@\(location=\)'"$QT_ARCH_PATH/"'@\1${prefix}/@' \
-e 's@\(-[IL]\)'"$QT_ARCH_PATH/"'@\1${prefix}/@g' \
$i
fi
done
echo " edited ${#nfiles} files"
)
fi
}
#
# Change prefix=... and Prefix=... to use ${prefix}
#
changePrefix()
{
echo "relocate QT installation to new prefix directory:"
echo " $QT_ARCH_PATH"
echo "edit:"
echo " $QT_ARCH_PATH/bin/qt.conf"
echo " $QT_ARCH_PATH/lib/pkgconfig/*.pc"
[ -n "$QT_ARCH_PATH" -a -d "$QT_ARCH_PATH/bin" -a -d "$QT_ARCH_PATH/lib/pkgconfig" ] || {
echo "Error: QT_ARCH_PATH not correctly set"
return
}
# adjust qt.conf
for i in $QT_ARCH_PATH/bin/qt.conf
do
if [ -f "$i" ]
then
nfiles="x$nfiles"
sed -i \
-e 's@^\([Pp]refix=\).*$@\1'"$QT_ARCH_PATH@" \
$i
echo " edited 1 file"
fi
done
# adjust pkgconfig files
(
cd $QT_ARCH_PATH/lib/pkgconfig || exit
unset nfiles
for i in *.pc
do
if [ -f "$i" ]
then
nfiles="x$nfiles"
sed -i \
-e 's@^\([Pp]refix=\).*$@\1'"$QT_ARCH_PATH@" \
$i
fi
done
echo " edited ${#nfiles} files"
)
}
# ------------------------------------------------------------------------------
#
# create qt.conf and adjustPkgConfig to use ${prefix} internally
# create qt.conf and adjust locations to use ${prefix} internally
#
finalizeQt()
{
echo "Create/Edit files to ease later relocation of a QT installation"
createQtConf
adjustPkgConfig
pkgconfigAdjust $QT_ARCH_PATH
}
# ----------------------------------------------------------------- end-of-file
# -----------------------------------------------------------------------------
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -229,6 +229,79 @@ NOT_FOUND
}
#
# Change prefix=... and Prefix=... in pkgconfig
#
pkgconfigSetPrefix()
{
local dir="$1"
local nfiles
if [ -n "$dir" -a -d "$dir/lib/pkgconfig" ]
then
(
cd $dir/lib/pkgconfig || exit
echo "Set pkgconfig prefix : $dir"
echo " files ... lib/pkgconfig/*.pc"
for i in *.pc
do
if [ -f "$i" ]
then
nfiles="x$nfiles"
sed -i \
-e 's@^\([Pp]refix=\).*$@\1'"$dir@" \
$i
fi
done
echo " edited ${#nfiles} files"
)
else
echo "Error: incorrect prefix value: $dir" 1>&2
return 1
fi
}
#
# Adjust pkgconfig information
# to generalize *location=, -I/... and -L/...
# to use ${prefix}
#
pkgconfigAdjust()
{
local dir="$1"
local nfiles
if [ -n "$dir" -a -d "$dir/lib/pkgconfig" ]
then
(
cd $dir/lib/pkgconfig || exit
echo "Adjust pkgconfig locations : $dir"
echo " files ... lib/pkgconfig/*.pc"
for i in *.pc
do
if [ -f "$i" ]
then
nfiles="x$nfiles"
sed -i \
-e 's@\(location=\)'"$dir/"'@\1${prefix}/@' \
-e 's@\(-[IL]\)'"$dir/"'@\1${prefix}/@g' \
$i
fi
done
echo " edited ${#nfiles} files"
)
else
echo "Error: incorrect prefix value: $dir" 1>&2
return 1
fi
}
#
# Download file $1 from url $2 into download/ directory
#
......
......@@ -132,7 +132,7 @@ For finer control, the build stages can be selected or deselected individually:
To make a different paraview version, simply specify on the command-line.
For example,
./makeParaview 4.4.0
./makeParaview 5.0.1
Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
......
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -29,7 +29,7 @@
# Build script for QT (the qt-everywhere-opensource-src package)
#
#------------------------------------------------------------------------------
qtVERSION=4.8.7
unset qtVERSION # No default version
qtTYPE=qt-everywhere-opensource-src
#------------------------------------------------------------------------------
......@@ -48,7 +48,7 @@ usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [VERSION]
usage: ${0##*/} [OPTION] [qt-VERSION]
options:
-gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
-help
......@@ -174,4 +174,4 @@ else
}
fi
# ----------------------------------------------------------------- end-of-file
# -----------------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment