2008-06-17 18:45:11 +00:00
|
|
|
project.name = "Premake4"
|
|
|
|
|
|
|
|
-- Project options
|
|
|
|
|
|
|
|
addoption("no-tests", "Build without automated tests")
|
|
|
|
|
|
|
|
|
|
|
|
-- Output directories
|
|
|
|
|
|
|
|
project.config["Debug"].bindir = "bin/debug"
|
|
|
|
project.config["Release"].bindir = "bin/release"
|
|
|
|
|
|
|
|
|
|
|
|
-- Packages
|
|
|
|
|
|
|
|
dopackage("src")
|
|
|
|
|
|
|
|
|
|
|
|
-- Cleanup code
|
|
|
|
|
|
|
|
function doclean(cmd, arg)
|
|
|
|
docommand(cmd, arg)
|
|
|
|
os.rmdir("bin")
|
|
|
|
os.rmdir("doc")
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Release code
|
|
|
|
|
2008-07-23 20:42:56 +00:00
|
|
|
REPOS = "https://premake.svn.sourceforge.net/svnroot/premake"
|
|
|
|
TRUNK = "/trunk"
|
|
|
|
TAGS = "/tags/4.0-dev/"
|
2008-06-17 18:45:11 +00:00
|
|
|
|
|
|
|
function dorelease(cmd, arg)
|
|
|
|
|
|
|
|
if (not arg) then
|
|
|
|
error "You must specify a version"
|
|
|
|
end
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Make sure everything is good before I start
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
print("")
|
|
|
|
print("PRE-FLIGHT CHECKLIST")
|
|
|
|
print(" * is README up-to-date?")
|
|
|
|
print(" * is CHANGELOG up-to-date?")
|
|
|
|
print(" * did you test build with GCC?")
|
|
|
|
print(" * did you test build with Doxygen?")
|
|
|
|
print(" * are 'svn' (all) and '7z' (Windows) available?")
|
|
|
|
print("")
|
|
|
|
print("Press [Enter] to continue or [^C] to quit.")
|
|
|
|
io.stdin:read("*l")
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Set up environment
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
local version = arg
|
|
|
|
|
2008-07-23 20:42:56 +00:00
|
|
|
os.mkdir("release")
|
2008-06-17 18:45:11 +00:00
|
|
|
|
2008-07-23 20:42:56 +00:00
|
|
|
local folder = "premake4-"..version
|
2008-06-17 18:45:11 +00:00
|
|
|
local trunk = REPOS..TRUNK
|
2008-06-27 16:53:36 +00:00
|
|
|
local branch = REPOS..TAGS..version
|
2008-06-17 18:45:11 +00:00
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Build and run all automated tests on working copy
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
print("Building tests on working copy...")
|
2008-07-23 20:42:56 +00:00
|
|
|
os.execute("premake --target gnu >release/release.log")
|
|
|
|
result = os.execute("make CONFIG=Release >release/release.log")
|
2008-06-17 18:45:11 +00:00
|
|
|
if (result ~= 0) then
|
|
|
|
error("Test build failed; see release.log for details")
|
|
|
|
end
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Look for a release branch in SVN, and create one from trunk if necessary
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
print("Checking for release branch...")
|
2008-07-23 20:42:56 +00:00
|
|
|
os.chdir("release")
|
2008-06-17 18:45:11 +00:00
|
|
|
result = os.execute(string.format("svn ls %s >release.log 2>&1", branch))
|
|
|
|
if (result ~= 0) then
|
|
|
|
print("Creating release branch...")
|
|
|
|
result = os.execute(string.format('svn copy %s %s -m "Creating release branch for %s" >release.log', trunk, branch, version))
|
|
|
|
if (result ~= 0) then
|
|
|
|
error("Failed to create release branch at "..branch)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Checkout a local copy of the release branch
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
print("Getting source code from release branch...")
|
|
|
|
os.execute(string.format("svn co %s %s >release.log", branch, folder))
|
|
|
|
if (not os.fileexists(folder.."/README.txt")) then
|
|
|
|
error("Unable to checkout from repository at "..branch)
|
|
|
|
end
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Embed version numbers into the files
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- (embed version #s)
|
|
|
|
-- (check into branch)
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Build the release binary for this platform
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
print("Building release version...")
|
|
|
|
os.chdir(folder)
|
|
|
|
os.execute("premake --clean --no-tests --target gnu >../release.log")
|
|
|
|
|
|
|
|
if (windows) then
|
|
|
|
os.execute("make CONFIG=Release >../release.log")
|
|
|
|
os.chdir("bin/release")
|
2008-07-23 20:42:56 +00:00
|
|
|
result = os.execute(string.format("7z a -tzip ..\\..\\..\\premake4-win32-%s.zip premake4.exe >../release.log", version))
|
2008-06-17 18:45:11 +00:00
|
|
|
elseif (macosx) then
|
|
|
|
os.execute('TARGET_ARCH="-arch i386 -arch ppc" make CONFIG=Release >../release.log')
|
|
|
|
os.chdir("bin/release")
|
2008-07-23 20:42:56 +00:00
|
|
|
result = os.execute(string.format("tar czvf ../../../premake4-macosx-%s.tar.gz premake4 >../release.log", version))
|
2008-06-17 18:45:11 +00:00
|
|
|
else
|
|
|
|
os.execute("make CONFIG=Release >../release.log")
|
|
|
|
os.chdir("bin/release")
|
2008-07-23 20:42:56 +00:00
|
|
|
result = os.execute(string.format("tar czvf ../../../premake4-linux-%s.tar.gz premake4 >../release.log", version))
|
2008-06-17 18:45:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if (result ~= 0) then
|
|
|
|
error("Failed to build binary package; see release.log for details")
|
|
|
|
end
|
|
|
|
|
|
|
|
os.chdir("../../..")
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
2008-07-23 20:42:56 +00:00
|
|
|
-- Build the source code package
|
2008-06-17 18:45:11 +00:00
|
|
|
-------------------------------------------------------------------
|
|
|
|
if (macosx) then
|
2008-07-23 20:42:56 +00:00
|
|
|
result = os.execute(string.format("zip -r9 premake4-src-%s.zip %s/* >release.log", version, folder))
|
2008-06-17 18:45:11 +00:00
|
|
|
if (result ~= 0) then
|
|
|
|
error("Failed to build source code package; see release.log for details")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Clean up
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
print("Cleaning up...")
|
|
|
|
os.rmdir(folder)
|
|
|
|
os.remove("release.log")
|
|
|
|
|
|
|
|
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
-- Next steps
|
|
|
|
-------------------------------------------------------------------
|
|
|
|
if (windows) then
|
|
|
|
print("DONE - now run release script under Linux")
|
|
|
|
elseif (linux) then
|
|
|
|
print("DONE - now run release script under Mac OS X")
|
|
|
|
else
|
|
|
|
print("DONE - really this time")
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|