From ad8f68f7d9acca385b921530d1b5d4cefc1de531 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 5 Oct 2009 13:01:48 +0200 Subject: [PATCH] Small fixes to the cross-compilation howto. --- examples/cross-compiling-windows-binary.mdwn | 32 ++++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/examples/cross-compiling-windows-binary.mdwn b/examples/cross-compiling-windows-binary.mdwn index e8337e8..2af6c57 100644 --- a/examples/cross-compiling-windows-binary.mdwn +++ b/examples/cross-compiling-windows-binary.mdwn @@ -1,6 +1,6 @@ -[[!meta title="cross-compiling a Windows binary under Linux using MinGW"]] +[[!meta title="cross-compiling tinc for Windows under Linux using MinGW"]] -## Howto: cross-compiling a Windows binary under Linux using MinGW +## Howto: cross-compiling tinc for Windows under Linux using MinGW This howto describes how to create a Windows binary of tinc. Although it is possible to compile tinc under Windows itself, cross-compiling it under Linux @@ -26,17 +26,18 @@ There are only a few packages that need to be installed as root to get started: ### Setting up the build directory and getting the sources -We will create a directory called `mingw/` in the home directory. -We use apt-get to get the required libraries necessary for tinc. +We will create a directory called `mingw/` in the home directory. We use +apt-get to get the required libraries necessary for tinc, and use `git` to get +the latest development version of tinc. > mkdir $HOME/mingw > cd $HOME/mingw > apt-get source openssl liblzo2-dev zlib1g-dev > git clone git://tinc-vpn.org/tinc -### Creating the mingw script +### Making cross-compilation easy -To make cross-compiling easy, we install a script called `mingw` that will set +To make cross-compiling easy, we create a script called `mingw` that will set up the necessary environment variables so configure scripts and Makefiles will use the MinGW version of GCC and binutils: @@ -45,7 +46,7 @@ use the MinGW version of GCC and binutils: > #!/bin/sh > export CC=i586-mingw32msvc-gcc > export CXX=i586-mingw32msvc-g++ -> export CPP=/usr/bin/i586-mingw32msvc-cpp +> export CPP=i586-mingw32msvc-cpp > export RANLIB=i586-mingw32msvc-ranlib > export PATH="/usr/i586-mingw32msvc/bin:$PATH" > exec "$@" @@ -55,10 +56,12 @@ If `$HOME/bin` is not already part of your `$PATH`, you need to add it: > export PATH="$HOME/bin:$PATH" -You can also run the export commands from the `mingw` script by hand instead of -calling the mingw script for every `./configure` or `make` command, or execute -`$HOME/bin/mingw $SHELL` to get a shell with the right environment variables -set. +We use this script to call `./configure` and `make` with the right environment +variables. You can also run the export commands from the `mingw` script by +hand instead of calling the mingw script for every `./configure` or `make` +command, or execute `$HOME/bin/mingw $SHELL` to get a shell with these +environment variables set, but in this howto we will call it explicitly every +time it is needed. ### Compiling LZO @@ -83,7 +86,10 @@ tests, so we only build the static library here: OpenSSL is always a bit hard to compile, because they have their own `Configure` script that needs some tweaking. There is also a small bug in -e_os2.h that breaks compilation with recent versions of GCC. First download this [[openssl-cross-compilation.diff]] to your home directory, then patch OpenSSL, and then compile as usual: +e_os2.h that breaks compilation with recent versions of GCC. First download +this [[openssl-cross-compilation.diff]] to your home directory, then patch +OpenSSL, and then compile as usual. Do not use the `-j` option when compiling +OpenSSL, it will break. > cd $HOME/mingw/openssl-0.9.8k > patch < $HOME/openssl-cross-compilation.diff @@ -100,7 +106,7 @@ this is not necessary. > cd $HOME/mingw/tinc > autoreconf -fsi -> mingw ./configure --host=mingw32 -with-openssl=$HOME/mingw/usr/local +> mingw ./configure --host=mingw32 --with-openssl=$HOME/mingw/usr/local > mingw make ### Testing tinc -- 2.20.1