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 /scripts
parentda9ad7f437c44840f319ed9500649466c945101b (diff)
Started a release script
Diffstat (limited to 'scripts')
-rw-r--r--scripts/embed.lua61
-rw-r--r--scripts/release.lua105
2 files changed, 166 insertions, 0 deletions
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