Modified libretroshare to compile under MacOSX.

1) b64.c used c++ functions -> b64.cc
2) OSX will use miniupnpc for now -> modified #defines.
3) change in openssl fn signature?
4) updated build file for OSX.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2344 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-02-16 22:25:58 +00:00
parent 4a5bd60880
commit 56e9536336
7 changed files with 62 additions and 17 deletions

View File

@ -16,6 +16,10 @@ debug {
# DEFINES *= CONN_DEBUG P3DISC_DEBUG RSSERIAL_DEBUG RSITEM_DEBUG DEBUG_PQISSL DEBUG_PQISTREAMER
# DEFINES *= NET_DEBUG
# DEFINES *= DISTRIB_DEBUG
# DEFINES *= P3TURTLE_DEBUG FT_DEBUG DEBUG_FTCHUNK MPLEX_DEBUG
# DEFINES *= CONN_DEBUG
QMAKE_CXXFLAGS -= -fomit-frame-pointer
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
}
@ -103,6 +107,31 @@ win32 {
INCLUDEPATH += . $${SSL_DIR}/include $${UPNPC_DIR} $${PTHREADS_DIR} $${ZLIB_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
}
################################# MacOSX ##########################################
mac {
QMAKE_CC = g++
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
#DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW
#DEFINES *= MINIUPNPC_VERSION=13
DESTDIR = lib
#miniupnp implementation files
HEADERS += upnp/upnputil.h
SOURCES += upnp/upnputil.c
# Beautiful Hack to fix 64bit file access.
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dfopen64=fopen"
UPNPC_DIR = ../../../miniupnpc-1.0
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
INCLUDEPATH += . $${UPNPC_DIR}
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
}
################################### COMMON stuff ##################################
################################### COMMON stuff ##################################
#DEPENDPATH += . \
@ -302,7 +331,7 @@ SOURCES += \
upnp/upnphandler.cc \
dht/opendht.cc \
dht/opendhtstr.cc \
dht/b64.c \
dht/b64.cc \
services/p3portservice.cc \
services/p3channels.cc \
services/p3forums.cc \

View File

@ -1158,9 +1158,14 @@ X509 *AuthSSL::loadX509FromDER(const uint8_t *ptr, uint32_t len)
std::cerr << std::endl;
#endif
X509 *tmp = NULL;
const unsigned char **certptr = (const unsigned char **) &ptr;
X509 *x509 = d2i_X509(&tmp, certptr, len);
X509 *tmp = NULL;
#ifdef __APPLE__
unsigned char **certptr = (unsigned char **) &ptr;
#else
const unsigned char **certptr = (const unsigned char **) &ptr;
#endif
X509 *x509 = d2i_X509(&tmp, certptr, len);
return x509;
}

View File

@ -1,5 +1,5 @@
//Linux and macos implementation
#ifndef WINDOWS_SYS
//Linux only
#if !defined(WINDOWS_SYS) && !defined(__APPLE__)
/* This stuff is actually C */
@ -429,8 +429,8 @@ bool upnphandler::getExternalAddress(struct sockaddr_in &addr)
#ifdef WINDOWS_SYS
// Windows / Mac version.
#if defined(WINDOWS_SYS) || defined(__APPLE__)
/* This stuff is actually C */

View File

@ -1,5 +1,5 @@
//Linux and macos implementation
#ifndef WINDOWS_SYS
//Linux only...
#if !defined(WINDOWS_SYS) && !defined(__APPLE__)
#ifndef _RS_UPNP_IFACE_H
#define _RS_UPNP_IFACE_H
@ -86,8 +86,8 @@ int CtrlPointCallbackEventHandler(Upnp_EventType ,void* , void*);
#if defined(WINDOWS_SYS) || defined(__APPLE__)
#ifdef WINDOWS_SYS
//windows implementation
#ifndef _RS_UPNP_IFACE_H
#define _RS_UPNP_IFACE_H

View File

@ -107,7 +107,7 @@ void ListRedirections(struct UPNPUrls * urls,
* 2 - get extenal ip address
* 3 - Add port mapping
* 4 - get this port mapping from the IGD */
bool SetRedirectAndTest(struct UPNPUrls * urls,
int SetRedirectAndTest(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * iaddr,
const char * iport,
@ -209,7 +209,7 @@ bool SetRedirectAndTest(struct UPNPUrls * urls,
return ok;
}
bool TestRedirect(struct UPNPUrls * urls,
int TestRedirect(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * iaddr,
const char * iport,
@ -261,7 +261,7 @@ bool TestRedirect(struct UPNPUrls * urls,
bool
int
RemoveRedirect(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * eport,

View File

@ -21,6 +21,13 @@
#include <miniupnpc.h>
#include <upnpcommands.h>
/* Ensure linking names are okay on OSX platform. (C interface) */
#ifdef __cplusplus
extern "C" {
#endif
/* protofix() checks if protocol is "UDP" or "TCP"
* returns NULL if not */
const char * protofix(const char * proto);
@ -33,24 +40,28 @@ void GetConnectionStatus(struct UPNPUrls * urls,
void ListRedirections(struct UPNPUrls * urls,
struct IGDdatas * data);
bool SetRedirectAndTest(struct UPNPUrls * urls,
int SetRedirectAndTest(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * iaddr,
const char * iport,
const char * eport,
const char * proto);
bool TestRedirect(struct UPNPUrls * urls,
int TestRedirect(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * iaddr,
const char * iport,
const char * eport,
const char * proto);
bool RemoveRedirect(struct UPNPUrls * urls,
int RemoveRedirect(struct UPNPUrls * urls,
struct IGDdatas * data,
const char * eport,
const char * proto);
#ifdef __cplusplus
}
#endif
/* EOF */
#endif