openssl and gnupg plugins now support build modes

svn path=/trunk/kdesupport/qca/; revision=648608
This commit is contained in:
Justin Karneges 2007-03-31 20:14:49 +00:00
parent 32cd6df7d8
commit 637ba1b52c
9 changed files with 203 additions and 23 deletions

View File

@ -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;
}
};

View File

@ -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)
}

View File

@ -2,6 +2,9 @@
<name>qca-gnupg</name>
<profile>qca-gnupg.pro</profile>
<noprefix/>
<dep type='buildmode'>
<required/>
</dep>
<dep type='qca'>
<required/>
</dep>

View File

@ -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 <QtCrypto>\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;
}
};

View File

@ -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;
}
};

View File

@ -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)
{

View File

@ -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)
}

View File

@ -2,6 +2,10 @@
<name>qca-openssl</name>
<profile>qca-openssl.pro</profile>
<noprefix/>
<lib/>
<dep type='buildmode'>
<required/>
</dep>
<dep type='qca'>
<required/>
</dep>

View File

@ -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");