2 Building XZ Utils on Windows
3 ============================
8 This document explains shortly where to get and how to install the
9 build tools that are needed to build XZ Utils on Windows. The final
10 binary package will be standalone in sense that it will depend only
11 on DLLs that are included in all Windows installations.
13 These instructions don't apply to Cygwin. XZ Utils can be built under
14 Cygwin in the same way as many other packages.
16 These instructions don't apply to MinGW and MSYS developers either,
17 who may want to package XZ Utils for MinGW or MSYS distributions.
18 You know who you are, and will probably use quite different configure
19 options etc. than what is described here.
22 Installing the toolchain(s)
23 ---------------------------
25 Some of the following is needed:
26 - MSYS is always needed to use the GNU Autotools based build system.
27 - MinGW builds 32-bit x86 binaries.
28 - 32-bit MinGW-w64 (I call it MingW-w32 here) builds 32-bit x86
30 - MinGW-w64 builds 64-bit x86-64 binaries.
32 So you need to pick between MinGW and MinGW-w32 when building
33 32-bit version. You don't need both.
35 You might find 7-Zip <https://7-zip.org/> handy when extracting
36 some files. The ready-made build script build.bash will also use
37 7-Zip to create the distributable .zip and .7z files.
39 I used the following directory structure but you can use whatever
40 you want. Just note that I will use these in my examples. Each of
41 these should have a subdirectory "bin":
45 C:\devel\tools\mingw-w32
46 C:\devel\tools\mingw-w64
51 You can download MSYS from MinGW's Sourceforge page:
53 https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/
55 I recommend using MSYS 1.0.11 (MSYS-1.0.11.exe or
56 msysCORE-1.0.11-bin.tar.gz) because that package includes all the
57 required tools. At least some of the later versions include only
58 a subset and thus you would need to download the rest separately.
59 The old version will work fine for building XZ Utils.
61 You can use either the .exe or .tar.gz package. I prefer .tar.gz,
62 because it can be extracted into any directory and later removed
63 without worrying about uninstallers.
68 NOTE: This section may be outdated. I haven't tried MinGW recently.
70 You can download the required packages from MinGW's Sourceforge page:
72 https://sourceforge.net/projects/mingw/files/
74 These version numbers were the latest when I wrote this document, but
75 you probably should pick the latest versions:
77 MinGW Runtime -> mingwrt-3.17-mingw32-dev.tar.gz
78 MinGW API for MS-Windows -> w32api-3.14-mingw32-dev.tar.gz
79 GNU Binutils -> binutils-2.20-1-bin.tar.gz
80 GCC Version 4 -> gcc-full-4.4.0-mingw32-bin-2.tar.lzma
82 The full GCC package is quite big, but if you want a smaller
83 download, you will need to download more than one file, so I'm
84 using the full package in this document for simplicity.
86 Extract the packages in the above order, possibly overwriting files
87 from packages that were extracted earlier.
90 Installing MinGW-w32 or MinGW-w64
92 I used the packages from Mingw-builds project. With that it is
93 enough to pick one .7z file for 32-bit and another for 64-bit
94 toolchain. For XZ Utils 5.2.0 I used the packages from these
97 https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/sjlj/
99 https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-win32/sjlj/
101 If you install both MinGW-w32 and MinGW-w64, remember to extract
102 them into different directories. build.bash looks at
103 C:\devel\tools\mingw-w32 and C:\devel\tools\mingw-w64 by default.
109 Start MSYS by going to the directory C:\devel\tools\msys and running
110 msys.bat there (double-click or use command prompt). It will start
111 at "home" directory, which is C:\devel\tools\msys\home\YourUserName.
113 If you have xz-5.x.x.tar.gz in C:\devel, you should be able to build
114 it now with the following commands:
117 tar xzf xz-5.x.x.tar.gz
119 bash windows/build.bash
121 If you used some other directory than C:\devel\tools for the build
122 tools, edit the variables near the beginning of build.bash first.
124 If you want to build manually, read the buildit() function in
125 build.bash. Look especially at the latter configure invocation.
127 Be patient. Running configure and other scripts used by the build
128 system is (very) slow under Windows.
131 Using a snapshot from the Git repository
133 To use a snapshot, the build system files need to be generated with
134 autogen.sh or "autoreconf -fi" before trying to build using the
135 above build instructions. You can install the relevant extra packages
136 from MinGW or use Cygwin or use e.g. a GNU/Linux system to create a
137 source package with the required build system files.