From: Konrad Rosenbaum Date: Tue, 3 Jan 2017 20:48:45 +0000 (+0100) Subject: make compileable on win32 with msys X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=276e29154cd6efb18128dd3176bc22216e85d2d8;p=web%2Fkonrad%2Fsmoke.git make compileable on win32 with msys Change-Id: Icd5afaafd5d8ab9304fbd78356c7ee4ff7f98117 --- diff --git a/Makefile b/Makefile index 9904e4b..2b5a40f 100644 --- a/Makefile +++ b/Makefile @@ -99,6 +99,7 @@ woc: wbase: woc mkdir -p bin cp -a pack/qtbase/lib* bin + -cp -a pack/qtbase/*.dll bin cp -a pack/qtbase/*.qm bin server: wob @@ -123,6 +124,7 @@ winclient: client taurus: -$(MKDIR) bin cd taurus && $(QMAKE) $(QMCFG) $(QMAKEFLAGS) && $(MAKE) + #cd taurus/aurora && bash ./build-gpg.sh $(COPY) taurus/lib/* bin/ -$(COPY) taurus/aurora/gpg/bin/gpg bin/ -$(COPY) taurus/aurora/gpg/bin/gpg.exe bin/ diff --git a/commonlib/commonexport.h b/commonlib/commonexport.h index 921f2ca..4cac02b 100644 --- a/commonlib/commonexport.h +++ b/commonlib/commonexport.h @@ -1,7 +1,7 @@ #include -#ifndef MAGICSMOKE_COMMON_LIB_BUILD +#ifdef MAGICSMOKE_COMMON_LIB_BUILD #define MAGICSMOKE_COMMON_EXPORT Q_DECL_EXPORT #else #define MAGICSMOKE_COMMON_EXPORT Q_DECL_IMPORT diff --git a/commonlib/commonlib.pro b/commonlib/commonlib.pro index dc2379e..3fff3fc 100644 --- a/commonlib/commonlib.pro +++ b/commonlib/commonlib.pro @@ -3,7 +3,7 @@ #basics TEMPLATE = lib -VERSION = 0.1 +VERSION = TARGET = magicsmoke-common include(../basics.pri) diff --git a/iface/wext/keyvalue.h b/iface/wext/keyvalue.h index f294ff2..5d2f0ae 100644 --- a/iface/wext/keyvalue.h +++ b/iface/wext/keyvalue.h @@ -4,14 +4,14 @@ // Description: removes abstract flag from classes that only need to be abstract in PHP // // -// Author: Konrad Rosenbaum , (C) 2009-2011 +// Author: Konrad Rosenbaum , (C) 2016 // // Copyright: See README/COPYING.GPL files that come with this distribution // // -#ifndef MAGICSMOKE_MOORDER_H -#define MAGICSMOKE_MOORDER_H +#ifndef MAGICSMOKE_KEYVALUE_H +#define MAGICSMOKE_KEYVALUE_H #include "MOKeyValuePairAbstract" #include "misc.h" @@ -30,7 +30,7 @@ class MSIFACE_EXPORT MOKeyValuePair:public MOKeyValuePairAbstract WOBJECT(MOKeyValuePair) public: MOKeyValuePair(QString k,QString v){setkey(k);setvalue(v);setisnull(false);} - MOKeyValuePair(QString k,nullptr_t){setkey(k);setisnull(true);} + MOKeyValuePair(QString k,std::nullptr_t){setkey(k);setisnull(true);} inline operator QPair () { diff --git a/pack b/pack index f2a5d37..3a3c81a 160000 --- a/pack +++ b/pack @@ -1 +1 @@ -Subproject commit f2a5d37c76272477abc5f5a1c668b7d1467be0ef +Subproject commit 3a3c81aaaf035bd578c30ed37aba7875fed6765a diff --git a/sesscli/scrand.cpp b/sesscli/scrand.cpp new file mode 100644 index 0000000..b82d604 --- /dev/null +++ b/sesscli/scrand.cpp @@ -0,0 +1,60 @@ +// +// C++ Interface: Random Number Retriever +// +// +// Author: Konrad Rosenbaum , (C) 2016 +// +// Copyright: See README/COPYING.GPL files that come with this distribution +// +// + +#include "scrand.h" + +#ifdef Q_OS_WIN32 +#include +//#pragma comment(lib, "advapi32.lib") +#else +#include +#endif + +#include + +namespace MagicSmokeRandom { + +/// Get some crypto strength random bytes. May return less than requested. +QByteArray getRandomBytes(quint8 bytes) +{ + if(bytes==0)return QByteArray(); +#if defined(Q_OS_UNIX)||defined(Q_OS_LINUX)||defined(Q_OS_DARWIN) + //try urandom, then random + QFile fd("/dev/urandom"); + if(!fd.open(QIODevice::ReadOnly)){ + fd.setFileName("/dev/random"); + if(!fd.open(QIODevice::ReadOnly)){ + qDebug()<<"Unable to open /dev/{u}random - sorry."; + return QByteArray(); + } + } + QByteArray r=fd.read(bytes); + fd.close(); + return r; +#elif defined(Q_OS_WIN32) + BYTE data[256]; + HCRYPTPROV hCryptProv=0; + if (!::CryptAcquireContextW(&hCryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)){ + qDebug()<<"Error: Unable to acquire crypto context."; + return QByteArray(); + } + QByteArray r; + if(::CryptGenRandom(hCryptProv,bytes,data)){ + r=QByteArray((const char*)data,bytes); + }else{ + qDebug()<<"Error: Unable to get random numbers from OS."; + } + if(!::CryptReleaseContext(hCryptProv, 0)) + qDebug()<<"Warning: unable to release crypto context!"; + return r; +#endif +} + +} diff --git a/sesscli/scrand.h b/sesscli/scrand.h index 873c074..691a618 100644 --- a/sesscli/scrand.h +++ b/sesscli/scrand.h @@ -11,52 +11,12 @@ #ifndef MAGICSMOKE_SC_RAND_H #define MAGICSMOKE_SC_RAND_H -#ifdef Q_OS_WIN32 -#include -#pragma comment(lib, "advapi32.lib") -#else -#include -#endif - #include namespace MagicSmokeRandom { /// Get some crypto strength random bytes. May return less than requested. -inline QByteArray getRandomBytes(quint8 bytes) -{ - if(bytes==0)return QByteArray(); -#if defined(Q_OS_UNIX)||defined(Q_OS_LINUX)||defined(Q_OS_DARWIN) - //try urandom, then random - QFile fd("/dev/urandom"); - if(!fd.open(QIODevice::ReadOnly)){ - fd.setFileName("/dev/random"); - if(!fd.open(QIODevice::ReadOnly)){ - qDebug()<<"Unable to open /dev/{u}random - sorry."; - return QByteArray(); - } - } - QByteArray r=fd.read(bytes); - fd.close(); - return r; -#elif defined(Q_OS_WIN32) - BYTE data[256]; - HCRYPTPROV hCryptProv=0; - if (!::CryptAcquireContextW(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)){ - qDebug()<<"Error: Unable to acquire crypto context."; - return QByteArray(); - } - QByteArray r; - if(::CryptGenRandom(hCryptProv,bytes,data)){ - r=QByteArray((const char*)data,bytes); - }else{ - qDebug()<<"Error: Unable to get random numbers from OS."; - } - if(!::CryptReleaseContext(hProvider, 0)) - qDebug()<<"Warning: unable to release crypto context!"; - return r; -#endif -} +QByteArray getRandomBytes(quint8 bytes); } diff --git a/sesscli/scrand.pri b/sesscli/scrand.pri index 9d95f27..5f83a49 100644 --- a/sesscli/scrand.pri +++ b/sesscli/scrand.pri @@ -1,5 +1,7 @@ # Random Stuff +SOURCES += $$PWD/scrand.cpp + win32 { -#LIBS += -ladvapi32 + LIBS += -ladvapi32 } diff --git a/sesscli/sesscli.pro b/sesscli/sesscli.pro index 9f7e5d4..375bd6f 100644 --- a/sesscli/sesscli.pro +++ b/sesscli/sesscli.pro @@ -3,7 +3,7 @@ #basics TEMPLATE = lib -VERSION = 0.1 +VERSION = TARGET = magicsmoke-sesscli include(../basics.pri) @@ -16,8 +16,8 @@ TRANSLATIONS = \ smoke-sc_en.ts #main source files -SOURCES = scli.cpp -HEADERS = scli.h +SOURCES += scli.cpp +HEADERS += scli.h INCLUDEPATH += . #make sure exports are ok diff --git a/sessman/sessman.pro b/sessman/sessman.pro index 42fca3b..5e6d0a5 100644 --- a/sessman/sessman.pro +++ b/sessman/sessman.pro @@ -3,7 +3,7 @@ #basics TEMPLATE = app -VERSION = 0.1 +VERSION = TARGET = magicsmoke-sessman include(../basics.pri) @@ -17,8 +17,8 @@ TRANSLATIONS = \ smoke-sm_en.ts #main source files -SOURCES = sman.cpp login.cpp -HEADERS = sman.h login.h +SOURCES += sman.cpp login.cpp +HEADERS += sman.h login.h INCLUDEPATH += . DEPENDPATH += $$INCLUDEPATH