From fc27a5c0ea07fb82060bfaed98d75f8f8c6dc35c Mon Sep 17 00:00:00 2001 From: historic_bruno Date: Mon, 30 Jan 2012 06:21:11 +0000 Subject: [PATCH] More FreeBSD build fixes. Fixes some warnings about files that don't end with newline. This was SVN commit r10991. --- build/premake/premake4.lua | 38 +++++++++---------- build/premake/premake4/premake4.lua | 6 ++- source/graphics/TerritoryBoundary.h | 2 +- source/lib/sysdep/os/unix/x/x.cpp | 4 +- source/maths/BoundingBoxOriented.h | 2 +- source/mocks/mocks_real.cpp | 4 +- source/mocks/mocks_test.cpp | 4 +- source/ps/Compress.h | 4 +- source/ps/GameSetup/GameSetup.cpp | 2 +- .../simulation2/components/ICmpSelectable.cpp | 4 +- .../scripting/EngineScriptConversions.cpp | 4 +- source/third_party/mongoose/mongoose.cpp | 4 ++ .../Handlers/GraphicsSetupHandlers.cpp | 2 +- 13 files changed, 42 insertions(+), 38 deletions(-) diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index 4727bfa09c..8099d11260 100644 --- a/build/premake/premake4.lua +++ b/build/premake/premake4.lua @@ -732,35 +732,26 @@ function setup_main_exe () -- see manifest.cpp project_add_manifest() - elseif os.is("linux") then + elseif os.is("linux") or os.is("bsd") then -- Libraries links { "fam", -- Utilities "rt", - -- Dynamic libraries (needed for linking for gold) - "dl", } - -- Threading support - buildoptions { "-pthread" } - linkoptions { "-pthread" } - - -- For debug_resolve_symbol - configuration "Debug" - linkoptions { "-rdynamic" } - configuration { } - - elseif os.is("bsd") then - - -- Libraries - links { - "fam", - "execinfo", - -- Utilities - "rt", - } + if os.is("linux") then + links { + -- Dynamic libraries (needed for linking for gold) + "dl", + } + elseif os.is("bsd") then + links { + -- Needed for backtrace* on FreeBSD + "execinfo", + } + end -- Threading support buildoptions { "-pthread" } @@ -1147,6 +1138,11 @@ function setup_tests() -- Dynamic libraries (needed for linking for gold) "dl", } + elseif os.is("bsd") then + links { + -- Needed for backtrace* on FreeBSD + "execinfo", + } end -- Threading support diff --git a/build/premake/premake4/premake4.lua b/build/premake/premake4/premake4.lua index 503930ba92..6cacae37eb 100644 --- a/build/premake/premake4/premake4.lua +++ b/build/premake/premake4/premake4.lua @@ -49,9 +49,13 @@ configuration "vs*" defines { "_CRT_SECURE_NO_WARNINGS" } + configuration "bsd" + defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } + links { "m" } + configuration "linux" defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } - links { "m", "dl" } + links { "m", "dl" } configuration "macosx" defines { "LUA_USE_MACOSX" } diff --git a/source/graphics/TerritoryBoundary.h b/source/graphics/TerritoryBoundary.h index 5c962ea98a..f490f50314 100644 --- a/source/graphics/TerritoryBoundary.h +++ b/source/graphics/TerritoryBoundary.h @@ -63,4 +63,4 @@ public: static std::vector ComputeBoundaries(const Grid* territories); }; -#endif \ No newline at end of file +#endif // INCLUDED_TERRITORYBOUNDARY diff --git a/source/lib/sysdep/os/unix/x/x.cpp b/source/lib/sysdep/os/unix/x/x.cpp index d2034bdf76..4b868cbd0e 100644 --- a/source/lib/sysdep/os/unix/x/x.cpp +++ b/source/lib/sysdep/os/unix/x/x.cpp @@ -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 @@ -24,7 +24,7 @@ #include "precompiled.h" -#if OS_LINUX +#if OS_LINUX || OS_BSD # define HAVE_X 1 #else # define HAVE_X 0 diff --git a/source/maths/BoundingBoxOriented.h b/source/maths/BoundingBoxOriented.h index 5efce10762..fd796ef037 100644 --- a/source/maths/BoundingBoxOriented.h +++ b/source/maths/BoundingBoxOriented.h @@ -104,4 +104,4 @@ public: static const CBoundingBoxOriented EMPTY; }; -#endif // INCLUDED_BOX \ No newline at end of file +#endif // INCLUDED_BOX diff --git a/source/mocks/mocks_real.cpp b/source/mocks/mocks_real.cpp index 4ef3b0a1b6..1bdd8c9c2c 100644 --- a/source/mocks/mocks_real.cpp +++ b/source/mocks/mocks_real.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -25,7 +25,7 @@ #endif #include "lib/precompiled.h" -#if OS_LINUX +#if OS_LINUX || OS_BSD #include "mocks/dlfcn.h" #include "mocks/unistd.h" #endif // OS_LINUX diff --git a/source/mocks/mocks_test.cpp b/source/mocks/mocks_test.cpp index 37ed2d037e..11299fb03b 100644 --- a/source/mocks/mocks_test.cpp +++ b/source/mocks/mocks_test.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -28,7 +28,7 @@ // Cause calls to be redirected to the real function by default #define DEFAULT(name) static T::Real_##name real_##name -#if OS_LINUX +#if OS_LINUX || OS_BSD #include "mocks/dlfcn.h" DEFAULT(dladdr); diff --git a/source/ps/Compress.h b/source/ps/Compress.h index e7e71b9922..013eef8ad5 100644 --- a/source/ps/Compress.h +++ b/source/ps/Compress.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -27,4 +27,4 @@ void CompressZLib(const std::string& data, std::string& out, bool includeLengthH void DecompressZLib(const std::string& data, std::string& out, bool includeLengthHeader); -#endif // INCLUDED_COMPRESS \ No newline at end of file +#endif // INCLUDED_COMPRESS diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 8e335eee32..c40dd12ec9 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -714,7 +714,7 @@ void Shutdown(int UNUSED(flags)) #if OS_UNIX static void FixLocales() { -#if OS_MACOSX +#if OS_MACOSX || OS_BSD // OS X requires a UTF-8 locale in LC_CTYPE so that *wprintf can handle // wide characters. Peculiarly the string "UTF-8" seems to be acceptable // despite not being a real locale, and it's conveniently language-agnostic, diff --git a/source/simulation2/components/ICmpSelectable.cpp b/source/simulation2/components/ICmpSelectable.cpp index dc959eab80..07c4b5112b 100644 --- a/source/simulation2/components/ICmpSelectable.cpp +++ b/source/simulation2/components/ICmpSelectable.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -27,4 +27,4 @@ BEGIN_INTERFACE_WRAPPER(Selectable) DEFINE_INTERFACE_METHOD_1("SetSelectionHighlight", void, ICmpSelectable, SetSelectionHighlight, CColor) END_INTERFACE_WRAPPER(Selectable) -bool ICmpSelectable::ms_EnableDebugOverlays = false; \ No newline at end of file +bool ICmpSelectable::ms_EnableDebugOverlays = false; diff --git a/source/simulation2/scripting/EngineScriptConversions.cpp b/source/simulation2/scripting/EngineScriptConversions.cpp index 7a1544e5fe..06d63448e1 100644 --- a/source/simulation2/scripting/EngineScriptConversions.cpp +++ b/source/simulation2/scripting/EngineScriptConversions.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Wildfire Games. +/* Copyright (C) 2012 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -245,4 +245,4 @@ template<> jsval ScriptInterface::ToJSVal >(JSContext* cx, const Grid jsval ScriptInterface::ToJSVal >(JSContext* cx, const Grid& val) { return ToJSVal_Grid(cx, val); -} \ No newline at end of file +} diff --git a/source/third_party/mongoose/mongoose.cpp b/source/third_party/mongoose/mongoose.cpp index 06782b11c0..48bbe0ee99 100644 --- a/source/third_party/mongoose/mongoose.cpp +++ b/source/third_party/mongoose/mongoose.cpp @@ -37,6 +37,10 @@ #undef DEBUG +#if defined(__FreeBSD__) +// Fix undefined PF_INET on FreeBSD +#include +#endif // Copyright (c) 2004-2011 Sergey Lyubka // diff --git a/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp index 87789add84..a83ef983fc 100644 --- a/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp @@ -57,7 +57,7 @@ MESSAGEHANDLER(InitGraphics) { UNUSED2(msg); -#if OS_LINUX || OS_MACOSX || (OS_WIN && !CONFIG2_WSDL) +#if OS_UNIX || (OS_WIN && !CONFIG2_WSDL) // When using GLX (Linux), SDL has to load the GL library to find // glXGetProcAddressARB before it can load any extensions. // When running in Atlas, we skip the SDL video initialisation code