Last tweaks for RC1
This commit is contained in:
parent
343050bc6f
commit
ba154a2f83
32
BUILD.txt
32
BUILD.txt
@ -1,14 +1,25 @@
|
||||
PREMAKE BUILD INSTRUCTIONS
|
||||
|
||||
As of version 4.0, Premake is written in a mix of C and Lua. This mix
|
||||
makes it smaller, enables the templating features, and makes the
|
||||
whole thing easier to maintain. The trade-off is a couple of wrinkles
|
||||
in the build process.
|
||||
enables many new features, but it makes building Premake a bit more
|
||||
complicated.
|
||||
|
||||
If you downloaded a source code package from SourceForge, you can just
|
||||
build using the default "Release" configuration and go. The information
|
||||
in this file is primarily for people who got the code from Subversion,
|
||||
or developers who want to make changes to the Premake code.
|
||||
If you downloaded a source code package from SourceForge, you will
|
||||
find project files for Visual Studio, Code::Blocks, CodeLite, and
|
||||
GNU make in the build/ directory. Build the release configuration
|
||||
(the default for the makefiles) and you will find the executable in
|
||||
bin/release ready to go.
|
||||
|
||||
If you want to use a debug build instead, or if you downloaded the
|
||||
source code from Subversion instead of a SourceForge release, read
|
||||
the next section for more information.
|
||||
|
||||
Visual Studio 2002 and 2003 users: these version of Visual Studio
|
||||
are unable to build Premake due to string size limitations. Use one
|
||||
the newer, free versions of Visual Studio C++ Express instead.
|
||||
|
||||
If you find all of this very confusing and need some help, see the
|
||||
end of this document for contact information.
|
||||
|
||||
|
||||
GENERATING THE PROJECT FILES
|
||||
@ -23,8 +34,8 @@ GENERATING THE PROJECT FILES
|
||||
get it as source code or a prebuilt binary from the SourceForge
|
||||
download page.
|
||||
|
||||
Once you have a working Premake installed, generate the project files
|
||||
in the normal way. For Premake 4.x, type a command like:
|
||||
Once you have a working Premake installed, use it to generate the
|
||||
project files. For Premake 4.x, type a command like:
|
||||
|
||||
premake4 gmake -- for GNU makefiles using GCC
|
||||
premake4 vs2005 -- for a Visual Studio 2005 solution
|
||||
@ -71,8 +82,7 @@ COMPILING SCRIPTS
|
||||
If you make changes to the core Lua scripts, you can integrate them
|
||||
into the release build using the "compile" command:
|
||||
|
||||
premake4 compile -- for Premake 4.x
|
||||
premake --compile -- for Premake 3.x
|
||||
premake4 compile
|
||||
|
||||
This command compiles all of the scripts listed in _manifest.lua into
|
||||
bytecode and embeds them into src/host/bytecode.c. The next release
|
||||
|
111
premake.lua
111
premake.lua
@ -26,114 +26,3 @@ project.name = "Premake4"
|
||||
docommand(cmd, arg)
|
||||
os.rmdir("bin")
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Functions copied from Premake4; can drop them once I'm self-hosting
|
||||
|
||||
path = { }
|
||||
|
||||
function string.findlast(s, pattern, plain)
|
||||
local curr = 0
|
||||
repeat
|
||||
local next = s:find(pattern, curr + 1, plain)
|
||||
if (next) then curr = next end
|
||||
until (not next)
|
||||
if (curr > 0) then
|
||||
return curr
|
||||
end
|
||||
end
|
||||
|
||||
function path.getbasename(p)
|
||||
local fn = path.getname(p)
|
||||
local i = fn:findlast(".", true)
|
||||
if (i) then
|
||||
return fn:sub(1, i - 1)
|
||||
else
|
||||
return fn
|
||||
end
|
||||
end
|
||||
|
||||
function path.getname(p)
|
||||
local i = p:findlast("/", true)
|
||||
if (i) then
|
||||
return p:sub(i + 1)
|
||||
else
|
||||
return p
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Compile scripts to bytecodes
|
||||
|
||||
function dumpfile(out, filename)
|
||||
local func = loadfile(filename)
|
||||
local dump = string.dump(func)
|
||||
local len = string.len(dump)
|
||||
out:write("\t\"")
|
||||
for i=1,len do
|
||||
out:write(string.format("\\%03o", string.byte(dump, i)))
|
||||
end
|
||||
out:write("\",\n")
|
||||
return len
|
||||
end
|
||||
|
||||
function dumptmpl(out, filename)
|
||||
local f = io.open(filename)
|
||||
local tmpl = f:read("*a")
|
||||
f:close()
|
||||
|
||||
local name = path.getbasename(filename)
|
||||
local dump = "_TEMPLATES."..name.."=premake.loadtemplatestring('"..name.."',[["..tmpl.."]])"
|
||||
local len = string.len(dump)
|
||||
out:write("\t\"")
|
||||
for i=1,len do
|
||||
out:write(string.format("\\%03o", string.byte(dump, i)))
|
||||
end
|
||||
out:write("\",\n")
|
||||
return len
|
||||
end
|
||||
|
||||
function docompile(cmd, arg)
|
||||
local sizes = { }
|
||||
|
||||
scripts, templates, actions = dofile("src/_manifest.lua")
|
||||
table.insert(scripts, "_premake_main.lua")
|
||||
|
||||
local out = io.open("src/host/bytecode.c", "w+b")
|
||||
out:write("/* Precompiled bytecodes for built-in Premake scripts */\n")
|
||||
out:write("/* To regenerate this file, run `premake --compile` (Premake 3.x) */\n\n")
|
||||
|
||||
out:write("const char* builtin_bytecode[] = {\n")
|
||||
|
||||
for i,fn in ipairs(scripts) do
|
||||
print(fn)
|
||||
s = dumpfile(out, "src/"..fn)
|
||||
table.insert(sizes, s)
|
||||
end
|
||||
|
||||
for i,fn in ipairs(templates) do
|
||||
print(fn)
|
||||
s = dumptmpl(out, "src/"..fn)
|
||||
table.insert(sizes, s)
|
||||
end
|
||||
|
||||
for i,fn in ipairs(actions) do
|
||||
print(fn)
|
||||
s = dumpfile(out, "src/"..fn)
|
||||
table.insert(sizes, s)
|
||||
end
|
||||
|
||||
out:write("};\n\n");
|
||||
out:write("int builtin_sizes[] = {\n")
|
||||
|
||||
for i,v in ipairs(sizes) do
|
||||
out:write("\t"..v..",\n")
|
||||
end
|
||||
|
||||
out:write("\t0\n};\n");
|
||||
out:close()
|
||||
|
||||
print("Done.")
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ package.kind = "exe"
|
||||
|
||||
package.includepaths =
|
||||
{
|
||||
"host/lua-5.1.2/src"
|
||||
"host/lua-5.1.4/src"
|
||||
}
|
||||
|
||||
package.files =
|
||||
@ -49,11 +49,11 @@ package.kind = "exe"
|
||||
package.excludes =
|
||||
{
|
||||
"premake.lua", "premake4.lua",
|
||||
"host/lua-5.1.2/src/lua.c",
|
||||
"host/lua-5.1.2/src/luac.c",
|
||||
"host/lua-5.1.2/src/print.c",
|
||||
matchrecursive("host/lua-5.1.2/*.lua"),
|
||||
matchfiles("host/lua-5.1.2/etc/*.c")
|
||||
"host/lua-5.1.4/src/lua.c",
|
||||
"host/lua-5.1.4/src/luac.c",
|
||||
"host/lua-5.1.4/src/print.c",
|
||||
matchrecursive("host/lua-5.1.4/*.lua"),
|
||||
matchfiles("host/lua-5.1.4/etc/*.c")
|
||||
}
|
||||
|
||||
if (linux) then
|
||||
|
Loading…
Reference in New Issue
Block a user