diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg index 1ae80ba36d..7a7ff2ecfa 100644 --- a/binaries/data/config/default.cfg +++ b/binaries/data/config/default.cfg @@ -5,11 +5,15 @@ ; * create a text file called "local.cfg" instead, and copy * ; * the lines from this file that you want to change. * ; * * -; * On Linux / OS X, create: * -; * ~/.config/0ad/config/local.cfg * +; * On Linux, create: * +; * $XDG_CONFIG_HOME/0ad/config/local.cfg * +; * (Note: $XDG_CONFIG_HOME defaults to ~/.config) * +; * * +; * On OS X, create: * +; * ~/Library/Application\ Support/0ad/config/local.cfg * ; * * ; * On Windows, create: * -; * %appdata%/0ad/config/local.cfg * +; * %appdata%\0ad\config\local.cfg * ; * * ; ************************************************************** diff --git a/build/premake/extern_libs4.lua b/build/premake/extern_libs4.lua index 915469549c..6a580bbe49 100644 --- a/build/premake/extern_libs4.lua +++ b/build/premake/extern_libs4.lua @@ -211,6 +211,14 @@ extern_lib_defs = { if os.is("windows") then add_default_include_paths("boost") end + if os.getversion().description == "OpenBSD" then + includedirs { "/usr/local/include" } + end + -- Uncomment the following for your system if you are using boost <= 1.42 + add_default_links({ + --unix_names = { "boost_system-mt" } + --bsd_names = { "boost_system" } + }) end, link_settings = function() if os.is("windows") then @@ -351,6 +359,9 @@ extern_lib_defs = { if os.is("windows") then add_default_include_paths("libpng") end + if os.getversion().description == "OpenBSD" then + includedirs { "/usr/local/include/libpng" } + end end, link_settings = function() if os.is("windows") then @@ -534,6 +545,14 @@ extern_lib_defs = { if os.is("windows") then add_default_lib_paths("vorbis") end + -- TODO: We need to force linking with these as currently + -- they need to be loaded explicitly on execution + if os.getversion().description == "OpenBSD" then + add_default_links({ + unix_names = { "ogg", + "vorbis" }, + }) + end add_default_links({ win_names = { "vorbisfile" }, unix_names = { "vorbisfile" }, diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index 9fb8c2fc64..a2fdfbfb49 100644 --- a/build/premake/premake4.lua +++ b/build/premake/premake4.lua @@ -307,7 +307,7 @@ function project_set_build_flags() if _ACTION == "gmake" then linkoptions { "-Wl,-rpath,'$$ORIGIN'" } elseif _ACTION == "codeblocks" then - linkoptions { "-Wl,-R\\\\$$ORIGIN" } + linkoptions { "-Wl,-R\\\\$$ORIGIN" } end end end @@ -338,7 +338,7 @@ function get_main_project_target_type() elseif os.is("macosx") then return "ConsoleApp" else - return "WindowedApp" + return "WindowedApp" end end @@ -609,7 +609,7 @@ function setup_all_libs () "cxxtest", } - if not _OPTIONS["without-audio"] then + if not _OPTIONS["without-audio"] then table.insert(extern_libs, "openal") table.insert(extern_libs, "vorbis") end @@ -765,7 +765,7 @@ function setup_main_exe () links { "fam" } end - if not _OPTIONS["android"] then + if not _OPTIONS["android"] and not (os.getversion().description == "OpenBSD") then links { "rt" } end @@ -774,14 +774,14 @@ function setup_main_exe () linkoptions { "-Wl,--fix-cortex-a8" } end - if os.is("linux") then + if os.is("linux") or os.getversion().description == "GNU/kFreeBSD" then links { -- Dynamic libraries (needed for linking for gold) "dl", } elseif os.is("bsd") then links { - -- Needed for backtrace* on FreeBSD + -- Needed for backtrace* on BSDs "execinfo", } end @@ -1014,7 +1014,9 @@ function setup_collada_project(project_name, target_type, rel_source_dirs, rel_i linkoptions { "-rdynamic" } elseif os.is("bsd") then - -- define BSD-something? + if os.getversion().description == "OpenBSD" then + links { "c", } + end buildoptions { "-fno-strict-aliasing" } @@ -1180,7 +1182,7 @@ function setup_tests() links { "fam" } end - if not _OPTIONS["android"] then + if not _OPTIONS["android"] and not (os.getversion().description == "OpenBSD") then links { "rt" } end @@ -1189,14 +1191,14 @@ function setup_tests() linkoptions { "-Wl,--fix-cortex-a8" } end - if os.is("linux") then + if os.is("linux") or os.getversion().description == "GNU/kFreeBSD" then links { -- Dynamic libraries (needed for linking for gold) "dl", } elseif os.is("bsd") then links { - -- Needed for backtrace* on FreeBSD + -- Needed for backtrace* on BSDs "execinfo", } end diff --git a/build/premake/premake4/build/gmake.unix/Premake4.make b/build/premake/premake4/build/gmake.unix/Premake4.make index 36a0ede6e4..addb049bf0 100644 --- a/build/premake/premake4/build/gmake.unix/Premake4.make +++ b/build/premake/premake4/build/gmake.unix/Premake4.make @@ -64,49 +64,50 @@ ifeq ($(config),debug) endif OBJECTS := \ - $(OBJDIR)/os_getcwd.o \ - $(OBJDIR)/path_isabsolute.o \ - $(OBJDIR)/os_isdir.o \ - $(OBJDIR)/os_rmdir.o \ - $(OBJDIR)/os_chdir.o \ - $(OBJDIR)/os_uuid.o \ - $(OBJDIR)/os_isfile.o \ - $(OBJDIR)/os_match.o \ - $(OBJDIR)/os_pathsearch.o \ - $(OBJDIR)/os_copyfile.o \ $(OBJDIR)/os_mkdir.o \ - $(OBJDIR)/premake.o \ + $(OBJDIR)/os_uuid.o \ + $(OBJDIR)/os_copyfile.o \ + $(OBJDIR)/os_isdir.o \ $(OBJDIR)/string_endswith.o \ + $(OBJDIR)/os_isfile.o \ + $(OBJDIR)/os_getcwd.o \ + $(OBJDIR)/os_rmdir.o \ + $(OBJDIR)/os_pathsearch.o \ + $(OBJDIR)/premake.o \ + $(OBJDIR)/path_isabsolute.o \ $(OBJDIR)/scripts.o \ - $(OBJDIR)/liolib.o \ - $(OBJDIR)/ltm.o \ - $(OBJDIR)/linit.o \ - $(OBJDIR)/loadlib.o \ - $(OBJDIR)/lgc.o \ - $(OBJDIR)/lstate.o \ - $(OBJDIR)/llex.o \ - $(OBJDIR)/lstrlib.o \ - $(OBJDIR)/lmem.o \ - $(OBJDIR)/lopcodes.o \ - $(OBJDIR)/ldump.o \ - $(OBJDIR)/lmathlib.o \ - $(OBJDIR)/ldo.o \ - $(OBJDIR)/ltablib.o \ - $(OBJDIR)/lparser.o \ - $(OBJDIR)/lfunc.o \ - $(OBJDIR)/lobject.o \ - $(OBJDIR)/ldebug.o \ - $(OBJDIR)/ldblib.o \ + $(OBJDIR)/os_chdir.o \ + $(OBJDIR)/os_match.o \ + $(OBJDIR)/os_getversion.o \ $(OBJDIR)/lauxlib.o \ - $(OBJDIR)/lzio.o \ + $(OBJDIR)/ldebug.o \ + $(OBJDIR)/ltablib.o \ + $(OBJDIR)/liolib.o \ + $(OBJDIR)/lstrlib.o \ + $(OBJDIR)/ldo.o \ + $(OBJDIR)/ldump.o \ $(OBJDIR)/loslib.o \ - $(OBJDIR)/lcode.o \ - $(OBJDIR)/lapi.o \ - $(OBJDIR)/ltable.o \ - $(OBJDIR)/lbaselib.o \ - $(OBJDIR)/lvm.o \ - $(OBJDIR)/lstring.o \ $(OBJDIR)/lundump.o \ + $(OBJDIR)/ldblib.o \ + $(OBJDIR)/lmem.o \ + $(OBJDIR)/ltm.o \ + $(OBJDIR)/lstate.o \ + $(OBJDIR)/lmathlib.o \ + $(OBJDIR)/lvm.o \ + $(OBJDIR)/ltable.o \ + $(OBJDIR)/llex.o \ + $(OBJDIR)/lgc.o \ + $(OBJDIR)/loadlib.o \ + $(OBJDIR)/lfunc.o \ + $(OBJDIR)/lopcodes.o \ + $(OBJDIR)/lparser.o \ + $(OBJDIR)/lbaselib.o \ + $(OBJDIR)/lzio.o \ + $(OBJDIR)/linit.o \ + $(OBJDIR)/lobject.o \ + $(OBJDIR)/lstring.o \ + $(OBJDIR)/lapi.o \ + $(OBJDIR)/lcode.o \ RESOURCES := \ @@ -167,135 +168,138 @@ $(GCH): $(PCH) | $(OBJDIR) $(SILENT) $(CC) $(CFLAGS) -o "$@" -c "$<" endif -$(OBJDIR)/os_getcwd.o: ../../src/host/os_getcwd.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_getcwd.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/path_isabsolute.o: ../../src/host/path_isabsolute.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/path_isabsolute.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_isdir.o: ../../src/host/os_isdir.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_isdir.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_rmdir.o: ../../src/host/os_rmdir.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_rmdir.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_chdir.o: ../../src/host/os_chdir.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_chdir.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_uuid.o: ../../src/host/os_uuid.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_uuid.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_isfile.o: ../../src/host/os_isfile.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_isfile.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_match.o: ../../src/host/os_match.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_match.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_pathsearch.o: ../../src/host/os_pathsearch.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_pathsearch.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/os_copyfile.o: ../../src/host/os_copyfile.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_copyfile.d -MT "$@" -o "$@" -c "$<" $(OBJDIR)/os_mkdir.o: ../../src/host/os_mkdir.c $(GCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_mkdir.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/premake.o: ../../src/host/premake.c $(GCH) | prebuild +$(OBJDIR)/os_uuid.o: ../../src/host/os_uuid.c $(GCH) | prebuild @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/premake.d -MT "$@" -o "$@" -c "$<" + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_uuid.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_copyfile.o: ../../src/host/os_copyfile.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_copyfile.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_isdir.o: ../../src/host/os_isdir.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_isdir.d -MT "$@" -o "$@" -c "$<" $(OBJDIR)/string_endswith.o: ../../src/host/string_endswith.c $(GCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/string_endswith.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_isfile.o: ../../src/host/os_isfile.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_isfile.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_getcwd.o: ../../src/host/os_getcwd.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_getcwd.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_rmdir.o: ../../src/host/os_rmdir.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_rmdir.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_pathsearch.o: ../../src/host/os_pathsearch.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_pathsearch.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/premake.o: ../../src/host/premake.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/premake.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/path_isabsolute.o: ../../src/host/path_isabsolute.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/path_isabsolute.d -MT "$@" -o "$@" -c "$<" $(OBJDIR)/scripts.o: ../../src/host/scripts.c $(GCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/scripts.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/liolib.o: ../../src/host/lua-5.1.4/src/liolib.c $(GCH) | prebuild +$(OBJDIR)/os_chdir.o: ../../src/host/os_chdir.c $(GCH) | prebuild @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/liolib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ltm.o: ../../src/host/lua-5.1.4/src/ltm.c $(GCH) | prebuild + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_chdir.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_match.o: ../../src/host/os_match.c $(GCH) | prebuild @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ltm.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/linit.o: ../../src/host/lua-5.1.4/src/linit.c $(GCH) | prebuild + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_match.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/os_getversion.o: ../../src/host/os_getversion.c $(GCH) | prebuild @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/linit.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/loadlib.o: ../../src/host/lua-5.1.4/src/loadlib.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/loadlib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lgc.o: ../../src/host/lua-5.1.4/src/lgc.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lgc.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lstate.o: ../../src/host/lua-5.1.4/src/lstate.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lstate.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/llex.o: ../../src/host/lua-5.1.4/src/llex.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/llex.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lstrlib.o: ../../src/host/lua-5.1.4/src/lstrlib.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lstrlib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lmem.o: ../../src/host/lua-5.1.4/src/lmem.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lmem.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lopcodes.o: ../../src/host/lua-5.1.4/src/lopcodes.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lopcodes.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ldump.o: ../../src/host/lua-5.1.4/src/ldump.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldump.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lmathlib.o: ../../src/host/lua-5.1.4/src/lmathlib.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lmathlib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ldo.o: ../../src/host/lua-5.1.4/src/ldo.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldo.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ltablib.o: ../../src/host/lua-5.1.4/src/ltablib.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ltablib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lparser.o: ../../src/host/lua-5.1.4/src/lparser.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lparser.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lfunc.o: ../../src/host/lua-5.1.4/src/lfunc.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lfunc.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lobject.o: ../../src/host/lua-5.1.4/src/lobject.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lobject.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ldebug.o: ../../src/host/lua-5.1.4/src/ldebug.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldebug.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ldblib.o: ../../src/host/lua-5.1.4/src/ldblib.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldblib.d -MT "$@" -o "$@" -c "$<" + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/os_getversion.d -MT "$@" -o "$@" -c "$<" $(OBJDIR)/lauxlib.o: ../../src/host/lua-5.1.4/src/lauxlib.c $(GCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lauxlib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lzio.o: ../../src/host/lua-5.1.4/src/lzio.c $(GCH) | prebuild +$(OBJDIR)/ldebug.o: ../../src/host/lua-5.1.4/src/ldebug.c $(GCH) | prebuild @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lzio.d -MT "$@" -o "$@" -c "$<" + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldebug.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/ltablib.o: ../../src/host/lua-5.1.4/src/ltablib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ltablib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/liolib.o: ../../src/host/lua-5.1.4/src/liolib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/liolib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lstrlib.o: ../../src/host/lua-5.1.4/src/lstrlib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lstrlib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/ldo.o: ../../src/host/lua-5.1.4/src/ldo.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldo.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/ldump.o: ../../src/host/lua-5.1.4/src/ldump.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldump.d -MT "$@" -o "$@" -c "$<" $(OBJDIR)/loslib.o: ../../src/host/lua-5.1.4/src/loslib.c $(GCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/loslib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lcode.o: ../../src/host/lua-5.1.4/src/lcode.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lcode.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lapi.o: ../../src/host/lua-5.1.4/src/lapi.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lapi.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/ltable.o: ../../src/host/lua-5.1.4/src/ltable.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ltable.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lbaselib.o: ../../src/host/lua-5.1.4/src/lbaselib.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lbaselib.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lvm.o: ../../src/host/lua-5.1.4/src/lvm.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lvm.d -MT "$@" -o "$@" -c "$<" -$(OBJDIR)/lstring.o: ../../src/host/lua-5.1.4/src/lstring.c $(GCH) | prebuild - @echo $(notdir $<) - $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lstring.d -MT "$@" -o "$@" -c "$<" $(OBJDIR)/lundump.o: ../../src/host/lua-5.1.4/src/lundump.c $(GCH) | prebuild @echo $(notdir $<) $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lundump.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/ldblib.o: ../../src/host/lua-5.1.4/src/ldblib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ldblib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lmem.o: ../../src/host/lua-5.1.4/src/lmem.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lmem.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/ltm.o: ../../src/host/lua-5.1.4/src/ltm.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ltm.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lstate.o: ../../src/host/lua-5.1.4/src/lstate.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lstate.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lmathlib.o: ../../src/host/lua-5.1.4/src/lmathlib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lmathlib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lvm.o: ../../src/host/lua-5.1.4/src/lvm.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lvm.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/ltable.o: ../../src/host/lua-5.1.4/src/ltable.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/ltable.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/llex.o: ../../src/host/lua-5.1.4/src/llex.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/llex.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lgc.o: ../../src/host/lua-5.1.4/src/lgc.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lgc.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/loadlib.o: ../../src/host/lua-5.1.4/src/loadlib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/loadlib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lfunc.o: ../../src/host/lua-5.1.4/src/lfunc.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lfunc.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lopcodes.o: ../../src/host/lua-5.1.4/src/lopcodes.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lopcodes.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lparser.o: ../../src/host/lua-5.1.4/src/lparser.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lparser.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lbaselib.o: ../../src/host/lua-5.1.4/src/lbaselib.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lbaselib.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lzio.o: ../../src/host/lua-5.1.4/src/lzio.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lzio.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/linit.o: ../../src/host/lua-5.1.4/src/linit.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/linit.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lobject.o: ../../src/host/lua-5.1.4/src/lobject.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lobject.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lstring.o: ../../src/host/lua-5.1.4/src/lstring.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lstring.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lapi.o: ../../src/host/lua-5.1.4/src/lapi.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lapi.d -MT "$@" -o "$@" -c "$<" +$(OBJDIR)/lcode.o: ../../src/host/lua-5.1.4/src/lcode.c $(GCH) | prebuild + @echo $(notdir $<) + $(SILENT) $(CC) $(PCHINCLUDES) $(CFLAGS) -MF $(OBJDIR)/lcode.d -MT "$@" -o "$@" -c "$<" -include $(OBJECTS:%.o=%.d) -include $(GCH:%.h.gch=%.h.d) diff --git a/build/premake/premake4/src/base/os.lua b/build/premake/premake4/src/base/os.lua index a9a040e938..24f14d174e 100644 --- a/build/premake/premake4/src/base/os.lua +++ b/build/premake/premake4/src/base/os.lua @@ -1,7 +1,7 @@ -- -- os.lua -- Additions to the OS namespace. --- Copyright (c) 2002-2010 Jason Perkins and the Premake project +-- Copyright (c) 2002-2011 Jason Perkins and the Premake project -- @@ -26,6 +26,9 @@ if os.is("windows") then formats = { "%s.dll", "%s" } path = os.getenv("PATH") + elseif os.is("haiku") then + formats = { "lib%s.so", "%s.so" } + path = os.getenv("LIBRARY_PATH") else if os.is("macosx") then formats = { "lib%s.dylib", "%s.dylib" } @@ -43,7 +46,7 @@ end end - table.insert(formats, "%s") + table.insert(formats, "%s") path = (path or "") .. ":/lib:/usr/lib:/usr/local/lib" end @@ -179,6 +182,18 @@ end +-- +-- Run a shell command and return the output. +-- + + function os.outputof(cmd) + local pipe = io.popen(cmd) + local result = pipe:read('*a') + pipe:close() + return result + end + + -- -- Remove a directory, along with any contained files or subdirectories. -- diff --git a/build/premake/premake4/src/host/os_getversion.c b/build/premake/premake4/src/host/os_getversion.c new file mode 100644 index 0000000000..c676d934f8 --- /dev/null +++ b/build/premake/premake4/src/host/os_getversion.c @@ -0,0 +1,231 @@ +/** + * \file os_getversioninfo.c + * \brief Retrieve operating system version information. + * \author Copyright (c) 2011 Jason Perkins and the Premake project + */ + +#include "premake.h" + +struct OsVersionInfo +{ + int majorversion; + int minorversion; + int revision; + const char* description; +} ; + +static void getversion(struct OsVersionInfo* info); + +int os_getversion(lua_State* L) +{ + struct OsVersionInfo info; + getversion(&info); + + lua_newtable(L); + + lua_pushstring(L, "majorversion"); + lua_pushnumber(L, info.majorversion); + lua_settable(L, -3); + + lua_pushstring(L, "minorversion"); + lua_pushnumber(L, info.minorversion); + lua_settable(L, -3); + + lua_pushstring(L, "revision"); + lua_pushnumber(L, info.revision); + lua_settable(L, -3); + + lua_pushstring(L, "description"); + lua_pushstring(L, info.description); + lua_settable(L, -3); + + return 1; +} + +/*************************************************************/ + +#if defined(PLATFORM_WINDOWS) + +#if !defined(VER_SUITE_WH_SERVER) +#define VER_SUITE_WH_SERVER (0x00008000) +#endif + +#ifndef SM_SERVERR2 +# define SM_SERVERR2 89 +#endif + +SYSTEM_INFO getsysteminfo() +{ + typedef void (WINAPI *GetNativeSystemInfoSig)(LPSYSTEM_INFO); + GetNativeSystemInfoSig nativeSystemInfo = (GetNativeSystemInfoSig) + GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetNativeSystemInfo"); + + SYSTEM_INFO systemInfo = {{0}}; + if ( nativeSystemInfo ) nativeSystemInfo(&systemInfo); + else GetSystemInfo(&systemInfo); + return systemInfo; +} + +void getversion(struct OsVersionInfo* info) +{ + OSVERSIONINFOEX versionInfo = {0}; + + versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + GetVersionEx((OSVERSIONINFO*)&versionInfo); + + info->majorversion = versionInfo.dwMajorVersion; + info->minorversion = versionInfo.dwMinorVersion; + info->revision = versionInfo.wServicePackMajor; + + if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 0) + { + info->description = "Windows 2000"; + } + else if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 1) + { + info->description = "Windows XP"; + } + else if (versionInfo.dwMajorVersion == 5 && versionInfo.dwMinorVersion == 2) + { + SYSTEM_INFO systemInfo = getsysteminfo(); + if (versionInfo.wProductType == VER_NT_WORKSTATION && + systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { + info->description = "Windows XP Professional x64"; + } + else if (versionInfo.wSuiteMask & VER_SUITE_WH_SERVER) + { + info->description = "Windows Home Server"; + } + else if (GetSystemMetrics(SM_SERVERR2) == 0) + { + info->description = "Windows Server 2003"; + } + else + { + info->description = "Windows Server 2003 R2"; + } + } + else if (versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion == 0) + { + if (versionInfo.wProductType == VER_NT_WORKSTATION) + { + info->description = "Windows Vista"; + } + else + { + info->description = "Windows Server 2008"; + } + } + else if (versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion == 1 ) + { + if (versionInfo.wProductType != VER_NT_WORKSTATION) + { + info->description = "Windows Server 2008 R2"; + } + else + { + info->description = "Windows 7"; + } + } + else + { + info->description = "Windows"; + } +} + +/*************************************************************/ + +#elif defined(PLATFORM_MACOSX) + +#include + +void getversion(struct OsVersionInfo* info) +{ + SInt32 majorversion, minorversion, bugfix; + Gestalt(gestaltSystemVersionMajor, &majorversion); + Gestalt(gestaltSystemVersionMinor, &minorversion); + Gestalt(gestaltSystemVersionBugFix, &bugfix); + + info->majorversion = majorversion; + info->minorversion = minorversion; + info->revision = bugfix; + + info->description = "Mac OS X"; + if (info->majorversion == 10) + { + switch (info->minorversion) + { + case 4: + info->description = "Mac OS X Tiger"; + break; + case 5: + info->description = "Mac OS X Leopard"; + break; + case 6: + info->description = "Mac OS X Snow Leopard"; + break; + case 7: + info->description = "Mac OS X Lion"; + break; + } + } +} + +/*************************************************************/ + +#elif defined(PLATFORM_BSD) || defined(PLATFORM_LINUX) || defined(PLATFORM_SOLARIS) + +#include +#include +#include + +void getversion(struct OsVersionInfo* info) +{ + struct utsname u; + char* ver; + + info->majorversion = 0; + info->minorversion = 0; + info->revision = 0; + + if (uname(&u)) + { + // error + info->description = PLATFORM_STRING; + return; + } + +#if !defined(PLATFORM_LINUX) + info->description = u.sysname; +#else + // On Linux info->sysname gets set, but it isn't passed out of this function + info->description = "Linux"; +#endif + + if ((ver = strtok(u.release, ".-")) != NULL) + { + info->majorversion = atoi(ver); + // continue parsing from the previous position + if ((ver = strtok(NULL, ".-")) != NULL) + { + info->minorversion = atoi(ver); + if ((ver = strtok(NULL, ".-")) != NULL) + info->revision = atoi(ver); + } + } +} + +/*************************************************************/ + +#else + +void getversion(struct OsVersionInfo* info) +{ + info->majorversion = 0; + info->minorversion = 0; + info->revision = 0; + info->description = PLATFORM_STRING; +} + +#endif diff --git a/build/premake/premake4/src/host/premake.c b/build/premake/premake4/src/host/premake.c index 01beb597de..19547b7080 100644 --- a/build/premake/premake4/src/host/premake.c +++ b/build/premake/premake4/src/host/premake.c @@ -38,6 +38,7 @@ static const luaL_Reg os_functions[] = { { "copyfile", os_copyfile }, { "isdir", os_isdir }, { "getcwd", os_getcwd }, + { "getversion", os_getversion }, { "isfile", os_isfile }, { "matchdone", os_matchdone }, { "matchisfile", os_matchisfile }, diff --git a/build/premake/premake4/src/host/premake.h b/build/premake/premake4/src/host/premake.h index 46f8784c79..b564aab655 100644 --- a/build/premake/premake4/src/host/premake.h +++ b/build/premake/premake4/src/host/premake.h @@ -1,7 +1,7 @@ /** * \file premake.h * \brief Program-wide constants and definitions. - * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project + * \author Copyright (c) 2002-2011 Jason Perkins and the Premake project */ #define lua_c @@ -15,7 +15,7 @@ #if defined(__linux__) #define PLATFORM_LINUX (1) #define PLATFORM_STRING "linux" -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) #define PLATFORM_BSD (1) #define PLATFORM_STRING "bsd" #elif defined(__APPLE__) && defined(__MACH__) @@ -24,6 +24,9 @@ #elif defined(__sun__) && defined(__svr4__) #define PLATFORM_SOLARIS (1) #define PLATFORM_STRING "solaris" +#elif defined(__HAIKU__) +#define PLATFORM_HAIKU (1) +#define PLATFORM_STRING "haiku" #else #define PLATFORM_WINDOWS (1) #define PLATFORM_STRING "windows" @@ -52,6 +55,7 @@ int path_isabsolute(lua_State* L); int os_chdir(lua_State* L); int os_copyfile(lua_State* L); int os_getcwd(lua_State* L); +int os_getversion(lua_State* L); int os_isdir(lua_State* L); int os_isfile(lua_State* L); int os_matchdone(lua_State* L); diff --git a/build/premake/premake4/src/host/scripts.c b/build/premake/premake4/src/host/scripts.c index 54d57b1078..14618ca394 100644 --- a/build/premake/premake4/src/host/scripts.c +++ b/build/premake/premake4/src/host/scripts.c @@ -4,9 +4,10 @@ const char* builtin_scripts[] = { /* base/os.lua */ - "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 \"\"\nio.input(\"/etc/ld.so.conf\")\nif io.input() then\nfor line in io.lines() do\npath = path .. \":\" .. line\nend\nio.input():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)\nif mas" - "k:startswith(\"./\") then\nmask = mask:sub(3)\nend\nlocal basedir = mask\nlocal starpos = mask:find(\"%*\")\nif starpos then\nbasedir = basedir:sub(1, starpos - 1)\nend\nbasedir = path.getdirectory(basedir)\nif (basedir == \".\") then basedir = \"\" end\nlocal recurse = mask:find(\"**\", nil, true)\nmask = path.wildcards(mask)\nlocal function matchwalker(basedir)\nlocal wildcard = path.join(basedir, \"*\")\nlocal m = os.matchstart(wildcard)\nwhile (os.matchnext(m)) do\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\nlocal fname = path.join(basedir, os.matchname(m))\nif fname:match(mask) == fname then\ntable.insert(result, fname)\nend\nend\nend\nos.matchdone(m)\nif recurse then\nm = os.matchstart(wildcard)\nwhile (os.matchnext(m)) do\nif not os.matchisfile(m) then\nlocal dirname = os.matchname(m)\nmatchwalker(path.join(basedir, dirname))\nend\nend\nos.matchdone(m)\nend\nend\nmatchwalker(basedir)\nend\nfunction os.matchdirs(...)\nlocal result = { }\nfor _, ma" - "sk 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\")\nelseif os.is(\"haiku\") then\nformats = { \"lib%s.so\", \"%s.so\" }\npath = os.getenv(\"LIBRARY_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 \"\"\nio.input(\"/etc/ld.so.conf\")\nif io.input() then\nfor line in io.lines() do\npath = path .. \":\" .. line\nend\nio.input():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(i" + "d)\nreturn (os.get():lower() == id:lower())\nend\nlocal function domatch(result, mask, wantfiles)\nif mask:startswith(\"./\") then\nmask = mask:sub(3)\nend\nlocal basedir = mask\nlocal starpos = mask:find(\"%*\")\nif starpos then\nbasedir = basedir:sub(1, starpos - 1)\nend\nbasedir = path.getdirectory(basedir)\nif (basedir == \".\") then basedir = \"\" end\nlocal recurse = mask:find(\"**\", nil, true)\nmask = path.wildcards(mask)\nlocal function matchwalker(basedir)\nlocal wildcard = path.join(basedir, \"*\")\nlocal m = os.matchstart(wildcard)\nwhile (os.matchnext(m)) do\nlocal isfile = os.matchisfile(m)\nif ((wantfiles and isfile) or (not wantfiles and not isfile)) then\nlocal fname = path.join(basedir, os.matchname(m))\nif fname:match(mask) == fname then\ntable.insert(result, fname)\nend\nend\nend\nos.matchdone(m)\nif recurse then\nm = os.matchstart(wildcard)\nwhile (os.matchnext(m)) do\nif not os.matchisfile(m) then\nlocal dirname = os.matchname(m)\nmatchwalker(path.join(basedir, dirname))\nend\nend\nos.mat" + "chdone(m)\nend\nend\nmatchwalker(basedir)\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\nfunction os.outputof(cmd)\nlocal pipe = io.popen(cmd)\nlocal result = pipe:read('*a')\npipe:close()\nreturn result\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", /* base/path.lua */ "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\n" @@ -298,4 +299,4 @@ const char* builtin_scripts[] = { "\npremake.action.call(action.trigger)\nprint(\"Done.\")\nreturn 0\nend\n", 0 -}; \ No newline at end of file +}; diff --git a/build/workspaces/update-workspaces.sh b/build/workspaces/update-workspaces.sh index 8ead28961a..43a298b8be 100644 --- a/build/workspaces/update-workspaces.sh +++ b/build/workspaces/update-workspaces.sh @@ -92,7 +92,7 @@ case "`uname -s`" in # Only GNU and FreeBSD sed have the -i option (and redirecting # to the same file results in an empty file and starting a subshell # isn't as obvious as redirecting to a new file and replacing the old) - sed -e 's/-ldl //g' build/gmake.unix/Premake4.make > build/gmake.unix/Premake4.make_new + sed -e 's/ -ldl/ /g' build/gmake.unix/Premake4.make > build/gmake.unix/Premake4.make_new mv build/gmake.unix/Premake4.make_new build/gmake.unix/Premake4.make ;; esac diff --git a/source/lib/config2.h b/source/lib/config2.h index e4a32c6d6a..f653d53a22 100644 --- a/source/lib/config2.h +++ b/source/lib/config2.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 Wildfire Games +/* Copyright (c) 2012 Wildfire Games * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -73,7 +73,8 @@ #ifndef CONFIG2_FILE_ENABLE_AIO // work around a bug introduced in Linux 2.6.38 // (http://www.wildfiregames.com/forum/index.php?showtopic=14561&view=findpost&p=217710) -# if OS_LINUX +// OpenBSD doesn't provide aio.h so we disable its use +# if OS_LINUX || OS_OPENBSD # define CONFIG2_FILE_ENABLE_AIO 0 # else # define CONFIG2_FILE_ENABLE_AIO 1 diff --git a/source/lib/posix/posix_aio.h b/source/lib/posix/posix_aio.h index 5768d8cfcc..4172768ebc 100644 --- a/source/lib/posix/posix_aio.h +++ b/source/lib/posix/posix_aio.h @@ -30,10 +30,22 @@ #if OS_WIN # include "lib/sysdep/os/win/wposix/waio.h" -#elif OS_ANDROID +#elif OS_ANDROID || OS_OPENBSD // Android doesn't provide aio.h. We don't actually use aio on Linuxes (see // CONFIG2_FILE_ENABLE_AIO) but we use its symbols and structs, so define // them here +# if OS_OPENBSD +// OpenBSD 5.1 (latest version at time of writing) has no struct sigevent defined, +// so we do this here. +struct sigevent +{ + int sigev_notify; + int sigev_signo; + union sigval sigev_value; + void (*sigev_notify_function)(union sigval); + pthread_attr_t *sigev_notify_attributes; +}; +# endif # define LIO_READ 0 # define LIO_WRITE 1 # define LIO_NOP 2 diff --git a/source/lib/posix/posix_mman.h b/source/lib/posix/posix_mman.h index 3d2ca35e78..d14f3039d1 100644 --- a/source/lib/posix/posix_mman.h +++ b/source/lib/posix/posix_mman.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 Wildfire Games +/* Copyright (c) 2012 Wildfire Games * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -20,6 +20,9 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef INCLUDED_POSIX_MMAN +#define INCLUDED_POSIX_MMAN + #if OS_WIN # include "lib/sysdep/os/win/wposix/wmman.h" #else @@ -27,3 +30,5 @@ #endif #include "lib/posix/posix_errno.h" // for user convenience + +#endif // #ifndef INCLUDED_POSIX_MMAN diff --git a/source/lib/secure_crt.cpp b/source/lib/secure_crt.cpp index 51123aad89..849c76eaf2 100644 --- a/source/lib/secure_crt.cpp +++ b/source/lib/secure_crt.cpp @@ -106,7 +106,7 @@ STATUS_ADD_DEFINITIONS(secureCrtStatusDefinitions); // self-test and the t* defines (needed for test). #if EMULATE_SECURE_CRT -#if !OS_UNIX || OS_MACOSX +#if !OS_UNIX || OS_MACOSX || OS_OPENBSD // return length [in characters] of a string, not including the trailing // null character. to protect against access violations, only the // first characters are examined; if the null character is diff --git a/source/lib/secure_crt.h b/source/lib/secure_crt.h index fb84c5ee76..b21566bb7d 100644 --- a/source/lib/secure_crt.h +++ b/source/lib/secure_crt.h @@ -47,12 +47,15 @@ namespace ERR #if EMULATE_SECURE_CRT // (conflicts with glibc definitions) -#if !OS_UNIX || OS_MACOSX +#if !OS_UNIX || OS_MACOSX || OS_OPENBSD // return length [in characters] of a string, not including the trailing // null character. to protect against access violations, only the // first characters are examined; if the null character is // not encountered by then, is returned. +// strnlen is available on OpenBSD +#if !OS_OPENBSD extern size_t strnlen(const char* str, size_t max_len); +#endif extern size_t wcsnlen(const wchar_t* str, size_t max_len); #endif diff --git a/source/lib/sysdep/os.h b/source/lib/sysdep/os.h index 5d0d162032..42e8f11db1 100644 --- a/source/lib/sysdep/os.h +++ b/source/lib/sysdep/os.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010 Wildfire Games +/* Copyright (c) 2012 Wildfire Games * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -68,9 +68,16 @@ // BSD #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) # define OS_BSD 1 +// OpenBSD has no aio.h and we need a way to disable it for it only +# if defined(__OpenBSD__) +# define OS_OPENBSD 1 +# endif #else # define OS_BSD 0 #endif +#ifndef OS_OPENBSD +# define OS_OPENBSD 0 +#endif // Solaris #if defined(sun) || defined(__sun) # define OS_SOLARIS 1 diff --git a/source/lib/sysdep/os/bsd/bcpu.cpp b/source/lib/sysdep/os/bsd/bcpu.cpp index ea3394520b..609bca942b 100644 --- a/source/lib/sysdep/os/bsd/bcpu.cpp +++ b/source/lib/sysdep/os/bsd/bcpu.cpp @@ -28,6 +28,7 @@ #include "lib/module_init.h" #include "valgrind.h" +#include #include size_t os_cpu_NumProcessors() diff --git a/source/maths/Brush.cpp b/source/maths/Brush.cpp index 672284374f..90f27f7afc 100644 --- a/source/maths/Brush.cpp +++ b/source/maths/Brush.cpp @@ -413,4 +413,4 @@ void CBrush::GetFaces(std::vector >& out) const faceStartIdx = j + 1; } -} \ No newline at end of file +} diff --git a/source/ps/CStrIntern.h b/source/ps/CStrIntern.h index 87e4adbf53..405ffe7fae 100644 --- a/source/ps/CStrIntern.h +++ b/source/ps/CStrIntern.h @@ -83,4 +83,4 @@ private: CStrInternInternals* m; }; -#endif // INCLUDED_CSTRINTERN \ No newline at end of file +#endif // INCLUDED_CSTRINTERN diff --git a/source/ps/Font.cpp b/source/ps/Font.cpp index 01ca07038e..4cc366823d 100644 --- a/source/ps/Font.cpp +++ b/source/ps/Font.cpp @@ -81,4 +81,4 @@ const std::map& CFont::GetGlyphs() Handle CFont::GetTexture() { return unifont_get_texture(h); -} \ No newline at end of file +} diff --git a/source/ps/PreprocessorWrapper.cpp b/source/ps/PreprocessorWrapper.cpp index 0124f85b3e..4f5ff39aac 100644 --- a/source/ps/PreprocessorWrapper.cpp +++ b/source/ps/PreprocessorWrapper.cpp @@ -83,4 +83,4 @@ CStr CPreprocessorWrapper::Preprocess(const CStr& input) free(output); return ret; -} \ No newline at end of file +} diff --git a/source/ps/PreprocessorWrapper.h b/source/ps/PreprocessorWrapper.h index 8bf24d27c8..37c6af6c54 100644 --- a/source/ps/PreprocessorWrapper.h +++ b/source/ps/PreprocessorWrapper.h @@ -41,4 +41,4 @@ private: CPreprocessor m_Preprocessor; }; -#endif // INCLUDED_PREPROCESSORWRAPPER \ No newline at end of file +#endif // INCLUDED_PREPROCESSORWRAPPER diff --git a/source/ps/Profiler2GPU.cpp b/source/ps/Profiler2GPU.cpp index e4cbffb1b0..22d6379449 100644 --- a/source/ps/Profiler2GPU.cpp +++ b/source/ps/Profiler2GPU.cpp @@ -871,4 +871,4 @@ void CProfiler2GPU::FrameEnd() { } void CProfiler2GPU::RegionEnter(const char* UNUSED(id)) { } void CProfiler2GPU::RegionLeave(const char* UNUSED(id)) { } -#endif \ No newline at end of file +#endif diff --git a/source/renderer/OverlayRenderer.cpp b/source/renderer/OverlayRenderer.cpp index 18f73743a6..be36f08ee8 100644 --- a/source/renderer/OverlayRenderer.cpp +++ b/source/renderer/OverlayRenderer.cpp @@ -606,4 +606,4 @@ void OverlayRenderer::RenderForegroundOverlays(const CCamera& viewCamera) glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); #endif -} \ No newline at end of file +} diff --git a/source/renderer/TexturedLineRData.h b/source/renderer/TexturedLineRData.h index f9d04be96d..2a50cd596a 100644 --- a/source/renderer/TexturedLineRData.h +++ b/source/renderer/TexturedLineRData.h @@ -85,4 +85,4 @@ protected: CVertexBuffer::VBChunk* m_VBIndices; }; -#endif // INCLUDED_TEXTUREDLINERDATA \ No newline at end of file +#endif // INCLUDED_TEXTUREDLINERDATA diff --git a/source/simulation2/components/tests/test_ObstructionManager.h b/source/simulation2/components/tests/test_ObstructionManager.h index 699db5a5b2..9108723a2d 100644 --- a/source/simulation2/components/tests/test_ObstructionManager.h +++ b/source/simulation2/components/tests/test_ObstructionManager.h @@ -474,4 +474,4 @@ public: TS_ASSERT_EQUALS(obSquare3.u, CFixedVector2D(fixed::FromInt(1), fixed::FromInt(0))); TS_ASSERT_EQUALS(obSquare3.v, CFixedVector2D(fixed::FromInt(0), fixed::FromInt(1))); } -}; \ No newline at end of file +}; diff --git a/source/simulation2/helpers/Render.cpp b/source/simulation2/helpers/Render.cpp index 712a6d40a4..2bee4d2fd7 100644 --- a/source/simulation2/helpers/Render.cpp +++ b/source/simulation2/helpers/Render.cpp @@ -567,4 +567,4 @@ void SimRender::SubdividePoints(std::vector& points, float maxSegment } points.swap(newPoints); -} \ No newline at end of file +}