3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
Thomas Tuegel 75d2a7dc4d
qt5: reduce closure size
First, closure size is reduced by including the static libraries in $out instead
of trying to move them to $dev. The Qt build system cannot handle libraries
being split between different prefixes. Previously, the static libraries were
moved into $dev and the shared libraries were symlinked from $out to $dev to
fool the build system. However, this causes $dev to be retained at
runtime. Instead, we now keep the static libraries in $out. Fortunately, the
static libraries are not very large anyway.

Second, we build with QT_NO_DEBUG defined unless debugging is enabled. This
causes some assertions to be removed; when assertions are included, they pull
paths from $dev into the runtime closure by using the __FILE__ macro. We also
now patch qtbase to remove even more assertions when QT_NO_DEBUG is defined.
2018-01-15 18:48:37 -06:00

37 lines
1.1 KiB
Bash

# fixQtModulePaths
#
# Usage: fixQtModulePaths _dir_
#
# Find Qt module definitions in directory _dir_ and patch the module paths.
#
fixQtModulePaths () {
local dir="$1"
local bin="${!outputBin}"
local dev="${!outputDev}"
local lib="${!outputLib}"
if [ -d "$dir" ]; then
find "$dir" -name 'qt_*.pri' | while read pr; do
if grep -q '\$\$QT_MODULE_' "${pr:?}"; then
echo "fixQtModulePaths: Fixing module paths in \`${pr:?}'..."
sed -i "${pr:?}" \
-e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
-e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
-e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \
-e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g"
fi
done
elif [ -e "$dir" ]; then
echo "fixQtModulePaths: Warning: \`$dir' is not a directory"
else
echo "fixQtModulePaths: Warning: \`$dir' does not exist"
fi
if [ "z$bin" != "z$dev" ]; then
if [ -d "$bin/bin" ]; then
mkdir -p "$dev/bin"
lndir -silent "$bin/bin" "$dev/bin"
fi
fi
}