From 1554e17f48de31c74344f335c5751894d874ecc7 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 25 Aug 2013 21:06:29 +0000 Subject: [PATCH] patch from Stefan Sperling to allow compilation on OpenBSD git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6613 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/libbitdht.pro | 6 +++++ libbitdht/src/util/bdrandom.cc | 2 ++ libretroshare/src/libretroshare.pro | 16 ++++++++++++ libretroshare/src/rsserver/rsloginhandler.cc | 6 ++--- plugins/FeedReader/FeedReader.pro | 9 +++++++ retroshare-gui/src/retroshare-gui.pro | 26 ++++++++++++++++++++ 6 files changed, 62 insertions(+), 3 deletions(-) diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro index dfeb1d187..5d5e49979 100644 --- a/libbitdht/src/libbitdht.pro +++ b/libbitdht/src/libbitdht.pro @@ -93,6 +93,12 @@ freebsd-* { DESTDIR = lib } +################################# OpenBSD ########################################## + +openbsd-* { + DESTDIR = lib +} + ################################### COMMON stuff ################################## ################################### COMMON stuff ################################## diff --git a/libbitdht/src/util/bdrandom.cc b/libbitdht/src/util/bdrandom.cc index c680ab765..bd0e9c694 100644 --- a/libbitdht/src/util/bdrandom.cc +++ b/libbitdht/src/util/bdrandom.cc @@ -15,6 +15,8 @@ static bool auto_seed = bdRandom::seed( (time(NULL) + ((uint32_t) pthread_self() #elif defined(__FreeBSD__) // since this is completely insecure anyway, just kludge for now static bool auto_seed = bdRandom::seed(time(NULL)); + #elif defined(__OpenBSD__) + static bool auto_seed = bdRandom::seed(arc4random()); #else static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_self()*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ; #endif diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index 490cfb39c..2f1357c75 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -286,6 +286,22 @@ freebsd-* { DESTDIR = lib } +################################# OpenBSD ########################################## + +openbsd-* { + INCLUDEPATH *= /usr/local/include + INCLUDEPATH += $$system(pkg-config --cflags glib-2.0 | sed -e "s/-I//g") + + OPENPGPSDK_DIR = ../../openpgpsdk/src + INCLUDEPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk + + QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen + + CONFIG += upnp_libupnp + + DESTDIR = lib +} + ################################### COMMON stuff ################################## HEADERS += dbase/cachestrapper.h \ diff --git a/libretroshare/src/rsserver/rsloginhandler.cc b/libretroshare/src/rsserver/rsloginhandler.cc index 1de34f22c..ebc018541 100644 --- a/libretroshare/src/rsserver/rsloginhandler.cc +++ b/libretroshare/src/rsserver/rsloginhandler.cc @@ -5,7 +5,7 @@ #include "rsloginhandler.h" #include "util/rsdir.h" -#if defined(UBUNTU) || defined(__FreeBSD__) +#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__) #include GnomeKeyringPasswordSchema my_schema = { @@ -119,7 +119,7 @@ bool RsLoginHandler::tryAutoLogin(const std::string& ssl_id,std::string& ssl_pas /******************************** WINDOWS/UNIX SPECIFIC PART ******************/ #ifndef WINDOWS_SYS /* UNIX */ -#if defined(UBUNTU) || defined(__FreeBSD__) +#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__) gchar *passwd = NULL; @@ -361,7 +361,7 @@ bool RsLoginHandler::enableAutoLogin(const std::string& ssl_id,const std::string /******************************** WINDOWS/UNIX SPECIFIC PART ******************/ #ifndef WINDOWS_SYS /* UNIX */ -#if defined(UBUNTU) || defined(__FreeBSD__) +#if defined(UBUNTU) || defined(__FreeBSD__) || defined(__OpenBSD__) if(GNOME_KEYRING_RESULT_OK == gnome_keyring_store_password_sync(&my_schema, NULL, (gchar*)("RetroShare password for SSL Id "+ssl_id).c_str(),(gchar*)ssl_passwd.c_str(),"RetroShare SSL Id",ssl_id.c_str(),NULL)) { std::cerr << "Stored passwd " << "************************" << " into gnome keyring" << std::endl; diff --git a/plugins/FeedReader/FeedReader.pro b/plugins/FeedReader/FeedReader.pro index 3a4f8073e..e376a7556 100644 --- a/plugins/FeedReader/FeedReader.pro +++ b/plugins/FeedReader/FeedReader.pro @@ -92,3 +92,12 @@ win32 { LIBS += -lcurl -lxml2 -lxslt -lws2_32 -lwldap32 } + +openbsd-* { + LIBXML2_DIR = /usr/local/include/libxml2 + + INCLUDEPATH += $${LIBXML2_DIR} + + LIBS += -lcurl -lxml2 -lxslt +} + diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 96ef134f3..d7c47a182 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -222,6 +222,32 @@ freebsd-* { } +##################################### OpenBSD ###################################### + +openbsd-* { + INCLUDEPATH *= /usr/local/include + + PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a + PRE_TARGETDEPS *= ../../openpgpsdk/src/lib/libops.a + + LIBS *= ../../libretroshare/src/lib/libretroshare.a + LIBS *= ../../openpgpsdk/src/lib/libops.a -lbz2 + LIBS *= -lssl -lcrypto + LIBS *= -lgpgme + LIBS *= -lupnp + LIBS *= -lgnome-keyring + PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a + + gxs { + LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a + LIBS += -lsqlite3 + } + + LIBS *= -rdynamic +} + + + ############################## Common stuff ###################################### # On Linux systems that alredy have libssl and libcrypto it is advisable