3 -- Build script for LaTeX2e "base" files
5 -- Identify the bundle and module
9 -- CTAN's name for this is a bit different from ours
10 ctanpkg
= "latex-base"
12 -- Location of main directory: use Unix-style path separators
15 -- Set up the file types needed here
77 -- A few special file for unpacking
78 unpackfiles
= {"unpack.ins"}
84 "load-unicode-data.tex",
85 "load-unicode-xetex-classes.tex",
92 -- Custom settings for the check system
93 testsuppdir
= "testfiles/helpers"
95 -- No dependencies at all (other than l3build of course)
99 -- Customise typesetting
100 indexstyle
= "source2e.ist"
103 local errorlevel
= unpack ()
104 if errorlevel
~=0 then
107 local function format (engine
,fmtname
)
108 -- the relationships are all correct
109 local errorlevel
= os
.execute (
110 os_setenv
.. " TEXINPUTS=" .. unpackdir
.. os_pathsep
.. localdir
112 engine
.. " -etex -ini " .. " -output-directory=" .. unpackdir
..
113 " " .. unpackdir
.. "/latex.ltx"
115 if errorlevel
~=0 then
118 ren (unpackdir
, "latex.fmt", fmtname
)
119 -- As format building is added in as an 'extra', the normal
120 -- copy mechanism (checkfiles) will fail as things get cleaned up
121 -- inside bundleunpack(): get around that using a manual copy
122 cp (fmtname
, unpackdir
, localdir
)
123 if fmtname
== "elatex.fmt" then
124 rm(localdir
, "latex.fmt")
125 ren(localdir
, fmtname
, "latex.fmt")
129 if not userargs
["testfiledir"] then
130 cp ('fonttext.cfg', supportdir
, unpackdir
)
132 local checkengines
= optengines
or checkengines
133 for _
,i
in ipairs(checkengines
) do
134 errorlevel
= format (i
, string.gsub (i
, "tex$", "") .. "latex.fmt")
135 if errorlevel
~=0 then
142 -- Custom bundleunpack which does not search the localdir
143 -- That is needed as texsys.cfg is unpacked in an odd way and
144 -- without this will otherwise not be available
145 function bundleunpack ()
146 local errorlevel
= mkdir(localdir
)
147 if errorlevel
~=0 then
150 errorlevel
= cleandir(unpackdir
)
151 if errorlevel
~=0 then
154 for _
,i
in ipairs (sourcefiles
) do
155 errorlevel
= cp (i
, ".", unpackdir
)
156 if errorlevel
~=0 then
160 for _
,i
in ipairs (unpacksuppfiles
) do
161 errorlevel
= cp (i
, supportdir
, localdir
)
162 if errorlevel
~=0 then
166 for _
,i
in ipairs (unpackfiles
) do
167 for _
,j
in ipairs (filelist (unpackdir
, i
)) do
168 os
.execute (os_yes
.. ">>" .. localdir
.. "/yes")
169 errorlevel
= os
.execute (
170 -- Notice that os.execute is used from 'here' as this ensures that
171 -- localdir points to the correct place: running 'inside'
172 -- unpackdir would avoid the need for setting -output-directory
173 -- but at the cost of needing to correct the relative position
174 -- of localdir w.r.t. unpackdir
175 os_setenv
.. " TEXINPUTS=" .. unpackdir
.. os_concat
..
176 unpackexe
.. " " .. unpackopts
.. " -output-directory=" .. unpackdir
177 .. " " .. unpackdir
.. "/" .. j
.. " < " .. localdir
.. "/yes"
179 if errorlevel
~=0 then
187 -- base does all of the targets itself
188 function main (target
, file
, engine
)
190 if target
== "check" then
192 errorlevel
= check (file
, engine
)
193 elseif target
== "clean" then
194 errorlevel
= clean ()
195 elseif target
== "ctan" then
197 errorlevel
= ctan (true)
198 elseif target
== "doc" then
200 elseif target
== "install" then
202 elseif target
== "save" then
204 errorlevel
= save (file
, engine
)
208 elseif target
== "unpack" then
209 -- A simple way to have the unpack target also build the format
210 errorlevel
= format ()
211 elseif target
== "version" then
219 -- Load the common settings for the LaTeX2e repo
220 dofile (maindir
.. "/build-config.lua")
222 -- Find and run the build system
223 kpse
.set_program_name ("kpsewhich")
224 dofile (kpse
.lookup ("l3build.lua"))