diff --git a/mac_post_make.sh b/mac_post_make.sh index b28aefce..7712f72f 100755 --- a/mac_post_make.sh +++ b/mac_post_make.sh @@ -12,12 +12,14 @@ QT_FW_PATH="/Library/Frameworks" SDL_FW_PATH="/Library/Frameworks" -APPLICATION="./bin/pokerth.app" +APPLICATION="./pokerth.app" BINARY="$APPLICATION/Contents/MacOs/pokerth" +RESOURCES="$APPLICATION/Contents/Resources/" # strip binary strip $BINARY +cp -R ./data $RESOURCES # create framework-path BINARY_FW_PATH="$APPLICATION/Contents/Frameworks" mkdir $BINARY_FW_PATH @@ -45,4 +47,4 @@ if [ "$1" != "--without-qt" ] ; then QTCORE_LINK=$(otool -L $BINARY_FW_PATH/$QTGUI | grep QtCore | cut -d"(" -f1 | cut -f2) install_name_tool -change $QTCORE_LINK @executable_path/../Frameworks/$QTCORE $BINARY_FW_PATH/$QTGUI -fi \ No newline at end of file +fi diff --git a/pokerth_game.pro b/pokerth_game.pro index 2e8730d8..228b7828 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -3,8 +3,8 @@ TEMPLATE = app CODECFORSRC = UTF-8 -#CONFIG += qt thread embed_manifest_exe warn_on release -CONFIG += qt thread embed_manifest_exe warn_on debug +#CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on release +CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on debug #Uncomment this for RELEASE #QTPLUGIN += qjpeg qgif @@ -348,6 +348,8 @@ mac{ # on Intel-Mac you have to comment this line out or build will fail. # QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk/ + LIBPATH += lib + LIBS += -lpokerth_lib # Qt static (path is standard for self-compiling qt) #LIBS += /usr/local/Trolltech/Qt-4.2.3/lib/libQtCore.a #LIBS += /usr/local/Trolltech/Qt-4.2.3/lib/libQtGui.a @@ -359,13 +361,15 @@ mac{ LIBS += -framework SDL_mixer # standard path for darwinports # make sure you have a universal version of boost - LIBS += /opt/local/lib/libboost_thread.a + LIBS += /opt/local/lib/libboost_thread-gcc40-mt-1_34.a + LIBS += /opt/local/lib/libboost_filesystem-gcc40-mt-1_34.a # libraries installed on every mac LIBS += -lcrypto -lz -framework Carbon # set the application icon RC_FILE = pokerth.icns - LIBPATH += /Developer/SDKs/MacOSX10.4u.sdk/usr/lib - INCLUDEPATH += /Developer/SDKs/MacOSX10.4u.sdk/usr/include/ + LIBPATH += /Developer/SDKs/MacOSX10.5.sdk/usr/lib + INCLUDEPATH += /Developer/SDKs/MacOSX10.5.sdk/usr/include/ INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers - INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers + INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers + INCLUDEPATH += /opt/local/include } diff --git a/pokerth_lib.pro b/pokerth_lib.pro index d86a94dc..963ca323 100644 --- a/pokerth_lib.pro +++ b/pokerth_lib.pro @@ -3,8 +3,8 @@ TEMPLATE = lib CODECFORSRC = UTF-8 -#CONFIG += staticlib thread warn_on release -CONFIG += staticlib thread warn_on debug +#CONFIG += staticlib thread exceptions rtti stl warn_on release +CONFIG += staticlib thread exceptions rtti stl warn_on debug UI_DIR = uics TARGET = lib/pokerth_lib @@ -197,7 +197,8 @@ mac{ # on Intel-Mac you have to comment this line out or build will fail. # QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk/ - INCLUDEPATH += /Developer/SDKs/MacOSX10.4u.sdk/usr/include/ + INCLUDEPATH += /Developer/SDKs/MacOSX10.5.sdk/usr/include/ INCLUDEPATH += /Library/Frameworks/SDL.framework/Headers - INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers + INCLUDEPATH += /Library/Frameworks/SDL_mixer.framework/Headers + INCLUDEPATH += /opt/local/include } diff --git a/pokerth_server.pro b/pokerth_server.pro index dd8e4f65..1c778b86 100644 --- a/pokerth_server.pro +++ b/pokerth_server.pro @@ -3,8 +3,8 @@ TEMPLATE = app CODECFORSRC = UTF-8 -#CONFIG += thread console embed_manifest_exe warn_on release -CONFIG += thread console embed_manifest_exe warn_on debug +#CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on release +CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on debug UI_DIR = uics TARGET = bin/pokerth_server @@ -194,3 +194,28 @@ unix : !mac { ## My release static libs #LIBS += -lcrypto } + +mac{ + # make it universal + CONFIG += x86 + CONFIG += ppc + QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.3 + + # for universal-compilation on PPC-Mac uncomment the following line + # on Intel-Mac you have to comment this line out or build will fail. + # QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk/ + + LIBPATH += lib + LIBS += -lpokerth_lib + # standard path for darwinports + # make sure you have a universal version of boost + LIBS += /opt/local/lib/libboost_thread-gcc40-mt-1_34.a + LIBS += /opt/local/lib/libboost_filesystem-gcc40-mt-1_34.a + # libraries installed on every mac + LIBS += -lcrypto -liconv + # set the application icon + RC_FILE = pokerth.icns + LIBPATH += /Developer/SDKs/MacOSX10.5.sdk/usr/lib + INCLUDEPATH += /Developer/SDKs/MacOSX10.5.sdk/usr/include/ + INCLUDEPATH += /opt/local/include +} diff --git a/src/core/libircclient/include/config.h b/src/core/libircclient/include/config.h index 8e3c0cf6..0c6e51ab 100644 --- a/src/core/libircclient/include/config.h +++ b/src/core/libircclient/include/config.h @@ -2,7 +2,9 @@ /* include/config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the `gethostbyname_r' function. */ -#define HAVE_GETHOSTBYNAME_R 1 +#ifndef __APPLE__ + #define HAVE_GETHOSTBYNAME_R 1 +#endif /* Define to 1 if you have the `inet_ntoa' function. */ #define HAVE_INET_NTOA 1 diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index ee8f2215..6c11e322 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -82,10 +82,15 @@ ClientStateInit::Process(ClientThread &client) if (IOCTLSOCKET(context.GetSocket(), FIONBIO, &mode) == SOCKET_ERROR) throw ClientException(__FILE__, __LINE__, ERR_SOCK_CREATION_FAILED, SOCKET_ERRNO()); - // The following call is optional - the return value is not checked. + // The following calls are optional - the return value is not checked. int nodelay = 1; setsockopt(context.GetSocket(), SOL_SOCKET, TCP_NODELAY, (char *)&nodelay, sizeof(nodelay)); +#ifdef SO_NOSIGPIPE + int nosigpipe = 1; + setsockopt(context.GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&nosigpipe, sizeof(nosigpipe)); +#endif + client.SetState(ClientStateStartResolve::Instance()); return MSG_SOCK_INIT_DONE; diff --git a/src/net/common/serveracceptthread.cpp b/src/net/common/serveracceptthread.cpp index 03973879..9f3600e1 100644 --- a/src/net/common/serveracceptthread.cpp +++ b/src/net/common/serveracceptthread.cpp @@ -182,11 +182,16 @@ ServerAcceptThread::AcceptLoop() { throw ServerException(__FILE__, __LINE__, ERR_SOCK_CREATION_FAILED, SOCKET_ERRNO()); } - // Optional call - don't check return value. + // Optional calls - don't check return value. // Enable keepalive - won't be of much use but better than nothing. int keepalive = 1; setsockopt(tmpData->GetSocket(), SOL_SOCKET, SO_KEEPALIVE, (char *)&keepalive, sizeof(keepalive)); +#ifdef SO_NOSIGPIPE + int nosigpipe = 1; + setsockopt(tmpData->GetSocket(), SOL_SOCKET, SO_NOSIGPIPE, (char *)&nosigpipe, sizeof(nosigpipe)); +#endif + GetLobbyThread().AddConnection(tmpData); } } diff --git a/src/net/socket_helper.h b/src/net/socket_helper.h index b44a5b57..c1ce7f64 100644 --- a/src/net/socket_helper.h +++ b/src/net/socket_helper.h @@ -62,7 +62,11 @@ typedef unsigned char u_char; #define IOCTLSOCKET ioctl #define SOCKET_ERR_NOTCONN ENOTCONN #define SOCKET_ERR_NOTSOCK ENOTSOCK -#define SOCKET_SEND_FLAGS MSG_NOSIGNAL +#ifdef __APPLE__ + #define SOCKET_SEND_FLAGS 0 +#else + #define SOCKET_SEND_FLAGS MSG_NOSIGNAL +#endif #define IS_SOCKET_ERR_WOULDBLOCK(_e) ((_e) == EINPROGRESS || (_e) == EAGAIN)