mame/3rdparty/genie/scripts/release.lua
Julian Sikorski 1a5ac25f61 Sync with GENie upstream revision ce9f3c5 (#6262)
* Change makerules to take variable $(PROJECT_TYPE) instead of hardcoded 'gmake'

This allows to run `make projgen PROJECT_TYPE=ninja` to generate ninja build files instead.
and to build GENie using ninja by running `make release PROJECT_TYPE=ninja`.

Using ninja improves build times,
e.g. for macOS: 12.47s with gmake goes down to 2.05s with ninja.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Set prefer project set as solution.startproject as default target

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Adding `GenerateMapFiles` flag.

Causes Visual Studio's linker to generate .map files for that
configuration.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Add ninja support for 'wholearchive' libraries

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Fixup ninja.esc to gracefully ignore nil passed as value

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Use -Wl,-force_load for wholearchive libs when building for macosx

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Updated README.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Add space after filename in 'Generating' message

This makes the filename 'clickable' to open in iTerm and VSCode

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Print generated filenames as quoted string

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Remove '...' after filename

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Pop cwd after pushing to run file

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Make paths in embed.lua rely on script dir

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Updated README.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Fix issues caused by make-4.3 no longer adding spaces to variables in some cases The fix was found by @asavah.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Fixed release script.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Updated README.

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>

* Update scripts.c

Co-authored-by: Christian Helmich <kagekirin@gmail.com>
Co-authored-by: Johan Sköld <johan@skold.cc>
Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
2020-02-06 12:49:15 +11:00

47 lines
1.3 KiB
Lua

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