2020-05-17 19:45:41 +03:00
|
|
|
#
|
|
|
|
# Meson project file for FreeType 2
|
|
|
|
#
|
|
|
|
|
2024-01-27 19:11:22 +03:00
|
|
|
# Copyright (C) 2020-2024 by
|
2020-05-17 19:45:41 +03:00
|
|
|
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
#
|
|
|
|
# This file is part of the FreeType project, and may only be used, modified,
|
|
|
|
# and distributed under the terms of the FreeType project license,
|
|
|
|
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
|
|
|
# indicate that you have read the license and understand and accept it
|
|
|
|
# fully.
|
|
|
|
|
2021-07-03 17:34:01 +03:00
|
|
|
#
|
|
|
|
# Say
|
|
|
|
#
|
|
|
|
# meson configure
|
|
|
|
#
|
|
|
|
# to see all configuration options and their default values. For example,
|
|
|
|
# to build only a shared version of FreeType, override the default value
|
|
|
|
# with
|
|
|
|
#
|
|
|
|
# meson setup -Ddefault_library=shared
|
|
|
|
#
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
project('freetype2', 'c',
|
|
|
|
meson_version: '>= 0.55.0',
|
2020-10-26 18:25:08 +03:00
|
|
|
version: run_command('builds/meson/extract_freetype_version.py',
|
2021-12-14 06:50:18 +03:00
|
|
|
'include/freetype/freetype.h',
|
|
|
|
check: true).stdout().strip(),
|
2020-05-17 19:45:41 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2021-07-05 06:44:13 +03:00
|
|
|
# Only meson >= 0.57 can read a file and assign its contents to a
|
|
|
|
# variable; we thus use an external command to have this functionality
|
|
|
|
# with older versions, too.
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2021-12-14 07:40:16 +03:00
|
|
|
python_exe = find_program('python3')
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2020-11-04 23:00:22 +03:00
|
|
|
ft2_so_version = run_command(python_exe,
|
2020-09-22 21:05:37 +03:00
|
|
|
files('builds/meson/extract_libtool_version.py'),
|
2020-05-17 19:45:41 +03:00
|
|
|
'--soversion',
|
2021-12-14 06:50:18 +03:00
|
|
|
files('builds/unix/configure.raw'),
|
|
|
|
check: true).stdout().strip()
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2020-10-26 20:39:19 +03:00
|
|
|
ft2_pkgconfig_version = run_command(python_exe,
|
2020-11-04 23:00:22 +03:00
|
|
|
files('builds/meson/extract_libtool_version.py'),
|
2021-12-14 06:50:18 +03:00
|
|
|
files('builds/unix/configure.raw'),
|
|
|
|
check: true).stdout().strip()
|
2020-11-04 23:00:22 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
ft2_includes = include_directories('include')
|
|
|
|
|
2021-07-28 00:30:16 +03:00
|
|
|
freetype_includedir = join_paths(get_option('includedir'), 'freetype2')
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2022-11-14 13:36:25 +03:00
|
|
|
ft2_defines = []
|
|
|
|
|
2024-08-12 13:43:14 +03:00
|
|
|
freetype_aclocaldir = join_paths(get_option('datadir'), 'aclocal')
|
|
|
|
|
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
# Generate a custom `ftmodule.h` version based on the content of
|
|
|
|
# `modules.cfg`.
|
|
|
|
|
|
|
|
ftmodule_h = custom_target('ftmodule.h',
|
|
|
|
output: 'ftmodule.h',
|
|
|
|
input: 'modules.cfg',
|
2020-09-22 21:05:37 +03:00
|
|
|
command: [python_exe, files('builds/meson/parse_modules_cfg.py'),
|
2020-05-17 19:45:41 +03:00
|
|
|
'--format=ftmodule.h', '@INPUT@', '--output', '@OUTPUT@'],
|
|
|
|
install: true,
|
2021-07-28 00:30:16 +03:00
|
|
|
install_dir: join_paths(freetype_includedir, 'freetype/config'),
|
2020-05-17 19:45:41 +03:00
|
|
|
)
|
|
|
|
ft2_sources = [ftmodule_h]
|
2022-11-14 13:36:25 +03:00
|
|
|
ft2_defines += ['-DFT_CONFIG_MODULES_H=<ftmodule.h>']
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
# FreeType 2 modules.
|
|
|
|
|
|
|
|
ft_main_modules = run_command(python_exe,
|
2020-09-22 21:05:37 +03:00
|
|
|
files('builds/meson/parse_modules_cfg.py'),
|
2020-05-17 19:45:41 +03:00
|
|
|
'--format=main-modules',
|
2021-12-14 06:50:18 +03:00
|
|
|
files('modules.cfg'),
|
|
|
|
check: true).stdout().strip().split()
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
ft2_sources += files([
|
|
|
|
'src/base/ftbase.c',
|
|
|
|
'src/base/ftinit.c',
|
|
|
|
])
|
|
|
|
|
|
|
|
foreach mod: ft_main_modules
|
|
|
|
source = mod
|
|
|
|
if mod == 'winfonts'
|
|
|
|
source = 'winfnt'
|
|
|
|
elif mod == 'cid'
|
|
|
|
source = 'type1cid'
|
|
|
|
endif
|
|
|
|
ft2_sources += 'src/@0@/@1@.c'.format(mod, source)
|
|
|
|
endforeach
|
|
|
|
|
2021-08-02 13:55:28 +03:00
|
|
|
# NOTE: The `bzip2` aux module is handled through options.
|
2020-05-17 19:45:41 +03:00
|
|
|
ft_aux_modules = run_command(python_exe,
|
2020-09-22 21:05:37 +03:00
|
|
|
files('builds/meson/parse_modules_cfg.py'),
|
2020-05-17 19:45:41 +03:00
|
|
|
'--format=aux-modules',
|
2021-12-14 06:50:18 +03:00
|
|
|
files('modules.cfg'),
|
|
|
|
check: true).stdout().strip().split()
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
foreach auxmod: ft_aux_modules
|
|
|
|
source = auxmod
|
|
|
|
# Most sources are named `src/<module>/<module>.c`, but there are a few
|
|
|
|
# exceptions handled here.
|
|
|
|
if auxmod == 'cache'
|
|
|
|
source = 'ftcache'
|
|
|
|
elif auxmod == 'lzw'
|
|
|
|
source = 'ftlzw'
|
2021-08-02 13:55:28 +03:00
|
|
|
elif auxmod == 'gzip'
|
|
|
|
source = 'ftgzip'
|
|
|
|
elif auxmod == 'bzip2'
|
2020-05-17 19:45:41 +03:00
|
|
|
# Handled through options instead, see below.
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
ft2_sources += 'src/@0@/@1@.c'.format(auxmod, source)
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
|
|
|
|
# FreeType 2 base extensions.
|
2021-07-03 17:34:01 +03:00
|
|
|
# To be configured in `modules.cfg`.
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
base_extensions = run_command(python_exe,
|
2020-09-22 21:05:37 +03:00
|
|
|
files('builds/meson/parse_modules_cfg.py'),
|
2020-05-17 19:45:41 +03:00
|
|
|
'--format=base-extensions-list',
|
2021-12-14 06:50:18 +03:00
|
|
|
files('modules.cfg'),
|
|
|
|
check: true).stdout().split()
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
foreach ext: base_extensions
|
|
|
|
ft2_sources += files('src/base/' + ext)
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
|
|
|
|
# Header files.
|
|
|
|
|
|
|
|
ft2_public_headers = files([
|
|
|
|
'include/freetype/freetype.h',
|
|
|
|
'include/freetype/ftadvanc.h',
|
|
|
|
'include/freetype/ftbbox.h',
|
|
|
|
'include/freetype/ftbdf.h',
|
|
|
|
'include/freetype/ftbitmap.h',
|
|
|
|
'include/freetype/ftbzip2.h',
|
|
|
|
'include/freetype/ftcache.h',
|
|
|
|
'include/freetype/ftchapters.h',
|
2021-05-23 12:36:16 +03:00
|
|
|
'include/freetype/ftcid.h',
|
2020-05-17 19:45:41 +03:00
|
|
|
'include/freetype/ftcolor.h',
|
|
|
|
'include/freetype/ftdriver.h',
|
|
|
|
'include/freetype/fterrdef.h',
|
|
|
|
'include/freetype/fterrors.h',
|
|
|
|
'include/freetype/ftfntfmt.h',
|
|
|
|
'include/freetype/ftgasp.h',
|
|
|
|
'include/freetype/ftglyph.h',
|
|
|
|
'include/freetype/ftgxval.h',
|
|
|
|
'include/freetype/ftgzip.h',
|
|
|
|
'include/freetype/ftimage.h',
|
|
|
|
'include/freetype/ftincrem.h',
|
|
|
|
'include/freetype/ftlcdfil.h',
|
|
|
|
'include/freetype/ftlist.h',
|
2024-08-13 03:19:19 +03:00
|
|
|
'include/freetype/ftlogging.h',
|
2020-05-17 19:45:41 +03:00
|
|
|
'include/freetype/ftlzw.h',
|
|
|
|
'include/freetype/ftmac.h',
|
|
|
|
'include/freetype/ftmm.h',
|
|
|
|
'include/freetype/ftmodapi.h',
|
|
|
|
'include/freetype/ftmoderr.h',
|
|
|
|
'include/freetype/ftotval.h',
|
|
|
|
'include/freetype/ftoutln.h',
|
|
|
|
'include/freetype/ftparams.h',
|
|
|
|
'include/freetype/ftpfr.h',
|
|
|
|
'include/freetype/ftrender.h',
|
|
|
|
'include/freetype/ftsizes.h',
|
|
|
|
'include/freetype/ftsnames.h',
|
|
|
|
'include/freetype/ftstroke.h',
|
|
|
|
'include/freetype/ftsynth.h',
|
|
|
|
'include/freetype/ftsystem.h',
|
|
|
|
'include/freetype/fttrigon.h',
|
|
|
|
'include/freetype/fttypes.h',
|
|
|
|
'include/freetype/ftwinfnt.h',
|
2021-12-26 07:14:11 +03:00
|
|
|
'include/freetype/otsvg.h',
|
2020-05-17 19:45:41 +03:00
|
|
|
'include/freetype/t1tables.h',
|
|
|
|
'include/freetype/ttnameid.h',
|
|
|
|
'include/freetype/tttables.h',
|
|
|
|
'include/freetype/tttags.h',
|
|
|
|
])
|
|
|
|
|
|
|
|
ft2_config_headers = files([
|
|
|
|
'include/freetype/config/ftconfig.h',
|
|
|
|
'include/freetype/config/ftheader.h',
|
|
|
|
'include/freetype/config/ftstdlib.h',
|
|
|
|
'include/freetype/config/integer-types.h',
|
|
|
|
'include/freetype/config/mac-support.h',
|
|
|
|
'include/freetype/config/public-macros.h',
|
|
|
|
])
|
|
|
|
|
2022-11-14 13:36:25 +03:00
|
|
|
ft2_defines += ['-DFT2_BUILD_LIBRARY=1']
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
# System support file.
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
|
|
|
# NOTE: msys2 on Windows has `unistd.h` and `fcntl.h` but not `sys/mman.h`!
|
|
|
|
has_unistd_h = cc.has_header('unistd.h')
|
|
|
|
has_fcntl_h = cc.has_header('fcntl.h')
|
|
|
|
has_sys_mman_h = cc.has_header('sys/mman.h')
|
|
|
|
|
|
|
|
mmap_option = get_option('mmap')
|
2021-03-08 12:30:57 +03:00
|
|
|
|
2021-07-12 11:22:48 +03:00
|
|
|
use_unix_ftsystem_c = false
|
2021-03-07 21:13:59 +03:00
|
|
|
if mmap_option.disabled()
|
|
|
|
ft2_sources += files(['src/base/ftsystem.c',])
|
2021-01-27 14:43:41 +03:00
|
|
|
elif host_machine.system() == 'windows'
|
|
|
|
ft2_sources += files(['builds/windows/ftsystem.c',])
|
2020-05-17 19:45:41 +03:00
|
|
|
else
|
2021-03-07 21:13:59 +03:00
|
|
|
if has_unistd_h and has_fcntl_h and has_sys_mman_h
|
2021-07-03 17:34:01 +03:00
|
|
|
# This version of `ftsystem.c` uses `mmap` to read input font files.
|
2021-03-07 21:13:59 +03:00
|
|
|
ft2_sources += files(['builds/unix/ftsystem.c',])
|
2021-07-12 11:22:48 +03:00
|
|
|
use_unix_ftsystem_c = true
|
2021-03-07 21:13:59 +03:00
|
|
|
elif mmap_option.enabled()
|
|
|
|
error('mmap was enabled via options but is not available,'
|
|
|
|
+ ' required headers were not found!')
|
|
|
|
else
|
|
|
|
ft2_sources += files(['src/base/ftsystem.c',])
|
|
|
|
endif
|
2020-05-17 19:45:41 +03:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# Debug support file
|
|
|
|
#
|
|
|
|
# NOTE: Some specialized versions exist for other platforms not supported by
|
|
|
|
# Meson. Most implementation differences are extremely minor, i.e., in the
|
2021-07-03 17:34:01 +03:00
|
|
|
# implementation of `FT_Message` and `FT_Panic`, and getting the `FT2_DEBUG`
|
2020-05-17 19:45:41 +03:00
|
|
|
# value from the environment, when this is supported. A smaller refactor
|
|
|
|
# might make these platform-specific files much smaller, and could be moved
|
|
|
|
# into `ftsystem.c` as well.
|
2024-08-08 11:28:05 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
if host_machine.system() == 'windows'
|
2020-10-26 21:21:19 +03:00
|
|
|
winmod = import('windows')
|
|
|
|
ft2_sources += [
|
|
|
|
'builds/windows/ftdebug.c',
|
|
|
|
winmod.compile_resources('src/base/ftver.rc'),
|
|
|
|
]
|
2020-05-17 19:45:41 +03:00
|
|
|
else
|
2020-10-26 21:21:19 +03:00
|
|
|
ft2_sources += 'src/base/ftdebug.c'
|
2020-05-17 19:45:41 +03:00
|
|
|
endif
|
|
|
|
|
2021-11-21 13:01:37 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
ft2_deps = []
|
2021-11-21 13:01:37 +03:00
|
|
|
common_ldflags = []
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
|
2021-11-21 13:01:37 +03:00
|
|
|
# Correct compatibility version for OS x.
|
2021-11-21 09:58:50 +03:00
|
|
|
#
|
|
|
|
# OSX sets the compatibility_version (aka libtools version) differently from
|
|
|
|
# the library name.
|
2024-08-08 11:28:05 +03:00
|
|
|
|
2021-11-21 09:58:50 +03:00
|
|
|
if host_machine.system() == 'darwin'
|
2021-11-21 13:01:37 +03:00
|
|
|
# maintain compatibility with autotools on macOS
|
2021-11-21 09:58:50 +03:00
|
|
|
common_ldflags = [
|
|
|
|
'-compatibility_version', ft2_pkgconfig_version.split('.')[0],
|
|
|
|
'-current_version', ft2_pkgconfig_version
|
|
|
|
]
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
# Generate `ftoption.h` based on available dependencies.
|
|
|
|
|
2020-10-26 21:56:05 +03:00
|
|
|
process_header_command = [python_exe,
|
2020-09-22 21:05:37 +03:00
|
|
|
files('builds/meson/process_ftoption_h.py'),
|
2020-05-17 19:45:41 +03:00
|
|
|
'@INPUT@', '--output=@OUTPUT@']
|
2020-10-26 21:56:05 +03:00
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
ftoption_command = process_header_command
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# External GZip support.
|
2021-08-17 18:27:36 +03:00
|
|
|
zlib_option = get_option('zlib')
|
2021-03-08 12:30:57 +03:00
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# Backward-compatible aliases.
|
2021-08-17 18:27:36 +03:00
|
|
|
if zlib_option == 'disabled'
|
|
|
|
zlib_option = 'none'
|
|
|
|
elif zlib_option == 'enabled'
|
|
|
|
zlib_option = 'auto'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if zlib_option == 'auto'
|
|
|
|
# First try to find a system installation, otherwise fall back to
|
|
|
|
# the subproject.
|
|
|
|
zlib_dep = dependency('zlib',
|
|
|
|
required: false)
|
|
|
|
if zlib_dep.found()
|
|
|
|
zlib_option = 'system'
|
|
|
|
else
|
|
|
|
zlib_option = 'external'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if zlib_option == 'none'
|
|
|
|
ftoption_command += [ '--disable=FT_CONFIG_OPTION_USE_ZLIB' ]
|
|
|
|
elif zlib_option == 'internal'
|
|
|
|
ftoption_command += [ '--enable=FT_CONFIG_OPTION_USE_ZLIB' ]
|
|
|
|
elif zlib_option == 'external'
|
|
|
|
ftoption_command += [ '--enable=FT_CONFIG_OPTION_USE_ZLIB' ]
|
|
|
|
zlib_project = subproject('zlib',
|
|
|
|
required: true,
|
|
|
|
default_options: 'default_library=static')
|
|
|
|
zlib_dep = zlib_project.get_variable('zlib_dep')
|
|
|
|
ft2_deps += [zlib_dep]
|
|
|
|
elif zlib_option == 'system'
|
|
|
|
zlib_dep = dependency('zlib',
|
|
|
|
required: true)
|
|
|
|
assert(zlib_dep.found(), 'Could not find system zlib installation!')
|
|
|
|
ftoption_command += [
|
|
|
|
'--enable=FT_CONFIG_OPTION_USE_ZLIB',
|
|
|
|
'--enable=FT_CONFIG_OPTION_SYSTEM_ZLIB',
|
|
|
|
]
|
2020-10-26 21:56:05 +03:00
|
|
|
ft2_deps += [zlib_dep]
|
|
|
|
else
|
2021-08-17 18:27:36 +03:00
|
|
|
assert(false, 'Invalid zlib option ' + zlib_option)
|
2020-05-17 19:45:41 +03:00
|
|
|
endif
|
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# BZip2 support.
|
2024-10-12 13:49:46 +03:00
|
|
|
bzip2_dep = dependency(
|
|
|
|
'bzip2',
|
|
|
|
required: get_option('bzip2').disabled() ? get_option('bzip2') : false,
|
|
|
|
)
|
2024-03-04 21:14:51 +03:00
|
|
|
if not bzip2_dep.found()
|
2024-10-12 13:49:46 +03:00
|
|
|
bzip2_dep = cc.find_library(
|
|
|
|
'bz2',
|
2024-08-08 11:28:05 +03:00
|
|
|
has_headers: ['bzlib.h'],
|
2024-10-12 13:49:46 +03:00
|
|
|
required: get_option('bzip2'),
|
|
|
|
)
|
2024-03-04 21:14:51 +03:00
|
|
|
endif
|
2021-03-08 12:30:57 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
if bzip2_dep.found()
|
|
|
|
ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BZIP2']
|
|
|
|
ft2_sources += files(['src/bzip2/ftbzip2.c',])
|
|
|
|
ft2_deps += [bzip2_dep]
|
|
|
|
endif
|
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# PNG support.
|
2021-03-08 12:30:57 +03:00
|
|
|
libpng_dep = dependency('libpng',
|
|
|
|
required: get_option('png'),
|
|
|
|
fallback: 'libpng')
|
|
|
|
|
2021-01-06 10:55:16 +03:00
|
|
|
if libpng_dep.found()
|
|
|
|
ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_PNG']
|
|
|
|
ft2_deps += [libpng_dep]
|
|
|
|
endif
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# Harfbuzz support.
|
2020-05-17 19:45:41 +03:00
|
|
|
harfbuzz_dep = dependency('harfbuzz',
|
2021-03-08 12:30:57 +03:00
|
|
|
version: '>= 2.0.0',
|
2022-05-27 18:26:30 +03:00
|
|
|
required: get_option('harfbuzz'),
|
|
|
|
default_options: ['freetype=disabled'])
|
2021-03-08 12:30:57 +03:00
|
|
|
|
2020-10-26 20:09:56 +03:00
|
|
|
if harfbuzz_dep.found()
|
|
|
|
ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_HARFBUZZ']
|
|
|
|
ft2_deps += [harfbuzz_dep]
|
|
|
|
endif
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# Brotli decompression support.
|
2021-03-08 12:30:57 +03:00
|
|
|
brotli_dep = dependency('libbrotlidec',
|
|
|
|
required: get_option('brotli'))
|
|
|
|
|
2020-10-26 20:09:56 +03:00
|
|
|
if brotli_dep.found()
|
|
|
|
ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BROTLI']
|
|
|
|
ft2_deps += [brotli_dep]
|
|
|
|
endif
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2024-10-12 13:47:38 +03:00
|
|
|
if get_option('error_strings')
|
|
|
|
ftoption_command += ['--enable=FT_CONFIG_OPTION_ERROR_STRINGS']
|
|
|
|
endif
|
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
# We can now generate `ftoption.h`.
|
|
|
|
ftoption_h = custom_target('ftoption.h',
|
|
|
|
input: 'include/freetype/config/ftoption.h',
|
|
|
|
output: 'ftoption.h',
|
|
|
|
command: ftoption_command,
|
|
|
|
install: true,
|
2021-07-28 00:30:16 +03:00
|
|
|
install_dir: join_paths(freetype_includedir, 'freetype/config'),
|
2020-05-17 19:45:41 +03:00
|
|
|
)
|
|
|
|
ft2_sources += ftoption_h
|
2020-10-26 21:56:05 +03:00
|
|
|
ft2_defines += ['-DFT_CONFIG_OPTIONS_H=<ftoption.h>']
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2024-10-12 13:57:59 +03:00
|
|
|
if host_machine.system() == 'windows' and \
|
|
|
|
get_option('default_library') == 'shared'
|
2020-12-23 13:30:19 +03:00
|
|
|
ft2_defines += ['-DDLL_EXPORT=1']
|
|
|
|
endif
|
|
|
|
|
2021-02-14 00:32:26 +03:00
|
|
|
|
2021-07-03 17:34:01 +03:00
|
|
|
# Generate `ftconfig.h`.
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2020-10-26 21:56:05 +03:00
|
|
|
ftconfig_command = process_header_command
|
2024-08-08 11:28:05 +03:00
|
|
|
|
2020-10-26 21:56:05 +03:00
|
|
|
if has_unistd_h
|
|
|
|
ftconfig_command += '--enable=HAVE_UNISTD_H'
|
|
|
|
endif
|
|
|
|
if has_fcntl_h
|
|
|
|
ftconfig_command += '--enable=HAVE_FCNTL_H'
|
|
|
|
endif
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2021-07-12 11:22:48 +03:00
|
|
|
if use_unix_ftsystem_c
|
2020-10-26 21:56:05 +03:00
|
|
|
ftconfig_h_in = files('builds/unix/ftconfig.h.in')
|
2021-02-14 00:32:26 +03:00
|
|
|
ftconfig_h = custom_target('ftconfig.h',
|
|
|
|
input: ftconfig_h_in,
|
|
|
|
output: 'ftconfig.h',
|
|
|
|
command: ftconfig_command,
|
|
|
|
install: true,
|
2021-07-28 00:30:16 +03:00
|
|
|
install_dir: join_paths(freetype_includedir, 'freetype/config'),
|
2021-02-14 00:32:26 +03:00
|
|
|
)
|
|
|
|
ft2_sources += ftconfig_h
|
|
|
|
ft2_defines += ['-DFT_CONFIG_CONFIG_H=<ftconfig.h>']
|
2020-05-17 19:45:41 +03:00
|
|
|
endif
|
|
|
|
|
2020-10-26 21:56:05 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
ft2_lib = library('freetype',
|
|
|
|
sources: ft2_sources + [ftmodule_h],
|
2020-10-26 21:56:05 +03:00
|
|
|
c_args: ft2_defines,
|
|
|
|
gnu_symbol_visibility: 'hidden',
|
2020-05-17 19:45:41 +03:00
|
|
|
include_directories: ft2_includes,
|
|
|
|
dependencies: ft2_deps,
|
|
|
|
install: true,
|
2020-11-04 23:00:22 +03:00
|
|
|
version: ft2_so_version,
|
2021-11-21 09:58:50 +03:00
|
|
|
link_args: common_ldflags,
|
2020-05-17 19:45:41 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# To be used by other projects including this one via `subproject`.
|
|
|
|
|
2021-02-10 17:30:40 +03:00
|
|
|
freetype_dep = declare_dependency(
|
2020-05-17 19:45:41 +03:00
|
|
|
include_directories: ft2_includes,
|
|
|
|
link_with: ft2_lib,
|
2020-10-26 20:39:19 +03:00
|
|
|
version: ft2_pkgconfig_version)
|
2021-03-08 12:30:57 +03:00
|
|
|
|
2021-02-10 17:30:40 +03:00
|
|
|
meson.override_dependency('freetype2', freetype_dep)
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
# NOTE: Using both `install_dir` and `subdir` doesn't seem to work
|
|
|
|
# below, i.e., the `subdir` value seems to be ignored, contrary to
|
|
|
|
# examples in the Meson documentation.
|
2020-05-17 19:45:41 +03:00
|
|
|
install_headers('include/ft2build.h',
|
2021-07-28 00:30:16 +03:00
|
|
|
install_dir: freetype_includedir)
|
2020-05-17 19:45:41 +03:00
|
|
|
install_headers(ft2_public_headers,
|
2021-07-28 00:30:16 +03:00
|
|
|
install_dir: join_paths(freetype_includedir, 'freetype'))
|
2020-05-17 19:45:41 +03:00
|
|
|
install_headers(ft2_config_headers,
|
2021-07-28 00:30:16 +03:00
|
|
|
install_dir: join_paths(freetype_includedir, 'freetype/config'))
|
2020-05-17 19:45:41 +03:00
|
|
|
|
|
|
|
|
2024-08-12 13:43:14 +03:00
|
|
|
install_data('builds/unix/freetype2.m4',
|
|
|
|
install_dir: freetype_aclocaldir)
|
|
|
|
|
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
pkgconfig = import('pkgconfig')
|
2021-03-08 12:30:57 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
pkgconfig.generate(ft2_lib,
|
|
|
|
filebase: 'freetype2',
|
|
|
|
name: 'FreeType 2',
|
|
|
|
description: 'A free, high-quality, and portable font engine.',
|
|
|
|
url: 'https://freetype.org',
|
|
|
|
subdirs: 'freetype2',
|
2020-10-26 20:39:19 +03:00
|
|
|
version: ft2_pkgconfig_version,
|
2020-05-17 19:45:41 +03:00
|
|
|
)
|
|
|
|
|
2021-06-16 00:12:57 +03:00
|
|
|
if get_option('tests').enabled()
|
|
|
|
subdir('tests')
|
|
|
|
endif
|
2020-05-17 19:45:41 +03:00
|
|
|
|
2024-08-08 11:28:05 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
# NOTE: Unlike the old `make refdoc` command, this generates the
|
|
|
|
# documentation under `$BUILD/docs/` since Meson doesn't support modifying
|
|
|
|
# the source root directory (which is a good thing).
|
2024-08-08 11:28:05 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
gen_docs = custom_target('freetype2 reference documentation',
|
|
|
|
output: 'docs',
|
|
|
|
input: ft2_public_headers + ft2_config_headers,
|
|
|
|
command: [python_exe,
|
2020-09-22 21:05:37 +03:00
|
|
|
files('builds/meson/generate_reference_docs.py'),
|
2020-10-26 18:25:08 +03:00
|
|
|
'--version=' + meson.project_version(),
|
2021-10-07 01:46:14 +03:00
|
|
|
'--input-dir=' + meson.current_source_dir(),
|
2020-05-17 19:45:41 +03:00
|
|
|
'--output-dir=@OUTPUT@'
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-01-06 21:19:29 +03:00
|
|
|
|
|
|
|
summary({'OS': host_machine.system(),
|
2021-08-02 13:55:28 +03:00
|
|
|
}, section: 'Operating System')
|
|
|
|
|
2021-08-17 18:27:36 +03:00
|
|
|
summary({'Zlib': zlib_option,
|
2024-10-12 13:51:25 +03:00
|
|
|
'Bzip2': bzip2_dep.found(),
|
|
|
|
'Png': libpng_dep.found(),
|
|
|
|
'Harfbuzz': harfbuzz_dep.found(),
|
|
|
|
'Brotli': brotli_dep.found(),
|
|
|
|
}, bool_yn: true, section: 'Used Libraries')
|
2021-01-06 21:19:29 +03:00
|
|
|
|
2020-05-17 19:45:41 +03:00
|
|
|
# EOF
|