[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: Move format-building to top-level build config (13665e7b)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Oct 2 17:43:40 CEST 2019


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/13665e7b57a9f2c2d2e4c7c6038b33876eaf55f7

>---------------------------------------------------------------

commit 13665e7b57a9f2c2d2e4c7c6038b33876eaf55f7
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Oct 1 17:30:37 2019 +0100

    Move format-building to top-level build config
    
    This is using the new dedicated hook for tests, and is
    more-or-less the LaTeX3 implementation.
    
    Typesetting is not set up yet, but is allowed for in
    the names table argument. This will need a hook
    in l3build: to add for next release these.


>---------------------------------------------------------------

13665e7b57a9f2c2d2e4c7c6038b33876eaf55f7
 base/build.lua   | 58 +-------------------------------------------------------
 build-config.lua | 40 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 57 deletions(-)

diff --git a/base/build.lua b/base/build.lua
index 7e5ec25e..60257203 100644
--- a/base/build.lua
+++ b/base/build.lua
@@ -147,58 +147,6 @@ checkconfigs = {"build","config-TU"}
 
 update_tag = update_tag_base
 
-function format (doc)
-  local errorlevel = unpack ()
-  if errorlevel ~=0 then
-    return errorlevel
-  end
-  local function format (engine,fmtname)
-    -- the relationships are all correct
-    local sourcefile = unpackdir .. "/latex.ltx"
-    local finalname = string.gsub(engine,"tex","latex")
-    if fileexists(localdir .. "/" .. finalname .. ".ini") then
-       sourcefile = localdir .. "/" .. finalname .. ".ini"
-    end
-    local errorlevel = os.execute (
-        os_setenv .. " TEXINPUTS=" .. unpackdir .. os_pathsep .. localdir
-        .. os_concat ..
-        engine .. " -etex -ini " .. " -output-directory=" .. unpackdir ..
-        " -jobname=latex " .. sourcefile
-      )
-    if errorlevel ~=0 then
-      return errorlevel
-    end
-    ren (unpackdir, "latex.fmt", fmtname)
-    -- As format building is added in as an 'extra', the normal
-    -- copy mechanism (checkfiles) will fail as things get cleaned up
-    -- inside bundleunpack(): get around that using a manual copy
-    cp (fmtname, unpackdir, localdir)
-    if fmtname == "elatex.fmt" then
-      rm(localdir, "latex.fmt")
-      ren(localdir, fmtname, "latex.fmt")
-    end
-    return 0
-  end
-  if not options["config"] or options["config"][1] ~= "config-TU" then
-    cp("fonttext.cfg",supportdir,unpackdir)
-  end
-  local buildformats = { }
-  local enginedata = options["engine"] or checkengines
-  for _,name in ipairs(enginedata) do
-    table.insert(buildformats,name)
-  end
-  if not options["config"] then
-    table.insert(buildformats,"pdftex")
-  end
-  for _,i in ipairs(buildformats) do
-    errorlevel = format (i, string.gsub (i, "tex$", "") .. "latex.fmt")
-    if errorlevel ~=0 then
-      return errorlevel
-    end
-  end
-  return 0
-end
-
 -- Custom bundleunpack which does not search the localdir
 -- That is needed as texsys.cfg is unpacked in an odd way and
 -- without this will otherwise not be available
@@ -248,9 +196,6 @@ end
 function main (target, file, engine)
   local errorlevel
   if target == "check" then
-    if not options["rerun"] then
-      format()
-    end
     errorlevel = check (file, engine)
   elseif target == "clean" then
     errorlevel = clean ()
@@ -273,8 +218,7 @@ function main (target, file, engine)
   elseif target == "tag" then
     errorlevel = tag(file,engine)
   elseif target == "unpack" then
-    -- A simple way to have the unpack target also build the format
-    errorlevel = format ()
+    errorlevel = unpack ()
   elseif target == "uninstall" then
     errorlevel = uninstall()
   elseif target == "version" then
diff --git a/build-config.lua b/build-config.lua
index 6790f4f6..34ba8d54 100644
--- a/build-config.lua
+++ b/build-config.lua
@@ -163,3 +163,43 @@ function update_tag_ltx(file,content,tagname,tagdate)
     "\nRelease " .. iso .. "[^\n]*\n",
     "\nRelease " .. tag .. "\n")
 end
+
+-- Need to build format files
+local function fmt(names)
+  local function mkfmt(engine)
+    -- Use .ini files if available
+    local src = "latex.ltx"
+    local ini = string.gsub(engine,"tex","") .. "latex.ini"
+    if fileexists(supportdir .. "/" .. ini) then
+      src = ini
+    end
+    print("Building format for " .. engine)
+    local errorlevel = os.execute(
+      os_setenv .. " TEXINPUTS=" .. unpackdir .. os_pathsep .. localdir
+      .. os_pathsep .. texmfdir .. "//"
+      .. os_concat .. engine .. " -etex -ini -output-directory=" .. unpackdir
+      .. " " .. src 
+      .. (hide and (" > " .. os_null) or ""))
+    if errorlevel ~= 0 then return errorlevel end
+    local fmtname = string.gsub(engine,"tex$","") .. "latex.fmt"
+    if fileexists (unpackdir,"latex.fmt") then
+      ren(unpackdir,"latex.fmt",fmtname)
+    end
+    cp(fmtname,unpackdir,testdir)
+    return 0
+  end
+
+  if not options["config"] or options["config"][1] ~= "config-TU" then
+    cp("fonttext.cfg",supportdir,unpackdir)
+  end
+
+  local checkengines = names or options["engine"] or checkengines
+  local errorlevel
+  for _,engine in pairs(checkengines) do
+    errorlevel = mkfmt(engine)
+    if errorlevel ~= 0 then return errorlevel end
+  end
+  return 0
+end
+
+function checkinit_hook() return fmt() end
\ No newline at end of file





More information about the latex3-commits mailing list