summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/genie.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/genie.lua')
-rw-r--r--scripts/genie.lua121
1 files changed, 109 insertions, 12 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 356d4d8d3dc..cfe0efeff9e 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -99,6 +99,41 @@ newoption {
}
newoption {
+ trigger = 'with-bundled-zlib',
+ description = 'Build bundled Zlib library',
+}
+
+newoption {
+ trigger = 'with-bundled-jpeg',
+ description = 'Build bundled JPEG library',
+}
+
+newoption {
+ trigger = 'with-bundled-flac',
+ description = 'Build bundled FLAC library',
+}
+
+newoption {
+ trigger = 'with-bundled-lua',
+ description = 'Build bundled LUA library',
+}
+
+newoption {
+ trigger = 'with-bundled-sqlite3',
+ description = 'Build bundled SQLite library',
+}
+
+newoption {
+ trigger = 'with-bundled-portmidi',
+ description = 'Build bundled PortMidi library',
+}
+
+newoption {
+ trigger = 'with-bundled-portaudio',
+ description = 'Build bundled PortAudio library',
+}
+
+newoption {
trigger = "distro",
description = "Choose distribution",
allowed = {
@@ -169,6 +204,11 @@ newoption {
}
newoption {
+ trigger = "OPT_FLAGS",
+ description = "OPT_FLAGS.",
+}
+
+newoption {
trigger = "LDOPTS",
description = "Additional linker options",
}
@@ -311,6 +351,26 @@ newoption {
}
+newoption {
+ trigger = "SHLIB",
+ description = "Generate shared libs.",
+ allowed = {
+ { "0", "Static libs" },
+ { "1", "Shared libs" },
+ }
+}
+
+newoption {
+ trigger = "DRIVERS",
+ description = "List of drivers to compile.",
+}
+
+if _OPTIONS["SHLIB"]=="1" then
+ LIBTYPE = "SharedLib"
+else
+ LIBTYPE = "StaticLib"
+end
+
PYTHON = "python"
if _OPTIONS["PYTHON_EXECUTABLE"]~=nil then
@@ -438,11 +498,16 @@ msgarchiving ("Archiving $(notdir $@)...")
messageskip { "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage" }
-if (not os.isfile(path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
- error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
+if (_OPTIONS["DRIVERS"] == nil) then
+ if (not os.isfile(path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
+ error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
+ end
+ dofile (path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))
+else
+ OUT_STR = os.outputof( PYTHON .. " " .. MAME_DIR .. "src/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["DRIVERS"] .. " target " .. _OPTIONS["subtarget"])
+ load(OUT_STR)()
+ os.outputof( PYTHON .. " " .. MAME_DIR .. "src/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["DRIVERS"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.c")
end
-dofile (path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))
-
configuration { "gmake" }
flags {
"SingleOutputDir",
@@ -576,9 +641,29 @@ else
end
-- need to ensure FLAC functions are statically linked
-defines {
- "FLAC__NO_DLL",
-}
+if _OPTIONS["with-bundled-flac"] then
+ defines {
+ "FLAC__NO_DLL",
+ }
+ end
+
+if not _OPTIONS["with-bundled-jpeg"] then
+ defines {
+ "USE_SYSTEM_JPEGLIB",
+ }
+ end
+
+if not _OPTIONS["with-bundled-portmidi"] then
+ defines {
+ "USE_SYSTEM_PORTMIDI",
+ }
+ end
+
+if not _OPTIONS["with-bundled-sqlite3"] then
+ defines {
+ "USE_SYSTEM_SQLITE",
+ }
+ end
if _OPTIONS["NOASM"]=="1" then
defines {
@@ -650,7 +735,7 @@ end
}
end
-- add -g if we need symbols, and ensure we have frame pointers
-if _OPTIONS["SYMBOLS"]~=nil then
+if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
buildoptions {
"-g" .. _OPTIONS["SYMLEVEL"],
"-fno-omit-frame-pointer",
@@ -695,7 +780,7 @@ if _OPTIONS["PROFILE"] then
}
end
-if _OPTIONS["SYMBOLS"]~=nil then
+if _OPTIONS["SYMBOLS"]~=nil and _OPTIONS["SYMBOLS"]~="0" then
flags {
"Symbols",
}
@@ -724,8 +809,13 @@ if _OPTIONS["OPTIMIZE"] then
_OPTIONS["ARCHOPTS"]
}
end
+ if _OPTIONS["OPT_FLAGS"] then
+ buildoptions {
+ _OPTIONS["OPT_FLAGS"]
+ }
+ end
if _OPTIONS["LTO"]=="1" then
--- -flto=4 -> 4 threads
+-- -flto=4 -> 4 threads, reduce if you are low on memory (less than 8G)
buildoptions {
"-flto=4",
}
@@ -743,9 +833,16 @@ if _OPTIONS["OPTIMIZE"] then
end
end
+if _OPTIONS["SHLIB"] then
+ buildoptions {
+ "-fPIC"
+ }
+end
+
if _OPTIONS["SSE2"]=="1" then
buildoptions {
- "-msse2",
+ "-msse",
+ "-msse2"
}
end
@@ -842,6 +939,7 @@ end
end
if (version >= 30400) then
buildoptions {
+ "-Wno-inline-new-delete",
"-Wno-constant-logical-operand",
}
end
@@ -873,7 +971,6 @@ end
if (version >= 40800) then
-- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
buildoptions {
- "-Wno-unused-variable",
"-Wno-array-bounds"
}
end