Tidy up char 127
[latex2e.git] / trunk / build.lua
blob5a50904bd42194343a3ebddf8d0e454a1292b3e8
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 errorlevel = 0
33 for _,i in ipairs (bundles) do
34 errorlevel = run (i, "texlua " .. scriptname .. " " .. target)
35 if errorlevel ~= 0 then
36 break
37 end
38 end
39 if errorlevel == 0 then
40 for _,i in ipairs (required) do
41 errorlevel = run ("required/" .. i, "texlua " .. scriptname .. " " .. target)
42 if errorlevel ~= 0 then
43 break
44 end
45 end
46 end
47 return (errorlevel)
48 end
49 if target == "check" then
50 dobundles ("check")
51 elseif target == "clean" then
52 print ("Cleaning up")
53 dobundles ("clean")
54 rm (".", "*.zip")
55 elseif target == "ctan" then
56 local errorlevel = dobundles ("ctan")
57 if errorlevel == 0 then
58 for _,i in ipairs (bundles) do
59 cp ("*.zip", i, ".")
60 end
61 for _,i in ipairs (required) do
62 cp ("*.zip", "required/" .. i, ".")
63 end
64 end
65 elseif target == "doc" then
66 dobundles ("doc")
67 elseif target == "install" then
68 dobundles ("install")
69 elseif target == "unpack" then
70 dobundles ("unpack")
71 elseif target == "version" then
72 version ()
73 else
74 help ()
75 end
76 end
78 -- Find and run the build system
79 kpse.set_program_name ("kpsewhich")
80 dofile (kpse.lookup ("l3build.lua"))