-
Notifications
You must be signed in to change notification settings - Fork 37
/
build.lua
189 lines (163 loc) · 5.61 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
-- Build script for hyperref
module = "hyperref"
docfiledir = "doc"
docfiles = {"paper.pdf", "slides.pdf", "*.html", "*.css","doc/*.tex"}
textfiles = {"*.md", "*.txt"}
installfiles = {"*.def", "*.sty", "*.cfg"}
tdslocations = {
"doc/latex/hyperref/ChangeLog.txt",
"doc/latex/hyperref/README.md",
"doc/latex/hyperref/backref.pdf",
"doc/latex/hyperref/hyperref.pdf",
"doc/latex/hyperref/manifest.txt",
"doc/latex/hyperref/hyperref-doc.css",
"doc/latex/hyperref/hyperref-doc.html",
"doc/latex/hyperref/hyperref-doc.pdf",
"doc/latex/hyperref/hyperref-linktarget.pdf",
"doc/latex/hyperref/hyperref-patches.pdf",
"doc/latex/hyperref/hyperref-doc2.html",
"doc/latex/hyperref/hyperref-doc3.html",
"doc/latex/hyperref/hyperref-doc4.html",
"doc/latex/hyperref/hyperref-doc5.html",
"doc/latex/hyperref/hyperref-doc6.html",
"doc/latex/hyperref/nameref.pdf",
"doc/latex/hyperref/xr-hyper.pdf",
"doc/latex/hyperref/paper.pdf",
"doc/latex/hyperref/slides.pdf",
"doc/latex/hyperref/hyperref-doc.tex",
"source/latex/hyperref/backref.dtx",
"source/latex/hyperref/bmhydoc.sty",
"source/latex/hyperref/hluatex.dtx",
"source/latex/hyperref/hyperref.dtx",
"source/latex/hyperref/hyperref-patches.dtx",
"source/latex/hyperref/hyperref-linktarget.dtx",
"source/latex/hyperref/hyperref.ins",
"source/latex/hyperref/nameref.dtx",
"source/latex/hyperref/xr-hyper.dtx",
"source/latex/hyperref/doc/paperslides99.zip",
"tex/latex/hyperref/backref.sty",
"tex/latex/hyperref/hdvipdfm.def",
"tex/latex/hyperref/hdvips.def",
"tex/latex/hyperref/hdvipson.def",
"tex/latex/hyperref/hdviwind.def",
"tex/latex/hyperref/hluatex.def",
"tex/latex/hyperref/hpdftex.def",
"tex/latex/hyperref/htex4ht.cfg",
"tex/latex/hyperref/htex4ht.def",
"tex/latex/hyperref/htexture.def",
"tex/latex/hyperref/hvtex.def",
"tex/latex/hyperref/hvtexhtm.def",
"tex/latex/hyperref/hvtexmrk.def",
"tex/latex/hyperref/hxetex.def",
"tex/latex/hyperref/hyperref.sty",
"tex/latex/hyperref/hypertex.def",
"tex/latex/hyperref/minitoc-hyper.sty",
"tex/latex/hyperref/nameref.sty",
"tex/latex/hyperref/nohyperref.sty",
"tex/latex/hyperref/ntheorem-hyper.sty",
"tex/latex/hyperref/pd1enc.def",
"tex/latex/hyperref/pdfmark.def",
"tex/latex/hyperref/psdextra.def",
"tex/latex/hyperref/puarenc.def",
"tex/latex/hyperref/puenc.def",
"tex/latex/hyperref/puenc-extra.def",
"tex/latex/hyperref/puenc-greekbasic.def",
"tex/latex/hyperref/puvnenc.def",
"tex/latex/hyperref/xr-hyper.sty"
}
specialformats = specialformats or {}
specialformats["latex"] = specialformats["latex"] or
{
pdftexdev = {binary="pdftex",format = "pdflatex-dev"},
}
checkconfigs = {"build","config-pvt","config-3","config-xetex","config-pdftex"}
checkengines = {"pdftex","etex","luatex"}
-- for dev testing
-- checkengines = {"pdftex","pdftexdev","etex","luatex"}
-- checkengines = {"pdftex","pdftexdev"}
-- checkconfigs = {"config-dev"}
-- temp settings disable checks while testing ctan build
-- testfiledir= "disabled"
-- checkconfigs={}
-- checkengines = {"pdftex"}
checkruns = 2
typesetexe = "lualatex"
sourcefiles = {
"*.dtx",
"*.ins",
"*-hyper.sty",
"bmhydoc.sty",
"paperslides99.zip"
}
function checkinit_hook ()
local dvipdfmxversion=0
local pipe = io.popen'xdvipdfmx --version'
for line in pipe:lines() do
if string.match(line,"xdvipdfmx Version") then
dvipdfmxversion=tonumber(string.match(line,"%d+"))
end
end
pipe:close()
if (dvipdfmxversion <= 20200315) then
excludetests={"unicode-test","87-pdfversion"}
end
return 0
end
--excludefiles={"hyperref/hyperref-doc.tex"}
typesetfiles = {"hyperref-doc.tex",
"backref.dtx",
"hyperref.dtx",
"nameref.dtx",
"xr-hyper.dtx",
"hyperref-linktarget.dtx",
"hyperref-patches.dtx"
}
local function type_manual()
print("Special Typesetting hyperref-doc")
local file = jobname("doc/hyperref-doc.tex")
errorlevel = (runcmd("lualatex "..file, typesetdir, {"TEXINPUTS","LUAINPUTS"})
+ runcmd("lualatex "..file, typesetdir, {"TEXINPUTS","LUAINPUTS"})
+ runcmd("htlatex "..file, typesetdir, {"TEXINPUTS","LUAINPUTS"})
+ cp("*.html", typesetdir, docfiledir) + cp("*.css", typesetdir, docfiledir))
+ cp("*.pdf", typesetdir, docfiledir)
if errorlevel ~= 0 then
error("Error!!: Typesetting "..file..".tex")
return errorlevel
end
return 0
end
specialtypesetting = { }
specialtypesetting["hyperref-doc.tex"] = {func = type_manual}
cleanfiles = { "doc/*.html", "doc/*.css"}
flatten = false
packtdszip = true
-- l3build tag auto increases final letter
-- l3build tag AUTO increases .two-digit number and sets final letter to 'a'
tagfiles={"README.md","xr-hyper.sty","*.dtx","doc/*.tex"}
function update_tag(file,content,tagname,tagdate)
local tagpattern="(%d%d%d%d[-/]%d%d[-/]%d%d) v(%d+[.])(%d+)(%l)"
local oldv,newv
if tagname == 'auto' or tagname == 'AUTO' then
local i,j,olddate,a,b,c
i,j,olddate,a,b,c= string.find(content, tagpattern)
if i == nil then
print('OLD TAG NOT FOUND')
return content
else
print ('FOUND: ' .. olddate .. ' v' .. a .. b .. c)
oldv = olddate .. ' v' .. a .. b .. c
if tagname == 'AUTO' then
newv = tagdate .. ' v' .. a .. string.format("%02d",math.floor(b + 1)) .. 'a'
else
newv = tagdate .. ' v' .. a .. b .. string.char(string.byte(c)+1)
end
print('USING OLD TAG: ' .. oldv)
print('USING NEW TAG: ' .. newv)
local oldpattern = string.gsub(oldv,"[-/]", "[-/]")
content=string.gsub(content,oldpattern,newv)
return content
end
else
error("only automatic tagging supported")
end
end