-# libusb0.dll (needs to be shipped with frontends)
-$WGET -c http://$SF_MIRROR/project/libusb-win32/libusb-win32-releases/$VER_LIBUSB_WIN32/libusb-win32-bin-$VER_LIBUSB_WIN32.zip
-unzip -q libusb-win32-bin-$VER_LIBUSB_WIN32.zip
-cp -f libusb-win32-bin-$VER_LIBUSB_WIN32/bin/x86/libusb0_x86.dll $PREFIX/libusb0.dll
+# In order to link against Python we need libpython34.a.
+# The upstream Python 32bit installer ships this, the x86_64 installer
+# doesn't. Thus, we generate the file manually here.
+if [ $TARGET = "x86_64" ]; then
+ cp $PREFIX/python34.dll .
+ $MXE/usr/$TARGET-w64-mingw32.static.posix/bin/gendef python34.dll
+ $MXE/usr/bin/$TARGET-w64-mingw32.static.posix-dlltool \
+ --dllname python34.dll --def python34.def \
+ --output-lib libpython34.a
+ mv -f libpython34.a $PREFIX/Python34/libs
+ rm -f python34.dll
+fi
+
+# We need to include the *.pyd files from python34.zip into the installers,
+# otherwise importing certain modules (e.g. ctypes) won't work (bug #1409).
+unzip -q $PREFIX/python34.zip *.pyd -d $PREFIX