Ticket #2804: bsd_fixes_2.diff

File bsd_fixes_2.diff, 6.7 KB (added by Guido Falsi, 10 years ago)

Revised patch for BSD.

  • build/premake/extern_libs4.lua

     
    235235                -- Suppress all the Boost warnings on OS X by including it as a system directory
    236236                buildoptions { "-isystem../" .. libraries_dir .. "boost/include" }
    237237            end
    238             if os.getversion().description == "OpenBSD" then
     238            -- TODO: This actually applies to most libraries we use on BSDs, make this a global setting.
     239            if os.is("bsd") then
    239240                includedirs { "/usr/local/include" }
    240241            end
    241242        end,
     
    347348            elseif os.is("macosx") then
    348349                add_default_include_paths("iconv")
    349350                defines { "LIBICONV_STATIC" }
     351            elseif os.getversion().description == "FreeBSD" then
     352                defines { "HAVE_ICONV_CONST" }
    350353            end
    351354        end,
    352355        link_settings = function()
     
    355358            end
    356359            add_default_links({
    357360                win_names  = { "libiconv" },
    358                 -- TODO: glibc provides symbols for this, so we should only include that (and depend on libiconv) on non-glibc unix
    359361                osx_names = { "iconv" },
    360362                dbg_suffix = "",
    361363            })
     364            -- glibc (used on Linux and GNU/kFreeBSD) has iconv
     365            -- FreeBSD 10+ has iconv as a part of libc
     366            if os.is("bsd")
     367               and not (os.getversion().description == "FreeBSD" and os.getversion().majorversion >= 10
     368                        or os.getversion().description == "GNU/kFreeBSD") then
     369                add_default_links({
     370                    bsd_names = { "iconv" },
     371                })
     372            end
    362373        end,
    363374    },
    364375    icu = {
  • build/premake/premake4.lua

     
    3838
    3939dofile("extern_libs4.lua")
    4040
     41-- detect compiler for non-Windows
     42if os.is("macosx") then
     43    cc = "clang"
     44elseif os.is("linux") and _OPTIONS["icc"] then
     45    cc = "icc"
     46elseif not os.is("windows") then
     47    cc = os.getenv("CC")
     48    if cc == nil or cc == "" then
     49        local hasgcc = os.execute("which gcc > .gccpath")
     50        local f = io.open(".gccpath", "r")
     51        local gccpath = f:read("*line")
     52        f:close()
     53        os.execute("rm .gccpath")
     54        if gccpath == nil then
     55            cc = "clang"
     56        else
     57            cc = "gcc"
     58        end
     59    end
     60end
     61
     62-- TODO: proper clang support
     63if cc == "clang" then
     64    premake.gcc.cc  = "clang"
     65    premake.gcc.cxx = "clang++"
     66end
     67
    4168-- detect CPU architecture (simplistic, currently only supports x86, amd64 and ARM)
    4269arch = "x86"
    4370if _OPTIONS["android"] then
     
    5178    if arch == "x86_64" or arch == "amd64" then
    5279        arch = "amd64"
    5380    else
    54         os.execute("gcc -dumpmachine > .gccmachine.tmp")
     81        os.execute(cc .. " -dumpmachine > .gccmachine.tmp")
    5582        local f = io.open(".gccmachine.tmp", "r")
    5683        local machine = f:read("*line")
    5784        f:close()
     
    6794    end
    6895end
    6996
    70 -- Hack to force clang as default compiler on OS X
    71 -- TODO: proper clang support
    72 if os.is("macosx") then
    73     premake.gcc.cc  = "clang"
    74     premake.gcc.cxx = "clang++"
    75 end
    76 
    7797-- Set up the Solution
    7898solution "pyrogenesis"
    7999targetdir(rootdir.."/binaries/system")
     
    109129    -- It's too late to do this test by the time we start compiling the PCH file, so
    110130    -- do the test in this build script instead (which is kind of ugly - please fix if
    111131    -- you have a better idea)
    112     if not _OPTIONS["icc"] then
     132    if cc == "gcc" then
    113133        os.execute("gcc -dumpversion > .gccver.tmp")
    114134        local f = io.open(".gccver.tmp", "r")
    115135        major, dot, minor = f:read(1, 1, 1)
     
    158178function project_set_build_flags()
    159179
    160180    flags { "Symbols", "NoEditAndContinue" }
    161     if not _OPTIONS["icc"] and (os.is("windows") or not _OPTIONS["minimal-flags"]) then
     181    if cc ~= "icc" and (os.is("windows") or not _OPTIONS["minimal-flags"]) then
    162182        -- adds the -Wall compiler flag
    163183        flags { "ExtraWarnings" } -- this causes far too many warnings/remarks on ICC
    164184    end
     
    218238        end
    219239
    220240    else    -- *nix
    221         if _OPTIONS["icc"] and not _OPTIONS["minimal-flags"] then
     241        if cc == "icc" and not _OPTIONS["minimal-flags"] then
    222242            buildoptions {
    223243                "-w1",
    224244                -- "-Wabi",
     
    391411-- bundled libs
    392412function project_add_x11_dirs()
    393413    if not os.is("windows") and not os.is("macosx") then
    394         -- X11 includes may be installed in one of a gadzillion of three places
     414        -- X11 includes may be installed in one of a gadzillion of five places
    395415        -- Famous last words: "You can't include too much! ;-)"
    396416        includedirs {
    397417            "/usr/X11R6/include/X11",
    398418            "/usr/X11R6/include",
     419            "/usr/local/include/X11",
     420            "/usr/local/include",
    399421            "/usr/include/X11"
    400422        }
    401423        libdirs { "/usr/X11R6/lib" }
  • libraries/source/fcollada/src/Makefile

     
    77    PIC_FLAGS ?= -fpic
    88endif
    99
     10ifeq ($(OS_ARCH),FreeBSD)
     11    DIRS_SH=csh
     12else
     13    DIRS_SH=sh
     14endif
     15
    1016CXX ?= g++
    1117CXXFLAGS += -fvisibility=hidden -W -Wall -Wno-unused-parameter -Wno-unused-function $(OS_DEFINE) $(PIC_FLAGS) $(CPPFLAGS)
    1218CXXFLAGS_DEBUG := -O0 -g -D_DEBUG -DRETAIL
     
    227233all: output_dirs output/libFColladaSD.a output/libFColladaSR.a install
    228234
    229235output_dirs:
    230     bash -c 'mkdir -p output/{debug,release,test}/{FCollada/{FCDocument,FMath,FUtils,FColladaTest/{FCTestAssetManagement,FCTestExportImport,FCTestXRef}},FColladaPlugins/FArchiveXML}'
     236    $(DIRS_SH) -c 'mkdir -p output/{debug,release,test}/{FCollada/{FCDocument,FMath,FUtils,FColladaTest/{FCTestAssetManagement,FCTestExportImport,FCTestXRef}},FColladaPlugins/FArchiveXML}'
    231237
    232238test: FCollada/FColladaTest/ output/FColladaTest
    233239    ( cd FCollada/FColladaTest/ ; ../../output/FColladaTest )
  • libraries/source/spidermonkey/build.sh

     
    103103  LIB_PREFIX=lib
    104104  LIB_SRC_SUFFIX=.so
    105105  LIB_DST_SUFFIX=.so
     106  if [ "`uname -s`" = "OpenBSD" ]
     107  then
     108    DLL_SRC_SUFFIX=.so.1.0
     109    DLL_DST_SUFFIX=.so.1.0
     110    LIB_SRC_SUFFIX=.so.1.0
     111    LIB_DST_SUFFIX=:so.1.0
     112  fi
    106113fi
    107114
    108115# Copy files into the necessary locations for building and running the game
  • source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp

     
    158158                    wxString x(xmlData->GetNodeContent());
    159159                    unsigned long xTmp = 0;
    160160                    x.ToULong(&xTmp);
    161                     wxASSERT(xTmp <= (unsigned long)UINT32_MAX);
     161                    wxASSERT(xTmp <= (unsigned long)std::numeric_limits<unsigned int>::max());
    162162                    actorSeed = xTmp;
    163163                }
    164164