1Installation on Microsoft Windows:
2
3There are three ways to create binaries of this package for Microsoft Windows:
41) Native binaries, built using the mingw tool chain.
52) Native binaries, built using the MS Visual C/C++ tool chain.
63) Binaries for the Cygwin environment.
7
8===============================================================================
91) Native binaries, built using the mingw tool chain.
10
11   I recommend to use the Cygwin environment as the development environment
12   and mingw only as the target (runtime, deployment) environment.
13   For this, you need to install
14     * Cygwin (from https://cygwin.com/),
15     * some packages available from the Cygwin package installer:
16         make
17     * the mingw cross-compilation tools and runtime package, available from
18       the Cygwin package installer (setup-x86_64.exe):
19       - for creating 32-bit binaries: packages
20           mingw64-i686-gcc-core,
21           mingw64-i686-headers,
22           mingw64-i686-runtime
23       - for creating 64-bit binaries: packages
24           mingw64-x86_64-gcc-core,
25           mingw64-x86_64-headers,
26           mingw64-x86_64-runtime
27
28   Building 32-bit binaries for mingw is achieved through the following
29   preparation, configure, and build commands:
30
31      PATH=/usr/local/mingw32/bin:$PATH
32      export PATH
33      ./configure --host=i686-w64-mingw32 --prefix=/usr/local/mingw32 \
34            CC=i686-w64-mingw32-gcc \
35            CPPFLAGS="-I/usr/local/mingw32/include -Wall" \
36            LDFLAGS="-L/usr/local/mingw32/lib"
37      make
38      make check
39
40   Building 64-bit binaries for mingw is achieved through the following
41   preparation, configure, and build commands:
42
43      PATH=/usr/local/mingw64/bin:$PATH
44      export PATH
45      ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/mingw64 \
46            CC=x86_64-w64-mingw32-gcc \
47            CPPFLAGS="-I/usr/local/mingw64/include -Wall" \
48            LDFLAGS="-L/usr/local/mingw64/lib"
49      make
50      make check
51
52   Installation:
53
54      make install
55
56===============================================================================
572) Native binaries, built using the MS Visual C/C++ tool chain.
58
59   Note that binaries created with MSVC have a distribution constraint: They
60   depend on a closed-source library ('msvcr90.dll' for MSVC 9.0,
61   'vcruntime140.dll' for MSVC 14.0, and so on) which is not normally part of
62   a Windows installation.
63   You cannot distribute 'vcruntime*.dll' with the binaries - this would be a
64   violation of the GPL and of the Microsoft EULA.
65   You can distribute the binaries without including 'vcruntime*.dll'. Users
66   who don't have this library on their system will require to pull some files
67   (api-ms-win*.dll) through the Windows Update mechanism, see
68   https://support.microsoft.com/en-us/kb/2999226 .
69
70   This recipe requires MS Visual C/C++ 9.0 or newer.
71   You don't need the Visual Studio IDE, just the C/C++ tool chain.
72   As of 2016, you can install the MS Visual C/C++ 14.0 tool chain from
73   http://landinghub.visualstudio.com/visual-cpp-build-tools (it's the file
74   visualcppbuildtools_full.exe).
75
76   This recipe requires also a Cygwin environment (with 'bash', the common POSIX
77   commands, and 'make') as a build environment. Building with 'nmake' is not
78   supported.
79   For this, you need to install
80     * Cygwin (from https://cygwin.com/),
81     * some packages available from the Cygwin package installer:
82         make
83
84   You also need the scripts 'ar-lib' and 'compile' from
85     http://git.savannah.gnu.org/gitweb/?p=automake.git;a=blob_plain;f=lib/ar-lib;hb=HEAD
86     http://git.savannah.gnu.org/gitweb/?p=automake.git;a=blob_plain;f=lib/compile;hb=HEAD
87   respectively.
88   They may also be included in this package, in directory 'build-aux/'.
89   Save them; the instructions below assume that you stored them in $HOME/msvc/.
90   Make them executable:
91      chmod a+x ar-lib compile
92
93   Start a bash (from Cygwin).
94
95   Make sure that the MSVC tools ("cl" etc.) are found in PATH and the
96   environment variables INCLUDE and LIB are set appropriately.
97   In a typical MSVC 9.0 installation, it can be achieved by running
98     C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
99   In a typical MSVC 14.0 installation on Windows 10, it can be achieved
100   - for creating 32-bit binaries: through the following bash commands:
101
102      # Set environment variables for using MSVC 14,
103      # for creating native 32-bit Windows executables.
104
105      # Windows C library headers and libraries.
106      WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt'
107      WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\'
108      INCLUDE="${WindowsCrtIncludeDir};$INCLUDE"
109      LIB="${WindowsCrtLibDir}x86;$LIB"
110
111      # Windows API headers and libraries.
112      WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\8.1\Include\'
113      WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\'
114      INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE"
115      LIB="${WindowsSdkLibDir}x86;$LIB"
116
117      # Visual C++ tools, headers and libraries.
118      VSINSTALLDIR='C:\Program Files (x86)\Microsoft Visual Studio 14.0'
119      VCINSTALLDIR="${VSINSTALLDIR}"'\VC'
120      PATH=`cygpath -u "${VCINSTALLDIR}"`/bin:"$PATH"
121      INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}"
122      LIB="${VCINSTALLDIR}"'\lib;'"${LIB}"
123
124      export INCLUDE LIB
125
126   - for creating 64-bit binaries: through the following bash commands:
127
128     # Set environment variables for using MSVC 14,
129     # for creating native 64-bit Windows executables.
130
131     # Windows C library headers and libraries.
132     WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt'
133     WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\'
134     INCLUDE="${WindowsCrtIncludeDir};$INCLUDE"
135     LIB="${WindowsCrtLibDir}x64;$LIB"
136
137     # Windows API headers and libraries.
138     WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\8.1\Include\'
139     WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\'
140     INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE"
141     LIB="${WindowsSdkLibDir}x64;$LIB"
142
143     # Visual C++ tools, headers and libraries.
144     VSINSTALLDIR='C:\Program Files (x86)\Microsoft Visual Studio 14.0'
145     VCINSTALLDIR="${VSINSTALLDIR}"'\VC'
146     PATH=`cygpath -u "${VCINSTALLDIR}"`/bin/amd64:"$PATH"
147     INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}"
148     LIB="${VCINSTALLDIR}"'\lib\amd64;'"${LIB}"
149
150     export INCLUDE LIB
151
152   Building 32-bit binaries with MSVC is achieved through the following
153   preparation, configure, and build commands:
154
155      PATH=/usr/local/msvc32/bin:$PATH
156      export PATH
157
158      win32_target=_WIN32_WINNT_WINXP   # for MSVC 9.0
159      win32_target=_WIN32_WINNT_VISTA   # possibly for MSVC >= 10.0
160      win32_target=_WIN32_WINNT_WIN7    # possibly for MSVC >= 10.0
161      win32_target=_WIN32_WINNT_WIN8    # possibly for MSVC >= 10.0
162
163      ./configure --host=i686-w64-mingw32 --prefix=/usr/local/msvc32 \
164            CC="$HOME/msvc/compile cl -nologo" \
165            CFLAGS="-MD" \
166            CXX="$HOME/msvc/compile cl -nologo" \
167            CXXFLAGS="-MD" \
168            CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc32/include" \
169            LDFLAGS="-L/usr/local/msvc32/lib" \
170            LD="link" \
171            NM="dumpbin -symbols" \
172            STRIP=":" \
173            AR="$HOME/msvc/ar-lib lib" \
174            RANLIB=":"
175      make
176      make check
177
178   Building 64-bit binaries with MSVC is achieved through the following
179   preparation, configure, and build commands:
180
181      PATH=/usr/local/msvc64/bin:$PATH
182      export PATH
183
184      win32_target=_WIN32_WINNT_WINXP   # for MSVC 9.0
185      win32_target=_WIN32_WINNT_VISTA   # possibly for MSVC >= 10.0
186      win32_target=_WIN32_WINNT_WIN7    # possibly for MSVC >= 10.0
187      win32_target=_WIN32_WINNT_WIN8    # possibly for MSVC >= 10.0
188
189      ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/msvc64 \
190            CC="$HOME/msvc/compile cl -nologo" \
191            CFLAGS="-MD" \
192            CXX="$HOME/msvc/compile cl -nologo" \
193            CXXFLAGS="-MD" \
194            CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc64/include" \
195            LDFLAGS="-L/usr/local/msvc64/lib" \
196            LD="link" \
197            NM="dumpbin -symbols" \
198            STRIP=":" \
199            AR="$HOME/msvc/ar-lib lib" \
200            RANLIB=":"
201      make
202      make check
203
204   Installation:
205
206      make install
207
208===============================================================================
2093) Binaries for the Cygwin environment.
210
211   The generic instructions in the INSTALL file apply. But here are more
212   specific ones.
213
214   You need to install
215     * Cygwin (from https://cygwin.com/),
216     * some packages available from the Cygwin package installer:
217         make
218     * the Cygwin [cross-]compilation tools package, available from
219       the Cygwin package installer (setup-x86_64.exe):
220       - for creating 32-bit binaries: packages
221           cygwin32-gcc-core,
222           cygwin32
223       - for creating 64-bit binaries: packages
224           gcc-core
225
226   Building 32-bit binaries for Cygwin must be done in a directory *outside*
227   the Cygwin /home and /usr hierarchies. It is achieved through the following
228   preparation, configure, and build commands:
229
230      PATH=/usr/local/cygwin32/bin:/usr/i686-pc-cygwin/sys-root/usr/bin:$PATH
231      export PATH
232      ./configure --host=i686-pc-cygwin --prefix=/usr/local/cygwin32 \
233            CC=i686-pc-cygwin-gcc \
234            CPPFLAGS="-I/usr/local/cygwin32/include -Wall" \
235            LDFLAGS="-L/usr/local/cygwin32/lib"
236      make
237      make check
238
239   Building 64-bit binaries for Cygwin is achieved through the following
240   preparation, configure, and build commands:
241
242      PATH=/usr/local/cygwin64/bin:$PATH
243      export PATH
244      ./configure --host=x86_64-pc-cygwin --prefix=/usr/local/cygwin64 \
245            CC=x86_64-pc-cygwin-gcc \
246            CPPFLAGS="-I/usr/local/cygwin64/include -Wall" \
247            LDFLAGS="-L/usr/local/cygwin64/lib"
248      make
249      make check
250
251   Installation:
252
253      make install
254
255===============================================================================
256