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