+# lib64 fix - enable to update patch
+%if %{_lib} != "lib" && 0
+find '(' -name '*.[ch]' -o -name '*.cpp' -o -name '*.pro' ')' | \
+xargs grep -l /lib . | xargs sed -i -e '
+ s,/''usr/lib/,/%{_libdir}/,g
+ s,/''lib/mythtv,/%{_lib}/mythtv,g
+ s,{PREFIX}/lib$,{PREFIX}/%{_lib},g
+'
+exit 1
+%endif
+
+# Assigning null to QMAKE_LIBDIR_QT will prevent makefiles contain
+# -L$(QTDIR)/%{_lib} and -Wl,-rpath,$(QTDIR)/%{_lib}. And that will
+# prevent compiler finding libs from system when they should be looked
+# from current buildtree.
+# but that made it link with -lqt which doesn't exist, instead of -lqt-mt
+# so we make QMAKE wrapper which will do sed subst after calling
+# qmake. this is the wrapper.
+cat > qmake-wrapper.sh <<'EOF'
+#!/bin/sh
+getmakefile() {
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ -o)
+ shift
+ makefile="$1"
+ return
+ ;;
+ esac
+ shift
+ done
+}
+
+qmake-qt4 "$@"
+getmakefile "$@"
+if [ "$makefile" ]; then
+ %{__sed} -i -e '
+ s;-Wl,-rpath,$(QTDIR)/%{_lib};;
+ s;-L$(QTDIR)/%{_lib};;
+ ' $makefile
+fi
+EOF
+chmod +x qmake-wrapper.sh
+
+# move perl bindings to vendor prefix
+sed -i -e 's#perl Makefile.PL#%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"#' \
+ bindings/perl/Makefile
+