Require HarfBuzz 1.8 or newer.
[ttfautohint.git] / INSTALL.git
blob0b03cbc04ed9e12b85abe8ddd8d5d3575a170f26
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 (2.6)
21   inkscape (0.48.2)
22   X11 (in particular the `xwininfo' program)
23   ImageMagick (6.7.4)
24   xelatex (TeXLive 2018)
26 The version numbers in parentheses are known to work.  Newer versions should
27 work also.
29 The main font for the PDF file is Libertine; in addition, we use various
30 sans-serif TrueType fonts from the Noto family which are not part of
31 TeXLive.  To access them it is recommended to use SVN to clone parts of the
32 huge `noto-fonts' git repository and adjust the `TTFONTS' environment
33 variable accordingly to make xelatex find the fonts in the proper
34 directories.
36 [Yes, we access a github repository with SVN to quickly download just a part
37  of it!]
39   svn checkout \
40     https://github.com/googlei18n/noto-fonts/trunk/phaseIII_only/unhinted/ttf \
41     noto-fonts-alpha
42   svn checkout \
43     https://github.com/googlei18n/noto-fonts/trunk/unhinted \
44     noto-fonts
46 Here is an example how to set `TTFONTS'.
48   TTFONTS="/home/wl/noto-fonts-alpha//:/home/wl/noto-fonts//:"
50 Note the double slash ending the path elements; this makes TeX and its tools
51 search all subdirectories.  Also note the trailing `:' character, which
52 ensures that the directories are prepended to the built-in value of
53 `TTFONTS' (instead of replacing it).
55 Say
57   ./bootstrap
59 to clone the `gnulib' repository (which gets installed as a git submodule),
60 to build the `configure' script, and to set up necessary auxiliary files.
61 Then you can proceed with the instructions given in the `INSTALL' file with
62 the exception that parellel builds with `make -j' are not supported yet.
65 compilation within the MinGW environment (on Windows)
66 -----------------------------------------------------
68 [http://mingw.org]
70   o Since MSYS, the shell of MinGW, uses LF as line endings, `git checkout'
71     should not convert files to CRLF.  Before checking out the FreeType and
72     ttfautohint repositories, you should issue the command
74       git config --global core.autocrlf input
76     to avoid any line ending conversion.
78   o At the time of this writing (February 2014), the current MinGW bundle
79     (in particular mingwrt-4.0.3; the gcc version is 4.8.1) contains a
80     number of bugs that need work-arounds.  For this reason, you should use
81     FreeType version 2.5.3 (or the git repository) and HarfBuzz version
82     0.9.27 or newer.  The configuration scripts work just fine in an MSYS
83     shell.
85   o Only a very special functionality of HarfBuzz is needed; you might thus
86     reduce dependencies by adding the following options to its `configure'
87     script:
89       --with-glib=no
90       --with-gobject=no
91       --with-cairo=no
92       --with-icu=no
94   o You need bison 2.5 or newer.  MinGW doesn't offer this, but you can
95     download a MinGW port of version 3.0.2 from
97       https://sourceforge.net/projects/ezwinports/files/
99   o To compile a stand-alone version of ttfautohintGUI we must compile a
100     static version of Qt 4 first.  I've successfully followed these
101     instructions with version 4.8.5
103       https://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/
105     together with the following minor patch to MinGW
107       https://sourceforge.net/p/mingw/mingw-org-wsl/ci/928ddb53a9623fc38de3997a3acce4a8730f4dc6/
109     Note that these build instructions should be executed in a normal
110     cmd.exe shell, *not* MSYS.
112     An alternative is given at
114       https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
116     using a PowerShell script.  However, you still need the small MinGW
117     patch.
119     It's not necessary to invoke `make install' for Qt.  For ttfautohint's
120     `--with-qt' configure script argument in the next build step, use the
121     `bin' subdirectory of the just built Qt library, for example
123       --with-qt=/path/to/qt-4.8.5/bin
125   o Now configure and compile ttfautohint (within an MSYS shell) using
127       configure \
128         CXX='g++ -static-libgcc' \
129         --with-qt=<DIR> \
130         --with-doc=no \
131         ac_cv_func__set_invalid_parameter_handler=no
132       make LDFLAGS=-all-static
134     (The `ac_cv_func...' argument is another work-around for a MinGW bug,
135     the `CXX' line is a fix for libtool).
138 compilation with mxe (on Unix, for Windows)
139 -------------------------------------------
141 [https://mxe.cc]
143   o Check out the mxe git repository.
145   o Apply the following two patches to get smaller ttfautohint binaries.
147 diff --git a/src/harfbuzz.mk b/src/harfbuzz.mk
148 index 6b299da..bb56456 100644
149 --- a/src/harfbuzz.mk
150 +++ b/src/harfbuzz.mk
151 @@ -20,6 +20,10 @@ endef
152  define $(PKG)_BUILD
153      cd '$(1)' && ./configure \
154          $(MXE_CONFIGURE_OPTS) \
155 +        --with-glib=no \
156 +        --with-gobject=no \
157 +        --with-cairo=no \
158 +        --with-icu=no \
159          LIBS='-lstdc++'
160      $(MAKE) -C '$(1)' -j '$(JOBS)' install
161  endef
162 diff --git a/src/qt.mk b/src/qt.mk
163 index 889394e..aaf59f7 100644
164 --- a/src/qt.mk
165 +++ b/src/qt.mk
166 @@ -32,13 +32,16 @@ define $(PKG)_BUILD
167          -device-option PKG_CONFIG='$(TARGET)-pkg-config' \
168          -force-pkg-config \
169          -release \
170 -        -exceptions \
171 +        -no-exceptions \
172 +        -no-qt3support \
173          -static \
174          -prefix '$(PREFIX)/$(TARGET)/qt' \
175          -prefix-install \
176          -script \
177 +        -no-scripttools \
178 +        -no-stl \
179          -no-iconv \
180 -        -opengl desktop \
181 +        -no-opengl \
182          -no-webkit \
183          -no-glib \
184          -no-gstreamer \
185 @@ -51,11 +54,7 @@ define $(PKG)_BUILD
186          -nomake demos \
187          -nomake docs \
188          -nomake examples \
189 -        -qt-sql-sqlite \
190 -        -qt-sql-odbc \
191 -        -qt-sql-psql \
192 -        -no-sql-mysql \
193 -        -qt-sql-tds -D Q_USE_SYBASE \
194 +        -no-sql-sqlite \
195          -system-zlib \
196          -system-libpng \
197          -system-libjpeg \
199   o Put the following patch into a file called `qt-2.patch' and add it to
200     mxe's `src' directory.  This also helps reduce the size of the `qt'
201     libraries.
203 --- a/mkspecs/win32-g++/qmake.conf
204 +++ b/mkspecs/win32-g++/qmake.conf
205 @@ -31,7 +31,7 @@
206  QMAKE_CFLAGS_DEPS      = -M
207  QMAKE_CFLAGS_WARN_ON   = -Wall -Wextra
208  QMAKE_CFLAGS_WARN_OFF  = -w
209 -QMAKE_CFLAGS_RELEASE   = -O2
210 +QMAKE_CFLAGS_RELEASE   = -Os -momit-leaf-frame-pointer
211  QMAKE_CFLAGS_DEBUG     = -g
212  QMAKE_CFLAGS_YACC      = -Wno-unused -Wno-parentheses
214   o At the time of this writing (January 2016), mxe's default target is
215     `i686-w64-mingw32.static', which builds a 32bit static executable.  We
216     want exactly that for the distributed binaries.
218     [For private builds, however, this can be changed by setting the
219      `MXE_TARGETS' variable in the `settings.mk' file.  A template for this
220      file gets automatically generated after calling make the first time, so
221      you should call make, abort the build process after a few seconds,
222      adjust `settings.mk' to your needs, then continue with the instructions
223      below.  More details can be found on mxe's homepage.]
225   o Now build the necessary mxe infrastructure with
227       make check-requirements
228       make qt
229       make freetype
231     These calls download packages with a total size of approx. 550MBytes. 
232     Compilation easily takes some hours on a slower computer; all together
233     it finally occupies slightly more than 2GBytes on the harddisk.
235   o You are now ready to build ttfautohint from the git repository with
237       export PATH=/your/path/to/git/mxe/usr/bin:$PATH
239       mkdir out
241       ./bootstrap
242       ./configure \
243         --host=i686-w64-mingw32.static \
244         --with-qt=/your/path/to/git/mxe/usr/i686-w64-mingw32.static/qt/bin \
245         --disable-shared \
246         --without-doc \
247         --prefix=`pwd`/out
248       make
249       make install-strip
251     Binaries can be found in `out/bin'.