diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2015-07-21 07:39:52 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2015-07-21 07:43:09 +0200 |
commit | c4ed163680db9a566b29f5f1d8b98a928f8055a0 (patch) | |
tree | b3ce885464c59a4afd8238a7fe70a7a69ae9d6fb | |
parent | a42d7ef08ecacaef8e0429d80979c9943fd5d83e (diff) | |
download | luaotfload-c4ed163680db9a566b29f5f1d8b98a928f8055a0.tar.gz |
[status] allow passing additional files on command line
During a build process, the name of a freshly created fontloader package
will be passed to ``mkstatus`` so it’ll be considered in the status file.
-rw-r--r-- | Makefile | 9 | ||||
-rwxr-xr-x | scripts/mkstatus | 49 |
2 files changed, 49 insertions, 9 deletions
@@ -90,9 +90,10 @@ LUA = texlua ## variables. DO_GLYPHS = $(LUA) $(GLYPHSCRIPT) > /dev/null DO_CHARS = $(LUA) $(CHARSCRIPT) > /dev/null -DO_STATUS = $(LUA) $(STATUSSCRIPT) > /dev/null -DO_IMPORT = $(LUA) $(IMPORTSCRIPT) import -DO_PACKAGE = $(LUA) $(IMPORTSCRIPT) package $(PACKAGEDIR)/luaotfload-package.lua $(LOADER) +DO_STATUS = $(LUA) $(STATUSSCRIPT) $(LOADER) >/dev/null +DO_IMPORT = $(LUA) $(IMPORTSCRIPT) import >/dev/null +DO_PACKAGE = $(LUA) $(IMPORTSCRIPT) package \ + $(PACKAGEDIR)/luaotfload-package.lua $(LOADER) >/dev/null define check-lua-files @echo validating syntax @@ -143,7 +144,7 @@ $(GLYPHS): builddir $(CHARS): builddir $(DO_CHARS) -$(STATUS): builddir +$(STATUS): builddir loader $(DO_STATUS) $(LOADER): builddir diff --git a/scripts/mkstatus b/scripts/mkstatus index ba9cb06..9e10c03 100755 --- a/scripts/mkstatus +++ b/scripts/mkstatus @@ -55,7 +55,7 @@ local names = { { "src", "luaotfload-loaders.lua", }, { "src", "luaotfload-log.lua", }, { "src", "luaotfload-main.lua", }, - { "src/fontloader/runtime", "fontloader-fontloader.lua", }, + { "src/fontloader/runtime", "fontloader-reference.lua", }, --{ "src", "luaotfload-override.lua", }, --> part of init now { "src", "luaotfload-parsers.lua", }, { "src", "luaotfload-tool.lua", }, @@ -121,8 +121,9 @@ end local hash_all hash_all = function (list, acc) - if list == nil then - return hash_all (table.fastcopy (names), { }) + if acc == nil then + local base = table.fastcopy (names) + return hash_all (table.append (base, list), { }) end local finfo = list[#list] @@ -156,9 +157,47 @@ hash_all = function (list, acc) return acc end +local handle_argv = function (argv) + local argc = #argv + if argc < 1 then return { } end + local argoff = 1 + if argv [1] == "-v" then + verbose = true + if argc == 1 then return { } end + argoff = 2 + end + local aux aux = function (acc, i) + if i > argc then return acc else + local cur = argv[i] + if type (cur) == "string" and lfs.isfile (cur) then + acc[#acc + 1] = cur + else + die ("file not found: %s", tostring (cur)) + end + return aux (acc, i + 1) + end + end + return aux ({ }, argoff) +end + +local add_files +add_files = function (lst, acc) + if lst == nil then return end + if acc == nil then return add_files (lst, { }) end + local len = #lst + if len == 0 then return acc end + local cur = lst[len] + local fname = file.basename (cur) + local path = file.dirname (cur) + acc[#acc + 1] = { path, fname } + lst[len] = nil + return add_files (lst, acc) +end + local main = function () - if arg [1] == "-v" then verbose = true end - local hashes = hash_all () + local raw_extra = handle_argv (arg) + local cuit_extra = add_files (raw_extra) + local hashes = hash_all (cuit_extra) local notes = git_info () local serialized = table.serialize ({ notes = notes, hashes = hashes }, true) |