3dfxdev / EDGE

EDGE Source Code
http://edge2.sf.net
74 stars 10 forks source link

Openbsd (or all bsds?) support #18

Closed ryan-sg closed 8 years ago

ryan-sg commented 8 years ago

Here is some stuff to make building on OpenBSD pretty easy out of the box. I did some assumptions for taking care of the other bsds as well, but OpenBSD is all I have tested.

There is one more patch I need to make this build on OpenBSD, but it seems really weird. I am going to paste it into a comment to discuss in this pull request.

ryan-sg commented 8 years ago

mmkay, in ddf/main.c:

--- a/ddf/main.cc
+++ b/ddf/main.cc
@@ -195,7 +195,7 @@ public:
        define_c() : name(NULL), value(NULL)
        { }

-       define_c(char *_N, char *_V) : name(_N), value(_V)
+       define_c(char *n_N, char *v_V) : name(n_N), value(v_V)
        { }

        ~define_c()

without this, all compilers I have fail. any ideas? I don't know what I'm doing here :-) The closest clue i think i see is in the clang output, _N being defined by /usr/include/ctype.h on my system..

gcc 4.2.1:

20:10 ryan@iddqd:hyper3DGE$ gmake -f Makefiles/Makefile.bsd
mkdir -p obj_bsd/coal
mkdir -p obj_bsd/ddf
mkdir -p obj_bsd/deh_edge
mkdir -p obj_bsd/edge
mkdir -p obj_bsd/md5_conv
mkdir -p obj_bsd/md5_conv/kmq2
mkdir -p obj_bsd/epi
mkdir -p obj_bsd/glbsp
mkdir -p obj_bsd/timidity
mkdir -p obj_bsd/opllib
g++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DBSD -DUSE_OGG -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/libcpuid -o obj_bsd/ddf/main.o -c ddf/main.cc 
ddf/main.cc:198: error: expected ',' or '...' before numeric constant
ddf/main.cc: In constructor 'define_c::define_c(char*)':
ddf/main.cc:198: error: '_V' was not declared in this scope
ddf/main.cc:198: error: invalid conversion from 'int' to 'char*'
ddf/main.cc: In function 'void DDF_MainAddDefine(char*, char*)':
ddf/main.cc:221: error: no matching function for call to 'define_c::define_c(char*&, char*&)'
ddf/main.cc:198: note: candidates are: define_c::define_c(char*)
ddf/main.cc:195: note:                 define_c::define_c()
ddf/main.cc:186: note:                 define_c::define_c(const define_c&)
Makefiles/Makefile.bsd:133: recipe for target 'obj_bsd/ddf/main.o' failed
gmake: *** [obj_bsd/ddf/main.o] Error 1

gcc 4.9.3:

20:10 ryan@iddqd:hyper3DGE$ CXX=eg++ gmake -f Makefiles/Makefile.bsd
mkdir -p obj_bsd/coal
mkdir -p obj_bsd/ddf
mkdir -p obj_bsd/deh_edge
mkdir -p obj_bsd/edge
mkdir -p obj_bsd/md5_conv
mkdir -p obj_bsd/md5_conv/kmq2
mkdir -p obj_bsd/epi
mkdir -p obj_bsd/glbsp
mkdir -p obj_bsd/timidity
mkdir -p obj_bsd/opllib
eg++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DBSD -DUSE_OGG -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/libcpuid -o obj_bsd/ddf/main.o -c ddf/main.cc 
In file included from ddf/../epi/headers.h:26:0,
                 from ddf/../epi/epi.h:22,
                 from ddf/local.h:22,
                 from ddf/main.cc:19:
ddf/main.cc:198:17: error: expected ',' or '...' before numeric constant
  define_c(char *_N, char *_V) : name(_N), value(_V)
                 ^
ddf/main.cc: In constructor 'define_c::define_c(char*)':
ddf/main.cc:198:49: error: '_V' was not declared in this scope
  define_c(char *_N, char *_V) : name(_N), value(_V)
                                                 ^
ddf/main.cc:198:51: error: invalid conversion from 'int' to 'char*' [-fpermissive]
  define_c(char *_N, char *_V) : name(_N), value(_V)
                                                   ^
ddf/main.cc: In function 'void DDF_MainAddDefine(char*, char*)':
ddf/main.cc:221:40: error: no matching function for call to 'define_c::define_c(char*&, char*&)'
  defines.push_back(define_c(name, value));
                                        ^
ddf/main.cc:221:40: note: candidates are:
ddf/main.cc:198:2: note: define_c::define_c(char*)
  define_c(char *_N, char *_V) : name(_N), value(_V)
  ^
ddf/main.cc:198:2: note:   candidate expects 1 argument, 2 provided
ddf/main.cc:195:2: note: define_c::define_c()
  define_c() : name(NULL), value(NULL)
  ^
ddf/main.cc:195:2: note:   candidate expects 0 arguments, 2 provided
ddf/main.cc:185:7: note: define_c::define_c(const define_c&)
 class define_c
       ^
ddf/main.cc:185:7: note:   candidate expects 1 argument, 2 provided
Makefiles/Makefile.bsd:133: recipe for target 'obj_bsd/ddf/main.o' failed
gmake: *** [obj_bsd/ddf/main.o] Error 1

in clang 3.8.0:

20:10 ryan@iddqd:hyper3DGE$ CXX=clang gmake -f Makefiles/Makefile.bsd
mkdir -p obj_bsd/coal
mkdir -p obj_bsd/ddf
mkdir -p obj_bsd/deh_edge
mkdir -p obj_bsd/edge
mkdir -p obj_bsd/md5_conv
mkdir -p obj_bsd/md5_conv/kmq2
mkdir -p obj_bsd/epi
mkdir -p obj_bsd/glbsp
mkdir -p obj_bsd/timidity
mkdir -p obj_bsd/opllib
clang -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DBSD -DUSE_OGG -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/libcpuid -o obj_bsd/ddf/main.o -c ddf/main.cc 
ddf/main.cc:198:17: error: expected ')'
        define_c(char *_N, char *_V) : name(_N), value(_V)
                       ^
/usr/include/ctype.h:47:12: note: expanded from macro '_N'
#define _N      0x04
                ^
ddf/main.cc:198:10: note: to match this '('
        define_c(char *_N, char *_V) : name(_N), value(_V)
                ^
ddf/main.cc:198:33: error: cannot initialize a member subobject of type 'char *' with an rvalue of type 'int'
        define_c(char *_N, char *_V) : name(_N), value(_V)
                                       ^    ~~
ddf/main.cc:198:49: error: use of undeclared identifier '_V'
        define_c(char *_N, char *_V) : name(_N), value(_V)
                                                       ^
ddf/main.cc:221:20: error: no matching constructor for initialization of 'define_c'
        defines.push_back(define_c(name, value));
                          ^        ~~~~~~~~~~~
ddf/main.cc:198:2: note: candidate constructor not viable: requires 1 argument, but 2 were provided
        define_c(char *_N, char *_V) : name(_N), value(_V)
        ^
ddf/main.cc:185:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class define_c
      ^
ddf/main.cc:195:2: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
        define_c() : name(NULL), value(NULL)
        ^
4 errors generated.
Makefiles/Makefile.bsd:133: recipe for target 'obj_bsd/ddf/main.o' failed
gmake: *** [obj_bsd/ddf/main.o] Error 1