diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-09 22:54:52 +0100 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-12-09 22:54:52 +0100 |
commit | c6d79f40c1fd9ba9401b0f4edc688f29144048df (patch) | |
tree | bb01ec1e3b93b0a285e06495ab34a191f5d41d2b /scripts/mkimport | |
parent | 9f614b56bf48ebdd59e81e9e3e874b8f25bb174f (diff) | |
download | luaotfload-c6d79f40c1fd9ba9401b0f4edc688f29144048df.tar.gz |
[import] classify essential and non-essential files into appropriate subdirectories
Simplifies writing make rules ;)
Diffstat (limited to 'scripts/mkimport')
-rw-r--r-- | scripts/mkimport | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/scripts/mkimport b/scripts/mkimport index 1ee695b..f211c2f 100644 --- a/scripts/mkimport +++ b/scripts/mkimport @@ -214,7 +214,8 @@ end local derive_ourname = function (name, kind) local suffix = kind == kind_tex and ".tex" or ".lua" - return our_prefix .. "-" .. name .. suffix + local subdir = kind == kind_essential and "runtime" or "misc" + return subdir, our_prefix .. "-" .. name .. suffix end local is_readable = function (f) @@ -267,8 +268,8 @@ local news = function () local kind = def.kind local fullname = derive_fullname (cat, name, kind) local fullpath = file.join (location, fullname) - local ourname = derive_ourname (ours or name) - local ourpath = file.join (fontloader_subdir, ourname) -- relative + local subdir, ourname = derive_ourname (ours or name) + local ourpath = file.join (fontloader_subdir, subdir, ourname) -- relative local imported = false if not is_readable (fullpath) then @@ -319,7 +320,8 @@ local get_file_definition = function (name, ourname, kind) local dkind = def.kind --- test properties - if derive_ourname (dours, dkind) == ourname then return def, cat end + local subdir, derived = derive_ourname (dours, dkind) + if derived == ourname then return def, cat end if derive_fullname (cat, dname, dkind) == fullname then return def, cat end if dours == ourname then return def, cat end if dname == fullname then return def, cat end @@ -370,14 +372,19 @@ local import_file = function (name, kind, def, cat) local dkind = def.kind local srcdir = derive_category_path (cat) local fullname = derive_fullname (cat, dname, kind) - local ourname = derive_ourname (dname, kind) + local subdir, ourname = derive_ourname (dname, kind) + local ourpath = file.join (fontloader_subdir, subdir) local src = file.join (srcdir, fullname) - local dst = file.join (fontloader_subdir, ourname) + local dst = file.join (ourpath, ourname) local new = not lfs.isfile (dst) if not new and hash_file (src) == hash_file (dst) then status ("file %s is unchanged, skipping", fullname) return import_skipped end + if not (lfs.isdir (ourpath) or not lfs.mkdirs (ourpath)) then + die ("failed to create directory %s for file %s", + ourpath, ourname) + end status ("importing file %s", fullname) file.copy (src, dst) if hash_file (src) == hash_file (dst) then |