nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-static-libs.sh
Thomas Tuegel fe0ab944db
qt5: factor out common definitions and remove symlink farm
The module definitions are factored out and shared between qt56 and qt59. The
symlink farm which was created during builds is no longer needed.
2017-11-07 07:18:46 -06:00

33 lines
985 B
Bash

# 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
}