From abf7a9d408ed279a98287dad020afee88dcc68cc Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 22 Nov 2010 19:54:35 -0500 Subject: Add OpenBSD support --- src/luarocks/cfg.lua | 9 +++++++++ src/luarocks/fs/unix/tools.lua | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index d141bdee..2385d665 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -64,6 +64,10 @@ if system == "FreeBSD" then detected.unix = true detected.freebsd = true detected.bsd = true +elseif system == "OpenBSD" then + detected.unix = true + detected.openbsd = true + detected.bsd = true elseif system == "Darwin" then detected.unix = true detected.macosx = true @@ -289,6 +293,11 @@ if detected.freebsd then defaults.variables.LIBFLAG = "-shared" end +if detected.openbsd then + defaults.arch = "openbsd-"..proc + defaults.platforms = {"unix", "bsd", "openbsd"} +end + -- Expose some more values detected by LuaRocks for use by rockspec authors. defaults.variables.LUA = defaults.lua_interpreter defaults.variables.LIB_EXTENSION = defaults.lib_extension diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index bb7e48db..c805fb48 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua @@ -350,7 +350,18 @@ end function get_permissions(filename) local ret - local flag = cfg.is_platform("bsd") and "-f '%A'" or "-c '%a'" + + local flag + if cfg.is_platform("bsd") then + if cfg.is_platform("openbsd") then + flag = "-f '%Op'" + else + flag = "-f '%A'" + end + else + flag = "-c '%a'" + end + local pipe = io.popen("stat "..flag.." "..fs.Q(filename)) ret = pipe:read("*l") pipe:close() -- cgit v1.2.3-55-g6feb