+# The above installs in /usr/x86_64-pc-mingw32/sys-root/x86_64-pc-mingw32/lib
+# which is the wrong location. Move it to %{_mingw64_libdir}.
+mv $RPM_BUILD_ROOT%{_mingw64_sysroot}/%{_mingw64_target}/lib \
+ $RPM_BUILD_ROOT%{_mingw64_libdir}
+
+# However GCC when building looks in /usr/x86_64-pc-mingw32/lib for
+# libraries. Make symlinks so that this works.
+# XXX Hack - why is this needed?
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/%{_mingw64_target}/lib
+pushd $RPM_BUILD_ROOT%{_prefix}/%{_mingw64_target}/lib
+for f in ../sys-root/lib/*.[ao]; do
+ ln -s $f
+done
+popd
+