Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2017-03-22 01:24:08 +0300
committerOliver Schneider <oliver@assarbad.net>2017-03-22 01:24:08 +0300
commit59e79356166589c1f0164afe105507addae67cfb (patch)
tree9dfbd4feb1915ef8f240f74a52728bfbab4d1ed0
parentb8625c05bc96cc03d1d940aa7a7682029473f228 (diff)
Introducing os.str2uuid() as possibility to convert a string deterministically into a (pseudo-)UUID using SHA-3 (256-bit) aka Keccak
Replaced all leading spaces or mixed spaces/tabs with tabs (by rule 1 tab = 4 spaces) Prepared premake4.lua for this project to generate XP projects and VS2017 projects --HG-- branch : WDS-build
-rw-r--r--Premake4.vs8.vcproj20
-rw-r--r--premake4.lua50
-rw-r--r--scripts/release.lua2
-rw-r--r--src/actions/codeblocks/codeblocks_cbp.lua4
-rw-r--r--src/actions/make/make_cpp.lua4
-rw-r--r--src/actions/make/make_csharp.lua6
-rw-r--r--src/actions/vstudio/vs200x_vcproj.lua14
-rw-r--r--src/actions/vstudio/vs2010_vcxproj.lua14
-rw-r--r--src/base/api.lua80
-rw-r--r--src/base/bake.lua306
-rw-r--r--src/base/project.lua2
-rw-r--r--src/host/keccak.c333
-rwxr-xr-xsrc/host/os_stat.c2
-rw-r--r--src/host/os_uuid.c27
-rw-r--r--src/host/path_getabsolute.c2
-rw-r--r--src/host/path_isabsolute.c8
-rw-r--r--src/host/path_normalize.c18
-rwxr-xr-xsrc/host/premake.c3
-rwxr-xr-xsrc/host/premake.h3
-rw-r--r--src/host/scripts.c4
-rw-r--r--src/tools/gcc.lua2
21 files changed, 654 insertions, 250 deletions
diff --git a/Premake4.vs8.vcproj b/Premake4.vs8.vcproj
index 5c048fa..0de952e 100644
--- a/Premake4.vs8.vcproj
+++ b/Premake4.vs8.vcproj
@@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
- PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ PreprocessorDefinitions="USE_KECCAK;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
@@ -57,7 +57,7 @@
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ PreprocessorDefinitions="USE_KECCAK;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
/>
<Tool
@@ -127,7 +127,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
- PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ PreprocessorDefinitions="USE_KECCAK;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -144,7 +144,7 @@
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
+ PreprocessorDefinitions="USE_KECCAK;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
/>
<Tool
@@ -213,7 +213,7 @@
Name="VCCLCompilerTool"
Optimization="1"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
- PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP;PREMAKE_VERSION=4.4-wds"
+ PreprocessorDefinitions="USE_KECCAK;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP;PREMAKE_VERSION=4.4-wds"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
@@ -229,7 +229,7 @@
/>
<Tool
Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP;PREMAKE_VERSION=4.4-wds"
+ PreprocessorDefinitions="USE_KECCAK;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;HAVE_HGTIP;PREMAKE_VERSION=4.4-wds"
AdditionalIncludeDirectories="src\host\lua-5.1.4\src"
/>
<Tool
@@ -481,6 +481,10 @@
RelativePath="src\actions\vstudio\vs2015.lua"
>
</File>
+ <File
+ RelativePath="src\actions\vstudio\vs2017.lua"
+ >
+ </File>
</Filter>
<Filter
Name="xcode"
@@ -585,6 +589,10 @@
Name="host"
Filter=""
>
+ <File
+ RelativePath="src\host\keccak.c"
+ >
+ </File>
<Filter
Name="lua-5.1.4"
Filter=""
diff --git a/premake4.lua b/premake4.lua
index 1beadd0..836ac1e 100644
--- a/premake4.lua
+++ b/premake4.lua
@@ -43,7 +43,7 @@ do
premake.project.getbasename = function(prjname, pattern)
-- The below is used to insert the .vs(8|9|10|11|12|14) into the file names for projects and solutions
if _ACTION then
- name_map = {vs2005 = "vs8", vs2008 = "vs9", vs2010 = "vs10", vs2012 = "vs11", vs2013 = "vs12", vs2015 = "vs14"}
+ name_map = {vs2005 = "vs8", vs2008 = "vs9", vs2010 = "vs10", vs2012 = "vs11", vs2013 = "vs12", vs2015 = "vs14", vs2017 = "vs15"}
if name_map[_ACTION] then
pattern = pattern:gsub("%%%%", "%%%%." .. name_map[_ACTION])
else
@@ -69,18 +69,43 @@ do
end
orig_generate(obj, filename, callback)
end
-end
-local function transformMN(input) -- transform the macro names for older Visual Studio versions
- local new_map = { vs2002 = 0, vs2003 = 0, vs2005 = 0, vs2008 = 0 }
- local replacements = { Platform = "PlatformName", Configuration = "ConfigurationName" }
- if new_map[action] ~= nil then
- for k,v in pairs(replacements) do
- if input:find(k) then
- input = input:gsub(k, v)
+ -- We want to output the file with UTF-8 BOM
+ local orig_vc2010_header = premake.vstudio.vc2010.header
+ premake.vstudio.vc2010.header = function(targets)
+ io.capture()
+ orig_vc2010_header(targets)
+ local captured = io.endcapture()
+ io.write("\239\187\191")
+ io.write(captured)
+ end
+ -- Make sure we can generate XP-compatible projects for newer Visual Studio versions
+ local orig_vc2010_configurationPropertyGroup = premake.vstudio.vc2010.configurationPropertyGroup
+ premake.vstudio.vc2010.configurationPropertyGroup = function(cfg, cfginfo)
+ io.capture()
+ orig_vc2010_configurationPropertyGroup(cfg, cfginfo)
+ local captured = io.endcapture()
+ local toolsets = { vs2012 = "v110", vs2013 = "v120", vs2015 = "v140", vs2017 = "v141" }
+ local toolset = toolsets[_ACTION]
+ if toolset then
+ if _OPTIONS["xp"] then
+ toolset = toolset .. "_xp"
+ captured = captured:gsub("(</PlatformToolset>)", "_xp%1")
+ end
+ end
+ io.write(captured)
+ end
+ function transformMN(input) -- transform the macro names for older Visual Studio versions
+ local new_map = { vs2002 = 0, vs2003 = 0, vs2005 = 0, vs2008 = 0 }
+ local replacements = { Platform = "PlatformName", Configuration = "ConfigurationName" }
+ if new_map[action] ~= nil then
+ for k,v in pairs(replacements) do
+ if input:find(k) then
+ input = input:gsub(k, v)
+ end
end
end
+ return input
end
- return input
end
--
-- Define the project. Put the release configuration first so it will be the
@@ -101,6 +126,7 @@ solution "Premake4"
objdir (int_dir)
flags { "No64BitChecks", "ExtraWarnings", "StaticRuntime" }
includedirs { "src/host/lua-5.1.4/src" }
+ defines { "USE_KECCAK" }
files
{
@@ -190,6 +216,10 @@ solution "Premake4"
value = "path",
description = "Set the output location for the generated files"
}
+ newoption {
+ trigger = "xp",
+ description = "Enable XP-compatible build for newer Visual Studio versions."
+ }
diff --git a/scripts/release.lua b/scripts/release.lua
index 222e148..3fc8a62 100644
--- a/scripts/release.lua
+++ b/scripts/release.lua
@@ -39,7 +39,7 @@ function dorelease()
local version = _ARGS[1]
local kind = _ARGS[2]
- local pkgname = "premake-" .. version
+ local pkgname = "premake-" .. version
--
diff --git a/src/actions/codeblocks/codeblocks_cbp.lua b/src/actions/codeblocks/codeblocks_cbp.lua
index 3abd92e..9d8a4fa 100644
--- a/src/actions/codeblocks/codeblocks_cbp.lua
+++ b/src/actions/codeblocks/codeblocks_cbp.lua
@@ -54,7 +54,7 @@
_p(4,'</remote_debugging>')
_p(3,'</debugger>')
else
- error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks')
+ error('Sorry at this moment there is no support for debug environment variables with this debugger and codeblocks')
end
end
@@ -173,7 +173,7 @@
codeblocks.files(prj)
_p(2,'<Extensions>')
- for _, platform in ipairs(platforms) do
+ for _, platform in ipairs(platforms) do
for cfg in premake.eachconfig(prj, platform) do
if cfg.debugenvs and #cfg.debugenvs > 0 then
premake.codeblocks.debugenvs(cfg)
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index 2761810..4aa6fe2 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -243,8 +243,8 @@
_p(' ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CFLAGS)%s', make.list(cc.getcxxflags(cfg)))
_p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s',
- make.list(table.join(cc.getdefines(cfg.resdefines),
- cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))
+ make.list(table.join(cc.getdefines(cfg.resdefines),
+ cc.getincludedirs(cfg.resincludedirs), cfg.resoptions)))
end
diff --git a/src/actions/make/make_csharp.lua b/src/actions/make/make_csharp.lua
index 12dfda5..00ba65e 100644
--- a/src/actions/make/make_csharp.lua
+++ b/src/actions/make/make_csharp.lua
@@ -11,9 +11,9 @@
local function getresourcefilename(cfg, fname)
if path.getextension(fname) == ".resx" then
- local name = cfg.buildtarget.basename .. "."
- local dir = path.getdirectory(fname)
- if dir ~= "." then
+ local name = cfg.buildtarget.basename .. "."
+ local dir = path.getdirectory(fname)
+ if dir ~= "." then
name = name .. path.translate(dir, ".") .. "."
end
return "$(OBJDIR)/" .. _MAKE.esc(name .. path.getbasename(fname)) .. ".resources"
diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua
index 90b7a1e..142e250 100644
--- a/src/actions/vstudio/vs200x_vcproj.lua
+++ b/src/actions/vstudio/vs200x_vcproj.lua
@@ -148,8 +148,8 @@
_p(depth, '\t>')
_p(depth, '\t<Tool')
_p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360",
- "VCCLX360CompilerTool",
- "VCCLCompilerTool"))
+ "VCCLX360CompilerTool",
+ "VCCLCompilerTool"))
if needsCompileAs then
_p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2))
end
@@ -157,8 +157,8 @@
if usePCH then
if cfg.system == "PS3" then
local options = table.join(premake.snc.getcflags(cfg),
- premake.snc.getcxxflags(cfg),
- cfg.buildoptions)
+ premake.snc.getcxxflags(cfg),
+ cfg.buildoptions)
options = table.concat(options, " ");
options = options .. ' --create_pch="$(IntDir)/$(TargetName).pch"'
_p(depth, '\t\tAdditionalOptions="%s"', premake.esc(options))
@@ -212,9 +212,9 @@
else
-- Edit-and-continue does't work for some configurations
if cfg.flags.NoEditAndContinue or
- vc200x.optimization(cfg) ~= 0 or
- cfg.flags.Managed or
- cfg.platform == "x64" then
+ vc200x.optimization(cfg) ~= 0 or
+ cfg.flags.Managed or
+ cfg.platform == "x64" then
return 3
else
return 4
diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua
index d6f9b7b..993bd8f 100644
--- a/src/actions/vstudio/vs2010_vcxproj.lua
+++ b/src/actions/vstudio/vs2010_vcxproj.lua
@@ -129,7 +129,7 @@
if cfg.kind == "SharedLib" then
local ignore = (cfg.flags.NoImportLib ~= nil)
- _p(2,'<IgnoreImportLibrary>%s</IgnoreImportLibrary>', tostring(ignore))
+ _p(2,'<IgnoreImportLibrary>%s</IgnoreImportLibrary>', tostring(ignore))
end
if cfg.kind ~= "StaticLib" then
@@ -157,7 +157,7 @@
end
local function precompiled_header(cfg)
- if not cfg.flags.NoPCH and cfg.pchheader then
+ if not cfg.flags.NoPCH and cfg.pchheader then
_p(3,'<PrecompiledHeader>Use</PrecompiledHeader>')
_p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader)
else
@@ -229,7 +229,7 @@
end
local function floating_point(cfg)
- if cfg.flags.FloatFast then
+ if cfg.flags.FloatFast then
_p(3,'<FloatingPointModel>Fast</FloatingPointModel>')
elseif cfg.flags.FloatStrict and not cfg.flags.Managed then
_p(3,'<FloatingPointModel>Strict</FloatingPointModel>')
@@ -339,19 +339,19 @@
local function event_hooks(cfg)
if #cfg.postbuildcommands> 0 then
- _p(2,'<PostBuildEvent>')
+ _p(2,'<PostBuildEvent>')
_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
_p(2,'</PostBuildEvent>')
end
if #cfg.prebuildcommands> 0 then
- _p(2,'<PreBuildEvent>')
+ _p(2,'<PreBuildEvent>')
_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")))
_p(2,'</PreBuildEvent>')
end
if #cfg.prelinkcommands> 0 then
- _p(2,'<PreLinkEvent>')
+ _p(2,'<PreLinkEvent>')
_p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, "", "", "\r\n")))
_p(2,'</PreLinkEvent>')
end
@@ -372,7 +372,7 @@
end
local function item_def_lib(cfg)
- -- The Xbox360 project files are stored in another place in the project file.
+ -- The Xbox360 project files are stored in another place in the project file.
if cfg.kind == 'StaticLib' and cfg.platform ~= "Xbox360" then
_p(1,'<Lib>')
_p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name)
diff --git a/src/base/api.lua b/src/base/api.lua
index c11056f..52f5ccf 100644
--- a/src/base/api.lua
+++ b/src/base/api.lua
@@ -757,46 +757,46 @@
error("no active solution", 2)
end
- -- if this is a new project, or the project in that slot doesn't have a usage, create it
- if((not sln.projects[name]) or
- ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then
- premake.CurrentContainer = createproject(name, sln, true)
- else
- premake.CurrentContainer = iff(sln.projects[name].usage,
- sln.projects[name], sln.projects[name].usageProj)
- end
-
- -- add an empty, global configuration to the project
- configuration { }
-
- return premake.CurrentContainer
- end
-
- function project(name)
- if (not name) then
- --Only return non-usage projects
- if(type(premake.CurrentContainer) ~= "project") then return nil end
- if(premake.CurrentContainer.usage) then return nil end
- return premake.CurrentContainer
- end
-
- -- identify the parent solution
- local sln
- if (type(premake.CurrentContainer) == "project") then
- sln = premake.CurrentContainer.solution
- else
- sln = premake.CurrentContainer
- end
- if (type(sln) ~= "solution") then
- error("no active solution", 2)
- end
-
- -- if this is a new project, or the old project is a usage project, create it
- if((not sln.projects[name]) or sln.projects[name].usage) then
- premake.CurrentContainer = createproject(name, sln)
- else
- premake.CurrentContainer = sln.projects[name];
- end
+ -- if this is a new project, or the project in that slot doesn't have a usage, create it
+ if((not sln.projects[name]) or
+ ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then
+ premake.CurrentContainer = createproject(name, sln, true)
+ else
+ premake.CurrentContainer = iff(sln.projects[name].usage,
+ sln.projects[name], sln.projects[name].usageProj)
+ end
+
+ -- add an empty, global configuration to the project
+ configuration { }
+
+ return premake.CurrentContainer
+ end
+
+ function project(name)
+ if (not name) then
+ --Only return non-usage projects
+ if(type(premake.CurrentContainer) ~= "project") then return nil end
+ if(premake.CurrentContainer.usage) then return nil end
+ return premake.CurrentContainer
+ end
+
+ -- identify the parent solution
+ local sln
+ if (type(premake.CurrentContainer) == "project") then
+ sln = premake.CurrentContainer.solution
+ else
+ sln = premake.CurrentContainer
+ end
+ if (type(sln) ~= "solution") then
+ error("no active solution", 2)
+ end
+
+ -- if this is a new project, or the old project is a usage project, create it
+ if((not sln.projects[name]) or sln.projects[name].usage) then
+ premake.CurrentContainer = createproject(name, sln)
+ else
+ premake.CurrentContainer = sln.projects[name];
+ end
-- add an empty, global configuration to the project
configuration { }
diff --git a/src/base/bake.lua b/src/base/bake.lua
index 20aad72..11b702f 100644
--- a/src/base/bake.lua
+++ b/src/base/bake.lua
@@ -396,61 +396,61 @@
end
end
- local function getCfgKind(cfg)
- if(cfg.kind) then
- return cfg.kind;
- end
-
- if(cfg.project.__configs[""] and cfg.project.__configs[""].kind) then
- return cfg.project.__configs[""].kind;
- end
-
- return nil
- end
-
- local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)
- if(not cfg) then return end
-
- local foundUsePrjs = {};
- for _, useName in ipairs(cfg[searchField]) do
- local testName = useName:lower();
- if((not foundList[testName])) then
- local theProj = nil;
- local theUseProj = nil;
- for _, prj in ipairs(cfg.project.solution.projects) do
- if (prj.name:lower() == testName) then
- if(prj.usage) then
- theUseProj = prj;
- else
- theProj = prj;
- end
- end
- end
-
- --Must connect to a usage project.
- if(theUseProj) then
- foundList[testName] = true;
- local prjEntry = {
- name = testName,
- proj = theProj,
- usageProj = theUseProj,
- bLinkageOnly = bLinkage,
- };
- dstArray[testName] = prjEntry;
- table.insert(foundUsePrjs, theUseProj);
- end
- end
- end
-
- for _, usePrj in ipairs(foundUsePrjs) do
- --Links can only recurse through static libraries.
- if((searchField ~= "links") or
- (getCfgKind(usePrj.__configs[cfgname]) == "StaticLib")) then
- getprojrec(dstArray, foundList, usePrj.__configs[cfgname],
- cfgname, searchField, bLinkage);
- end
- end
- end
+ local function getCfgKind(cfg)
+ if(cfg.kind) then
+ return cfg.kind;
+ end
+
+ if(cfg.project.__configs[""] and cfg.project.__configs[""].kind) then
+ return cfg.project.__configs[""].kind;
+ end
+
+ return nil
+ end
+
+ local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage)
+ if(not cfg) then return end
+
+ local foundUsePrjs = {};
+ for _, useName in ipairs(cfg[searchField]) do
+ local testName = useName:lower();
+ if((not foundList[testName])) then
+ local theProj = nil;
+ local theUseProj = nil;
+ for _, prj in ipairs(cfg.project.solution.projects) do
+ if (prj.name:lower() == testName) then
+ if(prj.usage) then
+ theUseProj = prj;
+ else
+ theProj = prj;
+ end
+ end
+ end
+
+ --Must connect to a usage project.
+ if(theUseProj) then
+ foundList[testName] = true;
+ local prjEntry = {
+ name = testName,
+ proj = theProj,
+ usageProj = theUseProj,
+ bLinkageOnly = bLinkage,
+ };
+ dstArray[testName] = prjEntry;
+ table.insert(foundUsePrjs, theUseProj);
+ end
+ end
+ end
+
+ for _, usePrj in ipairs(foundUsePrjs) do
+ --Links can only recurse through static libraries.
+ if((searchField ~= "links") or
+ (getCfgKind(usePrj.__configs[cfgname]) == "StaticLib")) then
+ getprojrec(dstArray, foundList, usePrj.__configs[cfgname],
+ cfgname, searchField, bLinkage);
+ end
+ end
+ end
--
-- This function will recursively get all projects that the given configuration has in its "uses"
@@ -465,84 +465,84 @@
-- field of usage projects. These will only copy linker information, but they will recurse.
-- through other "links" fields.
--
- local function getprojectsconnections(cfg, cfgname)
- local dstArray = {};
- local foundList = {};
- foundList[cfg.project.name:lower()] = true;
-
- --First, follow the uses recursively.
- getprojrec(dstArray, foundList, cfg, cfgname, "uses", false);
-
- --Next, go through all of the usage projects and recursively get their links.
- --But only if they're not already there. Get the links as linkage-only.
- local linkArray = {};
- for prjName, prjEntry in pairs(dstArray) do
- getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname,
- "links", true);
- end
+ local function getprojectsconnections(cfg, cfgname)
+ local dstArray = {};
+ local foundList = {};
+ foundList[cfg.project.name:lower()] = true;
+
+ --First, follow the uses recursively.
+ getprojrec(dstArray, foundList, cfg, cfgname, "uses", false);
+
+ --Next, go through all of the usage projects and recursively get their links.
+ --But only if they're not already there. Get the links as linkage-only.
+ local linkArray = {};
+ for prjName, prjEntry in pairs(dstArray) do
+ getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname,
+ "links", true);
+ end
- --Copy from linkArray into dstArray.
- for prjName, prjEntry in pairs(linkArray) do
- dstArray[prjName] = prjEntry;
- end
+ --Copy from linkArray into dstArray.
+ for prjName, prjEntry in pairs(linkArray) do
+ dstArray[prjName] = prjEntry;
+ end
- return dstArray;
- end
+ return dstArray;
+ end
- local function isnameofproj(cfg, strName)
- local sln = cfg.project.solution;
- local strTest = strName:lower();
- for prjIx, prj in ipairs(sln.projects) do
- if (prj.name:lower() == strTest) then
- return true;
- end
- end
+ local function isnameofproj(cfg, strName)
+ local sln = cfg.project.solution;
+ local strTest = strName:lower();
+ for prjIx, prj in ipairs(sln.projects) do
+ if (prj.name:lower() == strTest) then
+ return true;
+ end
+ end
- return false;
- end
+ return false;
+ end
--
-- Copies the field from dstCfg to srcCfg.
--
- local function copydependentfield(srcCfg, dstCfg, strSrcField)
- local srcField = premake.fields[strSrcField];
- local strDstField = strSrcField;
-
- if type(srcCfg[strSrcField]) == "table" then
- --handle paths.
- if (srcField.kind == "dirlist" or srcField.kind == "filelist") and
- (not keeprelative[strSrcField]) then
- for i,p in ipairs(srcCfg[strSrcField]) do
- table.insert(dstCfg[strDstField],
- path.rebase(p, srcCfg.project.location, dstCfg.project.location))
- end
- else
- if(strSrcField == "links") then
- for i,p in ipairs(srcCfg[strSrcField]) do
- if(not isnameofproj(dstCfg, p)) then
- table.insert(dstCfg[strDstField], p)
- else
- printf("Failed to copy '%s' from proj '%s'.",
- p, srcCfg.project.name);
- end
- end
- else
- for i,p in ipairs(srcCfg[strSrcField]) do
- table.insert(dstCfg[strDstField], p)
- end
- end
- end
- else
- if(srcField.kind == "path" and (not keeprelative[strSrcField])) then
- dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],
- prj.location, dstCfg.project.location);
- else
- dstCfg[strDstField] = srcCfg[strSrcField];
- end
- end
- end
+ local function copydependentfield(srcCfg, dstCfg, strSrcField)
+ local srcField = premake.fields[strSrcField];
+ local strDstField = strSrcField;
+
+ if type(srcCfg[strSrcField]) == "table" then
+ --handle paths.
+ if (srcField.kind == "dirlist" or srcField.kind == "filelist") and
+ (not keeprelative[strSrcField]) then
+ for i,p in ipairs(srcCfg[strSrcField]) do
+ table.insert(dstCfg[strDstField],
+ path.rebase(p, srcCfg.project.location, dstCfg.project.location))
+ end
+ else
+ if(strSrcField == "links") then
+ for i,p in ipairs(srcCfg[strSrcField]) do
+ if(not isnameofproj(dstCfg, p)) then
+ table.insert(dstCfg[strDstField], p)
+ else
+ printf("Failed to copy '%s' from proj '%s'.",
+ p, srcCfg.project.name);
+ end
+ end
+ else
+ for i,p in ipairs(srcCfg[strSrcField]) do
+ table.insert(dstCfg[strDstField], p)
+ end
+ end
+ end
+ else
+ if(srcField.kind == "path" and (not keeprelative[strSrcField])) then
+ dstCfg[strDstField] = path.rebase(srcCfg[strSrcField],
+ prj.location, dstCfg.project.location);
+ else
+ dstCfg[strDstField] = srcCfg[strSrcField];
+ end
+ end
+ end
--
@@ -553,36 +553,36 @@
-- if the project is in this solution; instead it will add that project to the configuration's
-- links field, expecting that Premake will handle the rest.
--
- local function copyusagedata(cfg, cfgname, linkToProjs)
- local myPrj = cfg.project;
- local bIsStaticLib = (getCfgKind(cfg) == "StaticLib");
-
- for prjName, prjEntry in pairs(linkToProjs) do
- local srcPrj = prjEntry.usageProj;
- local srcCfg = srcPrj.__configs[cfgname];
-
- for name, field in pairs(premake.fields) do
- if(srcCfg[name]) then
- if(field.usagecopy) then
- if(not prjEntry.bLinkageOnly) then
- copydependentfield(srcCfg, cfg, name)
- end
- elseif(field.linkagecopy) then
- --Copy the linkage data if we're building a non-static thing
- --and this is a pure usage project. If it's not pure-usage, then
- --we will simply put the project's name in the links field later.
- if((not bIsStaticLib) and (not prjEntry.proj)) then
- copydependentfield(srcCfg, cfg, name)
- end
- end
- end
- end
-
- if((not bIsStaticLib) and prjEntry.proj) then
- table.insert(cfg.links, prjEntry.proj.name);
- end
- end
- end
+ local function copyusagedata(cfg, cfgname, linkToProjs)
+ local myPrj = cfg.project;
+ local bIsStaticLib = (getCfgKind(cfg) == "StaticLib");
+
+ for prjName, prjEntry in pairs(linkToProjs) do
+ local srcPrj = prjEntry.usageProj;
+ local srcCfg = srcPrj.__configs[cfgname];
+
+ for name, field in pairs(premake.fields) do
+ if(srcCfg[name]) then
+ if(field.usagecopy) then
+ if(not prjEntry.bLinkageOnly) then
+ copydependentfield(srcCfg, cfg, name)
+ end
+ elseif(field.linkagecopy) then
+ --Copy the linkage data if we're building a non-static thing
+ --and this is a pure usage project. If it's not pure-usage, then
+ --we will simply put the project's name in the links field later.
+ if((not bIsStaticLib) and (not prjEntry.proj)) then
+ copydependentfield(srcCfg, cfg, name)
+ end
+ end
+ end
+ end
+
+ if((not bIsStaticLib) and prjEntry.proj) then
+ table.insert(cfg.links, prjEntry.proj.name);
+ end
+ end
+ end
--
diff --git a/src/base/project.lua b/src/base/project.lua
index e9a3c7a..acff735 100644
--- a/src/base/project.lua
+++ b/src/base/project.lua
@@ -307,7 +307,7 @@
-- object - return the project object of the dependency
--
- function premake.getlinks(cfg, kind, part)
+ function premake.getlinks(cfg, kind, part)
-- if I'm building a list of link directories, include libdirs
local result = iif (part == "directory" and kind == "all", cfg.libdirs, {})
diff --git a/src/host/keccak.c b/src/host/keccak.c
new file mode 100644
index 0000000..d4a3d70
--- /dev/null
+++ b/src/host/keccak.c
@@ -0,0 +1,333 @@
+/*
+Implementation by the Keccak, Keyak and Ketje Teams, namely, Guido Bertoni,
+Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, hereby
+denoted as "the implementer".
+
+For more information, feedback or questions, please refer to our websites:
+http://keccak.noekeon.org/
+http://keyak.noekeon.org/
+http://ketje.noekeon.org/
+
+To the extent possible under law, the implementer has waived all copyright
+and related or neighboring rights to the source code in this file.
+http://creativecommons.org/publicdomain/zero/1.0/
+*/
+
+/*
+================================================================
+The purpose of this source file is to demonstrate a readable and compact
+implementation of all the Keccak instances approved in the FIPS 202 standard,
+including the hash functions and the extendable-output functions (XOFs).
+
+We focused on clarity and on source-code compactness,
+rather than on the performance.
+
+The advantages of this implementation are:
+ + The source code is compact, after removing the comments, that is. :-)
+ + There are no tables with arbitrary constants.
+ + For clarity, the comments link the operations to the specifications using
+ the same notation as much as possible.
+ + There is no restriction in cryptographic features. In particular,
+ the SHAKE128 and SHAKE256 XOFs can produce any output length.
+ + The code does not use much RAM, as all operations are done in place.
+
+The drawbacks of this implementation are:
+ - There is no message queue. The whole message must be ready in a buffer.
+ - It is not optimized for peformance.
+
+The implementation is even simpler on a little endian platform. Just define the
+LITTLE_ENDIAN symbol in that case.
+
+For a more complete set of implementations, please refer to
+the Keccak Code Package at https://github.com/gvanas/KeccakCodePackage
+
+For more information, please refer to:
+ * [Keccak Reference] http://keccak.noekeon.org/Keccak-reference-3.0.pdf
+ * [Keccak Specifications Summary] http://keccak.noekeon.org/specs_summary.html
+
+This file uses UTF-8 encoding, as some comments use Greek letters.
+================================================================
+*/
+
+/**
+ * Function to compute the Keccak[r, c] sponge function over a given input.
+ * @param rate The value of the rate r.
+ * @param capacity The value of the capacity c.
+ * @param input Pointer to the input message.
+ * @param inputByteLen The number of input bytes provided in the input message.
+ * @param delimitedSuffix Bits that will be automatically appended to the end
+ * of the input message, as in domain separation.
+ * This is a byte containing from 0 to 7 bits
+ * These <i>n</i> bits must be in the least significant bit positions
+ * and must be delimited with a bit 1 at position <i>n</i>
+ * (counting from 0=LSB to 7=MSB) and followed by bits 0
+ * from position <i>n</i>+1 to position 7.
+ * Some examples:
+ * - If no bits are to be appended, then @a delimitedSuffix must be 0x01.
+ * - If the 2-bit sequence 0,1 is to be appended (as for SHA3-*), @a delimitedSuffix must be 0x06.
+ * - If the 4-bit sequence 1,1,1,1 is to be appended (as for SHAKE*), @a delimitedSuffix must be 0x1F.
+ * - If the 7-bit sequence 1,1,0,1,0,0,0 is to be absorbed, @a delimitedSuffix must be 0x8B.
+ * @param output Pointer to the buffer where to store the output.
+ * @param outputByteLen The number of output bytes desired.
+ * @pre One must have r+c=1600 and the rate a multiple of 8 bits in this implementation.
+ */
+void Keccak(unsigned int rate, unsigned int capacity, const unsigned char *input, unsigned long long int inputByteLen, unsigned char delimitedSuffix, unsigned char *output, unsigned long long int outputByteLen);
+
+/**
+ * Function to compute SHAKE128 on the input message with any output length.
+ */
+void FIPS202_SHAKE128(const unsigned char *input, unsigned int inputByteLen, unsigned char *output, int outputByteLen)
+{
+ Keccak(1344, 256, input, inputByteLen, 0x1F, output, outputByteLen);
+}
+
+/**
+ * Function to compute SHAKE256 on the input message with any output length.
+ */
+void FIPS202_SHAKE256(const unsigned char *input, unsigned int inputByteLen, unsigned char *output, int outputByteLen)
+{
+ Keccak(1088, 512, input, inputByteLen, 0x1F, output, outputByteLen);
+}
+
+/**
+ * Function to compute SHA3-224 on the input message. The output length is fixed to 28 bytes.
+ */
+void FIPS202_SHA3_224(const unsigned char *input, unsigned int inputByteLen, unsigned char *output)
+{
+ Keccak(1152, 448, input, inputByteLen, 0x06, output, 28);
+}
+
+/**
+ * Function to compute SHA3-256 on the input message. The output length is fixed to 32 bytes.
+ */
+void FIPS202_SHA3_256(const unsigned char *input, unsigned int inputByteLen, unsigned char *output)
+{
+ Keccak(1088, 512, input, inputByteLen, 0x06, output, 32);
+}
+
+/**
+ * Function to compute SHA3-384 on the input message. The output length is fixed to 48 bytes.
+ */
+void FIPS202_SHA3_384(const unsigned char *input, unsigned int inputByteLen, unsigned char *output)
+{
+ Keccak(832, 768, input, inputByteLen, 0x06, output, 48);
+}
+
+/**
+ * Function to compute SHA3-512 on the input message. The output length is fixed to 64 bytes.
+ */
+void FIPS202_SHA3_512(const unsigned char *input, unsigned int inputByteLen, unsigned char *output)
+{
+ Keccak(576, 1024, input, inputByteLen, 0x06, output, 64);
+}
+
+/*
+================================================================
+Technicalities
+================================================================
+*/
+
+typedef unsigned char UINT8;
+typedef unsigned long long int UINT64;
+typedef UINT64 tKeccakLane;
+
+#ifndef LITTLE_ENDIAN
+/** Function to load a 64-bit value using the little-endian (LE) convention.
+ * On a LE platform, this could be greatly simplified using a cast.
+ */
+static UINT64 load64(const UINT8 *x)
+{
+ int i;
+ UINT64 u=0;
+
+ for(i=7; i>=0; --i) {
+ u <<= 8;
+ u |= x[i];
+ }
+ return u;
+}
+
+/** Function to store a 64-bit value using the little-endian (LE) convention.
+ * On a LE platform, this could be greatly simplified using a cast.
+ */
+static void store64(UINT8 *x, UINT64 u)
+{
+ unsigned int i;
+
+ for(i=0; i<8; ++i) {
+ x[i] = u;
+ u >>= 8;
+ }
+}
+
+/** Function to XOR into a 64-bit value using the little-endian (LE) convention.
+ * On a LE platform, this could be greatly simplified using a cast.
+ */
+static void xor64(UINT8 *x, UINT64 u)
+{
+ unsigned int i;
+
+ for(i=0; i<8; ++i) {
+ x[i] ^= u;
+ u >>= 8;
+ }
+}
+#endif
+
+/*
+================================================================
+A readable and compact implementation of the Keccak-f[1600] permutation.
+================================================================
+*/
+
+#define ROL64(a, offset) ((((UINT64)a) << offset) ^ (((UINT64)a) >> (64-offset)))
+#define i(x, y) ((x)+5*(y))
+
+#ifdef LITTLE_ENDIAN
+ #define readLane(x, y) (((tKeccakLane*)state)[i(x, y)])
+ #define writeLane(x, y, lane) (((tKeccakLane*)state)[i(x, y)]) = (lane)
+ #define XORLane(x, y, lane) (((tKeccakLane*)state)[i(x, y)]) ^= (lane)
+#else
+ #define readLane(x, y) load64((UINT8*)state+sizeof(tKeccakLane)*i(x, y))
+ #define writeLane(x, y, lane) store64((UINT8*)state+sizeof(tKeccakLane)*i(x, y), lane)
+ #define XORLane(x, y, lane) xor64((UINT8*)state+sizeof(tKeccakLane)*i(x, y), lane)
+#endif
+
+/**
+ * Function that computes the linear feedback shift register (LFSR) used to
+ * define the round constants (see [Keccak Reference, Section 1.2]).
+ */
+int LFSR86540(UINT8 *LFSR)
+{
+ int result = ((*LFSR) & 0x01) != 0;
+ if (((*LFSR) & 0x80) != 0)
+ /* Primitive polynomial over GF(2): x^8+x^6+x^5+x^4+1 */
+ (*LFSR) = ((*LFSR) << 1) ^ 0x71;
+ else
+ (*LFSR) <<= 1;
+ return result;
+}
+
+/**
+ * Function that computes the Keccak-f[1600] permutation on the given state.
+ */
+void KeccakF1600_StatePermute(void *state)
+{
+ unsigned int round, x, y, j, t;
+ UINT8 LFSRstate = 0x01;
+
+ for(round=0; round<24; round++) {
+ { /* === θ step (see [Keccak Reference, Section 2.3.2]) === */
+ tKeccakLane C[5], D;
+
+ /* Compute the parity of the columns */
+ for(x=0; x<5; x++)
+ C[x] = readLane(x, 0) ^ readLane(x, 1) ^ readLane(x, 2) ^ readLane(x, 3) ^ readLane(x, 4);
+ for(x=0; x<5; x++) {
+ /* Compute the θ effect for a given column */
+ D = C[(x+4)%5] ^ ROL64(C[(x+1)%5], 1);
+ /* Add the θ effect to the whole column */
+ for (y=0; y<5; y++)
+ XORLane(x, y, D);
+ }
+ }
+
+ { /* === ρ and π steps (see [Keccak Reference, Sections 2.3.3 and 2.3.4]) === */
+ tKeccakLane current, temp;
+ /* Start at coordinates (1 0) */
+ x = 1; y = 0;
+ current = readLane(x, y);
+ /* Iterate over ((0 1)(2 3))^t * (1 0) for 0 ≤ t ≤ 23 */
+ for(t=0; t<24; t++) {
+ /* Compute the rotation constant r = (t+1)(t+2)/2 */
+ unsigned int r = ((t+1)*(t+2)/2)%64;
+ /* Compute ((0 1)(2 3)) * (x y) */
+ unsigned int Y = (2*x+3*y)%5; x = y; y = Y;
+ /* Swap current and state(x,y), and rotate */
+ temp = readLane(x, y);
+ writeLane(x, y, ROL64(current, r));
+ current = temp;
+ }
+ }
+
+ { /* === χ step (see [Keccak Reference, Section 2.3.1]) === */
+ tKeccakLane temp[5];
+ for(y=0; y<5; y++) {
+ /* Take a copy of the plane */
+ for(x=0; x<5; x++)
+ temp[x] = readLane(x, y);
+ /* Compute χ on the plane */
+ for(x=0; x<5; x++)
+ writeLane(x, y, temp[x] ^((~temp[(x+1)%5]) & temp[(x+2)%5]));
+ }
+ }
+
+ { /* === ι step (see [Keccak Reference, Section 2.3.5]) === */
+ for(j=0; j<7; j++) {
+ unsigned int bitPosition = (1<<j)-1; /* 2^j-1 */
+ if (LFSR86540(&LFSRstate))
+ XORLane(0, 0, (tKeccakLane)1<<bitPosition);
+ }
+ }
+ }
+}
+
+/*
+================================================================
+A readable and compact implementation of the Keccak sponge functions
+that use the Keccak-f[1600] permutation.
+================================================================
+*/
+
+#include <string.h>
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+void Keccak(unsigned int rate, unsigned int capacity, const unsigned char *input, unsigned long long int inputByteLen, unsigned char delimitedSuffix, unsigned char *output, unsigned long long int outputByteLen)
+{
+ UINT8 state[200];
+ unsigned int rateInBytes = rate/8;
+ unsigned int blockSize = 0;
+ unsigned int i;
+
+ if (((rate + capacity) != 1600) || ((rate % 8) != 0))
+ return;
+
+ /* === Initialize the state === */
+ memset(state, 0, sizeof(state));
+
+ /* === Absorb all the input blocks === */
+ while(inputByteLen > 0) {
+ blockSize = MIN(inputByteLen, rateInBytes);
+ for(i=0; i<blockSize; i++)
+ state[i] ^= input[i];
+ input += blockSize;
+ inputByteLen -= blockSize;
+
+ if (blockSize == rateInBytes) {
+ KeccakF1600_StatePermute(state);
+ blockSize = 0;
+ }
+ }
+
+ /* === Do the padding and switch to the squeezing phase === */
+ /* Absorb the last few bits and add the first bit of padding (which coincides with the delimiter in delimitedSuffix) */
+ state[blockSize] ^= delimitedSuffix;
+ /* If the first bit of padding is at position rate-1, we need a whole new block for the second bit of padding */
+ if (((delimitedSuffix & 0x80) != 0) && (blockSize == (rateInBytes-1)))
+ KeccakF1600_StatePermute(state);
+ /* Add the second bit of padding */
+ state[rateInBytes-1] ^= 0x80;
+ /* Switch to the squeezing phase */
+ KeccakF1600_StatePermute(state);
+
+ /* === Squeeze out all the output blocks === */
+ while(outputByteLen > 0) {
+ blockSize = MIN(outputByteLen, rateInBytes);
+ memcpy(output, state, blockSize);
+ output += blockSize;
+ outputByteLen -= blockSize;
+
+ if (outputByteLen > 0)
+ KeccakF1600_StatePermute(state);
+ }
+}
diff --git a/src/host/os_stat.c b/src/host/os_stat.c
index b3554dc..21d6585 100755
--- a/src/host/os_stat.c
+++ b/src/host/os_stat.c
@@ -13,7 +13,7 @@ int os_stat(lua_State* L)
struct stat s;
const char* filename = luaL_checkstring(L, 1);
- if (stat(filename, &s) != 0)
+ if (stat(filename, &s) != 0)
{
lua_pushnil(L);
switch (errno)
diff --git a/src/host/os_uuid.c b/src/host/os_uuid.c
index e3bee6b..045c69e 100644
--- a/src/host/os_uuid.c
+++ b/src/host/os_uuid.c
@@ -39,3 +39,30 @@ int os_uuid(lua_State* L)
lua_pushstring(L, uuid);
return 1;
}
+
+#ifdef USE_KECCAK
+void FIPS202_SHA3_256(const unsigned char *input, unsigned int inputByteLen, unsigned char *output);
+
+int os_str2uuid(lua_State* L)
+{
+ char uuid[38];
+ unsigned char bytes[32] = { 0 };
+ const char* str = luaL_checkstring(L, -1);
+
+ if (!str)
+ {
+ return os_uuid(L); /* generate a random UUID then */
+ }
+
+ FIPS202_SHA3_256((const unsigned char*)str, strlen(str), bytes);
+ sprintf(uuid, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+ bytes[0], bytes[2], bytes[4], bytes[6],
+ bytes[8], bytes[10],
+ bytes[12], bytes[14],
+ bytes[16], bytes[18],
+ bytes[20], bytes[22], bytes[24], bytes[26], bytes[28], bytes[30]);
+
+ lua_pushstring(L, uuid);
+ return 1;
+}
+#endif
diff --git a/src/host/path_getabsolute.c b/src/host/path_getabsolute.c
index 36b1c3a..407aa1f 100644
--- a/src/host/path_getabsolute.c
+++ b/src/host/path_getabsolute.c
@@ -89,7 +89,7 @@ int path_getabsolute(lua_State* L)
lua_pop(L, 1);
lua_pushstring(L, buffer);
- lua_rawseti(L, -3, ++i);
+ lua_rawseti(L, -3, ++i);
}
return 1;
}
diff --git a/src/host/path_isabsolute.c b/src/host/path_isabsolute.c
index 7412935..bdde8eb 100644
--- a/src/host/path_isabsolute.c
+++ b/src/host/path_isabsolute.c
@@ -19,9 +19,9 @@ int do_isabsolute(const char* path)
{
return (
path[0] == '/' ||
- path[0] == '\\' ||
- path[0] == '$' ||
- (path[0] == '"' && path[1] == '$') ||
- (path[0] != '\0' && path[1] == ':')
+ path[0] == '\\' ||
+ path[0] == '$' ||
+ (path[0] == '"' && path[1] == '$') ||
+ (path[0] != '\0' && path[1] == ':')
);
}
diff --git a/src/host/path_normalize.c b/src/host/path_normalize.c
index 64c5cf2..1514355 100644
--- a/src/host/path_normalize.c
+++ b/src/host/path_normalize.c
@@ -44,15 +44,15 @@ int path_normalize(lua_State* L)
}
/* remove any trailing slashes */
- for (--src; src > buffer && *src == '/'; --src) {
- *src = '\0';
- }
-
- /* remove any leading "./" sequences */
- src = buffer;
- while (strncmp(src, "./", 2) == 0) {
- src += 2;
- }
+ for (--src; src > buffer && *src == '/'; --src) {
+ *src = '\0';
+ }
+
+ /* remove any leading "./" sequences */
+ src = buffer;
+ while (strncmp(src, "./", 2) == 0) {
+ src += 2;
+ }
*dst = '\0';
lua_pushstring(L, src);
diff --git a/src/host/premake.c b/src/host/premake.c
index 6f9cc6d..31bb694 100755
--- a/src/host/premake.c
+++ b/src/host/premake.c
@@ -81,6 +81,9 @@ static const luaL_Reg os_functions[] = {
{ "rmdir", os_rmdir },
{ "stat", os_stat },
{ "uuid", os_uuid },
+#ifdef USE_KECCAK
+ { "str2uuid", os_str2uuid },
+#endif
{ NULL, NULL }
};
diff --git a/src/host/premake.h b/src/host/premake.h
index ef7d3fc..bd1c1dd 100755
--- a/src/host/premake.h
+++ b/src/host/premake.h
@@ -79,6 +79,9 @@ int os_pathsearch(lua_State* L);
int os_rmdir(lua_State* L);
int os_stat(lua_State* L);
int os_uuid(lua_State* L);
+#ifdef USE_KECCAK
+int os_str2uuid(lua_State* L);
+#endif
int string_endswith(lua_State* L);
diff --git a/src/host/scripts.c b/src/host/scripts.c
index bda3c59..347d384 100644
--- a/src/host/scripts.c
+++ b/src/host/scripts.c
@@ -85,8 +85,8 @@ const char* builtin_scripts[] = {
/* tools/gcc.lua */
"premake.gcc={}premake.gcc.cc=\"gcc\"premake.gcc.cxx=\"g++\"premake.gcc.ar=\"ar\"local n={EnableSSE=\"-msse\",EnableSSE2=\"-msse2\",ExtraWarnings=\"-Wall -Wextra\",FatalWarnings=\"-Werror\",FloatFast=\"-ffast-math\",FloatStrict=\"-ffloat-store\",NoFramePointer=\"-fomit-frame-pointer\",Optimize=\"-O2\",OptimizeSize=\"-Os\",OptimizeSpeed=\"-O3\",Symbols=\"-g\",}local l={NoExceptions=\"-fno-exceptions\",NoRTTI=\"-fno-rtti\",}premake.gcc.platforms={Native={cppflags=\"-MMD\",},x32={cppflags=\"-MMD\",flags=\"-m32\",ldflags=\"-L/usr/lib32\",},x64={cppflags=\"-MMD\",flags=\"-m64\",ldflags=\"-L/usr/lib64\",},Universal={cppflags=\"\",flags=\"-arch i386 -arch x86_64 -arch ppc -arch ppc64\",},Universal32={cppflags=\"\",flags=\"-arch i386 -arch ppc\",},Universal64={cppflags=\"\",flags=\"-arch x86_64 -arch ppc64\",},PS3={cc=\"ppu-lv2-g++\",cxx=\"ppu-lv2-g++\",ar=\"ppu-lv2-ar\",cppflags=\"-MMD\",},WiiDev={cppflags=\"-MMD -MP -I$(LIBOGC_INC) $(MACHDEP)\",ldflags=\"-L$(LIBOGC_LIB) $(MACHDEP)\",cfgsettings=[[\n ifeq ($(strip $("
- "DEVKITPPC)),)\n $(error \"DEVKITPPC environment variable is not set\")'\n endif\n include $(DEVKITPPC)/wii_rules']],},}local t=premake.gcc.platforms\nfunction premake.gcc.getcppflags(a)local e={}table.insert(e,t[a.platform].cppflags)if e[1]:startswith(\"-MMD\")and a.system~=\"haiku\"then\ntable.insert(e,\"-MP\")end\nreturn e\nend\nfunction premake.gcc.getcflags(e)local a=table.translate(e.flags,n)table.insert(a,t[e.platform].flags)if e.system~=\"windows\"and e.kind==\"SharedLib\"then\ntable.insert(a,\"-fPIC\")end\nreturn a\nend\nfunction premake.gcc.getcxxflags(e)local e=table.translate(e.flags,l)return e\nend\nfunction premake.gcc.getldflags(e)local a={}if not e.flags.Symbols then\nif e.system==\"macosx\"then\ntable.insert(a,\"-Wl,-x\")else\ntable.insert(a,\"-s\")end\nend\nif e.kind==\"SharedLib\"then\nif e.system==\"macosx\"then\ntable.insert(a,\"-dynamiclib\")else\ntable.insert(a,\"-shared\")end\nif e.system==\"windows\"and not e.flags.NoImportLib then\ntable.insert(a,'-Wl,--out-implib=\"'..e.linktarge"
- "t.fullpath..'\"')end\nend\nif e.kind==\"WindowedApp\"and e.system==\"windows\"then\ntable.insert(a,\"-mwindows\")end\nlocal e=t[e.platform]table.insert(a,e.flags)table.insert(a,e.ldflags)return a\nend\nfunction premake.gcc.getlibdirflags(a)local e={}for t,a in ipairs(premake.getlinks(a,\"all\",\"directory\"))do\ntable.insert(e,'-L'.._MAKE.esc(a))end\nreturn e\nend\nfunction premake.gcc.getlinkflags(a)local e={}for t,a in ipairs(premake.getlinks(a,\"system\",\"name\"))do\nif path.getextension(a)==\".framework\"then\ntable.insert(e,'-framework '.._MAKE.esc(path.getbasename(a)))else\ntable.insert(e,'-l'.._MAKE.esc(a))end\nend\nreturn e\nend\nfunction premake.gcc.getdefines(a)local e={}for t,a in ipairs(a)do\ntable.insert(e,'-D'..a)end\nreturn e\nend\nfunction premake.gcc.getincludedirs(a)local e={}for t,a in ipairs(a)do\ntable.insert(e,\"-I\".._MAKE.esc(a))end\nreturn e\nend\nfunction premake.gcc.getcfgsettings(e)return t[e.platform].cfgsettings\nend",
+ "DEVKITPPC)),)\n $(error \"DEVKITPPC environment variable is not set\")'\n endif\n include $(DEVKITPPC)/wii_rules']],},}local t=premake.gcc.platforms\nfunction premake.gcc.getcppflags(a)local e={}table.insert(e,t[a.platform].cppflags)if e[1]:startswith(\"-MMD\")and a.system~=\"haiku\"then\ntable.insert(e,\"-MP\")end\nreturn e\nend\nfunction premake.gcc.getcflags(e)local a=table.translate(e.flags,n)table.insert(a,t[e.platform].flags)if e.system~=\"windows\"and e.kind==\"SharedLib\"then\ntable.insert(a,\"-fPIC\")end\nreturn a\nend\nfunction premake.gcc.getcxxflags(e)local e=table.translate(e.flags,l)return e\nend\nfunction premake.gcc.getldflags(e)local a={}if not e.flags.Symbols then\nif e.system==\"macosx\"then\ntable.insert(a,\"-Wl,-x\")else\ntable.insert(a,\"-s\")end\nend\nif e.kind==\"SharedLib\"then\nif e.system==\"macosx\"then\ntable.insert(a,\"-dynamiclib\")else\ntable.insert(a,\"-shared\")end\nif e.system==\"windows\"and not e.flags.NoImportLib then\ntable.insert(a,'-Wl,--out-implib=\"'..e.linktarget.f"
+ "ullpath..'\"')end\nend\nif e.kind==\"WindowedApp\"and e.system==\"windows\"then\ntable.insert(a,\"-mwindows\")end\nlocal e=t[e.platform]table.insert(a,e.flags)table.insert(a,e.ldflags)return a\nend\nfunction premake.gcc.getlibdirflags(a)local e={}for t,a in ipairs(premake.getlinks(a,\"all\",\"directory\"))do\ntable.insert(e,'-L'.._MAKE.esc(a))end\nreturn e\nend\nfunction premake.gcc.getlinkflags(a)local e={}for t,a in ipairs(premake.getlinks(a,\"system\",\"name\"))do\nif path.getextension(a)==\".framework\"then\ntable.insert(e,'-framework '.._MAKE.esc(path.getbasename(a)))else\ntable.insert(e,'-l'.._MAKE.esc(a))end\nend\nreturn e\nend\nfunction premake.gcc.getdefines(a)local e={}for t,a in ipairs(a)do\ntable.insert(e,'-D'..a)end\nreturn e\nend\nfunction premake.gcc.getincludedirs(a)local e={}for t,a in ipairs(a)do\ntable.insert(e,\"-I\".._MAKE.esc(a))end\nreturn e\nend\nfunction premake.gcc.getcfgsettings(e)return t[e.platform].cfgsettings\nend",
/* tools/msc.lua */
"premake.msc={}premake.msc.namestyle=\"windows\"",
diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua
index 2268d7d..985d4f4 100644
--- a/src/tools/gcc.lua
+++ b/src/tools/gcc.lua
@@ -85,7 +85,7 @@
ldflags = "-L$(LIBOGC_LIB) $(MACHDEP)",
cfgsettings = [[
ifeq ($(strip $(DEVKITPPC)),)
- $(error "DEVKITPPC environment variable is not set")'
+ $(error "DEVKITPPC environment variable is not set")'
endif
include $(DEVKITPPC)/wii_rules']],
},