Ticket #1463: more_openbsd_compat.diff

File more_openbsd_compat.diff, 14.5 KB (added by leper, 12 years ago)
  • build/premake/extern_libs4.lua

     
    211211            if os.is("windows") then
    212212                add_default_include_paths("boost")
    213213            end
     214            if os.is("bsd") then
     215                -- for OpenBSD
     216                includedirs { "/usr/local/include" }
     217            end
    214218        end,
    215219        link_settings = function()
    216220            if os.is("windows") then
     
    356360            if os.is("windows") then
    357361                add_default_include_paths("libpng")
    358362            end
     363            if os.is("bsd") then
     364                -- OpenBSD only
     365                includedirs { "/usr/local/include/libpng" }
     366            end
    359367        end,
    360368        link_settings = function()
    361369            if os.is("windows") then
  • build/premake/premake4/build/gmake.unix/Premake4.make

     
    2929  CFLAGS    += $(CPPFLAGS) -Wall -Os
    3030  CXXFLAGS  += $(CFLAGS)
    3131  LDFLAGS   += -s -rdynamic
    32   LIBS      += -lm -ldl
     32  LIBS      += -lm
    3333  RESFLAGS  += $(DEFINES) $(INCLUDES)
    3434  LDDEPS    +=
    3535  LINKCMD    = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(LDDEPS) $(LIBS)
  • 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/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/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
  • 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
  • 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/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/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/maths/Brush.cpp

     
    413413
    414414        faceStartIdx = j + 1;
    415415    }
    416 }
    417  No newline at end of file
     416}
  • libraries/nvtt/issue176.patch

     
     1Index: src/src/nvcore/nvcore.h
     2===================================================================
     3--- src/src/nvcore/nvcore.h (revision 11943)
     4+++ src/src/nvcore/nvcore.h (working copy)
     5@@ -41,6 +41,9 @@
     6 #elif defined POSH_OS_FREEBSD
     7 #  define NV_OS_FREEBSD 1
     8 #  define NV_OS_UNIX 1
     9+#elif defined POSH_OS_OPENBSD
     10+#  define NV_OS_OPENBSD 1
     11+#  define NV_OS_UNIX 1
     12 #elif defined POSH_OS_CYGWIN32
     13 #  define NV_OS_CYGWIN 1
     14 #elif defined POSH_OS_MINGW
     15@@ -178,7 +181,7 @@
     16 #elif NV_CC_GNUC
     17 #  if NV_OS_LINUX
     18 #      include "DefsGnucLinux.h"
     19-#  elif NV_OS_DARWIN || NV_OS_FREEBSD
     20+#  elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
     21 #      include "DefsGnucDarwin.h"
     22 #  elif NV_OS_MINGW
     23 #      include "DefsGnucWin32.h"
     24Index: src/src/nvcore/Debug.cpp
     25===================================================================
     26--- src/src/nvcore/Debug.cpp    (revision 11943)
     27+++ src/src/nvcore/Debug.cpp    (working copy)
     28@@ -27,7 +27,7 @@
     29 #  include <signal.h>
     30 #endif
     31 
     32-#if NV_OS_LINUX || NV_OS_DARWIN || NV_OS_FREEBSD
     33+#if NV_OS_LINUX || NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
     34 #  include <unistd.h>  // getpid
     35 #endif
     36 
     37@@ -38,10 +38,13 @@
     38 #  endif
     39 #endif
     40 
     41-#if NV_OS_DARWIN || NV_OS_FREEBSD
     42+#if NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
     43 #  include <sys/types.h>
     44+#  include <sys/param.h>
     45 #  include <sys/sysctl.h>  // sysctl
     46-#  include <sys/ucontext.h>
     47+#  if !NV_OS_OPENBSD
     48+#      include <sys/ucontext.h>
     49+#  endif
     50 #  undef HAVE_EXECINFO_H
     51 #  if defined(HAVE_EXECINFO_H) // only after OSX 10.5
     52 #      include <execinfo.h> // backtrace
     53@@ -210,6 +213,14 @@
     54            ucontext_t * ucp = (ucontext_t *)secret;
     55            return (void *)ucp->uc_mcontext.mc_eip;
     56 #      endif
     57+#  elif NV_OS_OPENBSD
     58+#      if NV_CPU_X86_64
     59+           ucontext_t * ucp = (ucontext_t *)secret;
     60+           return (void *)ucp->sc_rip;
     61+#      elif NV_CPU_X86
     62+           ucontext_t * ucp = (ucontext_t *)secret;
     63+           return (void *)ucp->sc_eip;
     64+#      endif
     65 #  else
     66 #      if NV_CPU_X86_64
     67            // #define REG_RIP REG_INDEX(rip) // seems to be 16
     68Index: src/src/nvcore/poshlib/posh.h
     69===================================================================
     70--- src/src/nvcore/poshlib/posh.h   (revision 11943)
     71+++ src/src/nvcore/poshlib/posh.h   (working copy)
     72@@ -298,6 +298,11 @@
     73 #  define POSH_OS_STRING "FreeBSD"
     74 #endif
     75 
     76+#if defined __OpenBSD__
     77+#  define POSH_OS_OPENBSD 1
     78+#  define POSH_OS_STRING "OpenBSD"
     79+#endif
     80+
     81 #if defined __CYGWIN32__
     82 #  define POSH_OS_CYGWIN32 1
     83 #  define POSH_OS_STRING "Cygwin"
     84Index: src/src/nvmath/nvmath.h
     85===================================================================
     86--- src/src/nvmath/nvmath.h (revision 11943)
     87+++ src/src/nvmath/nvmath.h (working copy)
     88@@ -115,7 +115,7 @@
     89 {
     90 #if NV_OS_WIN32
     91    return _finite(f) != 0;
     92-#elif NV_OS_DARWIN || NV_OS_FREEBSD
     93+#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
     94    return isfinite(f);
     95 #elif NV_OS_LINUX
     96    return finitef(f);
     97@@ -130,7 +130,7 @@
     98 {
     99 #if NV_OS_WIN32
     100    return _isnan(f) != 0;
     101-#elif NV_OS_DARWIN || NV_OS_FREEBSD
     102+#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
     103    return isnan(f);
     104 #elif NV_OS_LINUX
     105    return isnanf(f);
  • libraries/nvtt/src/src/nvcore/nvcore.h

     
    4141#elif defined POSH_OS_FREEBSD
    4242#   define NV_OS_FREEBSD 1
    4343#   define NV_OS_UNIX 1
     44#elif defined POSH_OS_OPENBSD
     45#   define NV_OS_OPENBSD 1
     46#   define NV_OS_UNIX 1
    4447#elif defined POSH_OS_CYGWIN32
    4548#   define NV_OS_CYGWIN 1
    4649#elif defined POSH_OS_MINGW
     
    178181#elif NV_CC_GNUC
    179182#   if NV_OS_LINUX
    180183#       include "DefsGnucLinux.h"
    181 #   elif NV_OS_DARWIN || NV_OS_FREEBSD
     184#   elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
    182185#       include "DefsGnucDarwin.h"
    183186#   elif NV_OS_MINGW
    184187#       include "DefsGnucWin32.h"
  • libraries/nvtt/src/src/nvcore/Debug.cpp

     
    2727#   include <signal.h>
    2828#endif
    2929
    30 #if NV_OS_LINUX || NV_OS_DARWIN || NV_OS_FREEBSD
     30#if NV_OS_LINUX || NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
    3131#   include <unistd.h>  // getpid
    3232#endif
    3333
     
    3838#   endif
    3939#endif
    4040
    41 #if NV_OS_DARWIN || NV_OS_FREEBSD
     41#if NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
    4242#   include <sys/types.h>
     43#   include <sys/param.h>
    4344#   include <sys/sysctl.h>  // sysctl
    44 #   include <sys/ucontext.h>
     45#   if !NV_OS_OPENBSD
     46#       include <sys/ucontext.h>
     47#   endif
    4548#   undef HAVE_EXECINFO_H
    4649#   if defined(HAVE_EXECINFO_H) // only after OSX 10.5
    4750#       include <execinfo.h> // backtrace
     
    210213            ucontext_t * ucp = (ucontext_t *)secret;
    211214            return (void *)ucp->uc_mcontext.mc_eip;
    212215#       endif
     216#   elif NV_OS_OPENBSD
     217#       if NV_CPU_X86_64
     218            ucontext_t * ucp = (ucontext_t *)secret;
     219            return (void *)ucp->sc_rip;
     220#       elif NV_CPU_X86
     221            ucontext_t * ucp = (ucontext_t *)secret;
     222            return (void *)ucp->sc_eip;
     223#       endif
    213224#   else
    214225#       if NV_CPU_X86_64
    215226            // #define REG_RIP REG_INDEX(rip) // seems to be 16
  • libraries/nvtt/src/src/nvcore/poshlib/posh.h

     
    298298#  define POSH_OS_STRING "FreeBSD"
    299299#endif
    300300
     301#if defined __OpenBSD__
     302#  define POSH_OS_OPENBSD 1
     303#  define POSH_OS_STRING "OpenBSD"
     304#endif
     305
    301306#if defined __CYGWIN32__
    302307#  define POSH_OS_CYGWIN32 1
    303308#  define POSH_OS_STRING "Cygwin"
  • libraries/nvtt/src/src/nvmath/nvmath.h

     
    115115{
    116116#if NV_OS_WIN32
    117117    return _finite(f) != 0;
    118 #elif NV_OS_DARWIN || NV_OS_FREEBSD
     118#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
    119119    return isfinite(f);
    120120#elif NV_OS_LINUX
    121121    return finitef(f);
     
    130130{
    131131#if NV_OS_WIN32
    132132    return _isnan(f) != 0;
    133 #elif NV_OS_DARWIN || NV_OS_FREEBSD
     133#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
    134134    return isnan(f);
    135135#elif NV_OS_LINUX
    136136    return isnanf(f);
  • libraries/nvtt/README.txt

     
    66  r907.patch and r1025.patch (from NVTT SVN - fixes build on FreeBSD)
    77  rpath.patch (fixes .so file search paths for bundled copy)
    88  issue139.patch (fixes http://code.google.com/p/nvidia-texture-tools/issues/detail?id=139)
     9  issue176.patch (partially from http:/code.google.com/p/nvidia-texture-tools/issues/detail?id=176 - fixes build on OpenBSD)
    910  png-api.patch (partially from NVTT SVN r1248 - fixes build with libpng 1.5)
    1011  cmake-freebsd.patch (fixes build on FreeBSD)
    1112  gcc47-unistd.patch (fixes build on GCC 4.7)
  • libraries/enet/build.sh

     
    1818
    1919mkdir -p lib/
    2020
    21 if [ "`uname -s`" = "Darwin" ]
    22 then
    23   # Fix libtool's use of an absolute path
    24   install_name_tool -id @executable_path/libenet.1.dylib src/.libs/libenet.1.dylib
    25   cp src/.libs/libenet.dylib lib/
    26   cp src/.libs/libenet.1.dylib ../../binaries/system/
    27 else
    28   cp src/.libs/libenet.so lib/
    29   cp src/.libs/libenet.so.1 ../../binaries/system/
    30 fi
     21case "`uname -s`" in
     22  "Darwin" )
     23    # Fix libtool's use of an absolute path
     24    install_name_tool -id @executable_path/libenet.1.dylib src/.libs/libenet.1.dylib
     25    cp src/.libs/libenet.dylib lib/
     26    cp src/.libs/libenet.1.dylib ../../binaries/system/
     27    ;;
     28  "OpenBSD" )
     29    cp src/.libs/libenet.so.1.* lib/
     30    cp src/.libs/libenet.so.1.* ../../binaries/system/libenet.so.1
     31    ;;
     32  * )
     33    cp src/.libs/libenet.so lib/
     34    cp src/.libs/libenet.so.1 ../../binaries/system/
     35    ;;
     36esac