Repository navigation
Expand file tree
/
Copy pathcompat.harfbuzz.lua
More file actions
135 lines (133 loc) · 6.42 KB
/
Copy pathcompat.harfbuzz.lua
File metadata and controls
135 lines (133 loc) · 6.42 KB
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
125
126
127
128
129
130
131
132
133
134
135
-- compat.harfbuzz — HarfBuzz text shaping engine, with the FreeType font backend.
--
-- Shape A (C-source compat, C++ flavour): the user writes `#include <hb.h>`
-- and, for the FreeType bridge, `#include <hb-ft.h>`.
--
-- ONE TRANSLATION UNIT, ON PURPOSE.
-- Upstream builds with meson (or a CMake port), and reproducing either here
-- would mean tracking ~137 .cc files plus their generated config. HarfBuzz
-- ships `src/harfbuzz.cc` for exactly this case: an amalgamation that
-- #includes every implementation file. It is upstream's own supported
-- "just compile one file" path, so the source list stays one line and cannot
-- drift out of sync with a release.
--
-- The amalgamation also #includes the backends this package does not enable
-- (CoreText, DirectWrite, GDI, GLib, Graphite2, ICU). Each of those is behind
-- its own HAVE_* gate and compiles to nothing when the gate is absent, so
-- naming only HAVE_FREETYPE selects precisely the FreeType backend without
-- editing anything.
--
-- ONE GENERATED config.h, no configure step. HarfBuzz reads a config.h under
-- HAVE_CONFIG_H; the one below (mcpp_generated/config.h) only names the
-- backend's HAVE_* switches, so `hb-config.hh` still supplies every default.
-- It exists for the switch no-freetype (below), which a command-line define
-- could not take back.
--
-- HB_NO_MT IS DELIBERATELY NOT SET. It drops HarfBuzz's atomics and locks,
-- which is only sound when the consumer guarantees single-threaded use --
-- a promise a shared index package cannot make on its consumers' behalf.
package = {
spec = "1",
namespace = "compat",
name = "harfbuzz",
description = "HarfBuzz — OpenType text shaping engine with the FreeType backend",
licenses = {"MIT"},
repo = "https://github.com/harfbuzz/harfbuzz",
type = "package",
xpm = {
linux = {
["14.3.0"] = {
url = {
GLOBAL = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/14.3.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/harfbuzz/releases/download/14.3.0/harfbuzz-14.3.0.tar.gz",
},
sha256 = "566e996a1b40486954fb7110ffe6eb88a0f7958bb466cdb023b0302618acea4a",
-- 1: hb-ft with FreeType's variation and transform entry points
-- (the HAVE_FT_* below): installed copies take them.
-- 2: the switch no-freetype, read in the generated config.h.
revision = 2,
},
},
macosx = {
["14.3.0"] = {
url = {
GLOBAL = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/14.3.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/harfbuzz/releases/download/14.3.0/harfbuzz-14.3.0.tar.gz",
},
sha256 = "566e996a1b40486954fb7110ffe6eb88a0f7958bb466cdb023b0302618acea4a",
-- 1: hb-ft with FreeType's variation and transform entry points
-- (the HAVE_FT_* below): installed copies take them.
-- 2: the switch no-freetype, read in the generated config.h.
revision = 2,
},
},
windows = {
["14.3.0"] = {
url = {
GLOBAL = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/14.3.0.tar.gz",
CN = "https://gitcode.com/mcpp-res/harfbuzz/releases/download/14.3.0/harfbuzz-14.3.0.tar.gz",
},
sha256 = "566e996a1b40486954fb7110ffe6eb88a0f7958bb466cdb023b0302618acea4a",
-- 1: hb-ft with FreeType's variation and transform entry points
-- (the HAVE_FT_* below): installed copies take them.
-- 2: the switch no-freetype, read in the generated config.h.
revision = 2,
},
},
},
mcpp = {
language = "c++23",
import_std = false,
include_dirs = { "mcpp_generated", "*/src" },
sources = { "*/src/harfbuzz.cc" },
-- HAVE_FREETYPE turns on hb-ft.cc inside the amalgamation, which is
-- what makes <hb-ft.h> more than a set of declarations. The public
-- header is installed either way, so without this the consumer gets a
-- link error rather than a compile error -- worth pinning down here.
--
-- The four HAVE_FT_* are what upstream's meson.build sets for every
-- FreeType that has these entry points (check_freetype_funcs; all of
-- them since FreeType 2.11, so compat.freetype 2.13.3 too). Without
-- them hb-ft.cc compiles out its variation and transform support: the
-- FreeType font functions ignore hb_font_set_variations() and the
-- face's FT_Set_Transform, and upstream's shaping suites fail with
-- --font-funcs=ft on every variable font (TestGVAR*, TestHVAR*,
-- TestCVARGVAR*, HBTest-VF …).
--
-- They are in config.h, not cxxflags, for the switch no-freetype:
-- with HAVE_FREETYPE, hb_font_create() reaches hb_ft_font_set_funcs
-- through hb_font_set_funcs_using()'s table of backends, so every
-- program that makes a font links all of FreeType (its core and every
-- driver), whether or not it ever names FreeType. A consumer whose
-- fonts take HarfBuzz's own `ot` functions (the default first in that
-- table) turns it on and carries none of it; <hb-ft.h>'s functions
-- are then not defined.
cxxflags = { "-DHAVE_CONFIG_H=1" },
generated_files = {
["mcpp_generated/config.h"] = [==[
/* compat.harfbuzz: the backend HarfBuzz is built with. mcpp defines
MCPP_FEATURE_NO_FREETYPE for this package's units when the switch is on. */
#ifndef MCPP_FEATURE_NO_FREETYPE
#define HAVE_FREETYPE 1
#define HAVE_FT_GET_VAR_BLEND_COORDINATES 1
#define HAVE_FT_SET_VAR_BLEND_COORDINATES 1
#define HAVE_FT_DONE_MM_VAR 1
#define HAVE_FT_GET_TRANSFORM 1
#endif
]==],
},
-- no-freetype HarfBuzz without its FreeType backend (hb-ft): off by
-- default, the build it always was.
features = {
["no-freetype"] = {},
},
targets = { ["harfbuzz"] = { kind = "lib" } },
deps = { ["compat.freetype"] = "2.13.3" },
linux = {
ldflags = { "-lm", "-lpthread" },
},
macosx = {
ldflags = { "-lm" },
},
},
}