From: "Vadim A. Misbakh-Soloviov" <mva@mva.name>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/lua:master commit in: dev-lua/iluajit/files/, dev-lua/iluajit/
Date: Mon, 11 May 2015 09:20:51 +0000 (UTC) [thread overview]
Message-ID: <1431335928.c93be8bad5c6c628451c8af913077cd03d424b8c.mva@gentoo> (raw)
commit: c93be8bad5c6c628451c8af913077cd03d424b8c
Author: Vadim A. Misbakh-Soloviov <git <AT> mva <DOT> name>
AuthorDate: Mon May 11 09:18:48 2015 +0000
Commit: Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
CommitDate: Mon May 11 09:18:48 2015 +0000
URL: https://gitweb.gentoo.org/proj/lua.git/commit/?id=c93be8ba
[dev-lua/luajit] replaced wrapper
Signed-off-by: Vadim A. Misbakh-Soloviov <git <AT> mva.name>
dev-lua/iluajit/files/iluajit | 90 +++++++++++++++++++++++++++++++++++++
dev-lua/iluajit/iluajit-9999.ebuild | 3 +-
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/dev-lua/iluajit/files/iluajit b/dev-lua/iluajit/files/iluajit
new file mode 100755
index 0000000..8c48baf
--- /dev/null
+++ b/dev-lua/iluajit/files/iluajit
@@ -0,0 +1,90 @@
+#!luajit --
+
+-- Hide the shebang, since we don't hope env to be in /usr/bin, so just
+-- executing LuaJIT from the PATH, and make a pokerface, like we called
+-- it from env
+arg[-1]=arg[-2];
+arg[-2]=nil;
+
+local function run(cmd)
+ local f = io.popen(cmd..' 2>&1; echo "-retcode:$?"', 'r') -- XXX: Windows compat?
+ local l = f:read('*a')
+ f:close()
+ local i1,i2,ret = l:gsub("\n%-retcode","-retcode"):find('%-retcode:(%d+)\n$')
+ l = l:sub(1,i1-1)
+ return l,tonumber(ret)
+end
+
+local function exists(name)
+ if type(name)~="string" then return false end
+ return os.rename(name,name) and true or false
+end
+
+local ignore_argc=0;
+local force_interactive = false;
+local interactive = true;
+for i,v in pairs(arg) do
+ if ignore_argc>0 then
+ ignore_argc=-1;
+ elseif (v:match("^-l")) then
+ local req;
+ if (#v>2) then
+ req=v:match("^-l(.*)");
+ else
+ local nextarg=arg[i+1];
+ if (type(nextarg)=="string") then
+ ignore_argc=ignore_argc+1;
+ req=nextarg;
+ end
+ end
+ require(req);
+ elseif (v:match("^-e")) then
+ local ex;
+ if (#v>2) then
+ ex=v:match("^-e(.*)");
+ else
+ local nextarg=arg[i+1];
+ if (type(nextarg)=="string") then
+ ignore_argc=ignore_argc+1;
+ ex=nextarg;
+ end
+ end
+ loadstring(ex)();
+ elseif (v:match("^-i")) then
+ force_interactive=true;
+ elseif (v:match("^-b")) then
+ ignore_argc=math.huge; -- working with bytecode is incompatible with other options
+ local argv=arg;
+ for k,v in ipairs(argv) do
+ if v:match("^-[b]?[^ ]*e") then
+ argv[k+1]=[[']]..argv[k+1]:gsub([['(.*)']],[["%1"]])..[[']]
+ print(argv[k+1])
+ end
+ end
+ local args=table.concat(argv,' ')
+ local res,err=run("luajit "..args);
+ if (err==0) then
+ print(res);
+ else
+ local err_msg;
+ if res:find("\n") then
+ err_msg="\n"..res;
+ else
+ err_msg=res;
+ end
+ print("Error! Exit code: "..err.."; Message: "..(err_msg or "<no message>"))
+ end
+ elseif (i>0) then
+ interactive=false;
+ if (exists(v)) then
+ loadfile(v)();
+ end
+ end
+end
+if (force_interactive) then
+ interactive=true;
+end
+
+if (interactive and ignore_argc<math.huge) then
+ require("iluajit")
+end
diff --git a/dev-lua/iluajit/iluajit-9999.ebuild b/dev-lua/iluajit/iluajit-9999.ebuild
index b8d573c..f888097 100644
--- a/dev-lua/iluajit/iluajit-9999.ebuild
+++ b/dev-lua/iluajit/iluajit-9999.ebuild
@@ -39,5 +39,6 @@ src_install() {
insinto "${lmod}"
doins *.lua
- make_wrapper "${PN}" "luajit ${lmod}/${PN}.lua"
+# make_wrapper "${PN}" "luajit -l ${PN}"
+ dobin ${FILESDIR}/${PN}
}
next reply other threads:[~2015-05-11 9:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 9:20 Vadim A. Misbakh-Soloviov [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-05-27 22:13 [gentoo-commits] proj/lua:master commit in: dev-lua/iluajit/files/, dev-lua/iluajit/ Vadim A. Misbakh-Soloviov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431335928.c93be8bad5c6c628451c8af913077cd03d424b8c.mva@gentoo \
--to=mva@mva.name \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox