Fix some runtime clang sanitizer warnings.
[ttfautohint.git] / INSTALL.git
blob6aa3b949a7694aa44271e95eeea6210975258652
2 building and installing ttfautohint from git
3 ============================================
5 Building ttfautohint from the git repository needs some tools that are not
6 required when building from a release:
8   autoconf (2.65)
9   automake (1.13)
10   bison (2.6.5)
11   flex (2.5.37)
12   git (1.5.5)
13   libtool (2.2.2)
14   perl (this is a prerequisite of automake also)
16 If you configure to build the documentation files also (which are normally
17 distributed with the release package), the following is necessary:
19   help2man (1.40.1)
20   pandoc (1.12.2.1)
21   inkscape (0.48.2)
22   X11 (in particular the `xwininfo' program)
23   ImageMagick (6.7.4)
24   lualatex or xelatex (TeXLive 2016)
26 The version numbers in parentheses are known to work.  Newer versions should
27 work also.  In addition, the following freely available fonts are used; in
28 case your system doesn't provide them, use the given URLs for downloading.
30   Amiri               http://www.amirifont.org/
31   FreeSerif           https://www.gnu.org/software/freefont/
32   KhmerOS             http://www.khmeros.info/en/fonts
33   Lohit Kannada       https://fedorahosted.org/lohit/
34   NotoSansEthiopic    https://www.google.com/get/noto/
35   NotoSansMyanmar
36   NotoSerifGeorgian
37   NotoSerifGujarati
38   NotoSerifLao
39   NotoSerifTamil
40   Pothana2000         http://www.kavya-nandanam.com/
41   SagarNormal         http://www.nongnu.org/freebangfont/
43 Say
45   ./bootstrap
47 to clone the `gnulib' repository (which gets installed as a git submodule),
48 to build the `configure' script, and to set up necessary auxiliary files.
49 Then you can proceed with the instructions given in the `INSTALL' file with
50 the exception that parellel builds with `make -j' are not supported yet.
53 compilation within the MinGW environment (on Windows)
54 -----------------------------------------------------
56 [http://mingw.org]
58   o Since MSYS, the shell of MinGW, uses LF as line endings, `git checkout'
59     should not convert files to CRLF.  Before checking out the FreeType and
60     ttfautohint repositories, you should issue the command
62       git config --global core.autocrlf input
64     to avoid any line ending conversion.
66   o At the time of this writing (February 2014), the current MinGW bundle
67     (in particular mingwrt-4.0.3; the gcc version is 4.8.1) contains a
68     number of bugs that need work-arounds.  For this reason, you should use
69     FreeType version 2.5.3 (or the git repository) and HarfBuzz version
70     0.9.27 or newer.  The configuration scripts work just fine in an MSYS
71     shell.
73   o Only a very special functionality of HarfBuzz is needed; you might thus
74     reduce dependencies by adding the following options to its `configure'
75     script:
77       --with-glib=no
78       --with-gobject=no
79       --with-cairo=no
80       --with-icu=no
82   o You need bison 2.5 or newer.  MinGW doesn't offer this, but you can
83     download a MinGW port of version 3.0.2 from
85       https://sourceforge.net/projects/ezwinports/files/
87   o To compile a stand-alone version of ttfautohintGUI we must compile a
88     static version of Qt 4 first.  I've successfully followed these
89     instructions with version 4.8.5
91       http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/
93     together with the following minor patch to MinGW
95       https://sourceforge.net/p/mingw/mingw-org-wsl/ci/928ddb53a9623fc38de3997a3acce4a8730f4dc6/
97     Note that these build instructions should be executed in a normal
98     cmd.exe shell, *not* MSYS.
100     An alternative is given at
102       http://qt-project.org/wiki/How-to-build-a-static-Qt-for-Windows-MinGW
104     using a PowerShell script.  However, you still need the small MinGW
105     patch.
107     It's not necessary to invoke `make install' for Qt.  For ttfautohint's
108     `--with-qt' configure script argument in the next build step, use the
109     `bin' subdirectory of the just built Qt library, for example
111       --with-qt=/path/to/qt-4.8.5/bin
113   o Now configure and compile ttfautohint (within an MSYS shell) using
115       configure \
116         CXX='g++ -static-libgcc' \
117         --with-qt=<DIR> \
118         --with-doc=no \
119         ac_cv_func__set_invalid_parameter_handler=no
120       make LDFLAGS=-all-static
122     (The `ac_cv_func...' argument is another work-around for a MinGW bug,
123     the `CXX' line is a fix for libtool).
126 compilation with mxe (on Unix, for Windows)
127 -------------------------------------------
129 [http://mxe.cc]
131   o Check out the mxe git repository.
133   o Apply the following two patches to get smaller ttfautohint binaries.
135 diff --git a/src/harfbuzz.mk b/src/harfbuzz.mk
136 index 6b299da..bb56456 100644
137 --- a/src/harfbuzz.mk
138 +++ b/src/harfbuzz.mk
139 @@ -20,6 +20,10 @@ endef
140  define $(PKG)_BUILD
141      cd '$(1)' && ./configure \
142          $(MXE_CONFIGURE_OPTS) \
143 +        --with-glib=no \
144 +        --with-gobject=no \
145 +        --with-cairo=no \
146 +        --with-icu=no \
147          LIBS='-lstdc++'
148      $(MAKE) -C '$(1)' -j '$(JOBS)' install
149  endef
150 diff --git a/src/qt.mk b/src/qt.mk
151 index 889394e..aaf59f7 100644
152 --- a/src/qt.mk
153 +++ b/src/qt.mk
154 @@ -32,13 +32,16 @@ define $(PKG)_BUILD
155          -device-option PKG_CONFIG='$(TARGET)-pkg-config' \
156          -force-pkg-config \
157          -release \
158 -        -exceptions \
159 +        -no-exceptions \
160 +        -no-qt3support \
161          -static \
162          -prefix '$(PREFIX)/$(TARGET)/qt' \
163          -prefix-install \
164          -script \
165 +        -no-scripttools \
166 +        -no-stl \
167          -no-iconv \
168 -        -opengl desktop \
169 +        -no-opengl \
170          -no-webkit \
171          -no-glib \
172          -no-gstreamer \
173 @@ -51,11 +54,7 @@ define $(PKG)_BUILD
174          -nomake demos \
175          -nomake docs \
176          -nomake examples \
177 -        -qt-sql-sqlite \
178 -        -qt-sql-odbc \
179 -        -qt-sql-psql \
180 -        -no-sql-mysql \
181 -        -qt-sql-tds -D Q_USE_SYBASE \
182 +        -no-sql-sqlite \
183          -system-zlib \
184          -system-libpng \
185          -system-libjpeg \
187   o Put the following patch into a file called `qt-2.patch' and add it to
188     mxe's `src' directory.  This also helps reduce the size of the `qt'
189     libraries.
191 --- a/mkspecs/win32-g++/qmake.conf
192 +++ b/mkspecs/win32-g++/qmake.conf
193 @@ -31,7 +31,7 @@
194  QMAKE_CFLAGS_DEPS      = -M
195  QMAKE_CFLAGS_WARN_ON   = -Wall -Wextra
196  QMAKE_CFLAGS_WARN_OFF  = -w
197 -QMAKE_CFLAGS_RELEASE   = -O2
198 +QMAKE_CFLAGS_RELEASE   = -Os -momit-leaf-frame-pointer
199  QMAKE_CFLAGS_DEBUG     = -g
200  QMAKE_CFLAGS_YACC      = -Wno-unused -Wno-parentheses
202   o At the time of this writing (January 2016), mxe's default target is
203     `i686-w64-mingw32.static', which builds a 32bit static executable.  We
204     want exactly that for the distributed binaries.
206     [For private builds, however, this can be changed by setting the
207      `MXE_TARGETS' variable in the `settings.mk' file.  A template for this
208      file gets automatically generated after calling make the first time, so
209      you should call make, abort the build process after a few seconds,
210      adjust `settings.mk' to your needs, then continue with the instructions
211      below.  More details can be found on mxe's homepage.]
213   o Now build the necessary mxe infrastructure with
215       make check-requirements
216       make qt
217       make freetype
219     These calls download packages with a total size of approx. 550MBytes. 
220     Compilation easily takes some hours on a slower computer; all together
221     it finally occupies slightly more than 2GBytes on the harddisk.
223   o You are now ready to build ttfautohint from the git repository with
225       export PATH=/your/path/to/git/mxe/usr/bin:$PATH
227       mkdir out
229       ./bootstrap
230       ./configure \
231         --host=i686-w64-mingw32.static \
232         --with-qt=/your/path/to/git/mxe/usr/i686-w64-mingw32.static/qt/bin \
233         --disable-shared \
234         --without-doc \
235         --prefix=`pwd`/out
236       make
237       make install-strip
239     Binaries can be found in `out/bin'.