Move a tag
[latex2e.git] / latex2e-20170415 / build.lua
blob9905911de3197b7c114a1d037fe035538c17eddc
1 #!/usr/bin/env texlua
3 -- Build script for LaTeX2e files
5 -- No bundle or module here, but these have to be defined
6 bundle = "LaTeX2e"
7 module = ""
9 -- A couple of custom variables: the order here is set up for 'importance'
10 bundles = {"base", "doc"}
11 required = {"cyrillic", "graphics", "tools", "amsmath"}
13 -- Location of main directory: use Unix-style path separators
14 maindir = "."
16 -- Help for the master script is simple
17 function help ()
18 print ""
19 print " build check - run automated check system "
20 print " build ctan - create CTAN-ready archive "
21 print " build doc - runs all documentation files "
22 print " build clean - clean out directory tree "
23 print " build install - install files in local texmf tree"
24 print ""
25 end
27 -- A custom main function
28 -- While almost all of this is customise, the need to be able to cp and
29 -- rm files means that loading l3build.lua is very useful
30 function main (target)
31 local function dobundles (target)
32 local t = { }
33 for _,v in ipairs(bundles) do
34 table.insert(t, v)
35 end
36 for _,v in ipairs(required) do
37 table.insert(t, "required/" .. v)
38 end
39 return call(t, target)
40 end
41 if target == "check" then
42 dobundles ("check")
43 elseif target == "clean" then
44 print ("Cleaning up")
45 dobundles ("clean")
46 rm (".", "*.zip")
47 elseif target == "ctan" then
48 local errorlevel = dobundles ("ctan")
49 if errorlevel == 0 then
50 for _,i in ipairs (bundles) do
51 cp ("*.zip", i, ".")
52 end
53 for _,i in ipairs (required) do
54 cp ("*.zip", "required/" .. i, ".")
55 end
56 end
57 elseif target == "doc" then
58 dobundles ("doc")
59 elseif target == "install" then
60 dobundles ("install")
61 elseif target == "unpack" then
62 dobundles ("unpack")
63 elseif target == "version" then
64 version ()
65 else
66 help ()
67 end
68 end
70 -- Find and run the build system
71 kpse.set_program_name ("kpsewhich")
72 dofile (kpse.lookup ("l3build.lua"))