summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid <david@xagasoft.com>2010-02-04 21:37:00 +0000
committerDavid <david@xagasoft.com>2010-02-04 21:37:00 +0000
commit1f29dc180b5a86ddf2115f97ad410e0e9b1beb4b (patch)
treebd4236dd6ffb7e7ca19eb3611e3c57e8f1ef924e
parent81b7d806028bd484e2765cbc57b9677544bf52b2 (diff)
downloadlibbu++-1f29dc180b5a86ddf2115f97ad410e0e9b1beb4b.tar.gz
libbu++-1f29dc180b5a86ddf2115f97ad410e0e9b1beb4b.tar.bz2
libbu++-1f29dc180b5a86ddf2115f97ad410e0e9b1beb4b.tar.xz
libbu++-1f29dc180b5a86ddf2115f97ad410e0e9b1beb4b.zip
david - Made a build-M3 file for building to windows (mingw). This one actually builds *.cpp, yay!... Although i took out Process, Plugger, and Regex... to be re-added later... also had to stubify a few more functions when compiling on WIN32.
-rw-r--r--mingw.bld80
-rw-r--r--src/fastcgi.cpp10
-rw-r--r--src/fifo.cpp14
-rw-r--r--src/ito.cpp4
-rw-r--r--src/itoserver.cpp2
-rw-r--r--src/itoserver.h5
-rw-r--r--src/logger.cpp4
-rw-r--r--src/multiserver.cpp2
-rw-r--r--src/plugger.cpp5
-rw-r--r--src/plugger.h3
-rw-r--r--src/protocolhttp.cpp6
-rw-r--r--src/server.h6
12 files changed, 137 insertions, 4 deletions
diff --git a/mingw.bld b/mingw.bld
new file mode 100644
index 0000000..61dbeaf
--- /dev/null
+++ b/mingw.bld
@@ -0,0 +1,80 @@
1/**
2 * This is the default.bld file for libbu++, it pretty much handles everything
3 * libbu++ related, kinda' cool, eh? It can completely replace the old build
4 * and actually does a better job with a number of things.
5 */
6
7CXXFLAGS += "-ggdb -W -Wall";
8
9
10action "default"
11{
12 build: [targets("header-links"), "libbu++win.a"];
13}
14
15
16target files("src/*.h").replace("src/", "bu/")
17{
18 tag "header-links";
19 display "symlink";
20 input OUTPUT.replace("bu/","src/");
21 profile "build"
22 {
23 execute("ln -s ../${INPUT} ${OUTPUT}");
24 }
25}
26
27target "libbu++win.a"
28{
29 input files("src/*.cpp");
30 rule "lib";
31 CXXFLAGS += "-I. -Isupport/windows";
32}
33
34target "src/process.win_o"
35{
36 profile "build"
37 {
38 execute("rm -f src/process.win_o && touch src/process.win_o && echo NOT BUILDING PROCESS RIGHT NOW!!!");
39 }
40}
41target "src/regex.win_o"
42{
43 profile "build"
44 {
45 execute("rm -f src/regex.win_o && touch src/regex.win_o && echo NOT BUILDING REGEX RIGHT NOW!!!");
46 }
47}
48
49function cppToWinObj()
50{
51 if OBJ_DIR == null then
52 {
53 return INPUT.regex("\\.cpp$", ".win_o");
54 }
55 else
56 {
57 return OBJ_DIR + "/" + INPUT.fileName().regex("\\.cpp$", ".win_o");
58 }
59
60}
61
62rule "lib"
63{
64 input "*.win_o";
65 profile "build"
66 {
67 execute("wine C:/MinGW/bin/ar.exe cr ${OUTPUT} ${INPUT}");
68 }
69}
70
71rule "wincpp"
72{
73 input "*.cpp";
74 output INPUT.cppToWinObj();
75 //requires getMakeDeps("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -M ${INPUT}");
76 profile "build"
77 {
78 execute("wine C:/MinGW/bin/g++.exe ${CXXFLAGS} -c -o ${OUTPUT} ${INPUT}", "g++");
79 }
80}
diff --git a/src/fastcgi.cpp b/src/fastcgi.cpp
index 1662fe6..ede5cac 100644
--- a/src/fastcgi.cpp
+++ b/src/fastcgi.cpp
@@ -7,7 +7,10 @@
7 7
8#include "bu/fastcgi.h" 8#include "bu/fastcgi.h"
9 9
10#include <arpa/inet.h> 10#ifndef WIN32
11 #include <arpa/inet.h>
12#endif
13
11#include <errno.h> 14#include <errno.h>
12#include <unistd.h> 15#include <unistd.h>
13 16
@@ -37,6 +40,7 @@ Bu::FastCgi::~FastCgi()
37 40
38bool Bu::FastCgi::isEmbedded() 41bool Bu::FastCgi::isEmbedded()
39{ 42{
43#ifndef WIN32
40 struct sockaddr name; 44 struct sockaddr name;
41 socklen_t namelen = sizeof(name); 45 socklen_t namelen = sizeof(name);
42 if( getpeername( STDIN_FILENO, &name, &namelen ) != 0 && 46 if( getpeername( STDIN_FILENO, &name, &namelen ) != 0 &&
@@ -54,6 +58,10 @@ bool Bu::FastCgi::isEmbedded()
54 sio << "No socket detected, running in standalone mode" << sio.nl; 58 sio << "No socket detected, running in standalone mode" << sio.nl;
55 return false; 59 return false;
56 } 60 }
61#else
62 #warning Bu::FastCgi::isEmbedded IS A STUB for WIN32!!!!
63 return false;
64#endif
57} 65}
58 66
59void Bu::FastCgi::read( Bu::Socket &s, Bu::FastCgi::Record &r ) 67void Bu::FastCgi::read( Bu::Socket &s, Bu::FastCgi::Record &r )
diff --git a/src/fifo.cpp b/src/fifo.cpp
index 1bbab37..eaf1705 100644
--- a/src/fifo.cpp
+++ b/src/fifo.cpp
@@ -12,6 +12,8 @@
12#include <fcntl.h> 12#include <fcntl.h>
13#include <unistd.h> 13#include <unistd.h>
14 14
15#include "win32_compatibility.h"
16
15namespace Bu { subExceptionDef( FifoException ) } 17namespace Bu { subExceptionDef( FifoException ) }
16 18
17Bu::Fifo::Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc ) : 19Bu::Fifo::Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc ) :
@@ -19,6 +21,7 @@ Bu::Fifo::Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc ) :
19 iIn( -1 ), 21 iIn( -1 ),
20 iOut( -1 ) 22 iOut( -1 )
21{ 23{
24#ifndef WIN32
22 if( iFlags&Create ) 25 if( iFlags&Create )
23 { 26 {
24 if( mkfifo( sName.getStr(), mAcc ) ) 27 if( mkfifo( sName.getStr(), mAcc ) )
@@ -40,6 +43,9 @@ Bu::Fifo::Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc ) :
40 O_WRONLY 43 O_WRONLY
41 ); 44 );
42 } 45 }
46#else
47 #warning Bu::Fifo::Fifo IS A STUB for WIN32!!!!
48#endif
43} 49}
44 50
45Bu::Fifo::~Fifo() 51Bu::Fifo::~Fifo()
@@ -126,15 +132,23 @@ bool Bu::Fifo::isSeekable()
126 132
127bool Bu::Fifo::isBlocking() 133bool Bu::Fifo::isBlocking()
128{ 134{
135#ifndef WIN32
129 return ((fcntl( iIn, F_GETFL, 0 )&O_NONBLOCK) == O_NONBLOCK); 136 return ((fcntl( iIn, F_GETFL, 0 )&O_NONBLOCK) == O_NONBLOCK);
137#else
138 #warning Bu::Fifo::isBlocking IS A STUB for WIN32!!!!
139#endif
130} 140}
131 141
132void Bu::Fifo::setBlocking( bool bBlocking ) 142void Bu::Fifo::setBlocking( bool bBlocking )
133{ 143{
144#ifndef WIN32
134 if( bBlocking ) 145 if( bBlocking )
135 fcntl( iIn, F_SETFL, fcntl( iIn, F_GETFL, 0 )&(~O_NONBLOCK) ); 146 fcntl( iIn, F_SETFL, fcntl( iIn, F_GETFL, 0 )&(~O_NONBLOCK) );
136 else 147 else
137 fcntl( iIn, F_SETFL, fcntl( iIn, F_GETFL, 0 )|O_NONBLOCK ); 148 fcntl( iIn, F_SETFL, fcntl( iIn, F_GETFL, 0 )|O_NONBLOCK );
149#else
150 #warning Bu::Fifo::setBlocking IS A STUB for WIN32!!!!
151#endif
138} 152}
139 153
140void Bu::Fifo::flush() 154void Bu::Fifo::flush()
diff --git a/src/ito.cpp b/src/ito.cpp
index c8b3d68..e9fb033 100644
--- a/src/ito.cpp
+++ b/src/ito.cpp
@@ -43,6 +43,10 @@ bool Bu::Ito::join()
43 43
44void Bu::Ito::yield() 44void Bu::Ito::yield()
45{ 45{
46#ifndef WIN32
46 pthread_yield(); 47 pthread_yield();
48#else
49 #warning Bu::Ito::yield IS A STUB for WIN32!!!!
50#endif
47} 51}
48 52
diff --git a/src/itoserver.cpp b/src/itoserver.cpp
index 83d2e9f..cfd5c2f 100644
--- a/src/itoserver.cpp
+++ b/src/itoserver.cpp
@@ -5,6 +5,8 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "win32_compatibility.h"
9
8#include "bu/itoserver.h" 10#include "bu/itoserver.h"
9#include <errno.h> 11#include <errno.h>
10#include "bu/serversocket.h" 12#include "bu/serversocket.h"
diff --git a/src/itoserver.h b/src/itoserver.h
index bcdd1d1..4bbd6bf 100644
--- a/src/itoserver.h
+++ b/src/itoserver.h
@@ -9,7 +9,10 @@
9#define BU_ITO_SERVER_H 9#define BU_ITO_SERVER_H
10 10
11#include <stdint.h> 11#include <stdint.h>
12#include <sys/select.h> 12
13#ifndef WIN32
14 #include <sys/select.h>
15#endif
13 16
14#include "bu/fstring.h" 17#include "bu/fstring.h"
15#include "bu/list.h" 18#include "bu/list.h"
diff --git a/src/logger.cpp b/src/logger.cpp
index e3de2fb..b8f9ca3 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -23,6 +23,7 @@ Bu::Logger::~Logger()
23 23
24void Bu::Logger::log( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const char *sFormat, ...) 24void Bu::Logger::log( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const char *sFormat, ...)
25{ 25{
26#ifndef WIN32
26 if( (nLevel&nLevelMask) == 0 ) 27 if( (nLevel&nLevelMask) == 0 )
27 return; 28 return;
28 29
@@ -63,6 +64,9 @@ void Bu::Logger::log( uint32_t nLevel, const char *sFile, const char *sFunction,
63 write( fileno(stdout), line, strlen(line) ); 64 write( fileno(stdout), line, strlen(line) );
64 free( text ); 65 free( text );
65 free( line ); 66 free( line );
67#else
68 #warning Bu::Logger::log IS A STUB for WIN32!!!!
69#endif
66} 70}
67 71
68void Bu::Logger::setFormat( const Bu::FString &str ) 72void Bu::Logger::setFormat( const Bu::FString &str )
diff --git a/src/multiserver.cpp b/src/multiserver.cpp
index 73c794c..b049b4e 100644
--- a/src/multiserver.cpp
+++ b/src/multiserver.cpp
@@ -5,6 +5,8 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include "win32_compatibility.h"
9
8#include "bu/multiserver.h" 10#include "bu/multiserver.h"
9#include "bu/protocol.h" 11#include "bu/protocol.h"
10#include "bu/client.h" 12#include "bu/client.h"
diff --git a/src/plugger.cpp b/src/plugger.cpp
index 8a1ed47..ef74da1 100644
--- a/src/plugger.cpp
+++ b/src/plugger.cpp
@@ -7,4 +7,9 @@
7 7
8#include "bu/plugger.h" 8#include "bu/plugger.h"
9 9
10#ifndef WIN32
11
10namespace Bu { subExceptionDef( PluginException ) } 12namespace Bu { subExceptionDef( PluginException ) }
13
14#endif
15
diff --git a/src/plugger.h b/src/plugger.h
index 48d778d..60f1967 100644
--- a/src/plugger.h
+++ b/src/plugger.h
@@ -8,6 +8,7 @@
8#ifndef BU_PLUGGER_H 8#ifndef BU_PLUGGER_H
9#define BU_PLUGGER_H 9#define BU_PLUGGER_H
10 10
11#ifndef WIN32 //yeah, this one is going to take some work...
11 12
12#include "bu/hash.h" 13#include "bu/hash.h"
13#include "bu/list.h" 14#include "bu/list.h"
@@ -212,4 +213,6 @@ namespace Bu
212 }; 213 };
213} 214}
214 215
216#endif //#ifndef WIN32 //yeah, this one is going to take some work...
217
215#endif 218#endif
diff --git a/src/protocolhttp.cpp b/src/protocolhttp.cpp
index 534cb02..0c45ea7 100644
--- a/src/protocolhttp.cpp
+++ b/src/protocolhttp.cpp
@@ -6,7 +6,11 @@
6 */ 6 */
7 7
8#include <dirent.h> 8#include <dirent.h>
9#include <sys/wait.h> 9
10#ifndef WIN32
11 #include <sys/wait.h>
12#endif
13
10#include <errno.h> 14#include <errno.h>
11#include <stdlib.h> 15#include <stdlib.h>
12#include "bu/protocolhttp.h" 16#include "bu/protocolhttp.h"
diff --git a/src/server.h b/src/server.h
index 1e317a4..a618a8d 100644
--- a/src/server.h
+++ b/src/server.h
@@ -9,7 +9,10 @@
9#define BU_SERVER_H 9#define BU_SERVER_H
10 10
11#include <stdint.h> 11#include <stdint.h>
12#include <sys/select.h> 12
13#ifndef WIN32
14 #include <sys/select.h>
15#endif
13 16
14#include "bu/fstring.h" 17#include "bu/fstring.h"
15#include "bu/list.h" 18#include "bu/list.h"
@@ -17,6 +20,7 @@
17#include "bu/clientlink.h" 20#include "bu/clientlink.h"
18#include "bu/clientlinkfactory.h" 21#include "bu/clientlinkfactory.h"
19#include "bu/hash.h" 22#include "bu/hash.h"
23#include "bu/win32_compatibility.h"
20 24
21namespace Bu 25namespace Bu
22{ 26{