-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.lua
332 lines (297 loc) · 10.1 KB
/
build.lua
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
packageversion= "3.28"
packagedate = "2024-02-14"
fontloaderdate= "2023-12-28"
packagedesc = ""
module = "luaotfload"
ctanpkg = "luaotfload"
tdsroot = "luatex"
-- load my personal data for the ctan upload
local ok, mydata = pcall(require, "ulrikefischerdata.lua")
if not ok then
mydata = {
email = os.getenv'CTAN_EMAIL' or 'XXX',
name = os.getenv'CTAN_NAME' or 'XXX',
name = "XXX",
}
end
-- Allow for 'dev' release
--
-- See https://docs.github.com/en/actions/learn-github-actions/environment-variables
-- for the meaning of the environment variables, but tl;dr: GITHUB_REF_TYPE says
-- if we have a tag or a branch, GITHUB_REF_NAME has the corresponding name.
-- If either one of them isn't set, we look at the current git HEAD.
local main_branch do
local gh_type = os.getenv'GITHUB_REF_TYPE'
local name = os.getenv'GITHUB_REF_NAME'
if gh_type == 'tag' and name then
main_branch = not string.match(name, '-dev$')
else
if gh_type ~= 'branch' or not name then
local f = io.popen'git rev-parse --abbrev-ref HEAD'
name = f:read'*a':sub(1,-2)
assert(f:close())
end
main_branch = string.match(name, '^main')
end
if not main_branch then
tdsroot = "latex-dev"
print("Creating/installing dev-version in " .. tdsroot)
ctanpkg = ctanpkg .. "-dev"
ctanzip = ctanpkg
end
end
---------------------------------
uploadconfig = {
pkg = ctanpkg,
version = "v"..packageversion.." "..packagedate,
-- author = "Ulrike Fischer;Philipp Gesang;Marcel Krüger;The LaTeX Team;Élie Roux;Manuel Pégourié-Gonnard (inactive);Khaled Hosny (inactive);Will Robertson (inactive)",
-- author list is too long
author = "... as before ...",
license = "gpl2",
summary = "OpenType ‘loader’ for Plain TeX and LaTeX",
ctanPath = "/macros/luatex/generic/"..ctanpkg,
repository = "https://github.com/latex3/luaotfload",
bugtracker = "https://github.com/latex3/luaotfload/issues",
support = "https://github.com/latex3/luaotfload/issues",
uploader = mydata.name,
email = mydata.email,
update = true ,
topic = {"font-use","luatex"},
note = [[Uploaded automatically by l3build... description is unchanged despite the missing linebreaks, authors are unchanged]],
description=[[The package adopts the TrueType/OpenType Font loader code provided in ConTeXt,
and adapts it to use in Plain TeX and LaTeX. It works under LuaLaTeX only.]],
announcement_file="ctan.ann"
}
-- we perhaps need different settings for miktex ...
local luatexstatus = status.list()
local ismiktex = string.match (luatexstatus.banner,"MiKTeX")
-- l3build check settings
stdengine = "luatex"
checkformat = "latex"
specialformats = specialformats or {}
specialformats["latex"] = specialformats["latex"] or
{
luatexdev = {binary="luahbtex" ,format = "lualatex-dev"},
luatex = {binary="luahbtex" ,format = "lualatex"}
}
checkengines = {"luatex"}
checkconfigs = {
"build",
"config-harf",
"config-loader-unpackaged",
"config-loader-reference",
"config-latex-TU",
-- "config-unicode-math",
"config-plain",
"config-fontspec",
}
checkruns = 3
checksuppfiles = {"texmf.cnf"}
typesetsuppfiles = {"texmf.cnf"}
maxprintline=9999
-- exclude some text temporarly or in certain systems ...
if os.env["CONTEXTPATH"] then
-- local system
-- excludetests = {"math"} -- because of adjdemerits bug
if ismiktex then
excludetests = {"arabkernsfs","fontload-ttc-fontindex"}
else
-- excludetests = {"luatex-ja"}
end
else
-- travis or somewhere else ...
-- luacolor will fail until update ...
excludetests = {"luatex-ja","aux-resolve-fontname","luacolor"}
end
---------------------------------------------
-- l3build settings for CTAN/install target
---------------------------------------------
packtdszip=true
sourcefiledir = "./src"
docfiledir = "./doc"
-------------------
-- documentation
-------------------
typesetexe = "lua"..checkformat
-- main docu
typesetfiles = {"luaotfload-latex.tex"}
typesetcycles = 3 -- for the tests
ctanreadme= "CTANREADME.md"
docfiles =
{
"luaotfload.conf.example",
"luaotfload-main.tex",
"luaotfload.conf.rst",
"luaotfload-tool.rst",
}
textfiles =
{
"COPYING",
"NEWS",
docfiledir .. "/CTANREADME.md",
}
typesetdemofiles =
{
"filegraph.tex",
"luaotfload-conf.tex",
"luaotfload-tool.tex",
"shaper-demo-graphite.tex",
"shaper-demo.tex",
"scripts-demo.tex"
}
---------------------
-- installation
---------------------
sourcefiles =
{
"luaotfload.sty",
"**/luaotfload*.lua",
"**/fontloader-*.lua",
"**/fontloader-*.tex",
"luaotfload-blacklist.cnf",
"./doc/filegraph.tex",
"./doc/luaotfload-main.tex",
}
installfiles = {
"luaotfload.sty",
"luaotfload-blacklist.cnf",
"**/luaotfload*.lua",
"**/fontloader-*.lua",
"**/fontloader-*.tex",
}
tdslocations=
{
"source/luatex/luaotfload/fontloader-reference-load-order.lua",
"source/luatex/luaotfload/fontloader-reference-load-order.tex",
}
scriptfiles = {"luaotfload-tool.lua"}
scriptmanfiles = {"luaotfload.conf.5","luaotfload-tool.1"}
-----------------------------
-- l3build settings for tags:
-----------------------------
tagfiles = {
"doc/CTANREADME.md",
"README.md",
"src/luaotfload.sty",
"src/luaotfload*.lua",
"src/auto/luaotfload-glyphlist.lua",
"src/auto/luaotfload-status.lua",
"doc/luaotfload-main.tex",
"doc/luaotfload.conf.rst",
"doc/luaotfload-tool.rst",
"src/fontloader/runtime/fontloader-basics-gen.lua",
"scripts/mkstatus",
"testfiles/aaaaa-luakern.tlg"
}
-- windows/UF
function typeset_demo_tasks()
local errorlevel = 0
local pyextension
if os.type == "windows" then
pyextension = ".py"
else
pyextension = ""
end
local rst2man = "rst2man" .. pyextension
local rst2xetex = "rst2xetex" .. pyextension
errorlevel = run (docfiledir, rst2man .." luaotfload.conf.rst luaotfload.conf.5")
if errorlevel ~= 0 then
return errorlevel
end
errorlevel = run (docfiledir, rst2man .." luaotfload-tool.rst luaotfload-tool.1")
if errorlevel ~= 0 then
return errorlevel
end
errorlevel= run (typesetdir, rst2xetex .. " luaotfload.conf.rst luaotfload-conf.tex")
if errorlevel ~= 0 then
return errorlevel
end
errorlevel=run (typesetdir, rst2xetex .. " luaotfload-tool.rst luaotfload-tool.tex")
if errorlevel ~= 0 then
return errorlevel
end
return 0
end
local function lpeggsub(pattern)
return lpeg.Cs(lpeg.P{pattern + (1 * (lpeg.V(1) + -1))}^0)
end
local digit = lpeg.R'09'
local spaces = lpeg.P' '^1
local function lpegrep(pattern,times)
if times == 0 then return true end
return pattern * lpegrep(pattern, times - 1)
end
local tagdatepat = lpeg.Cg( -- Date: YYYY/MM/DD
lpegrep(digit, 4) * lpegrep('/' * digit * digit, 2)
* lpeg.Cc(string.gsub(packagedate, '-', '/')))
local packagedatepat = lpeg.Cg( -- Date: YYYY-MM-DD
lpegrep(digit, 4) * lpegrep('-' * digit * digit, 2)
* lpeg.Cc(packagedate))
local imgpackagedatepat = lpeg.Cg( -- Date: YYYY--MM--DD
lpegrep(digit, 4) * lpegrep('--' * digit * digit, 2)
* lpeg.Cc(string.gsub(packagedate, '-', '--')))
local xxxpackagedatepat = lpeg.Cg( -- Date: YYYYxxxMMxxxDD
lpegrep(digit, 4) * lpegrep('xxx' * digit * digit, 2)
* lpeg.Cc(string.gsub(fontloaderdate, '-', 'xxx')))
local packageversionpat = lpeg.Cg( -- Version: M.mmmm-dev
digit * '.' * digit^1 * lpeg.P'-dev'^-1
* lpeg.Cc(packageversion))
local imgpackageversionpat = lpeg.Cg( -- Version: M.mmmm--dev
digit * '.' * digit^1 * lpeg.P'--dev'^-1
* lpeg.Cc(string.gsub(packageversion, '-', '--')))
local sty_pattern = lpeggsub(tagdatepat * ' v' * packageversionpat)
local tex_pattern = lpeggsub(packagedatepat * ' v' * packageversionpat)
local lua_pattern = lpeggsub(
'version' * spaces * '=' * spaces
* '"' * packageversionpat * '",' * spaces * '--TAGVERSION'
+ 'date' * spaces * '=' * spaces
* '"' * packagedatepat * '",' * spaces * '--TAGDATE')
local readme_pattern = lpeggsub(
(lpeg.P'Version: ' + 'for ') * packageversionpat
+ 'version-' * imgpackageversionpat
+ packagedatepat + imgpackagedatepat)
local ctanreadme_pattern = lpeggsub(
'VERSION: ' * packageversionpat
+ 'DATE: ' * packagedatepat)
local rst_pattern = lpeggsub(
':Date:' * spaces * packagedatepat
+ ':Version:' * spaces * packageversionpat)
local status_pattern = lpeggsub('v' * packageversionpat * '/' * packagedatepat)
local fontloader_pattern = lpeggsub(
packageversionpat * ' with fontloaderxxx' * xxxpackagedatepat)
function update_tag (file,content,_tagname,_tagdate)
if string.match (file, "%.sty$" ) then
return sty_pattern:match(content)
elseif string.match (file,"fontloader%-basic") then
if main_branch then
return string.gsub (content,
"caches.namespace = 'generic%-dev'",
"caches.namespace = 'generic'")
else
return string.gsub (content,
"caches.namespace = 'generic'",
"caches.namespace = 'generic-dev'")
end
elseif file == "luaotfload-status.lua" then
return status_pattern:match(content)
elseif string.match (file, "%.lua$") then
return lua_pattern:match(content)
elseif file == 'README.md' then
return readme_pattern:match(content)
elseif string.match (file, "CTANREADME.md$") then
return ctanreadme_pattern:match(content)
elseif string.match (file, "%.tex$" ) then
return tex_pattern:match(content)
elseif string.match (file, "%.rst$" ) then
return rst_pattern:match(content)
elseif string.match (file,"mkstatus$") then
return status_pattern:match(content)
elseif string.match (file,"aaaaa%-luakern") then
return fontloader_pattern:match(content)
end
return content
end
kpse.set_program_name ("kpsewhich")
if not release_date then
dofile ( kpse.lookup ("l3build.lua"))
end