Skip to content

Commit

Permalink
Don't let install happen if we want manifest support and there's no L…
Browse files Browse the repository at this point in the history
…ua parser.
  • Loading branch information
icculus committed Jan 24, 2008
1 parent ce0f347 commit a482619
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -233,6 +233,9 @@ SET(STBIMAGE_SRCS
# it, but even that's not an unclimbable obstacle.
# In reality, you probably want to keep the parser, though, unless you REALLY
# must save every single byte in the download.
# YOU NEED THE PARSER IF YOU WANT MANIFESTS WRITTEN OUT.
# YOU NEED THE PARSER IF YOU WANT THE UNINSTALLER TO WORK.
# DON'T DISABLE THIS NOW IF YOU DON'T ABSOLUTELY HAVE TO.
# BINARY SIZE += 19
OPTION(MOJOSETUP_LUA_PARSER "Bigger binary but scripts don't need to be compiled." TRUE)
IF(MOJOSETUP_LUA_PARSER)
Expand Down
21 changes: 19 additions & 2 deletions lua_glue.c
Expand Up @@ -84,7 +84,7 @@ static inline void set_number(lua_State *L, lua_Number x, const char *sym)
{
lua_pushnumber(L, x);
lua_setfield(L, -2, sym);
} // set_string
} // set_number


// Sets t[sym]=f, where t is on the top of the Lua stack.
Expand All @@ -93,7 +93,17 @@ static inline void set_integer(lua_State *L, lua_Integer x, const char *sym)
{
lua_pushinteger(L, x);
lua_setfield(L, -2, sym);
} // set_string
} // set_integer


// Sets t[sym]=f, where t is on the top of the Lua stack.
// !!! FIXME: why is this a different naming convention?
static inline void set_boolean(lua_State *L, boolean x, const char *sym)
{
lua_pushboolean(L, x);
lua_setfield(L, -2, sym);
} // set_boolean


// !!! FIXME: why is this a different naming convention?
static inline void set_string_array(lua_State *L, int argc, const char **argv,
Expand Down Expand Up @@ -1555,6 +1565,12 @@ boolean MojoLua_initLua(void)
lua_Integer euid = MojoPlatform_geteuid();
lua_Integer gid = MojoPlatform_getgid();

#if DISABLE_LUA_PARSER
const boolean luaparser = false;
#else
const boolean luaparser = true;
#endif

if (locale == NULL) locale = xstrdup("???");
if (ostype == NULL) ostype = xstrdup("???");
if (osversion == NULL) osversion = xstrdup("???");
Expand Down Expand Up @@ -1616,6 +1632,7 @@ boolean MojoLua_initLua(void)
set_string(luaState, homedir, "homedir");
set_string(luaState, binarypath, "binarypath");
set_string(luaState, GBaseArchivePath, "basearchivepath");
set_boolean(luaState, luaparser, "luaparser");
set_integer(luaState, uid, "uid");
set_integer(luaState, euid, "euid");
set_integer(luaState, gid, "gid");
Expand Down
7 changes: 7 additions & 0 deletions scripts/localization.lua
Expand Up @@ -294,6 +294,13 @@ MojoSetup.localization = {
["BUG: support_uninstall requires write_manifest"] = {
};

-- This is shown if the config file wants us to add a manifest to the
-- files we write to disk, but didn't enable Lua parser support in the
-- binary (this is done through CMake when compiling the C code). This is
-- a bug the developer must fix before shipping her installer.
["BUG: write_manifest requires Lua parser support"] = {
};

-- This is a file's permissions. Programmers give these as strings, and
-- if one isn't valid, the program will report this. So, on Unix, they
-- might specify "0600" as a valid string, but "sdfksjdfk" wouldn't be
Expand Down
5 changes: 5 additions & 0 deletions scripts/mojosetup_mainline.lua
Expand Up @@ -1023,6 +1023,11 @@ local function do_install(install)
MojoSetup.fatal(_("BUG: support_uninstall requires write_manifest"))
end

-- Manifest support requires the Lua parser.
if (install.write_manifest) and (not MojoSetup.info.luaparser) then
MojoSetup.fatal(_("BUG: write_manifest requires Lua parser support"))
end

-- This is to save us the trouble of a loop every time we have to
-- find media by id...
MojoSetup.media = {}
Expand Down

0 comments on commit a482619

Please sign in to comment.