Added support for Haiku OS (Yuriy O'Donnell)

This commit is contained in:
Jason Perkins 2011-02-10 12:24:51 -05:00
parent b3dfe26ec6
commit a69bcbfb58
10 changed files with 462 additions and 412 deletions

View File

@ -6,6 +6,7 @@ build
bin
obj
release
ipch
src/host/scripts.c
Makefile

View File

@ -2,6 +2,7 @@
4.4 (in progress)
-------
* Added support for Haiku OS (Yuriy O'Donnell)
* Patch 2963313: Enable setting .NET framework version (Justen Hyde)
* Switched PS3 builds from GCC to SNC
* Ignore NoRTTI flag for Managed C++ projects (Nick Darnell)

View File

@ -60,7 +60,7 @@
buildoptions { "-mmacosx-version-min=10.1" }
linkoptions { "-lstdc++-static", "-mmacosx-version-min=10.1" }
configuration { "not windows", "not solaris" }
configuration { "linux", "bsd", "macosx" }
linkoptions { "-rdynamic" }
configuration { "solaris" }

View File

@ -1,7 +1,7 @@
--
-- cmdline.lua
-- Functions to define and handle command line actions and options.
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
--
@ -52,6 +52,7 @@
description = "Generate files for a different operating system",
allowed = {
{ "bsd", "OpenBSD, NetBSD, or FreeBSD" },
{ "haiku", "Haiku" },
{ "linux", "Linux" },
{ "macosx", "Apple Mac OS X" },
{ "solaris", "Solaris" },

View File

@ -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" }

View File

@ -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
@ -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"

View File

@ -1,7 +1,7 @@
--
-- gcc.lua
-- Provides GCC-specific configuration strings.
-- Copyright (c) 2002-2008 Jason Perkins and the Premake project
-- Copyright (c) 2002-2011 Jason Perkins and the Premake project
--
@ -50,15 +50,15 @@
premake.gcc.platforms =
{
Native = {
cppflags = "-MMD -MP",
cppflags = "-MMD",
},
x32 = {
cppflags = "-MMD -MP",
cppflags = "-MMD",
flags = "-m32",
ldflags = "-L/usr/lib32",
},
x64 = {
cppflags = "-MMD -MP",
cppflags = "-MMD",
flags = "-m64",
ldflags = "-L/usr/lib64",
},
@ -78,7 +78,7 @@
cc = "ppu-lv2-g++",
cxx = "ppu-lv2-g++",
ar = "ppu-lv2-ar",
cppflags = "-MMD -MP",
cppflags = "-MMD",
}
}
@ -90,11 +90,20 @@
--
function premake.gcc.getcppflags(cfg)
local result = { }
table.insert(result, platforms[cfg.platform].cppflags)
return result
local flags = { }
table.insert(flags, platforms[cfg.platform].cppflags)
-- We want the -MP flag for dependency generation (creates phony rules
-- for headers, prevents make errors if file is later deleted), but
-- Haiku doesn't support it (yet)
if flags[1]:startswith("-MMD") and cfg.system ~= "haiku" then
table.insert(flags, "-MP")
end
return flags
end
function premake.gcc.getcflags(cfg)
local result = table.translate(cfg.flags, cflags)
table.insert(result, platforms[cfg.platform].flags)
@ -104,6 +113,7 @@
return result
end
function premake.gcc.getcxxflags(cfg)
local result = table.translate(cfg.flags, cxxflags)
return result

View File

@ -1,7 +1,7 @@
--
-- tests/base/test_os.lua
-- Automated test suite for the new OS functions.
-- Copyright (c) 2008-2010 Jason Perkins and the Premake project
-- Copyright (c) 2008-2011 Jason Perkins and the Premake project
--
@ -14,8 +14,13 @@
--
function suite.findlib_FindSystemLib()
local libname = iif(os.is("windows"), "user32", "m")
test.istrue(os.findlib(libname))
if os.is("windows") then
test.istrue(os.findlib("user32"))
elseif os.is("haiku") then
test.istrue(os.findlib("root"))
else
test.istrue(os.findlib("m"))
end
end
function suite.findlib_FailsOnBadLibName()

View File

@ -1,7 +1,7 @@
--
-- tests/premake4.lua
-- Automated test suite for Premake 4.x
-- Copyright (c) 2008-2010 Jason Perkins and the Premake project
-- Copyright (c) 2008-2011 Jason Perkins and the Premake project
--
dofile("testfx.lua")
@ -44,7 +44,6 @@
dofile("test_platforms.lua")
dofile("test_targets.lua")
dofile("test_keywords.lua")
dofile("test_gcc.lua")
dofile("test_gmake_cpp.lua")
dofile("test_gmake_cs.lua")
dofile("base/test_api.lua")
@ -55,6 +54,7 @@
dofile("base/test_path.lua")
dofile("base/test_table.lua")
dofile("base/test_tree.lua")
dofile("tools/test_gcc.lua")
-- Clean tests
dofile("actions/test_clean.lua")

View File

@ -1,7 +1,7 @@
--
-- tests/test_gcc.lua
-- Automated test suite for the GCC toolset interface.
-- Copyright (c) 2009 Jason Perkins and the Premake project
-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
T.gcc = { }
@ -23,6 +23,28 @@
end
--
-- CPPFLAGS tests
--
function suite.cppflags_OnWindows()
cfg.system = "windows"
local r = premake.gcc.getcppflags(cfg)
test.isequal("-MMD -MP", table.concat(r, " "))
end
function suite.cppflags_OnHaiku()
cfg.system = "haiku"
local r = premake.gcc.getcppflags(cfg)
test.isequal("-MMD", table.concat(r, " "))
end
--
-- CFLAGS tests
--
function suite.cflags_SharedLib_Windows()
cfg.kind = "SharedLib"
cfg.system = "windows"
@ -31,14 +53,6 @@
end
function suite.ldflags_SharedLib_Windows()
cfg.kind = "SharedLib"
cfg.system = "windows"
local r = premake.gcc.getldflags(cfg)
test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
end
function suite.cflags_OnFpFast()
cfg.flags = { "FloatFast" }
local r = premake.gcc.getcflags(cfg)
@ -53,6 +67,18 @@
end
--
-- LDFLAGS tests
--
function suite.ldflags_SharedLib_Windows()
cfg.kind = "SharedLib"
cfg.system = "windows"
local r = premake.gcc.getldflags(cfg)
test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
end
function suite.linkflags_OnFrameworks()
cfg.links = { "Cocoa.framework" }
local r = premake.gcc.getlinkflags(cfg)