commit: 83d28a0cd387362c9f31f11783556c0ac547b3cd
parent 911ed5c6258ade5df03e595e2802c9d32118b86d
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 13 Jun 2020 16:20:34 -0700
Use variable name that matches ninja variable
Diffstat:
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/ninja.lua b/ninja.lua
@@ -144,7 +144,7 @@ end
function iterlines(file, raw)
table.insert(pkg.inputs.gen, '$dir/'..file)
- file = string.format('%s/%s/%s', basedir, pkg.dir, file)
+ file = string.format('%s/%s/%s', basedir, pkg.gendir, file)
if raw then
return io.lines(file)
end
@@ -157,7 +157,7 @@ end
function load(file)
table.insert(pkg.inputs.gen, '$dir/'..file)
- return dofile(string.format('%s/%s/%s', basedir, pkg.dir, file))
+ return dofile(string.format('%s/%s/%s', basedir, pkg.gendir, file))
end
--
@@ -226,7 +226,7 @@ end
function sub(name, fn)
local old = io.output()
- io.output(pkg.dir..'/'..name)
+ io.output(pkg.gendir..'/'..name)
fn()
io.output(old)
subninja(name)
@@ -431,7 +431,7 @@ local function fs(name, path)
end
function file(path, mode, src)
- if pkg.dir:hasprefix('pkg/') and not fs(pkg.name, path) then
+ if pkg.gendir:hasprefix('pkg/') and not fs(pkg.name, path) then
return
end
local out = '$builddir/root.hash/'..path
@@ -447,7 +447,7 @@ function file(path, mode, src)
end
function dir(path, mode)
- if pkg.dir:hasprefix('pkg/') and not fs(pkg.name, path) then
+ if pkg.gendir:hasprefix('pkg/') and not fs(pkg.name, path) then
return
end
mode = tonumber(mode, 8)
@@ -455,7 +455,7 @@ function dir(path, mode)
end
function sym(path, target)
- if pkg.dir:hasprefix('pkg/') and not fs(pkg.name, path) then
+ if pkg.gendir:hasprefix('pkg/') and not fs(pkg.name, path) then
return
end
local out = '$builddir/root.hash/'..path
diff --git a/setup.lua b/setup.lua
@@ -29,11 +29,11 @@ function subgen(dir)
table.insert(pkg.inputs.ninja, '$gendir/'..dir..'/ninja')
table.insert(pkg.inputs.index, '$outdir/'..dir..'/root.index')
table.insert(pkg.inputs.perms, '$outdir/'..dir..'/root.perms')
- local cmd = string.format('test -f %s/%s/local.ninja', pkg.dir, dir)
+ local cmd = string.format('test -f %s/%s/local.ninja', pkg.gendir, dir)
if recurse or not os.execute(cmd) then
local oldpkg, oldout = pkg, io.output()
- if pkg.dir ~= '.' then
- dir = pkg.dir..'/'..dir
+ if pkg.gendir ~= '.' then
+ dir = pkg.gendir..'/'..dir
end
gen(dir)
pkg = oldpkg
@@ -41,10 +41,10 @@ function subgen(dir)
end
end
-function gen(dir)
+function gen(gendir)
pkg={
- name=dir:match('[^/]*$'),
- dir=dir,
+ name=gendir:match('[^/]*$'),
+ gendir=gendir,
inputs={
perms={},
index={},
@@ -59,12 +59,12 @@ function gen(dir)
},
perms={},
}
- assert(os.execute('mkdir -p '..dir))
- local outdir = config.builddir..'/'..dir
+ assert(os.execute('mkdir -p '..gendir))
+ local outdir = config.builddir..'/'..gendir
assert(os.execute('mkdir -p '..outdir))
- io.output(dir..'/local.ninja.tmp')
- set('gendir', dir)
- if dir ~= '.' then
+ io.output(gendir..'/local.ninja.tmp')
+ set('gendir', gendir)
+ if gendir ~= '.' then
set('dir', '$basedir/$gendir')
set('outdir', '$builddir/$gendir')
set('srcdir', '$dir/src')
@@ -113,8 +113,8 @@ function gen(dir)
end
build('phony', '$dir/root', pkg.inputs.root)
io.close()
- os.rename(dir..'/local.ninja.tmp', dir..'/local.ninja')
- if dir == '.' then
+ os.rename(gendir..'/local.ninja.tmp', gendir..'/local.ninja')
+ if gendir == '.' then
os.execute('ln -sf local.ninja build.ninja')
end
end