Debian Codegraph @

doc/HOWTO-mingw.adoc

raw
1 = A note on Windows/MinGW support
2
3 Now you can compile Gauche to use MinGW runtime library. It is
4 the recommended way to build Gauche on Windows. (You may still be
5 able to build with Cygwin but it has a few quirks that interfere
6 with Gauche that may surprise you.)
7
8 Because of the difference of the underlying system, not all
9 system-related procedures are available on MinGW port.
10 The reference manual tells whether a particular procedure
11 is supported on "`Windows native`".
12
13 As of 0.9.5, the official Windows binaries are built with
14 mingw-w64 (see link:http://mingw-w64.org/[]). It may still be
15 built with the original MinGW, but our support efforts are
16 prioritized in favor of mingw-w64. By '`MinGW version`' in
17 the following sections, we mean Gauche built with mingw-w64.
18
19 If you just want to use Gauche on Windows, you can use the binary
20 installer. Below, we describe what you need to build Gauche
21 from the source.
22
23
24 == Prerequisites
25
26 You need the following software:
27
28 === link:http://msys2.github.io[MSYS2]
29
30 Download the installer and follow the instruction. I recommend
31 to leave the installation folder default (`C:\msys64`, for x86_64).
32 After setup wizard finished, do not forget to follow the instruction
33 in the above site to update packages.
34
35 Once MSYS2 is in place, you can get mingw-w64 toolchain using
36 `pacman`. Fire MSYS2 shell and type `+pacman -S <package> ...+`.
37 For +mingw-w64-***+ packages, choose suitable architecture.
38
39 NOTE: If you want to build x86_64 and i686 binary installers
40 on x86_64 machine, you have to install both architecture versions.
41
42 The following packages are needed:
43
44 - mingw-w64-x86_64-gcc / mingw-w64-i686-gcc
45 - autoconf
46 - automake
47 - libtool
48 - pkg-config
49 - make
50
51 The following packages are strongly recommended. Gauche can be built
52 without them, but some features will not be available.
53
54 - mingw-w64-x86_64-zlib / mingw-w64-i686-zlib
55 - mingw-w64-x86_64-libiconv / mingw-w64-i686-libiconv
56 - texinfo
57
58 The following packages are used if you wand to compile MbedTLS within
59 Gauche. See "Build with MbedTLS" below for the details.
60
61 - cmake
62 - python3
63
64 The following packages are only used for testing (`make check`). You
65 don't need them just to build and use Gauche:
66
67 - openssl
68 - winpty
69
70
71 [NOTE]
72 ====
73 `pacman` tries to install packages under `C:/msys64/mingw64` etc,
74 but sometimes the first attempt fails saying:
75
76 ----
77 error: failed to commit transaction (conflicting files)
78 .... /mingw64 exists in file system
79 ----
80
81 There is `/mingw64.exe` and `/mingw64.bat` (in msys2 file system) and
82 the installer gets confused. Manually creating directory `/mingw64`
83 will solve the problem.
84 ====
85
86 === Gauche
87
88 You need the latest release version of Gauche in order to build
89 Gauche from git source. Install it using binary installer, or,
90 get a tarball and build it with MSYS2.
91
92 Make sure that `gosh` is visible from the `PATH` of your MSYS shell.
93
94
95 === link:http://wixtoolset.org[Wix toolset]
96
97 (Optional) This is used to create installer. If you just want
98 to build just for your machine, you don't need this.
99
100
101 == Build
102
103 You can build it just like on any other Unix systems; but for your
104 convenience, there's a script `src/mingw-dist.sh` which builds Gauche
105 in a way that you can zip and copy the resulting binary elsewhere,
106 or build a binary installer.
107
108 If you start from git repo clone (instead of source tarball), you
109 have to run `./DIST gen` first to generate configure scripts.
110
111 Once configure scripts are in place, run the `mingw-dist.sh` on the
112 MSYS shell as follows:
113
114 [source,sh]
115 ----
116 # For x86_64 build:
117 MSYSTEM=MINGW64 src/mingw-dist.sh
118
119 # For i686 build:
120 MSYSTEM=MINGW32 src/mingw-dist.sh
121 ----
122
123 The compiled binaries are in `../Gauche-mingw-dist/Gauche-x86_64` or
124 `../Gauche-mingw-dist/Gauche-i686`, respectively. It includes DLLs
125 needed to run `gosh`, so you can just zip the directory and copy
126 to whatever machine you like.
127
128
129 == Build with Gauche-gl
130
131 If you have link:https://github.com/shirok/Gauche-gl[Gauche-gl] source
132 tree aside of Gauche source tree
133 (that is, from Gauche's `$top_srcdir`, you have `../Gauche-gl`),
134 you can build Gauche-gl as well. Give `--with-gl` option:
135
136 [source,sh]
137 ----
138 MSYSTEM=MINGW64 src/mingw-dist.sh --with-gl
139 ----
140
141
142 == Build with MbedTLS
143
144 In order to create TLS connection, you need to include MbedTLS support.
145 You can choose either to embed MbedTLS in the binary, or to depend
146 on external MbedTLS DLL.
147
148 To embed MbedTLS support, give `--with-mbedtls` option to `mingw-dist.sh`.
149 The MbedTLS source is downloaded and compiled during build.
150
151 [source,sh]
152 ----
153 MSYSTEM=MINGW64 src/mingw-dist.sh --with-mbedtls
154 ----
155
156 If you choose this, you need CMake and Python3 installed on your system,
157 which is required to build MbedTLS.
158
159 Note: If you build a Gauche binary in this way, it includes MbedTLS library
160 which is covered by Apache License 2.0. Distributing the binary will
161 be covered by that license, as well as BSDL.
162
163 To build Gauche to use extenral MbedTLS DLL, give `--with-mbedtls=dll` option
164 instead:
165
166 [source,sh]
167 ----
168 MSYSTEM=MINGW64 src/mingw-dist.sh --with-mbedtls=dll
169 ----
170
171 If you choose this, Gauche binary does not include MbedTLS and hence
172 not bound to its license. However, you need MbedTLS DLL on the
173 target machine to use TLS features.
174
175
176 == Build installer
177
178 Make sure `candle.exe` and `light.exe` (WiX toolset) are in the `PATH`.
179
180 Run `src/mingw-dist.sh` with `--with-installer` option, for example:
181
182 [source,sh]
183 ----
184 MSYSTEM=MINGW64 src/mingw-dist.sh --with-gl --with-installer
185 ----
186
187 This creates installer file `../Gauche-mingw-X.X.X-{32|64}bit.msi`.