summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3build/l3build-variables.lua
blob: bbebf2fd081fb76549b8563f1da73d676f60c984 (plain)
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
--[[

File l3build-variables.lua Copyright (C) 2018-2023 The LaTeX Project

It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
license or (at your option) any later version.  The latest version
of this license is in the file

   http://www.latex-project.org/lppl.txt

This file is part of the "l3build bundle" (The Work in LPPL)
and all files in that bundle must be distributed together.

-----------------------------------------------------------------------

The development version of the bundle can be found at

   https://github.com/latex3/l3build

for those people who are interested.

--]]

-- "module" is a deprecated function in Lua 5.2: as we want the name
-- for other purposes, and it should eventually be 'free', simply
-- remove the built-in
if type(module) == "function" then
  module = nil
end

-- Ensure the module and bundle exist
module = module or ""
bundle = bundle or ""

-- Directory structure for the build system
-- Use Unix-style path separators
currentdir = "."
maindir    = maindir or currentdir

-- Substructure for file locations
docfiledir    = docfiledir    or currentdir
sourcefiledir = sourcefiledir or currentdir
textfiledir   = textfiledir   or currentdir
supportdir    = supportdir    or maindir .. "/support"
testfiledir   = testfiledir   or currentdir .. "/testfiles"
testsuppdir   = testsuppdir   or testfiledir .. "/support"
texmfdir      = texmfdir      or maindir .. "/texmf"

-- Structure within a development area
builddir   = builddir   or maindir .. "/build"
distribdir = distribdir or builddir .. "/distrib"
localdir   = localdir   or builddir .. "/local"
resultdir  = resultdir  or builddir .. "/result"
testdir    = testdir    or builddir .. "/test"
typesetdir = typesetdir or builddir .. "/doc"
unpackdir  = unpackdir  or builddir .. "/unpacked"

-- Substructure for CTAN release material
ctandir = ctandir or distribdir .. "/ctan"
tdsdir  = tdsdir  or distribdir .. "/tds"
tdsroot = tdsroot or "latex"

-- Location for installation on CTAN or in TEXMFHOME
if bundle == "" then
  moduledir = tdsroot .. "/" .. module
  ctanpkg   = ctanpkg or module
else
  moduledir = tdsroot .. "/" .. bundle .. "/" .. module
  ctanpkg   = ctanpkg or bundle
end

-- File types for various operations
-- Use Unix-style globs
-- All of these may be set earlier, so a initialised conditionally
auxfiles           = auxfiles           or {"*.aux", "*.lof", "*.lot", "*.toc"}
bibfiles           = bibfiles           or {"*.bib"}
binaryfiles        = binaryfiles        or {"*.pdf", "*.zip"}
bstfiles           = bstfiles           or {"*.bst"}
checkfiles         = checkfiles         or { }
checksuppfiles     = checksuppfiles     or { }
cleanfiles         = cleanfiles         or {"*.log", "*.pdf", "*.zip"}
demofiles          = demofiles          or { }
docfiles           = docfiles           or { }
dynamicfiles       = dynamicfiles       or { }
excludefiles       = excludefiles       or {"*~","build.lua","config-*.lua"}
exefiles           = exefiles           or { }
installfiles       = installfiles       or {"*.sty","*.cls"}
makeindexfiles     = makeindexfiles     or {"*.ist"}
scriptfiles        = scriptfiles        or { }
scriptmanfiles     = scriptmanfiles     or { }
sourcefiles        = sourcefiles        or {"*.dtx", "*.ins", "*-????-??-??.sty"}
tagfiles           = tagfiles           or {"*.dtx"}
textfiles          = textfiles          or {"*.md", "*.txt"}
typesetdemofiles   = typesetdemofiles   or { }
typesetfiles       = typesetfiles       or {"*.dtx"}
typesetsuppfiles   = typesetsuppfiles   or { }
typesetsourcefiles = typesetsourcefiles or { }
unpackfiles        = unpackfiles        or {"*.ins"}
unpacksuppfiles    = unpacksuppfiles    or { }

-- Roots which should be unpacked to support unpacking/testing/typesetting
checkdeps   = checkdeps   or { }
typesetdeps = typesetdeps or { }
unpackdeps  = unpackdeps  or { }

-- Executable names plus following options
typesetexe = typesetexe or "pdflatex"
unpackexe  = unpackexe  or "pdftex"

checkopts   = checkopts   or "-interaction=nonstopmode"
typesetopts = typesetopts or "-interaction=nonstopmode"
unpackopts  = unpackopts  or ""

-- Engines for testing
checkengines = checkengines or {"pdftex", "xetex", "luatex"}
checkformat  = checkformat  or "latex"
specialformats = specialformats or { }
specialformats.context = specialformats.context or {
    luametatex = {binary = "context", format = ""},
    luatex     = {binary = "context", format = "", options = "--luatex"},
    pdftex     = {binary = "texexec", format = ""},
    xetex      = {binary = "texexec", format = "", options = "--xetex"}
  }
specialformats.latex = specialformats.latex or { }
specialformats.latex.etex = specialformats.latex.etex or
  {format = "latex"}
specialformats.latex.ptex = specialformats.latex.ptex or
   {binary = "euptex", options = "-kanji-internal=euc"}
specialformats.latex.uptex = specialformats.latex.uptex or
  {binary = "euptex"}
if not string.find(status.banner,"2019") then
  specialformats.latex.luatex = specialformats.latex.luatex or
    {binary = "luahbtex",format = "lualatex"}
  specialformats["latex-dev"] = specialformats["latex-dev"] or
    {luatex = {binary="luahbtex",format = "lualatex-dev"}}
end
specialformats.latex["make4ht"] = specialformats.latex["make4ht"] or
  {binary = "make4ht"}

stdengine = stdengine or checkengines[1] or "pdftex"

-- The tests themselves
includetests = includetests or {"*"}
excludetests = excludetests or { }

-- Configs for testing
checkconfigs = checkconfigs or {"build"}

-- Enable access to trees outside of the repo
-- As these may be set false, a more elaborate test than normal is needed
if checksearch == nil then
  checksearch = true
end
if typesetsearch == nil then
  typesetsearch = true
end
if unpacksearch == nil then
  unpacksearch = true
end

-- Additional settings to fine-tune typesetting
glossarystyle = glossarystyle or "gglo.ist"
indexstyle    = indexstyle    or "gind.ist"
specialtypesetting = specialtypesetting or { }

-- Supporting binaries and options
biberexe      = biberexe      or "biber"
biberopts     = biberopts     or ""
bibtexexe     = bibtexexe     or "bibtex8"
bibtexopts    = bibtexopts    or "-W"
makeindexexe  = makeindexexe  or "makeindex"
makeindexopts = makeindexopts or ""

-- Forcing epoch
if forcecheckepoch == nil then
  forcecheckepoch = true
end
if forcedocepoch == nil then
  forcedocepoch = false
end

-- Other required settings
asciiengines = asciiengines or {"pdftex"}
checkruns    = checkruns    or 1
ctanreadme   = ctanreadme   or "README.md"
ctanzip      = ctanzip      or ctanpkg .. "-ctan"
epoch        = epoch        or 1463734800
if flatten == nil then
  flatten = true
end
if flattentds == nil then
  flattentds = true
end
maxprintline = maxprintline or 9999
packtdszip   = packtdszip   or false
-- support "ps2pdfopt" for backward compatibility, gh issue #275
ps2pdfopts   = ps2pdfopts   or ps2pdfopt or ""
typesetcmds  = typesetcmds  or ""
typesetruns  = typesetruns  or 3
recordstatus = recordstatus or false

-- Extensions for various file types: used to abstract out stuff a bit
bakext = bakext or ".bak"
dviext = dviext or ".dvi"
logext = logext or ".log"
lveext = lveext or ".lve"
lvtext = lvtext or ".lvt"
pdfext = pdfext or ".pdf"
psext  = psext  or ".ps"
pvtext = pvtext or ".pvt"
tlgext = tlgext or ".tlg"
tpfext = tpfext or ".tpf"

test_types = test_types or { }
test_types.log = test_types.log or {
  test = lvtext,
  generated = logext,
  reference = tlgext,
  expectation = lveext,
  compare = compare_tlg,
  rewrite = rewrite_log,
}
test_types.pdf = test_types.pdf or {
  test = pvtext,
  generated = pdfext,
  reference = tpfext,
  rewrite = rewrite_pdf,
}

test_order = test_order or {"log", "pdf"}

-- Manifest options
manifestfile = manifestfile or "MANIFEST.md"

-- Non-standard installation locations
tdslocations = tdslocations or { }
tdsdirs = tdsdirs or {}

-- Upload settings
curlexe  = curlexe  or "curl"
uploadconfig = uploadconfig or {}
ctanupload   = ctanupload   or "ask"