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:
authorstarkos <none@none>2009-07-16 19:20:15 +0400
committerstarkos <none@none>2009-07-16 19:20:15 +0400
commit37faff9006870d5b323cfa2acb53d79d42fc6a25 (patch)
treecaf0d690da84d1cb2a49cfff942d361dfe32e7ab
parentda9ad7f437c44840f319ed9500649466c945101b (diff)
Started a release script
-rw-r--r--premake4.lua115
-rw-r--r--scripts/embed.lua61
-rw-r--r--scripts/release.lua105
3 files changed, 208 insertions, 73 deletions
diff --git a/premake4.lua b/premake4.lua
index f537574..29eb7f5 100644
--- a/premake4.lua
+++ b/premake4.lua
@@ -2,25 +2,16 @@
-- Premake 4.x build configuration script
--
-if (_ACTION == "vs2002" or _ACTION == "vs2003") then
- error(
- "\nBecause of compiler limitations, Visual Studio 2002 and 2003 aren't able to\n" ..
- "build this version of Premake. Use the free Visual Studio Express instead.", 0)
-end
-
-
-
--
--- Use the --to=path option to control where the project files get generated. I use
--- this to create project files for each supported toolset, each in their own folder,
--- in preparation for deployment.
+-- Earlier versions of Visual Studio limit static strings to 1K (IIRC) and choke on
+-- the embedded scripts. I'll work around it if people complain.
--
- newoption {
- trigger = "to",
- value = "path",
- description = "Set the output location for the generated files"
- }
+ if (_ACTION == "vs2002" or _ACTION == "vs2003") then
+ error(
+ "\nBecause of compiler limitations, Visual Studio 2002 and 2003 aren't able to\n" ..
+ "build this version of Premake. Use the free Visual Studio Express instead.", 0)
+ end
@@ -40,7 +31,6 @@ end
kind "ConsoleApp"
flags { "No64BitChecks", "ExtraWarnings" }
includedirs { "src/host/lua-5.1.4/src" }
- location ( _OPTIONS["to"] )
files
{
@@ -92,65 +82,44 @@ end
--
--- Embed the Lua scripts into src/host/scripts.c as static data buffers.
--- I embed the actual scripts, rather than Lua bytecodes, because the
--- bytecodes are not portable to different architectures.
+-- Use the --to=path option to control where the project files get generated. I use
+-- this to create project files for each supported toolset, each in their own folder,
+-- in preparation for deployment.
--
- local function embedfile(out, fname)
- local f = io.open(fname)
- local s = f:read("*a")
- f:close()
-
- -- strip tabs
- s = s:gsub("[\t]", "")
-
- -- strip any CRs
- s = s:gsub("[\r]", "")
-
- -- strip out comments
- s = s:gsub("\n%-%-[^\n]*", "")
-
- -- escape backslashes
- s = s:gsub("\\", "\\\\")
-
- -- strip duplicate line feeds
- s = s:gsub("\n+", "\n")
-
- -- strip out leading comments
- s = s:gsub("^%-%-\n", "")
-
- -- escape line feeds
- s = s:gsub("\n", "\\n")
-
- -- escape double quote marks
- s = s:gsub("\"", "\\\"")
-
- out:write("\t\"")
- out:write(s)
- out:write("\",\n")
- end
+ newoption {
+ trigger = "to",
+ value = "path",
+ description = "Set the output location for the generated files"
+ }
+
+
+--
+-- Use the embed action to convert all of the Lua scripts into C strings, which
+-- can then be built into the executable. Always embed the scripts before creating
+-- a release build.
+--
+
+ dofile("scripts/embed.lua")
- premake.actions["embed"] = {
+ newaction {
+ trigger = "embed",
description = "Embed scripts in scripts.c; required before release builds",
- execute = function ()
- -- load the manifest of script files
- scripts = dofile("src/_manifest.lua")
- table.insert(scripts, "_premake_main.lua")
-
- -- open scripts.c and write the file header
- local out = io.open("src/host/scripts.c", "w+b")
- out:write("/* Premake's Lua scripts, as static data buffers for release mode builds */\n")
- out:write("/* To regenerate this file, run: premake4 embed */ \n\n")
- out:write("const char* builtin_scripts[] = {\n")
-
- for i,fn in ipairs(scripts) do
- print(fn)
- s = embedfile(out, "src/"..fn)
- end
-
- out:write("\t0\n};\n");
- out:close()
- end
+ execute = doembed
+ }
+
+
+--
+-- Use the release action to prepare source and binary packages for a new release.
+-- This action isn't complete yet; a release still requires some manual work.
+--
+
+
+ dofile("scripts/release.lua")
+
+ newaction {
+ trigger = "release",
+ description = "Prepare a new release (incomplete)",
+ execute = dorelease
}
diff --git a/scripts/embed.lua b/scripts/embed.lua
new file mode 100644
index 0000000..d7a43e4
--- /dev/null
+++ b/scripts/embed.lua
@@ -0,0 +1,61 @@
+--
+-- Embed the Lua scripts into src/host/scripts.c as static data buffers.
+-- I embed the actual scripts, rather than Lua bytecodes, because the
+-- bytecodes are not portable to different architectures, which causes
+-- issues in Mac OS X Universal builds.
+--
+
+ local function embedfile(out, fname)
+ local f = io.open(fname)
+ local s = f:read("*a")
+ f:close()
+
+ -- strip tabs
+ s = s:gsub("[\t]", "")
+
+ -- strip any CRs
+ s = s:gsub("[\r]", "")
+
+ -- strip out comments
+ s = s:gsub("\n%-%-[^\n]*", "")
+
+ -- escape backslashes
+ s = s:gsub("\\", "\\\\")
+
+ -- strip duplicate line feeds
+ s = s:gsub("\n+", "\n")
+
+ -- strip out leading comments
+ s = s:gsub("^%-%-\n", "")
+
+ -- escape line feeds
+ s = s:gsub("\n", "\\n")
+
+ -- escape double quote marks
+ s = s:gsub("\"", "\\\"")
+
+ out:write("\t\"")
+ out:write(s)
+ out:write("\",\n")
+ end
+
+
+ function doembed()
+ -- load the manifest of script files
+ scripts = dofile("src/_manifest.lua")
+ table.insert(scripts, "_premake_main.lua")
+
+ -- open scripts.c and write the file header
+ local out = io.open("src/host/scripts.c", "w+b")
+ out:write("/* Premake's Lua scripts, as static data buffers for release mode builds */\n")
+ out:write("/* To regenerate this file, run: premake4 embed */ \n\n")
+ out:write("const char* builtin_scripts[] = {\n")
+
+ for i,fn in ipairs(scripts) do
+ print(fn)
+ s = embedfile(out, "src/"..fn)
+ end
+
+ out:write("\t0\n};\n");
+ out:close()
+ end
diff --git a/scripts/release.lua b/scripts/release.lua
new file mode 100644
index 0000000..b7e67f9
--- /dev/null
+++ b/scripts/release.lua
@@ -0,0 +1,105 @@
+--
+-- Prepare a new Premake release. This is still incomplete and some manual
+-- work is needed to get everything packaged up.
+--
+
+local function executef(cmd, ...)
+ cmd = string.format(cmd, unpack(arg))
+ os.execute(cmd)
+end
+
+
+function dorelease()
+
+--
+-- Make sure a version was specified
+--
+
+ if #_ARGS == 0 then
+ error("** You must specify a version number", 0)
+ end
+
+
+--
+-- Look for a release branch in Subversion; create one if necessary
+--
+
+
+--
+-- Check out the release branch
+--
+
+
+--
+-- Update the version number in premake.c
+--
+
+
+--
+-- Make absolutely sure the embedded scripts have been updated
+--
+
+
+--
+-- If anything changed in those last two steps, check it in to the branch
+--
+
+
+--
+-- Remove .svn, samples, and packages directories
+--
+
+
+--
+-- Generate project files to the build directory
+--
+
+ os.execute("premake4 /to=build/vs2005 vs2005")
+ os.execute("premake4 /to=build/vs2008 vs2008")
+ os.execute("premake4 /to=build/gmake.windows /os=windows gmake")
+ os.execute("premake4 /to=build/gmake.unix /os=linux gmake")
+ os.execute("premake4 /to=build/gmake.macosx /os=macosx /platform=universal32 gmake")
+ os.execute("premake4 /to=build/codeblocks.windows /os=windows codeblocks")
+ os.execute("premake4 /to=build/codeblocks.unix /os=linux codeblocks")
+ os.execute("premake4 /to=build/codeblocks.macosx /os=macosx /platform=universal32 codeblocks")
+ os.execute("premake4 /to=build/codelite.windows /os=windows codelite")
+ os.execute("premake4 /to=build/codelite.unix /os=linux codelite")
+ os.execute("premake4 /to=build/codelite.macosx /os=macosx /platform=universal32 codelite")
+
+
+--
+-- Create a source package
+--
+
+
+--
+-- Create a binary package for this platform. This step requires a working
+-- GNU/Make/GCC environment. I use MinGW on Windows.
+--
+
+ local fname = string.format("premake-%s-%s", _ARGS[1], os.get())
+
+ os.chdir("build/gmake." .. os.get())
+ os.execute("make config=" .. iif(os.is("macosx"), "releaseuniv32", "release"))
+
+ os.chdir("../../bin/release")
+ if os.is("windows") then
+ executef("7z -tzip a %s.zip premake4.exe", fname)
+ executef("move %s.zip ../..", fname)
+ else
+ executef("tar czvf %s.tar.gz premake", fname)
+ executef("mv %s.tar.gz ../..", fname)
+ end
+
+
+
+--
+-- Upload files to SourceForge
+--
+
+
+--
+-- Remind me of required next steps
+--
+
+end