diff --git a/plugins/qca-gnupg/buildmode.qcm b/plugins/qca-gnupg/buildmode.qcm new file mode 100644 index 00000000..c76596ec --- /dev/null +++ b/plugins/qca-gnupg/buildmode.qcm @@ -0,0 +1,52 @@ +/* +-----BEGIN QCMOD----- +name: buildmode +section: project +arg: release,Build with debugging turned off +arg: debug,Build with debugging turned on +arg: debug-and-release,Build two versions, with and without debugging turned on (default) +-----END QCMOD----- +*/ + +#define BUILDMODE +bool buildmode_release = false; +bool buildmode_debug = false; + +class qc_buildmode : public ConfObj +{ +public: + qc_buildmode(Conf *c) : ConfObj(c) {} + QString name() const { return "buildmode"; } + QString shortname() const { return "buildmode"; } + + // no output + QString checkString() const { return QString(); } + + bool exec() + { + // build mode + bool release = false; + bool debug = false; + QString config_buildmode; + if(conf->getenv("QC_RELEASE") == "Y") + { + release = true; + config_buildmode = "CONFIG += release\n"; + } + else if(conf->getenv("QC_DEBUG") == "Y") + { + debug = true; + config_buildmode = "CONFIG += debug\n"; + } + else // if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y") + { + release = true; + debug = true; + config_buildmode = "CONFIG += debug_and_release build_all\n"; + } + buildmode_release = release; + buildmode_debug = debug; + conf->addExtra(config_buildmode); + return true; + } +}; diff --git a/plugins/qca-gnupg/qca-gnupg.pro b/plugins/qca-gnupg/qca-gnupg.pro index fdb1ef54..6cf8971c 100644 --- a/plugins/qca-gnupg/qca-gnupg.pro +++ b/plugins/qca-gnupg/qca-gnupg.pro @@ -1,11 +1,10 @@ -#CONFIG += release -CONFIG += debug - TEMPLATE = lib CONFIG += plugin QT -= gui CONFIG += crypto +VERSION = 0.0.1 + windows:LIBS += -ladvapi32 GPG_BASE = . @@ -20,3 +19,8 @@ SOURCES += \ $$GPG_BASE/qca-gnupg.cpp include(conf.pri) + +CONFIG(debug, debug|release) { + unix:TARGET = $$join(TARGET,,,_debug) + else:TARGET = $$join(TARGET,,,d) +} diff --git a/plugins/qca-gnupg/qca-gnupg.qc b/plugins/qca-gnupg/qca-gnupg.qc index 8c1bc084..bafd34a6 100644 --- a/plugins/qca-gnupg/qca-gnupg.qc +++ b/plugins/qca-gnupg/qca-gnupg.qc @@ -2,6 +2,9 @@ qca-gnupg qca-gnupg.pro + + + diff --git a/plugins/qca-gnupg/qca.qcm b/plugins/qca-gnupg/qca.qcm index 193bfc23..99cc9a4c 100644 --- a/plugins/qca-gnupg/qca.qcm +++ b/plugins/qca-gnupg/qca.qcm @@ -1,6 +1,7 @@ /* -----BEGIN QCMOD----- name: QCA 2.0 +arg: in-tree-build,Build with uninstalled QCA, only useful for SVN users. -----END QCMOD----- */ @@ -15,27 +16,63 @@ public: QString shortname() const { return "qca"; } bool exec() { + // get the build mode +#ifdef BUILDMODE + bool release = buildmode_release; + bool debug = buildmode_debug; +#else + // else, default to just release mode + bool release = true; + bool debug = false; +#endif + // test for "crypto" feature and check qca version number + QString arg; + arg = conf->getenv("QC_IN_TREE_BUILD"); - QString proextra = - "CONFIG += qt crypto\n" - "QT -= gui\n"; - + QString proextra; + if (!arg.isEmpty()) { + proextra = + "CONFIG += qt \n" + "QT -= gui\n" + "INCLUDEPATH += ../../../../include/QtCrypto \n" + "LIBS += -L../../../../lib -lqca \n"; + } else { + proextra = + "CONFIG += qt crypto\n" + "QT -= gui\n"; + } QString str = "#include \n" "\n" "int main()\n" "{\n" " unsigned long x = QCA_VERSION;\n" - " if(x >= 0x020000) return 0; else return 1;\n" + " if(x >= 0x016363) return 0; else return 1;\n" "}\n"; - int ret; - if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret)) - return false; - if(ret != 0) - return false; + if(release) + { + int ret; + if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra + "CONFIG += release\n", &ret)) + return false; + if(ret != 0) + return false; + } + if(debug) + { + int ret; + if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra + "CONFIG += debug\n", &ret)) + return false; + if(ret != 0) + return false; + } + + if (!arg.isEmpty()) { + conf->addIncludePath("../../include/QtCrypto"); + conf->addLib("-L../../lib -lqca"); + } return true; } }; diff --git a/plugins/qca-openssl/buildmode.qcm b/plugins/qca-openssl/buildmode.qcm new file mode 100644 index 00000000..c76596ec --- /dev/null +++ b/plugins/qca-openssl/buildmode.qcm @@ -0,0 +1,52 @@ +/* +-----BEGIN QCMOD----- +name: buildmode +section: project +arg: release,Build with debugging turned off +arg: debug,Build with debugging turned on +arg: debug-and-release,Build two versions, with and without debugging turned on (default) +-----END QCMOD----- +*/ + +#define BUILDMODE +bool buildmode_release = false; +bool buildmode_debug = false; + +class qc_buildmode : public ConfObj +{ +public: + qc_buildmode(Conf *c) : ConfObj(c) {} + QString name() const { return "buildmode"; } + QString shortname() const { return "buildmode"; } + + // no output + QString checkString() const { return QString(); } + + bool exec() + { + // build mode + bool release = false; + bool debug = false; + QString config_buildmode; + if(conf->getenv("QC_RELEASE") == "Y") + { + release = true; + config_buildmode = "CONFIG += release\n"; + } + else if(conf->getenv("QC_DEBUG") == "Y") + { + debug = true; + config_buildmode = "CONFIG += debug\n"; + } + else // if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y") + { + release = true; + debug = true; + config_buildmode = "CONFIG += debug_and_release build_all\n"; + } + buildmode_release = release; + buildmode_debug = debug; + conf->addExtra(config_buildmode); + return true; + } +}; diff --git a/plugins/qca-openssl/qca-openssl.cpp b/plugins/qca-openssl/qca-openssl.cpp index 965c4786..7f45fbd8 100644 --- a/plugins/qca-openssl/qca-openssl.cpp +++ b/plugins/qca-openssl/qca-openssl.cpp @@ -2367,7 +2367,8 @@ public: unsigned char *p, *tmps = NULL; const unsigned char *s = NULL; - int i,j;//,ret=1; + int i,j; + j = 0; if(type == NID_md5_sha1) { diff --git a/plugins/qca-openssl/qca-openssl.pro b/plugins/qca-openssl/qca-openssl.pro index 671ba6e9..10b0aae5 100644 --- a/plugins/qca-openssl/qca-openssl.pro +++ b/plugins/qca-openssl/qca-openssl.pro @@ -1,11 +1,10 @@ -#CONFIG += release -CONFIG += debug - TEMPLATE = lib CONFIG += plugin QT -= gui CONFIG += crypto +VERSION = 0.0.1 + SOURCES = qca-openssl.cpp #SOURCES += main.cpp @@ -21,3 +20,8 @@ windows:{ } include(conf.pri) + +CONFIG(debug, debug|release) { + unix:TARGET = $$join(TARGET,,,_debug) + else:TARGET = $$join(TARGET,,,d) +} diff --git a/plugins/qca-openssl/qca-openssl.qc b/plugins/qca-openssl/qca-openssl.qc index 07580fc5..68d3430a 100644 --- a/plugins/qca-openssl/qca-openssl.qc +++ b/plugins/qca-openssl/qca-openssl.qc @@ -2,6 +2,10 @@ qca-openssl qca-openssl.pro + + + + diff --git a/plugins/qca-openssl/qca.qcm b/plugins/qca-openssl/qca.qcm index ad751999..99cc9a4c 100644 --- a/plugins/qca-openssl/qca.qcm +++ b/plugins/qca-openssl/qca.qcm @@ -16,6 +16,16 @@ public: QString shortname() const { return "qca"; } bool exec() { + // get the build mode +#ifdef BUILDMODE + bool release = buildmode_release; + bool debug = buildmode_debug; +#else + // else, default to just release mode + bool release = true; + bool debug = false; +#endif + // test for "crypto" feature and check qca version number QString arg; arg = conf->getenv("QC_IN_TREE_BUILD"); @@ -38,14 +48,27 @@ public: "int main()\n" "{\n" " unsigned long x = QCA_VERSION;\n" - " if(x >= 0x020000) return 0; else return 1;\n" + " if(x >= 0x016363) return 0; else return 1;\n" "}\n"; - int ret; - if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra, &ret)) - return false; - if(ret != 0) - return false; + if(release) + { + int ret; + if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra + "CONFIG += release\n", &ret)) + return false; + if(ret != 0) + return false; + } + + if(debug) + { + int ret; + if(!conf->doCompileAndLink(str, QStringList(), QString(), proextra + "CONFIG += debug\n", &ret)) + return false; + if(ret != 0) + return false; + } + if (!arg.isEmpty()) { conf->addIncludePath("../../include/QtCrypto"); conf->addLib("-L../../lib -lqca");