diff options
Diffstat (limited to 'src/luaotfload-tool.lua')
-rwxr-xr-x | src/luaotfload-tool.lua | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 376aa39..35dc9b3 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -7,10 +7,11 @@ -- LICENSE: GPL v2.0 ----------------------------------------------------------------------- -luaotfload = luaotfload or { } -local version = "2.7" -luaotfload.version = version -luaotfload.self = "luaotfload-tool" +luaotfload = luaotfload or { } +local version = "2.7" +luaotfload.version = version +luaotfload.min_luatex_version = { 0, 95, 0 } --- i. e. 0.95.0 +luaotfload.self = "luaotfload-tool" --[[doc-- @@ -33,16 +34,6 @@ see the luaotfload documentation for more info. Report bugs to kpse.set_program_name "luatex" ---[[doc-- - - We test for Lua 5.1 by means of capability detection to see if - we’re running an outdated Luatex. If so, we bail. - - \url{http://lua-users.org/wiki/LuaVersionCompatibility} - ---doc]]-- - - local iowrite = io.write local kpsefind_file = kpse.find_file local mathfloor = math.floor @@ -59,19 +50,32 @@ local texiowrite = texio.write local tonumber = tonumber local type = type -local runtime -if _G.getfenv ~= nil then -- 5.1 or LJ - if _G.jit ~= nil then - runtime = { "jit", jit.version } - else - runtime = { "stock", _VERSION } - print "FATAL ERROR" - print "Luaotfload requires a Luatex version >=0.76." - print "Please update your TeX distribution!" - os.exit (-1) - end -else -- 5.2 - runtime = { "stock", _VERSION } +do + local runtime = _G.jit and { "jit" , jit.version } + or { "stock", _VERSION } + local stats = status and status.list () + local minimum = luaotfload.min_luatex_version + local actual = { 0, 0, 0 } + if stats then + local major = stats.luatex_version / 100 + local minor = stats.luatex_version % 100 + local revision = stats.luatex_revision --[[ : string ]] + local revno = tonumber (revision) + actual = { major, minor, revno or 0 } + end + + if actual [1] < minimum [1] or actual [2] < minimum [2] + or actual [3] < minimum [3] + then + texio.write_nl ("term and log", + string.format ("\tFATAL ERROR\n\z + \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z + \tPlease update your TeX distribution!\n\n", + (unpack or table.unpack) (minimum))) + error "version check failed" + end + luaotfload.runtime = runtime + luaotfload.luatex_version = actual end local C, Ct, P, S = lpeg.C, lpeg.Ct, lpeg.P, lpeg.S @@ -336,15 +340,21 @@ local version_msg = function ( ) local out = function (...) texiowrite_nl (stringformat (...)) end local uname = os.uname () local meta = fonts.names.getmetadata () - local info = status.list () + + local runtime = luaotfload.runtime + local actual = luaotfload.luatex_version + local status = config.luaotfload.status + local notes = status and status.notes or { } + out (about, luaotfload.self) out ("%s version: %q", luaotfload.self, version) - out ("Revision: %q", config.luaotfload.status.notes.revision) + if notes.description then + out ("Luaotfload: %q", notes.description) + end + out ("Revision: %q", notes.revision) out ("Lua interpreter: %s; version %q", runtime[1], runtime[2]) --[[out ("Luatex SVN revision: %d", info.luatex_svn)]] --> SVN r5624 - out ("Luatex version: %.2f.%d", - info.luatex_version / 100, - info.luatex_revision) + out ("Luatex version: %d.%d", actual [1], actual [2]) out ("Platform: type=%s name=%s", os.type, os.name) local uname_vars = tablesortedkeys (uname) @@ -356,7 +366,7 @@ local version_msg = function ( ) out("No database metadata available.") else out ("Index: version=%q created=%q modified=%q", - config.luaotfload.status.notes.revision, + meta.version or "too old", meta.created or "ages ago", meta.modified or "ages ago") end |