Ticket #1463: openbsd.diff

File openbsd.diff, 19.4 KB (added by leper, 12 years ago)
  • binaries/data/config/default.cfg

     
    55; * create a text file called "local.cfg" instead, and copy    *
    66; * the lines from this file that you want to change.          *
    77; *                                                            *
    8 ; * On Linux / OS X, create:                                   *
    9 ; *   ~/.config/0ad/config/local.cfg                           *
     8; * On Linux, create:                                          *
     9; *   $XDG_CONFIG_HOME/0ad/config/local.cfg                    *
     10; *   (Note: $XDG_CONFIG_HOME defaults to ~/.config)           *
     11; *                                                            *
     12; * On OS X, create:                                           *
     13; *   ~/Library/Application\ Support/0ad/config/local.cfg      *
    1014; *                                                            *
    1115; * On Windows, create:                                        *
    12 ; *   %appdata%/0ad/config/local.cfg                           *
     16; *   %appdata%\0ad\config\local.cfg                           *
    1317; *                                                            *
    1418; **************************************************************
    1519
  • build/premake/extern_libs4.lua

     
    211211            if os.is("windows") then
    212212                add_default_include_paths("boost")
    213213            end
     214            if os.typeis("OpenBSD") then
     215                includedirs { "/usr/local/include" }
     216            end
    214217        end,
    215218        link_settings = function()
    216219            if os.is("windows") then
     
    356359            if os.is("windows") then
    357360                add_default_include_paths("libpng")
    358361            end
     362            if os.typeis("OpenBSD") then
     363                includedirs { "/usr/local/include/libpng" }
     364            end
    359365        end,
    360366        link_settings = function()
    361367            if os.is("windows") then
     
    539545            if os.is("windows") then
    540546                add_default_lib_paths("vorbis")
    541547            end
     548            if os.typeis("OpenBSD") then
     549                add_default_links({
     550                    unix_names = { "ogg",
     551                        "vorbis" },
     552                })
     553            end
    542554            add_default_links({
    543555                win_names  = { "vorbisfile" },
    544556                unix_names = { "vorbisfile" },
  • build/premake/premake4.lua

     
    307307                if _ACTION == "gmake" then
    308308                    linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
    309309                elseif _ACTION == "codeblocks" then
    310                     linkoptions { "-Wl,-R\\\\$$ORIGIN" }               
     310                    linkoptions { "-Wl,-R\\\\$$ORIGIN" }
    311311                end
    312312            end
    313313        end
     
    338338    elseif os.is("macosx") then
    339339        return "ConsoleApp"
    340340    else
    341         return "WindowedApp"       
     341        return "WindowedApp"
    342342    end
    343343end
    344344
     
    609609        "cxxtest",
    610610    }
    611611
    612         if not _OPTIONS["without-audio"] then
     612    if not _OPTIONS["without-audio"] then
    613613        table.insert(extern_libs, "openal")
    614614        table.insert(extern_libs, "vorbis")
    615615    end
     
    765765            links { "fam" }
    766766        end
    767767
    768         if not _OPTIONS["android"] then
     768        -- TODO pyrogenesis/test on OpenBSD link vorbis and ogg too (not only vorbisfile)
     769        if not _OPTIONS["android"] and not os.typeis("OpenBSD") then
    769770            links { "rt" }
    770771        end
    771772
     
    774775            linkoptions { "-Wl,--fix-cortex-a8" }
    775776        end
    776777
    777         if os.is("linux") then
     778        if os.is("linux") or os.typeis("GNU/kFreeBSD") then
    778779            links {
    779780                -- Dynamic libraries (needed for linking for gold)
    780781                "dl",
    781782            }
    782783        elseif os.is("bsd") then
    783784            links {
    784                 -- Needed for backtrace* on FreeBSD
     785                -- Needed for backtrace* on BSDs
    785786                "execinfo",
    786787            }
    787788        end
     
    10141015        linkoptions { "-rdynamic" }
    10151016
    10161017    elseif os.is("bsd") then
    1017         -- define BSD-something?
     1018        if os.typeis("OpenBSD") then
     1019            links { "c", }
     1020        end
    10181021
    10191022        buildoptions { "-fno-strict-aliasing" }
    10201023
     
    11801183            links { "fam" }
    11811184        end
    11821185
    1183         if not _OPTIONS["android"] then
     1186        if not _OPTIONS["android"] and not os.typeis("OpenBSD") then
    11841187            links { "rt" }
    11851188        end
    11861189
     
    11891192            linkoptions { "-Wl,--fix-cortex-a8" }
    11901193        end
    11911194
    1192         if os.is("linux") then
     1195        if os.is("linux") or os.typeis("GNU/kFreeBSD") then
    11931196            links {
    11941197                -- Dynamic libraries (needed for linking for gold)
    11951198                "dl",
    11961199            }
    11971200        elseif os.is("bsd") then
    11981201            links {
    1199                 -- Needed for backtrace* on FreeBSD
     1202                -- Needed for backtrace* on BSDs
    12001203                "execinfo",
    12011204            }
    12021205        end
  • build/premake/premake4/src/base/os.lua

     
    6565    end
    6666   
    6767
    68    
    6968--
    7069-- Check the current operating system; may be set with the /os command line flag.
    7170--
     
    7372    function os.is(id)
    7473        return (os.get():lower() == id:lower())
    7574    end
    76    
    77    
     75
     76    function os.typeget()
     77        return _OS_TYPE
     78    end
     79--
     80-- Check the current operating system type (currently only which BSD variation)
     81--
     82    function os.typeis(t)
     83        return (os.typeget():lower() == t:lower())
     84    end
    7885
    7986--
    8087-- The os.matchdirs() and os.matchfiles() functions
  • build/premake/premake4/src/host/premake.c

     
    8787    lua_pushstring(L, PLATFORM_STRING);
    8888    lua_setglobal(L, "_OS");
    8989
     90    /* set the OS platform type */
     91    lua_pushstring(L, PLATFORM_OS_TYPE);
     92    lua_setglobal(L, "_OS_TYPE");
     93
    9094    /* Parse the command line arguments */
    9195    if (z == OKAY)  z = process_arguments(L, argc, argv);
    9296
  • build/premake/premake4/src/host/premake.h

     
    1818#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
    1919#define PLATFORM_BSD      (1)
    2020#define PLATFORM_STRING   "bsd"
     21# if defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)
     22#  define PLATFORM_OS_TYPE "GNU/kFreeBSD"
     23# elif defined(__FreeBSD__)
     24#  define PLATFORM_OS_TYPE "FreeBSD"
     25# elif defined(__NetBSD__)
     26#  define PLATFORM_OS_TYPE "NetBSD"
     27# elif defined(__OpenBSD__)
     28#  define PLATFORM_OS_TYPE "OpenBSD"
     29# endif
    2130#elif defined(__APPLE__) && defined(__MACH__)
    2231#define PLATFORM_MACOSX   (1)
    2332#define PLATFORM_STRING   "macosx"
     
    2938#define PLATFORM_STRING   "windows"
    3039#endif
    3140
     41#ifndef PLATFORM_OS_TYPE
     42# define PLATFORM_OS_TYPE ""
     43#endif
     44
    3245
    3346/* Pull in platform-specific headers required by built-in functions */
    3447#if PLATFORM_WINDOWS
  • build/premake/premake4/src/host/scripts.c

     
    44
    55const char* builtin_scripts[] = {
    66    /* base/os.lua */
    7     "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"
     7    "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\nfunction os.typeget()\nreturn _OS_TYPE\nend\nfunction os.typeis(t)\nreturn (os.typeget():lower() == t:lower())\nend\nlocal function domatch(result, mask, wantfiles)\nif mas"
    88    "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"
    99    "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",
    1010
  • source/lib/config2.h

     
    1 /* Copyright (c) 2010 Wildfire Games
     1/* Copyright (c) 2012 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    7373#ifndef CONFIG2_FILE_ENABLE_AIO
    7474// work around a bug introduced in Linux 2.6.38
    7575// (http://www.wildfiregames.com/forum/index.php?showtopic=14561&view=findpost&p=217710)
    76 # if OS_LINUX
     76// OpenBSD doesn't provide aio.h so we disable its use
     77# if OS_LINUX || OS_OPENBSD
    7778#  define CONFIG2_FILE_ENABLE_AIO 0
    7879# else
    7980#  define CONFIG2_FILE_ENABLE_AIO 1
  • source/lib/posix/posix_aio.h

     
    3030
    3131#if OS_WIN
    3232# include "lib/sysdep/os/win/wposix/waio.h"
    33 #elif OS_ANDROID
     33#elif OS_ANDROID || OS_OPENBSD
    3434// Android doesn't provide aio.h. We don't actually use aio on Linuxes (see
    3535// CONFIG2_FILE_ENABLE_AIO) but we use its symbols and structs, so define
    3636// them here
     37# if OS_OPENBSD
     38// OpenBSD 5.1 (latest version at time of writing) has no struct sigevent defined,
     39// so we do this here.
     40struct sigevent
     41{
     42    int sigev_notify;
     43    int sigev_signo;
     44    union sigval sigev_value;
     45    void (*sigev_notify_function)(union sigval);
     46    pthread_attr_t *sigev_notify_attributes;
     47};
     48# endif
    3749# define LIO_READ 0
    3850# define LIO_WRITE 1
    3951# define LIO_NOP 2
  • source/lib/posix/posix_mman.h

     
    1 /* Copyright (c) 2010 Wildfire Games
     1/* Copyright (c) 2012 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    2020 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2121 */
    2222
     23#ifndef INCLUDED_POSIX_MMAN
     24#define INCLUDED_POSIX_MMAN
     25
    2326#if OS_WIN
    2427# include "lib/sysdep/os/win/wposix/wmman.h"
    2528#else
     
    2730#endif
    2831
    2932#include "lib/posix/posix_errno.h"  // for user convenience
     33
     34#endif  // #ifndef INCLUDED_POSIX_MMAN
  • source/lib/secure_crt.cpp

     
    106106// self-test and the t* defines (needed for test).
    107107#if EMULATE_SECURE_CRT
    108108
    109 #if !OS_UNIX || OS_MACOSX
     109#if !OS_UNIX || OS_MACOSX || OS_OPENBSD
    110110// return length [in characters] of a string, not including the trailing
    111111// null character. to protect against access violations, only the
    112112// first <max_len> characters are examined; if the null character is
  • source/lib/secure_crt.h

     
    4747#if EMULATE_SECURE_CRT
    4848
    4949// (conflicts with glibc definitions)
    50 #if !OS_UNIX || OS_MACOSX
     50#if !OS_UNIX || OS_MACOSX || OS_OPENBSD
    5151// return length [in characters] of a string, not including the trailing
    5252// null character. to protect against access violations, only the
    5353// first <max_len> characters are examined; if the null character is
    5454// not encountered by then, <max_len> is returned.
     55// strnlen is available on OpenBSD
     56#if !OS_OPENBSD
    5557extern size_t strnlen(const char* str, size_t max_len);
     58#endif
    5659extern size_t wcsnlen(const wchar_t* str, size_t max_len);
    5760#endif
    5861
  • source/lib/sysdep/os.h

     
    1 /* Copyright (c) 2010 Wildfire Games
     1/* Copyright (c) 2012 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    6868// BSD
    6969#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__)
    7070# define OS_BSD 1
     71// OpenBSD has no aio.h so and we need a way to disable it for it only
     72# if defined(__OpenBSD__)
     73#  define OS_OPENBSD 1
     74# endif
    7175#else
    7276# define OS_BSD 0
    7377#endif
     78#ifndef OS_OPENBSD
     79# define OS_OPENBSD 0
     80#endif
    7481// Solaris
    7582#if defined(sun) || defined(__sun)
    7683# define OS_SOLARIS 1
  • source/lib/sysdep/os/bsd/bcpu.cpp

     
    2828#include "lib/module_init.h"
    2929
    3030#include "valgrind.h"
     31#include <sys/param.h>
    3132#include <sys/sysctl.h>
    3233
    3334size_t os_cpu_NumProcessors()
  • source/maths/Brush.cpp

     
    413413
    414414        faceStartIdx = j + 1;
    415415    }
    416 }
    417  No newline at end of file
     416}
  • source/ps/CStrIntern.h

     
    8383    CStrInternInternals* m;
    8484};
    8585
    86 #endif // INCLUDED_CSTRINTERN
    87  No newline at end of file
     86#endif // INCLUDED_CSTRINTERN
  • source/ps/Font.cpp

     
    8181Handle CFont::GetTexture()
    8282{
    8383    return unifont_get_texture(h);
    84 }
    85  No newline at end of file
     84}
  • source/ps/PreprocessorWrapper.cpp

     
    8383        free(output);
    8484
    8585    return ret;
    86 }
    87  No newline at end of file
     86}
  • source/ps/PreprocessorWrapper.h

     
    4141    CPreprocessor m_Preprocessor;
    4242};
    4343
    44 #endif // INCLUDED_PREPROCESSORWRAPPER
    45  No newline at end of file
     44#endif // INCLUDED_PREPROCESSORWRAPPER
  • source/ps/Profiler2GPU.cpp

     
    871871void CProfiler2GPU::RegionEnter(const char* UNUSED(id)) { }
    872872void CProfiler2GPU::RegionLeave(const char* UNUSED(id)) { }
    873873
    874 #endif
    875  No newline at end of file
     874#endif
  • source/renderer/OverlayRenderer.cpp

     
    606606    glDisable(GL_BLEND);
    607607    glDisable(GL_TEXTURE_2D);
    608608#endif
    609 }
    610  No newline at end of file
     609}
  • source/renderer/TexturedLineRData.h

     
    8585    CVertexBuffer::VBChunk* m_VBIndices;
    8686};
    8787
    88 #endif // INCLUDED_TEXTUREDLINERDATA
    89  No newline at end of file
     88#endif // INCLUDED_TEXTUREDLINERDATA
  • source/simulation2/components/tests/test_ObstructionManager.h

     
    474474        TS_ASSERT_EQUALS(obSquare3.u, CFixedVector2D(fixed::FromInt(1), fixed::FromInt(0)));
    475475        TS_ASSERT_EQUALS(obSquare3.v, CFixedVector2D(fixed::FromInt(0), fixed::FromInt(1)));
    476476    }
    477 };
    478  No newline at end of file
     477};
  • source/simulation2/helpers/Render.cpp

     
    567567    }
    568568
    569569    points.swap(newPoints);
    570 }
    571  No newline at end of file
     570}