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-12-05 21:00:46 +0300
committerstarkos <none@none>2009-12-05 21:00:46 +0300
commit79dfb9bf9d54b9556c0f5718baad2947d426759d (patch)
treecee5df4b588b71471817465231ed370f181f0fdd
parent0a5f439ccf9c6d1ad86c9b2662e4f81d41774c49 (diff)
Automated most of the release
-rw-r--r--CHANGES.txt3
-rw-r--r--scripts/release.lua191
-rw-r--r--src/base/os.lua12
-rw-r--r--src/host/scripts.c2
4 files changed, 165 insertions, 43 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index b1cc8b4..c18afe2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,8 +2,9 @@
4.2 (in progress)
-----
-- Added support for Apple Xcode 3
+- Feature 1526976: Add support for Apple Xcode 3
- clean now removes MonoDevelop .pidb files correctly
+- added os.executef()
- Feature 2900623: Add targetsuffix and implibsuffix properties
-------
diff --git a/scripts/release.lua b/scripts/release.lua
index 5157ea3..c7df4b2 100644
--- a/scripts/release.lua
+++ b/scripts/release.lua
@@ -3,14 +3,10 @@
-- work is needed to get everything packaged up.
--
-local function executef(cmd, ...)
- cmd = string.format(cmd, unpack(arg))
- os.execute(cmd)
-end
-
-
function dorelease()
-
+ local z
+ local svnroot = "https://premake.svn.sourceforge.net/svnroot/premake"
+
--
-- Make sure a version was specified
--
@@ -19,64 +15,160 @@ function dorelease()
error("** You must specify a version number", 0)
end
-
+
--
--- Look for a release branch in Subversion; create one if necessary
+-- Look for required utilities
--
+ local required = { "svn", "zip", "tar", "make", "gcc" }
+ for _, cmd in ipairs(required) do
+ z = os.executef("%s --version &> release.log", cmd)
+ if z ~= 0 then
+ error("** '" .. cmd .. "' not found", 0)
+ end
+ end
+
--
--- Check out the release branch
+-- Pre-release checklist
--
+ print("")
+ print("Have you...")
+ print("* Updated the CHANGELOG?")
+ print("* Run tests on Windows and POSIX?")
+ print("* Updated the embedded scripts?")
+ print("* Checked in all changes?")
+ print("")
+ print("Press [Enter] to begin.")
+ io.read()
+
--
--- Update the version number in premake.c
+-- Create a directory to hold releases
+--
+
+ os.mkdir("release")
+ os.chdir("release")
+
+
+--
+-- Look for a release branch in Subversion; create one if necessary
--
+ print("Checking for release branch...")
+ local branch = string.format("%s/branches/%s", svnroot, _ARGS[1])
+ z = os.executef("svn ls %s &> release.log", branch)
+ if z ~= 0 then
+ print("Creating release branch...")
+ z = os.executef('svn cp %s/trunk %s -m "Branched for %s release" > release.log', svnroot, branch, _ARGS[1])
+ if z ~= 0 then
+ error("** Failed to create release branch.", 0)
+ end
+ end
+
--
--- Make absolutely sure the embedded scripts have been updated
+-- Check out the release branch
--
+ print("Checking out release branch...")
+ local branchdir = "premake-" .. _ARGS[1]
+ z = os.executef("svn co %s %s &> release.log", branch, branchdir)
+ if z ~= 0 then
+ error("** Failed to checkout release branch", 0)
+ end
+ os.chdir(branchdir)
+
--
--- If anything changed in those last two steps, check it in to the branch
+-- Update the version number in premake.c
--
+ print("Updating version number...")
+ io.input("src/host/premake.c")
+ local text = io.read("*a")
+ text = text:gsub("SVN", _ARGS[1])
+ io.output("src/host/premake.c")
+ io.write(text)
+ io.close()
+
--
--- Remove .svn, samples, and packages directories
+-- Make absolutely sure the embedded scripts have been updated
--
+ print("Updating embedded scripts...")
+ z = os.executef("premake4 embed &> ../release.log")
+ if z ~= 0 then
+ error("** Failed to update the embedded scripts", 0)
+ end
+
--
--- Generate project files to the build directory
+-- If anything changed in those last two steps, check it in to the branch
--
- 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")
-
+ print("Committing changes...")
+ z = os.executef('svn commit -m "Updated version and scripts" &> ../release.log')
+ if z ~= 0 then
+ error("** Failed to commit changes", 0)
+ end
+
--
--- Create a source package
+-- Right now I only generate the source packaging under Mac OS X
--
if os.is("macosx") then
- local fname = "premake-" .. _ARGS[1]
+
+ --
+ -- Remove .svn, samples, and packages directories
+ --
+
+ print("Cleaning up the source tree...")
+ z = os.executef("rm -rf `find . -name .svn`")
+ if z ~= 0 then
+ error("** Failed to remove .svn directories", 0)
+ end
+
+ z = os.executef("rm -rf samples")
+ if z ~= 0 then
+ error("** Failed to remove samples directories", 0)
+ end
+
+ z = os.executef("rm -rf packages")
+ if z ~= 0 then
+ error("** Failed to remove samples directories", 0)
+ end
+
+ --
+ -- Generate project files to the build directory
+ --
+
+ print("Generating project files...")
+ os.executef("premake4 /to=build/vs2005 vs2005 &> ../release.log")
+ os.executef("premake4 /to=build/vs2008 vs2008 &> ../release.log")
+ os.executef("premake4 /to=build/gmake.windows /os=windows gmake &> ../release.log")
+ os.executef("premake4 /to=build/gmake.unix /os=linux gmake &> ../release.log")
+ os.executef("premake4 /to=build/gmake.macosx /os=macosx /platform=universal32 gmake &> ../release.log")
+ os.executef("premake4 /to=build/codeblocks.windows /os=windows codeblocks &> ../release.log")
+ os.executef("premake4 /to=build/codeblocks.unix /os=linux codeblocks &> ../release.log")
+ os.executef("premake4 /to=build/codeblocks.macosx /os=macosx /platform=universal32 codeblocks &> ../release.log")
+ os.executef("premake4 /to=build/codelite.windows /os=windows codelite &> ../release.log")
+ os.executef("premake4 /to=build/codelite.unix /os=linux codelite &> ../release.log")
+ os.executef("premake4 /to=build/codelite.macosx /os=macosx /platform=universal32 codelite &> ../release.log")
+ os.executef("premake4 /to=build/xcode3 /platform=universal32 xcode3 &> ../release.log")
+
+ --
+ -- Create source package
+ --
+
+ print("Creating source code package...")
os.chdir("..")
- executef("zip -r9 %s-src.zip %s/*", fname, fname)
- executef("mv %s-src.zip %s", fname, fname)
- os.chdir(fname)
+ os.executef("zip -r9 %s-src.zip %s/* &> ../release.log", branchdir, branchdir)
+ os.chdir(branchdir)
+
end
@@ -85,29 +177,48 @@ function dorelease()
-- GNU/Make/GCC environment. I use MinGW on Windows.
--
- local fname = string.format("premake-%s-%s", _ARGS[1], os.get())
+ print("Building platform binary release...")
+ local fname = string.format("%s-%s", branchdir, os.get())
os.chdir("build/gmake." .. os.get())
- os.execute("make config=" .. iif(os.is("macosx"), "releaseuniv32", "release"))
+ os.executef("make config=%s &> ../../../release.log", 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)
+ os.executef("zip -9 %s.zip premake4.exe &> ../../../release.log", fname)
+ os.executef("move %s.zip ../../.. &> ../../../release.log", fname)
else
- executef("tar czvf %s.tar.gz premake4", fname)
- executef("mv %s.tar.gz ../..", fname)
+ os.executef("tar czvf %s.tar.gz premake4 &> ../../../release.log", fname)
+ os.executef("mv %s.tar.gz ../../.. &> ../../../release.log", fname)
end
-
-
+
--
-- Upload files to SourceForge
--
+ os.chdir("../..")
--
+-- Clean up
+--
+
+ os.chdir("..")
+ os.remove("release.log")
+
+
+--
-- Remind me of required next steps
--
+ print("")
+ print("Finished. Now...")
+ print("* Upload packages to SourceForge and create release")
+ print("* Write news post and publish to front page")
+ print("* Post to Twitter")
+ print("* Post to email list")
+ print("* Update Freshmeat")
+ print("* Post news item on SourceForge")
+ print("* Copy binaries to local path")
+
end
diff --git a/src/base/os.lua b/src/base/os.lua
index ff53cb7..6580668 100644
--- a/src/base/os.lua
+++ b/src/base/os.lua
@@ -1,11 +1,21 @@
--
-- os.lua
-- Additions to the OS namespace.
--- Copyright (c) 2002-2008 Jason Perkins and the Premake project
+-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
--
--
+-- Same as os.execute(), but accepts string formatting arguments.
+--
+
+ function os.executef(cmd, ...)
+ cmd = string.format(cmd, unpack(arg))
+ return os.execute(cmd)
+ end
+
+
+--
-- Scan the well-known system locations for a particular library.
--
diff --git a/src/host/scripts.c b/src/host/scripts.c
index 7f7f82e..86bab06 100644
--- a/src/host/scripts.c
+++ b/src/host/scripts.c
@@ -3,7 +3,7 @@
/* To regenerate this file, run: premake4 embed */
const char* builtin_scripts[] = {
- "function os.findlib(libname)\nlocal path, formats\nif os.is(\"windows\") then\nformats = { \"%s.dll\", \"%s\" }\npath = os.getenv(\"PATH\")\nelse\nif os.is(\"macosx\") then\nformats = { \"lib%s.dylib\", \"%s.dylib\" }\npath = os.getenv(\"DYLD_LIBRARY_PATH\")\nelse\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LD_LIBRARY_PATH\") or \"\"\nlocal f = io.open(\"/etc/ld.so.conf\", \"r\")\nif f then\nfor line in f:lines() do\npath = path .. \":\" .. line\nend\nf:close()\nend\nend\ntable.insert(formats, \"%s\")\npath = (path or \"\") .. \":/lib:/usr/lib:/usr/local/lib\"\nend\nfor _, fmt in ipairs(formats) do\nlocal name = string.format(fmt, libname)\nlocal result = os.pathsearch(name, path)\nif result then return result end\nend\nend\nfunction os.get()\nreturn _OPTIONS.os or _OS\nend\nfunction os.is(id)\nreturn (os.get():lower() == id:lower())\nend\nlocal function domatch(result, mask, wantfiles)\nlocal basedir = path.getdirectory(mask)\nif (basedir == \".\") then basedir = \"\" end\nlocal m = os.matchstart(mask)\nwhile (os.matchnext(m)) do\nlocal fname = os.matchname(m)\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\ntable.insert(result, path.join(basedir, fname))\nend\nend\nos.matchdone(m)\nif (mask:find(\"**\", nil, true)) then\nmask = path.getname(mask)\nm = os.matchstart(path.join(basedir, \"*\"))\nwhile (os.matchnext(m)) do\nlocal dirname = os.matchname(m)\nlocal submask = path.join(path.join(basedir, dirname), mask)\ndomatch(result, submask, wantfiles)\nend\nos.matchdone(m)\nend\nend\nfunction os.matchdirs(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, false)\nend\nreturn result\nend\nfunction os.matchfiles(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, true)\nend\nreturn result\nend\nlocal builtin_mkdir = os.mkdir\nfunction os.mkdir(p)\nlocal dir = iif(p:startswith(\"/\"), \"/\", \"\")\nfor part in p:gmatch(\"[^/]+\") do\ndir = dir .. part\nif (part ~= \"\" and not path.isabsolute(part) and not os.isdir(dir)) then\nlocal ok, err = builtin_mkdir(dir)\nif (not ok) then\nreturn nil, err\nend\nend\ndir = dir .. \"/\"\nend\nreturn true\nend\nlocal builtin_rmdir = os.rmdir\nfunction os.rmdir(p)\nlocal dirs = os.matchdirs(p .. \"/*\")\nfor _, dname in ipairs(dirs) do\nos.rmdir(dname)\nend\nlocal files = os.matchfiles(p .. \"/*\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nbuiltin_rmdir(p)\nend\n",
+ "function os.executef(cmd, ...)\ncmd = string.format(cmd, unpack(arg))\nreturn os.execute(cmd)\nend\nfunction os.findlib(libname)\nlocal path, formats\nif os.is(\"windows\") then\nformats = { \"%s.dll\", \"%s\" }\npath = os.getenv(\"PATH\")\nelse\nif os.is(\"macosx\") then\nformats = { \"lib%s.dylib\", \"%s.dylib\" }\npath = os.getenv(\"DYLD_LIBRARY_PATH\")\nelse\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LD_LIBRARY_PATH\") or \"\"\nlocal f = io.open(\"/etc/ld.so.conf\", \"r\")\nif f then\nfor line in f:lines() do\npath = path .. \":\" .. line\nend\nf:close()\nend\nend\ntable.insert(formats, \"%s\")\npath = (path or \"\") .. \":/lib:/usr/lib:/usr/local/lib\"\nend\nfor _, fmt in ipairs(formats) do\nlocal name = string.format(fmt, libname)\nlocal result = os.pathsearch(name, path)\nif result then return result end\nend\nend\nfunction os.get()\nreturn _OPTIONS.os or _OS\nend\nfunction os.is(id)\nreturn (os.get():lower() == id:lower())\nend\nlocal function domatch(result, mask, wantfiles)\nlocal basedir = path.getdirectory(mask)\nif (basedir == \".\") then basedir = \"\" end\nlocal m = os.matchstart(mask)\nwhile (os.matchnext(m)) do\nlocal fname = os.matchname(m)\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\ntable.insert(result, path.join(basedir, fname))\nend\nend\nos.matchdone(m)\nif (mask:find(\"**\", nil, true)) then\nmask = path.getname(mask)\nm = os.matchstart(path.join(basedir, \"*\"))\nwhile (os.matchnext(m)) do\nlocal dirname = os.matchname(m)\nlocal submask = path.join(path.join(basedir, dirname), mask)\ndomatch(result, submask, wantfiles)\nend\nos.matchdone(m)\nend\nend\nfunction os.matchdirs(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, false)\nend\nreturn result\nend\nfunction os.matchfiles(...)\nlocal result = { }\nfor _, mask in ipairs(arg) do\ndomatch(result, mask, true)\nend\nreturn result\nend\nlocal builtin_mkdir = os.mkdir\nfunction os.mkdir(p)\nlocal dir = iif(p:startswith(\"/\"), \"/\", \"\")\nfor part in p:gmatch(\"[^/]+\") do\ndir = dir .. part\nif (part ~= \"\" and not path.isabsolute(part) and not os.isdir(dir)) then\nlocal ok, err = builtin_mkdir(dir)\nif (not ok) then\nreturn nil, err\nend\nend\ndir = dir .. \"/\"\nend\nreturn true\nend\nlocal builtin_rmdir = os.rmdir\nfunction os.rmdir(p)\nlocal dirs = os.matchdirs(p .. \"/*\")\nfor _, dname in ipairs(dirs) do\nos.rmdir(dname)\nend\nlocal files = os.matchfiles(p .. \"/*\")\nfor _, fname in ipairs(files) do\nos.remove(fname)\nend\nbuiltin_rmdir(p)\nend\n",
"function path.getabsolute(p)\np = path.translate(p, \"/\")\nif (p == \"\") then p = \".\" end\nlocal result = iif (path.isabsolute(p), nil, os.getcwd())\nfor n, part in ipairs(p:explode(\"/\", true)) do\nif (part == \"\" and n == 1) then\nresult = \"/\"\nelseif (part == \"..\") then\nresult = path.getdirectory(result)\nelseif (part ~= \".\") then\nresult = path.join(result, part)\nend\nend\nresult = iif(result:endswith(\"/\"), result:sub(1, -2), result)\nreturn result\nend\nfunction path.getbasename(p)\nlocal name = path.getname(p)\nlocal i = name:findlast(\".\", true)\nif (i) then\nreturn name:sub(1, i - 1)\nelse\nreturn name\nend\nend\nfunction path.getdirectory(p)\nlocal i = p:findlast(\"/\", true)\nif (i) then\nif i > 1 then i = i - 1 end\nreturn p:sub(1, i)\nelse\nreturn \".\"\nend\nend\nfunction path.getdrive(p)\nlocal ch1 = p:sub(1,1)\nlocal ch2 = p:sub(2,2)\nif ch2 == \":\" then\nreturn ch1\nend\nend\nfunction path.getextension(p)\nlocal i = p:findlast(\".\", true)\nif (i) then\nreturn p:sub(i)\nelse\nreturn \"\"\nend\nend\nfunction path.getname(p)\nlocal i = p:findlast(\"[/\\\\]\")\nif (i) then\nreturn p:sub(i + 1)\nelse\nreturn p\nend\nend\nfunction path.getrelative(src, dst)\nsrc = path.getabsolute(src)\ndst = path.getabsolute(dst)\nif (src == dst) then\nreturn \".\"\nend\nif path.getdrive(src) ~= path.getdrive(dst) then\nreturn dst\nend\nsrc = src .. \"/\"\ndst = dst .. \"/\"\nlocal i = src:find(\"/\")\nwhile (i) do\nif (src:sub(1,i) == dst:sub(1,i)) then\nsrc = src:sub(i + 1)\ndst = dst:sub(i + 1)\nelse\nbreak\nend\ni = src:find(\"/\")\nend\nlocal result = \"\"\ni = src:find(\"/\")\nwhile (i) do\nresult = result .. \"../\"\ni = src:find(\"/\", i + 1)\nend\nresult = result .. dst\nreturn result:sub(1, -2)\nend\nfunction path.iscfile(fname)\nlocal extensions = { \".c\", \".s\", \".m\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.iscppfile(fname)\nlocal extensions = { \".cc\", \".cpp\", \".cxx\", \".c\", \".s\", \".m\", \".mm\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.isresourcefile(fname)\nlocal extensions = { \".rc\" }\nlocal ext = path.getextension(fname):lower()\nreturn table.contains(extensions, ext)\nend\nfunction path.join(leading, trailing)\nleading = leading or \"\"\nif (not trailing) then\nreturn leading\nend\nif (path.isabsolute(trailing)) then\nreturn trailing\nend\nif (leading == \".\") then\nleading = \"\"\nend\nif (leading:len() > 0 and not leading:endswith(\"/\")) then\nleading = leading .. \"/\"\nend\nreturn leading .. trailing\nend\nfunction path.rebase(p, oldbase, newbase)\np = path.getabsolute(path.join(oldbase, p))\np = path.getrelative(newbase, p)\nreturn p\nend\nfunction path.translate(p, sep)\nif (type(p) == \"table\") then\nlocal result = { }\nfor _, value in ipairs(p) do\ntable.insert(result, path.translate(value))\nend\nreturn result\nelse\nif (not sep) then\nif (os.is(\"windows\")) then\nsep = \"\\\\\"\nelse\nsep = \"/\"\nend\nend\nlocal result = p:gsub(\"[/\\\\]\", sep)\nreturn result\nend\nend\n",
"function string.explode(s, pattern, plain)\nif (pattern == '') then return false end\nlocal pos = 0\nlocal arr = { }\nfor st,sp in function() return s:find(pattern, pos, plain) end do\ntable.insert(arr, s:sub(pos, st-1))\npos = sp + 1\nend\ntable.insert(arr, s:sub(pos))\nreturn arr\nend\nfunction string.findlast(s, pattern, plain)\nlocal curr = 0\nrepeat\nlocal next = s:find(pattern, curr + 1, plain)\nif (next) then curr = next end\nuntil (not next)\nif (curr > 0) then\nreturn curr\nend\nend\nfunction string.startswith(haystack, needle)\nreturn (haystack:find(needle, 1, true) == 1)\nend",
"function table.contains(t, value)\nfor _,v in pairs(t) do\nif (v == value) then\nreturn true\nend\nend\nreturn false\nend\nfunction table.extract(arr, fname)\nlocal result = { }\nfor _,v in ipairs(arr) do\ntable.insert(result, v[fname])\nend\nreturn result\nend\nfunction table.implode(arr, before, after, between)\nlocal result = \"\"\nfor _,v in ipairs(arr) do\nif (result ~= \"\" and between) then\nresult = result .. between\nend\nresult = result .. before .. v .. after\nend\nreturn result\nend\nfunction table.isempty(t)\nreturn not next(t)\nend\nfunction table.join(...)\nlocal result = { }\nfor _,t in ipairs(arg) do\nif type(t) == \"table\" then\nfor _,v in ipairs(t) do\ntable.insert(result, v)\nend\nelse\ntable.insert(result, t)\nend\nend\nreturn result\nend\nfunction table.keys(tbl)\nlocal keys = {}\nfor k, _ in pairs(tbl) do\ntable.insert(keys, k)\nend\nreturn keys\nend\nfunction table.translate(arr, translation)\nlocal result = { }\nfor _, value in ipairs(arr) do\nlocal tvalue\nif type(translation) == \"function\" then\ntvalue = translation(value)\nelse\ntvalue = translation[value]\nend\nif (tvalue) then\ntable.insert(result, tvalue)\nend\nend\nreturn result\nend\n",