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.
This commit is contained in:
@@ -15,8 +15,8 @@ fixQtModulePaths () {
|
||||
if grep -q '\$\$QT_MODULE_' "${pr:?}"; then
|
||||
echo "fixQtModulePaths: Fixing module paths in \`${pr:?}'..."
|
||||
sed -i "${pr:?}" \
|
||||
-e "s|\\\$\\\$QT_MODULE_LIB_BASE|$dev/lib|g" \
|
||||
-e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$dev/lib|g" \
|
||||
-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
|
||||
@@ -27,13 +27,6 @@ fixQtModulePaths () {
|
||||
echo "fixQtModulePaths: Warning: \`$dir' does not exist"
|
||||
fi
|
||||
|
||||
if [ "z$dev" != "z$lib" ]; then
|
||||
if [ -d "$lib/lib" ]; then
|
||||
mkdir -p "$dev/lib"
|
||||
lndir -silent "$lib/lib" "$dev/lib"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "z$bin" != "z$dev" ]; then
|
||||
if [ -d "$bin/bin" ]; then
|
||||
mkdir -p "$dev/bin"
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
# fixQtStaticLibs
|
||||
#
|
||||
# Usage: fixQtStaticLibs _lib_ _dev_
|
||||
#
|
||||
# Find static Qt libraries in output _lib_ and move them to the corresponding
|
||||
# path in output _dev_. Any QMake library definitions (*.prl files) are also
|
||||
# moved and library paths are patched.
|
||||
#
|
||||
fixQtStaticLibs() {
|
||||
local lib="$1"
|
||||
local dev="$2"
|
||||
|
||||
pushd "$lib"
|
||||
if [ -d "lib" ]; then
|
||||
find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \
|
||||
while read -r -d $'\0' file; do
|
||||
mkdir -p "$dev/$(dirname "$file")"
|
||||
mv "$lib/$file" "$dev/$file"
|
||||
done
|
||||
fi
|
||||
popd
|
||||
|
||||
if [ -d "$dev" ]; then
|
||||
find "$dev" -name '*.prl' | while read prl; do
|
||||
echo "fixQtStaticLibs: Fixing built-in paths in \`$prl'..."
|
||||
sed -i "$prl" \
|
||||
-e '/^QMAKE_PRL_BUILD_DIR =/d' \
|
||||
-e '/^QMAKE_PRO_INPUT =/d' \
|
||||
-e "s|-L\\\$\\\$NIX_OUTPUT_OUT/lib|-L$lib/lib -L$dev/lib|g"
|
||||
done
|
||||
fi
|
||||
}
|
||||
@@ -4,7 +4,6 @@ qtDocPrefix=@qtDocPrefix@
|
||||
|
||||
. @fix_qt_builtin_paths@
|
||||
. @fix_qt_module_paths@
|
||||
. @fix_qt_static_libs@
|
||||
|
||||
providesQtRuntime() {
|
||||
[ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
|
||||
@@ -67,12 +66,3 @@ postPatchMkspecs() {
|
||||
if [ -z "$dontPatchMkspecs" ]; then
|
||||
postPhases="${postPhases}${postPhases:+ }postPatchMkspecs"
|
||||
fi
|
||||
|
||||
postMoveQtStaticLibs() {
|
||||
if [ "z${!outputLib}" != "z${!outputDev}" ]; then
|
||||
fixQtStaticLibs "${!outputLib}" "${!outputDev}"
|
||||
fi
|
||||
}
|
||||
if [ -z "$dontMoveQtStaticLibs" ]; then
|
||||
postPhases="${postPhases}${postPhases:+ }postMoveQtStaticLibs"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user