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