From 7882cf643d8d7e393bdcbc9efd811cff55d88cf0 Mon Sep 17 00:00:00 2001 From: starkos Date: Tue, 30 Dec 2008 01:29:15 +0000 Subject: Last tweaks for RC1 --- BUILD.txt | 36 +++++++++++------- premake.lua | 111 -------------------------------------------------------- src/premake.lua | 12 +++--- 3 files changed, 29 insertions(+), 130 deletions(-) diff --git a/BUILD.txt b/BUILD.txt index a34cc5c..ca5e323 100644 --- a/BUILD.txt +++ b/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. - - 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. + enables many new features, but it makes building Premake a bit more + complicated. + + 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 @@ -46,7 +57,7 @@ RELEASE AND DEBUG BUILDS make config=release -- build in release mode (IDEs like Visual Studio provide their own mechanism for switching - build configurations). + build configurations). In release mode (the default) you can build and run Premake like any other C application. In debug mode, Premake reads the Lua scripts from @@ -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 diff --git a/premake.lua b/premake.lua index 53a8491..6a6751e 100644 --- a/premake.lua +++ b/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 diff --git a/src/premake.lua b/src/premake.lua index 15963a5..4f8ec97 100644 --- a/src/premake.lua +++ b/src/premake.lua @@ -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 -- cgit v1.2.3