Improve mingw cross-compiling instructions
authorPaul Fertser <fercerpav@gmail.com>
Wed, 7 Aug 2013 14:47:01 +0000 (18:47 +0400)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 30 Aug 2013 15:59:57 +0000 (17:59 +0200)
This should make them less hackish and the outlined way seems to be
what upstream is recommending.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>

README.mingw

index 3b0e5ba..c8857cf 100644 (file)
@@ -1,41 +1,22 @@
 * How to cross compile libftdi-1.x for Windows? *
-   1 - To cross-compile for Win32 with mingw, you need to
-       have libusb-1.0 for Windows. libusbx is a fork of libusb-1.0
-       project which has gained popularity under Windows and Linux.
-       Therefore the instruction here uses libusbx. The process to
-       use libusb-1.0 from libusb.org is similar but take note it
-       does not offer Windows binary as of Jan 09 2013.
-
-   2 - Get libusbx Windows release binary from Sourceforge.
-       http://sourceforge.net/projects/libusbx/files/releases/
-
-   3 - The release version is libusbx-1.0.14-win.7z (706.2KB)
-       as of Jan 09, 2013.
-
-   4 - Alternatively you can also build form the release source tar ball
-       or the git source tree following standard cross compile process
-
-   5 - Copy include/libusbx-1.0/libusb.h to the include directory of your
-       cross compiler, eg.,
-       /opt/cross/i386-mingw32msvc/include/
-
-   6 - Copy MinGW32/static/libusb-1.0.a and MinGW32/dll/libusb-1.0.dll.a
-       to the library directory of your cross compiler, eg.,
-       /opt/cross/i386-mingw32msvc/lib/
-
-   7 - Create a build directory like "mkdir build-win32", e.g in ../libftdi/
-
-   8 - edit Toolchain-mingw32.cmake to reflect your cross compiler location.
-
-   9 - cd into the build directory and run
-       "cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake .."
-
-  10 - Copy src/ftdi.h to the include directory of your cross compiler,
-         eg., /opt/cross/i386-mingw32msvc/include/
-
-  11 - Copy build-win32/src/*.a to the library directory of your cross compiler,
-         eg., /opt/cross/i386-mingw32msvc/lib/
-
+   1 - Prepare a pkg-config wrapper according to
+       https://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html ,
+       additionally export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS and
+       PKG_CONFIG_ALLOW_SYSTEM_LIBS.
+   2 - Write a CMake toolchain file according to
+       http://www.vtk.org/Wiki/CmakeMingw . Change the path to your future sysroot.
+   3 - Get libusb sources (either by cloning the git repo or by downloading a
+       tarball). Unpack, autogen.sh (when building from git), and configure like this:
+       ./configure --build=`./config.guess` --host=i686-w64-mingw32 \
+               --prefix=/usr --with-sysroot=$HOME/i686-w64-mingw32-root/
+   4 - run
+       make install DESTDIR=$HOME/i686-w64-mingw32-root/
+   5 - go to libftdi-1.x source directory and run
+       cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw.cmake \
+             -DCMAKE_INSTALL_PREFIX="/usr" \
+             -DPKG_CONFIG_EXECUTABLE=`which i686-w64-mingw32-pkg-config`
+   6 - run
+       make install DESTDIR=$HOME/i686-w64-mingw32-root/
 
 * How to run libftdi-1.x under Windows *