From 68814e9bc62d8ea1cf3d17a657a23564341cf71c Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 21 Jul 2015 00:41:57 +0200 Subject: [build] add rules for import and packaging New targets: $ make import Runs the packaging script in import mode. Also, $ make loader Will package the files in the src/fontloader/* directories into a merged fontloader package using mtx-package. --- Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ab5c464..61e8e49 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ DOCSRCDIR = ./doc SCRIPTSRCDIR = ./scripts SRCSRCDIR = ./src FONTLOADERDIR = $(SRCSRCDIR)/fontloader/runtime +PACKAGEDIR = $(SRCSRCDIR)/fontloader/ BUILDDIR = ./build MISCDIR = ./misc @@ -48,6 +49,7 @@ DOCS = $(DOCPDF) $(DOTPDF) $(MANPAGES) GLYPHS = $(BUILDDIR)/$(NAME)-glyphlist.lua CHARS = $(BUILDDIR)/$(NAME)-characters.lua STATUS = $(BUILDDIR)/$(NAME)-status.lua +LOADER = $(BUILDDIR)/fontloader-$(shell date +%F).lua RESOURCES = $(GLYPHS) $(CHARS) $(STATUS) SOURCE = $(DOCSRC) $(MANSRC) $(SRC) README COPYING Makefile NEWS $(RESOURCESCRIPTS) @@ -88,8 +90,9 @@ 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) > /dev/null +DO_STATUS = $(LUA) $(STATUSSCRIPT) > /dev/null +DO_IMPORT = $(LUA) $(IMPORTSCRIPT) import +DO_PACKAGE = $(LUA) $(IMPORTSCRIPT) package $(PACKAGEDIR)/luaotfload-package.lua $(LOADER) define check-lua-files @echo validating syntax @@ -113,8 +116,12 @@ builddir: $(BUILDDIR) resources: $(RESOURCES) chars: $(CHARS) status: $(STATUS) +package: loader +loader: $(LOADER) ctan: $(CTAN_ZIP) tds: $(TDS_ZIP) +import: + $(DO_IMPORT) graph: $(DOTPDF) doc: $(DOCS) @@ -139,6 +146,9 @@ $(CHARS): builddir $(STATUS): builddir $(DO_STATUS) +$(LOADER): builddir + $(DO_PACKAGE) + $(BUILDDIR): /dev/null mkdir -p $(BUILDDIR) @@ -222,6 +232,7 @@ showtargets: @echo " luaotfload.conf(5) (requires Docutils)" @echo " graph generate file graph (requires GraphViz)" @echo + @echo " loader merge fontloader" @echo " chars import char-def.lua as luaotfload-characters.lua" @echo " status create repository info (luaotfload-status.lua)" @echo -- cgit From d6a31eacfaefe016d57c5caaf9ab5e12d3d50618 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 21 Jul 2015 01:20:29 +0200 Subject: [import] automate merge with parameters passed from makefile --- Makefile | 2 +- scripts/mkimport | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 61e8e49..21909e5 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ DOCSRCDIR = ./doc SCRIPTSRCDIR = ./scripts SRCSRCDIR = ./src FONTLOADERDIR = $(SRCSRCDIR)/fontloader/runtime -PACKAGEDIR = $(SRCSRCDIR)/fontloader/ +PACKAGEDIR = $(SRCSRCDIR)/fontloader BUILDDIR = ./build MISCDIR = ./misc diff --git a/scripts/mkimport b/scripts/mkimport index cd44450..89c74e7 100755 --- a/scripts/mkimport +++ b/scripts/mkimport @@ -33,11 +33,13 @@ local os = require "os" require "lualibs" +local filedirname = file.dirname local fileiswritable = file.is_writable local ioloaddata = io.loaddata local iopopen = io.popen local iowrite = io.write local lfschdir = lfs.chdir +local lfscurrentdir = lfs.currentdir local lfsisdir = lfs.isdir local lfsisfile = lfs.isfile local md5sumhexa = md5.sumhexa @@ -670,16 +672,42 @@ end local build_paths = function (argv) if not argv or type (argv) ~= "table" then die "build_paths" end - local orig_dir = lfs.currentdir () - local base_dir = orig_dir .. loader_orig_dir + local orig_dir = lfscurrentdir () + local base_dir = orig_dir .. loader_orig_dir + local target_name = orig_dir .. loader_target_dir + .. stringformat (loader_target_name, os.date ("%F")) + local merge_name = base_dir .. loader_merge_name + local output_name = base_dir .. loader_output_name + + if #argv >= 2 then + local fname = argv[2] + local dir = filedirname (fname) .. "/" + if not lfsisdir (dir) then + die ("second argument must be point into existing directory, not “%s”", + argv[2]) + end + base_dir = dir + merge_name = fname + output_name = dir .. loader_output_name + end + + if #argv == 3 then + --- also set the target name + local fname = argv[3] + local dir = filedirname (fname) + if not lfsisdir (dir) then + die ("third argument must be point into writable directory, not “%s”", + argv[3]) + end + target_name = fname + end local ret = { orig_dir = orig_dir, base_dir = base_dir, - merge_name = base_dir .. loader_merge_name, - target_name = orig_dir .. loader_target_dir - .. stringformat (loader_target_name, os.date ("%F")), - output_name = base_dir .. loader_output_name, + merge_name = merge_name, + target_name = target_name, + output_name = output_name, } return ret end @@ -717,7 +745,7 @@ local package = function (argv) if not lfsisfile (paths.merge_name) then die ("missing merge file at %s", emphasis (paths.merge_name )) end if not fileiswritable (paths.output_name) then die ("cannot write to %s", emphasis (paths.output_name)) end if not fileiswritable (paths.target_name) then die ("cannot write to %s", emphasis (paths.target_name)) end - if not lfschdir (paths.base_dir) then die ("failed to cd into %s", emphasis (paths.base_dir )) end +---- not lfschdir (paths.base_dir) then die ("failed to cd into %s", emphasis (paths.base_dir )) end if lfsisfile (paths.output_name) then status ("output file already exists at “%s”, unlinking", @@ -768,11 +796,17 @@ local package = function (argv) --- check postconditions - if not lfsisfile (paths.output_name) then die ("merge failed; package not found at " .. paths.output_name) end + if not lfsisfile (paths.output_name) then + die ("merge failed; package not found at " .. paths.output_name) + end --- at this point we know that mtxrun was invoked correctly and the --- result file has been created + if lfsisfile (paths.target_name) then + status ("target file %s exists, overwriting", emphasis (paths.target_name)) + end + local res, err = osrename (paths.output_name, paths.target_name) if res == nil then -- cgit From c4ed163680db9a566b29f5f1d8b98a928f8055a0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 21 Jul 2015 07:39:52 +0200 Subject: [status] allow passing additional files on command line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Makefile | 9 +++++---- scripts/mkstatus | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 21909e5..f81f544 100644 --- a/Makefile +++ b/Makefile @@ -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) -- cgit From e3d7d44a4eb599e7168158c66c6421e6e5f867a0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 21 Jul 2015 07:52:58 +0200 Subject: [build] include merged fontloader in resources This ensures the file is included in the TDS repository. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f81f544..2613db4 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ GLYPHS = $(BUILDDIR)/$(NAME)-glyphlist.lua CHARS = $(BUILDDIR)/$(NAME)-characters.lua STATUS = $(BUILDDIR)/$(NAME)-status.lua LOADER = $(BUILDDIR)/fontloader-$(shell date +%F).lua -RESOURCES = $(GLYPHS) $(CHARS) $(STATUS) +RESOURCES = $(GLYPHS) $(CHARS) $(LOADER) $(STATUS) SOURCE = $(DOCSRC) $(MANSRC) $(SRC) README COPYING Makefile NEWS $(RESOURCESCRIPTS) # Files grouped by installation location -- cgit From 6eff203e9bf3348d090b6b5046466415bcd6530a Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 21 Jul 2015 08:11:21 +0200 Subject: [mkstatus,build,conf] default to packaged fontloader via status file This adds an entry ``loader`` on the ``notes`` hash in the status table by means of which the fontloader can be specified. The status file is read when building the configuration table, and if it is present the entry in the ``loader`` table will be used as the default fontloader. Otherwise, Luaotfload falls back on the reference loader. --- Makefile | 2 +- scripts/mkstatus | 23 +++++++++++++++++------ src/luaotfload-configuration.lua | 6 +++--- 3 files changed, 21 insertions(+), 10 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2613db4..bd0021b 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ LUA = texlua ## variables. DO_GLYPHS = $(LUA) $(GLYPHSCRIPT) > /dev/null DO_CHARS = $(LUA) $(CHARSCRIPT) > /dev/null -DO_STATUS = $(LUA) $(STATUSSCRIPT) $(LOADER) >/dev/null +DO_STATUS = $(LUA) $(STATUSSCRIPT) --fontloader=$(LOADER) >/dev/null DO_IMPORT = $(LUA) $(IMPORTSCRIPT) import >/dev/null DO_PACKAGE = $(LUA) $(IMPORTSCRIPT) package \ $(PACKAGEDIR)/luaotfload-package.lua $(LOADER) >/dev/null diff --git a/scripts/mkstatus b/scripts/mkstatus index 9e10c03..809d4af 100755 --- a/scripts/mkstatus +++ b/scripts/mkstatus @@ -26,6 +26,7 @@ local iosavedata = io.savedata local iopopen = io.popen local iowrite = io.write local lfsisdir = lfs.isdir +local stringmatch = string.match ----------------------------------------------------------------------- -- settings @@ -158,26 +159,35 @@ hash_all = function (list, acc) end local handle_argv = function (argv) + local ret = { files = { }, loader = nil } local argc = #argv - if argc < 1 then return { } end + if argc < 1 then return ret end local argoff = 1 if argv [1] == "-v" then verbose = true - if argc == 1 then return { } end + if argc == 1 then return ret 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 + if type (cur) == "string" then + local loader = stringmatch (cur, "--fontloader=(.+)$") + if loader then + cur = loader + acc.loader = file.basename (cur) + end + if lfs.isfile (cur) then + local files = acc.files + files[#files + 1] = cur + end else die ("file not found: %s", tostring (cur)) end return aux (acc, i + 1) end end - return aux ({ }, argoff) + return aux (ret, argoff) end local add_files @@ -196,9 +206,10 @@ end local main = function () local raw_extra = handle_argv (arg) - local cuit_extra = add_files (raw_extra) + local cuit_extra = add_files (raw_extra.files) local hashes = hash_all (cuit_extra) local notes = git_info () + notes.loader = raw_extra.loader local serialized = table.serialize ({ notes = notes, hashes = hashes }, true) local success = io.savedata (filelist, serialized) diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index e9393c5..e2cfbd8 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -140,9 +140,9 @@ local feature_presets = { --doc]]-- local registered_loaders = { - default = "fontloader", - fontloader = "fontloader", - tl2013 = "tl2013", + default = luaotfloadstatus and luaotfloadstatus.notes.loader or "reference", + reference = "reference", + tl2014 = "tl2014", } --[[doc-- -- cgit