File: release.lua

package info (click to toggle)
mame 0.228%2Bdfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 956,280 kB
  • sloc: cpp: 4,712,769; xml: 1,946,353; ansic: 829,986; sh: 49,187; lisp: 18,100; python: 17,897; makefile: 10,815; cs: 10,047; javascript: 8,196; yacc: 7,565; java: 7,151; objc: 5,791; asm: 4,639; perl: 2,850; ada: 1,681; lex: 1,174; pascal: 1,139; ruby: 317; awk: 35
file content (47 lines) | stat: -rw-r--r-- 1,300 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function dorelease()
	--
	-- Helper function: runs a command (formatted, with optional arguments) and
	-- suppresses any output. Works on both Windows and POSIX. Might be a good
	-- candidate for a core function.
	--
	local function exec(cmd, ...)
		cmd = string.format(cmd, ...)
		local z = os.execute(cmd .. " > output.log 2> error.log")
		os.remove("output.log")
		os.remove("error.log")
		return z
	end


	print("Updating version number...")

	local f = io.popen("git rev-list --count HEAD")
	local rev = string.match(f:read("*a"), ".*%S")
	f:close()
	f = io.popen("git log --format=format:%H -1")
	local sha1 = f:read("*a")
	f:close()
	io.output("src/host/version.h")
	io.write("#define VERSION " ..rev .. "\n")
	io.write("#define VERSION_STR \"version " ..rev .. " (commit " .. sha1 .. ")\"\n")
	io.close()


	print("Updating embedded scripts...")

	local z = exec(_PREMAKE_COMMAND .. " embed")
	if z ~= true then
		error("** Failed to update the embedded scripts", 0)
	end


	print("Generating project files...")

	exec(_PREMAKE_COMMAND .. " /to=../build/gmake.windows /os=windows gmake")
	exec(_PREMAKE_COMMAND .. " /to=../build/gmake.linux /os=linux gmake")
	exec(_PREMAKE_COMMAND .. " /to=../build/gmake.darwin /os=macosx /platform=universal32 gmake")

	print("")
	print( "Finished.")

end