qtbase/bin/qt-configure-module.in
Joerg Bornemann 12b0f73a9e CMake: Don't hard-code "libexec" in qt-configure-module
If INSTALL_LIBEXECDIR was set to something != "libexec",
qt-configure-module contained the wrong path to qt-cmake.

Fixes: QTBUG-128137
Pick-to: 6.5 6.7 6.8
Change-Id: Ic095ff8cb804bbdd72e238e75ac867b7cc3bd478
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-08-16 12:36:35 +02:00

101 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
set -eu
script_dir_path=`dirname $0`
script_dir_path=`(cd "$script_dir_path"; pwd)`
# the current directory is the "build tree" or "object tree"
outpath=`pwd`
outpathPrefix=$outpath
SAVED_IFS=$IFS
IFS='
'
optfile=""
determineOptFilePath()
{
> "${outpathPrefix}/config.redo.in"
set -f # suppress globbing in for loop
for i in "$@"; do
if [ x"$i" = x"-top-level" ]; then
continue
fi
case $i in
-redo|--redo)
optfile=${outpathPrefix}/config.opt
if ! test -f "$optfile"; then
echo >&2 "No config.opt present - cannot redo configuration."
exit 1
fi
;;
*)
# If redo-ing, write the rest of parameters into the config.redo.in file
echo \"$i\" >> "${outpathPrefix}/config.redo.in"
;;
esac
done
}
printUsage()
{
cat <<EOF
Usage: qt-configure-module <module-source-dir> [options]
To display the available options for a Qt module, run
qt-configure-module <module-source-dir> -help
EOF
}
if [ "$#" -lt 1 ]; then
printUsage
exit 1
fi
module_root=$1
# This ensures the repo path does not end up in the config.opt file.
shift
if [ ! -f "$module_root/CMakeLists.txt" ]; then
echo >&2 "Error: $module_root is not a valid Qt module source directory."
printUsage
exit 1
fi
determineOptFilePath "$@"
optfilepath=${outpathPrefix}/config.opt
opttmpfilepath=${outpathPrefix}/config.opt.in
redofilepath=${outpathPrefix}/config.redo.last
redotmpfilepath=${outpathPrefix}/config.redo.in
qt_cmake_private_path="$script_dir_path/../@INSTALL_LIBEXECDIR@"
fresh_requested_arg=
if [ -z "$optfile" ]; then # only write optfile if not currently redoing
> "$opttmpfilepath"
> "$redotmpfilepath"
for arg in "$@"; do echo \"$arg\" >> "$opttmpfilepath"; done
"$qt_cmake_private_path/qt-cmake-private" -DIN_FILE="${opttmpfilepath}" \
-DOUT_FILE="${optfilepath}" \
-P "$script_dir_path/@__relative_path_to_cmake_scripts_dir@/QtWriteArgsFile.cmake"
else
# Rewriting config.opt into config.opt.in anyway. Allows for direct manipulation of config.opt
> "$opttmpfilepath"
for arg in `cat $optfile`; do echo \"$arg\" >> "$opttmpfilepath"; done
"$qt_cmake_private_path/qt-cmake-private" -DIN_FILE="${opttmpfilepath}" \
-DREDO_FILE="${redotmpfilepath}" -DOUT_FILE="${redofilepath}" \
-P "$script_dir_path/@__relative_path_to_cmake_scripts_dir@/QtWriteArgsFile.cmake"
optfilepath=${redofilepath}
fresh_requested_arg=-DFRESH_REQUESTED=TRUE
fi
cmake_script_path="$script_dir_path/@__relative_path_to_cmake_scripts_dir@/QtProcessConfigureArgs.cmake"
"$qt_cmake_private_path/qt-cmake-private" -DOPTFILE=$optfilepath -DMODULE_ROOT="$module_root" \
-DCMAKE_COMMAND="$qt_cmake_private_path/qt-cmake-private" -P "$cmake_script_path"
IFS=$SAVED_IFS