-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.meson
124 lines (89 loc) · 4.26 KB
/
README.meson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
The FreeType 2 demo programs can now be built with the Meson build
system (https://mesonbuild.com).
Requirements
------------
The Meson build tool and its dependencies must be installed, as well
as a C and a C++ compiler.
If Qt5 development libraries are available on your system, the
`ftinspect` program is compiled and linked against them, or ignored
otherwise.
A FreeType 2 source repository is always required to build some of the
test programs, because they depend on internal headers of the library
(e.g., `ttdebug`).
By default, the first run of `meson setup <builddir>` clones the HEAD
revision of FreeType's git repository under `subprojects/freetype2`.
However, you can use any other revision if you follow one of these
methods *before* running `meson setup`:
- Modify the contents of `subprojects/freetype2.wrap` to point to
your chosen URL and/or revision.
- Alternatively, create or replace `subprojects/freetype2` with a
symlink to or a copy of the FreeType source tree of your choosing.
In case meson cloned FreeType already, and new commits were added to
its git repository, say
meson subprojects update
to update it.
Quick compilation instructions
------------------------------
# Set up build directory named 'build', and optionally clone
# the FreeType 2 source repository, as explained above.
meson setup build
# Compile all demo programs
#
# You should be able to be able to run all programs directly from
# the `build/` directory.
meson compile -C build
The binaries can then be found in in the `build` subdirectory except
`ftinspect`, which is put into `build/src/ftinspect`.
Installation with `meson install`
---------------------------------
Please keep in mind that the FreeType 2 demo programs are mostly used
to develop and debug FreeType; it is thus rather unlikely that you
want to install them on your system. Nevertheless, the `meson
install` command works, with a big caveat: it installs the FreeType 2
headers, libraries, and configuration files as well.
This is the default behaviour for `meson install`, and can be
undesirable. Fortunately, Meson version 0.58 and above supports the
`--skip-subprojects` option to override this; see
https://mesonbuild.com/Release-notes-for-0-58-0.html#skip-subprojects-installation
A clean build followed by an installation using Meson 0.58 or above
looks like the following.
# Set up compilation to build and install the stripped demo programs
# to the `/opt` directory, instead of the default (which would be
# `/usr/local` on Linux).
#
# Note the extra options set here:
#
# * `strip=true` ensures that the installed binaries don't contain
# debug symbols.
# * `buildtype=release` ensures that the binaries are fully
# optimized.
meson setup build -Dstrip=true -Dbuildtype=release --prefix=/opt
meson install -C build --skip-subprojects
For older Meson releases, simply do not use `--skip-subprojects` and
remove the extra files manually. For example, assuming that FreeType
was *not* already installed under `/opt`, one could do
meson setup build -Dstrip=true -Dbuildtype=release --prefix=/opt
meson install -C build
rm /opt/lib/x86_64-linux-gnu/libfreetype.a
rm /opt/lib/x86_64-linux-gnu/pkgconfig/freetype2.pc
rm -rf /opt/include/freetype2
The `x86_64-linux-gnu` part varies depending on the host OS and used
architecture.
Note that by default all binaries are statically linked to the
FreeType library, which is useful for debugging. It also ensures that
the programs always use the exact FreeType 2 version they were
compiled against at runtime (which could be broken if your library
search path is not set correctly).
It is possible to build and link against the shared library instead,
by adding the `-Dfreetype2:default_library=shared` option, as in
meson setup build \
-Dstrip=true \
-Dbuildtype=release \
-Dfreetype2:default_library=shared \
--prefix=/opt \
meson install -C build --skip-subprojects
Note that `--skip-subprojects` prevents installation of the FreeType 2
shared library to the destination directory. Do not use it if you
want to install the library as well (along its headers and config
files).
--- end of README.meson ---