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
17 {"*.cfg", "*.clo", "*.cls", "*.def", "*.dfu", "*.fd", "*.ltx", "*.sty", "*.tex"}
18 sourcefiles
= {"*.cls", "unicode-letters.def", "*.dtx", "*.fdd", "ltpatch.ltx", "*.ins", "*.tex"}
49 -- A few special file for unpacking
50 unpackfiles
= {"unpack.ins"}
51 unpacksuppfiles
= {"hyphen.cfg", "UShyphen.tex"}
53 -- Custom settings for the check system
54 testsuppdir
= "testfiles/helpers"
56 -- No dependencies at all (other than l3build of course)
60 -- Customise typesetting
61 indexstyle
= "source2e.ist"
65 local function format (engine
,fmtname
)
66 -- the relationships are all correct
68 os_setenv
.. " TEXINPUTS=" .. unpackdir
.. os_pathsep
.. localdir
70 engine
.. " -etex -ini " .. " -output-directory=" .. unpackdir
..
71 " " .. unpackdir
.. "/latex.ltx"
73 ren (unpackdir
, "latex.fmt", fmtname
)
74 -- As format building is added in as an 'extra', the normal
75 -- copy mechanism (checkfiles) will fail as things get cleaned up
76 -- inside bundleunpack(): get around that using a manual copy
77 cp (fmtname
, unpackdir
, localdir
)
79 for _
,i
in ipairs (checkengines
) do
80 format (i
, string.gsub (i
, "tex$", "") .. "latex.fmt")
84 -- Custom bundleunpack which does not search the localdir
85 -- That is needed as texsys.cfg is unpacked in an odd way and
86 -- without this will otherwise not be available
87 function bundleunpack ()
90 for _
,i
in ipairs (sourcefiles
) do
91 cp (i
, ".", unpackdir
)
93 for _
,i
in ipairs (unpacksuppfiles
) do
94 cp (i
, supportdir
, localdir
)
96 for _
,i
in ipairs (unpackfiles
) do
97 for _
,j
in ipairs (filelist (unpackdir
, i
)) do
98 os
.execute (os_yes
.. ">>" .. localdir
.. "/yes")
100 -- Notice that os.execute is used from 'here' as this ensures that
101 -- localdir points to the correct place: running 'inside'
102 -- unpackdir would avoid the need for setting -output-directory
103 -- but at the cost of needing to correct the relative position
104 -- of localdir w.r.t. unpackdir
105 os_setenv
.. " TEXINPUTS=" .. unpackdir
.. os_concat
..
106 unpackexe
.. " " .. unpackopts
.. " -output-directory=" .. unpackdir
107 .. " " .. unpackdir
.. "/" .. j
.. " < " .. localdir
.. "/yes"
113 -- base does all of the targets itself
114 function main (target
, file
, engine
)
116 if target
== "check" then
118 errorlevel
= check (file
, engine
)
119 elseif target
== "clean" then
120 errorlevel
= clean ()
121 elseif target
== "ctan" then
123 errorlevel
= ctan (true)
124 elseif target
== "doc" then
126 elseif target
== "install" then
128 elseif target
== "save" then
130 errorlevel
= save (file
, engine
)
134 elseif target
== "unpack" then
135 -- A simple way to have the unpack target also build the format
136 errorlevel
= format ()
137 elseif target
== "version" then
145 -- Load the common settings for the LaTeX2e repo
146 dofile (maindir
.. "/build-config.lua")
148 -- Find and run the build system
149 kpse
.set_program_name ("kpsewhich")
150 dofile (kpse
.lookup ("l3build.lua"))