mirror of
https://github.com/QuasarApp/qca.git
synced 2025-04-26 11:34:32 +00:00
updated the build system: subdirs layout, latest qconf
svn path=/trunk/kdesupport/qca/; revision=406922
This commit is contained in:
parent
37f1142c97
commit
3ed21c34d7
11
TODO
11
TODO
@ -1,5 +1,6 @@
|
||||
* Additional unit tests
|
||||
* Update to latest Botan, and remake the botantools patch as appropriate
|
||||
* create .prf for auto-discovery by qmake-based projects
|
||||
|
||||
* API documentation
|
||||
clean up Algorithm
|
||||
@ -18,16 +19,6 @@
|
||||
add more "getters" to the library?
|
||||
give all classes non-default ctors/dtors/copy/op=, and dpointers?
|
||||
|
||||
* finish API:
|
||||
finish qcaprovider.h
|
||||
|
||||
* build system:
|
||||
get qt 4 support into qconf
|
||||
on non-win/mac, allow specifying of flatfile store, else install/use built-in
|
||||
certstore.qcm: QCA_NO_SYSTEMSTORE
|
||||
make sure it installs properly
|
||||
create qt4 qmake .prf for auto-discovery by applications
|
||||
|
||||
* finish code for APIs:
|
||||
core: properties
|
||||
cert: rfc 2818 hostname validation
|
||||
|
@ -1,9 +1,7 @@
|
||||
#include <qprocess.h>
|
||||
#include <qstringlist.h>
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: certstore
|
||||
arg: certstore-path=[path],Path to the SSL Certificate store
|
||||
arg: certstore-path=[path],Path to the SSL/X509 Certificate store
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
|
||||
@ -16,9 +14,21 @@ public:
|
||||
|
||||
bool exec()
|
||||
{
|
||||
bundled = false;
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
|
||||
// use built-in
|
||||
return true;
|
||||
#else
|
||||
QStringList pathsToTry;
|
||||
|
||||
pathsToTry.append(conf->getenv("QC_CERTSTORE_PATH"));
|
||||
path = conf->getenv("QC_CERTSTORE_PATH");
|
||||
if(!path.isEmpty())
|
||||
{
|
||||
if(QFile::exists(path))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is from Debian
|
||||
pathsToTry.append( QString("/etc/ssl/certs/ca-certificates.crt") );
|
||||
@ -27,27 +37,54 @@ public:
|
||||
pathsToTry.append( QString("/usr/share/ssl/cert.pem") );
|
||||
pathsToTry.append( QString("/usr/share/ssl/certs/ca-bundle.crt") );
|
||||
|
||||
for ( QStringList::Iterator path = pathsToTry.begin(); path != pathsToTry.end(); ++path ) {
|
||||
if ( QFile::exists( *path ) ) {
|
||||
m_firstGoodPath = *path;
|
||||
for(int n = 0; n < pathsToTry.count(); ++n)
|
||||
{
|
||||
if(QFile::exists(pathsToTry[n]))
|
||||
{
|
||||
path = pathsToTry[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QString certPathString = "QCA_SYSTEMSTORE_PATH='\"" + m_firstGoodPath + "\"'";
|
||||
// fall back to bundled
|
||||
if(path.isEmpty())
|
||||
{
|
||||
path = "$$DATADIR/qca/certs/rootcerts.pem";
|
||||
QString extra =
|
||||
"sharedfiles.path = $$DATADIR/qca\n"
|
||||
"sharedfiles.files = certs\n"
|
||||
"INSTALLS += sharedfiles\n";
|
||||
conf->addExtra(extra);
|
||||
bundled = true;
|
||||
}
|
||||
|
||||
QString certPathString = "QCA_SYSTEMSTORE_PATH='\"" + path + "\"'";
|
||||
conf->addDefine(certPathString);
|
||||
|
||||
if ( m_firstGoodPath.isEmpty() )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString resultString() const
|
||||
{
|
||||
return m_firstGoodPath;
|
||||
#if defined(Q_OS_WIN)
|
||||
return "using Windows built-in"
|
||||
#elif defined(Q_OS_MAC)
|
||||
return "using Mac built-in"
|
||||
#else
|
||||
if(success)
|
||||
{
|
||||
if(bundled)
|
||||
return "using bundled";
|
||||
else
|
||||
return path;
|
||||
}
|
||||
else
|
||||
return ConfObj::resultString();
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_firstGoodPath;
|
||||
QString path;
|
||||
bool bundled;
|
||||
};
|
||||
|
40
extra.qcm
Normal file
40
extra.qcm
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
-----BEGIN QCMOD-----
|
||||
name: extra
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
|
||||
class qc_extra : public ConfObj
|
||||
{
|
||||
public:
|
||||
qc_extra(Conf *c) : ConfObj(c) {}
|
||||
QString name() const { return "extra"; }
|
||||
QString shortname() const { return "extra"; }
|
||||
|
||||
// no output
|
||||
QString checkString() const { return QString(); }
|
||||
|
||||
bool exec()
|
||||
{
|
||||
QString prefix = conf->getenv("PREFIX");
|
||||
QString str = QString(
|
||||
"prefix=%1\n"
|
||||
"exec_prefix=${prefix}\n"
|
||||
"libdir=${prefix}/lib\n"
|
||||
"includedir=${prefix}/include/QtCrypto\n"
|
||||
"\n"
|
||||
"Name: QCA\n"
|
||||
"Description: Qt Cryptographic Architecture library\n"
|
||||
"Version: 2.0.0 #maybe this shouldn't be literal...\n"
|
||||
"Requires: qt-mt\n"
|
||||
"Libs: -L${libdir} -lqca\n"
|
||||
"Cflags: -I${includedir}\n"
|
||||
"\n"
|
||||
).arg(prefix);
|
||||
|
||||
QFile f("qca.pc");
|
||||
if(f.open(QFile::WriteOnly | QFile::Truncate))
|
||||
f.write(str.toLatin1());
|
||||
return true;
|
||||
}
|
||||
};
|
@ -16,50 +16,21 @@ public:
|
||||
|
||||
bool exec()
|
||||
{
|
||||
proc = new QProcess( 0 );
|
||||
QString path = conf->getenv("QC_GCRYPT_CONFIG");
|
||||
proc->addArgument( path + "libgcrypt-config" );
|
||||
proc->addArgument( "--libs" );
|
||||
if(path.isEmpty())
|
||||
path = "libgcrypt-config";
|
||||
|
||||
if(! proc->start() )
|
||||
// this often indicates that it wasn't found in the path.
|
||||
QStringList incs;
|
||||
QString ver, libs, other;
|
||||
if(!conf->findFooConfig(path, &ver, &incs, &libs, &other))
|
||||
return false;
|
||||
|
||||
do {
|
||||
usleep(100000);
|
||||
} while (proc->isRunning());
|
||||
|
||||
QString libs = proc->readStdout();
|
||||
if (!libs.isEmpty())
|
||||
for(int n = 0; n < incs.count(); ++n)
|
||||
conf->addIncludePath(incs[n]);
|
||||
if(!libs.isEmpty())
|
||||
conf->addLib(libs);
|
||||
|
||||
proc->clearArguments();
|
||||
proc->addArgument( path + "libgcrypt-config" );
|
||||
proc->addArgument( "--cflags" );
|
||||
|
||||
if(! proc->start() )
|
||||
return false;
|
||||
|
||||
do {
|
||||
usleep(100000);
|
||||
} while (proc->isRunning());
|
||||
|
||||
QString cflags = proc->readStdout();
|
||||
if (!cflags.isEmpty()) {
|
||||
QStringList cflagsList = QStringList::split(" ", cflags);
|
||||
for ( QStringList::Iterator it = cflagsList.begin(); it != cflagsList.end(); ++it ) {
|
||||
if ( (*it).startsWith("-I") ){
|
||||
// we want everything except the leading "-I"
|
||||
QString includePath = (*it).remove(0,2);
|
||||
conf->addIncludePath(includePath);
|
||||
} else {
|
||||
// we want whatever is left.
|
||||
conf->addExtra(QString("QMAKE_CFLAGS += ") + (*it) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!other.isEmpty())
|
||||
conf->addExtra(QString("QMAKE_CFLAGS += %1\n").arg(other));
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
QProcess* proc;
|
||||
};
|
||||
|
@ -9,8 +9,9 @@ DEFINES += QCA_PLUGIN
|
||||
INCLUDEPATH += ../../include/QtCrypto
|
||||
SOURCES = qca-gcrypt.cpp
|
||||
|
||||
# temp hack until the build system works again
|
||||
LIBS += -lgcrypt -lgpg-error
|
||||
include(conf.pri)
|
||||
|
||||
# install
|
||||
target.path += $$[QT_INSTALL_PLUGINS]/crypto
|
||||
INSTALLS += target
|
||||
|
||||
#include(conf.pri)
|
||||
#include(extra.pri)
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat >extra.pri <<EOT
|
||||
target.path=\$\$QT_PATH_PLUGINS/crypto
|
||||
INSTALLS += target
|
||||
|
||||
INSTALL_ROOT = $PREFIX
|
||||
|
||||
EOT
|
76
qca.pro
76
qca.pro
@ -1,72 +1,10 @@
|
||||
# qca qmake profile
|
||||
|
||||
TEMPLATE = lib
|
||||
#CONFIG += release
|
||||
QT -= gui
|
||||
TARGET = qca
|
||||
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
|
||||
VER_MAJ = 2
|
||||
VER_MIN = 0
|
||||
|
||||
# make DLL
|
||||
win: {
|
||||
CONFIG += dll
|
||||
DEFINES += QCA_MAKEDLL
|
||||
}
|
||||
|
||||
QCA_INC = include/QtCrypto
|
||||
QCA_CPP = src
|
||||
INCLUDEPATH += $$QCA_INC $$QCA_CPP
|
||||
|
||||
# botantools
|
||||
include(src/botantools/botantools.pri)
|
||||
|
||||
PRIVATE_HEADERS += \
|
||||
$$QCA_CPP/qca_plugin.h \
|
||||
$$QCA_CPP/qca_systemstore.h
|
||||
|
||||
PUBLIC_HEADERS += \
|
||||
$$QCA_INC/qca_export.h \
|
||||
$$QCA_INC/qca_tools.h \
|
||||
$$QCA_INC/qca_core.h \
|
||||
$$QCA_INC/qca_textfilter.h \
|
||||
$$QCA_INC/qca_basic.h \
|
||||
$$QCA_INC/qca_publickey.h \
|
||||
$$QCA_INC/qca_cert.h \
|
||||
$$QCA_INC/qca_keystore.h \
|
||||
$$QCA_INC/qca_securelayer.h \
|
||||
$$QCA_INC/qca_securemessage.h \
|
||||
$$QCA_INC/qcaprovider.h \
|
||||
|
||||
HEADERS += $$PRIVATE_HEADERS $$PUBLIC_HEADERS
|
||||
|
||||
SOURCES += \
|
||||
$$QCA_CPP/qca_tools.cpp \
|
||||
$$QCA_CPP/qca_core.cpp \
|
||||
$$QCA_CPP/qca_textfilter.cpp \
|
||||
$$QCA_CPP/qca_plugin.cpp \
|
||||
$$QCA_CPP/qca_basic.cpp \
|
||||
$$QCA_CPP/qca_publickey.cpp \
|
||||
$$QCA_CPP/qca_cert.cpp \
|
||||
$$QCA_CPP/qca_keystore.cpp \
|
||||
$$QCA_CPP/qca_securelayer.cpp \
|
||||
$$QCA_CPP/qca_securemessage.cpp \
|
||||
$$QCA_CPP/qca_default.cpp
|
||||
|
||||
unix:!mac: {
|
||||
SOURCES += $$QCA_CPP/qca_systemstore_flatfile.cpp
|
||||
}
|
||||
win: {
|
||||
SOURCES += $$QCA_CPP/qca_systemstore_win.cpp
|
||||
}
|
||||
mac: {
|
||||
SOURCES += $$QCA_CPP/qca_systemstore_mac.cpp
|
||||
LIBS += -framework Carbon -framework Security
|
||||
}
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = src tools
|
||||
|
||||
include(conf.pri)
|
||||
include(extra.pri)
|
||||
|
||||
# install
|
||||
pcfiles.path = $$PREFIX/lib/pkgconfig
|
||||
pcfiles.files = qca.pc
|
||||
INSTALLS += pcfiles
|
||||
|
||||
|
8
qca.qc
8
qca.qc
@ -1,8 +1,14 @@
|
||||
<qconf>
|
||||
<name>Qt Cryptographic Architecture (QCA)</name>
|
||||
<profile>qca.pro</profile>
|
||||
<nobindir/>
|
||||
<lib/>
|
||||
<libdir/>
|
||||
<datadir/>
|
||||
<moddir>.</moddir>
|
||||
<dep type='certstore'>
|
||||
<required/>
|
||||
</dep>
|
||||
<dep type='extra'>
|
||||
<required/>
|
||||
</dep>
|
||||
</qconf>
|
||||
|
33
qcextra
33
qcextra
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat >extra.pri <<EOT
|
||||
target.path=$PREFIX/lib
|
||||
INSTALLS += target
|
||||
|
||||
incfiles.path=$PREFIX/include/QtCrypto
|
||||
incfiles.files=\$\$PUBLIC_HEADERS
|
||||
INSTALLS += incfiles
|
||||
|
||||
pcfiles.path=$PREFIX/lib/pkgconfig
|
||||
pcfiles.files=qca.pc
|
||||
INSTALLS += pcfiles
|
||||
|
||||
INSTALL_ROOT = $PREFIX
|
||||
|
||||
EOT
|
||||
|
||||
cat >qca.pc <<EOF
|
||||
prefix= $PREFIX
|
||||
exec_prefix=\${prefix}
|
||||
libdir=\${prefix}/lib
|
||||
includedir=\${prefix}/include/QtCrypto
|
||||
|
||||
Name: QCA
|
||||
Description: Qt Cryptographic Architecture library
|
||||
Version: 2.0.0 #maybe this shouldn't be literal...
|
||||
Requires: qt-mt
|
||||
Libs: -L\${libdir} -lqca
|
||||
Cflags: -I\${includedir}
|
||||
|
||||
|
||||
EOF
|
85
src/src.pro
Normal file
85
src/src.pro
Normal file
@ -0,0 +1,85 @@
|
||||
# qca qmake profile
|
||||
|
||||
QCA_BASE = ..
|
||||
QCA_INCBASE = ../include
|
||||
QCA_SRCBASE = .
|
||||
|
||||
TEMPLATE = lib
|
||||
#CONFIG += release
|
||||
QT -= gui
|
||||
TARGET = qca
|
||||
DESTDIR = $$QCA_BASE
|
||||
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
|
||||
VER_MAJ = 2
|
||||
VER_MIN = 0
|
||||
|
||||
# make DLL
|
||||
win: {
|
||||
CONFIG += dll
|
||||
DEFINES += QCA_MAKEDLL
|
||||
}
|
||||
|
||||
QCA_INC = $$QCA_INCBASE/QtCrypto
|
||||
QCA_CPP = $$QCA_SRCBASE
|
||||
INCLUDEPATH += $$QCA_INC $$QCA_CPP
|
||||
|
||||
# botantools
|
||||
include($$QCA_SRCBASE/botantools/botantools.pri)
|
||||
|
||||
PRIVATE_HEADERS += \
|
||||
$$QCA_CPP/qca_plugin.h \
|
||||
$$QCA_CPP/qca_systemstore.h
|
||||
|
||||
PUBLIC_HEADERS += \
|
||||
$$QCA_INC/qca_export.h \
|
||||
$$QCA_INC/qca_tools.h \
|
||||
$$QCA_INC/qca_core.h \
|
||||
$$QCA_INC/qca_textfilter.h \
|
||||
$$QCA_INC/qca_basic.h \
|
||||
$$QCA_INC/qca_publickey.h \
|
||||
$$QCA_INC/qca_cert.h \
|
||||
$$QCA_INC/qca_keystore.h \
|
||||
$$QCA_INC/qca_securelayer.h \
|
||||
$$QCA_INC/qca_securemessage.h \
|
||||
$$QCA_INC/qcaprovider.h \
|
||||
|
||||
HEADERS += $$PRIVATE_HEADERS $$PUBLIC_HEADERS
|
||||
|
||||
SOURCES += \
|
||||
$$QCA_CPP/qca_tools.cpp \
|
||||
$$QCA_CPP/qca_core.cpp \
|
||||
$$QCA_CPP/qca_textfilter.cpp \
|
||||
$$QCA_CPP/qca_plugin.cpp \
|
||||
$$QCA_CPP/qca_basic.cpp \
|
||||
$$QCA_CPP/qca_publickey.cpp \
|
||||
$$QCA_CPP/qca_cert.cpp \
|
||||
$$QCA_CPP/qca_keystore.cpp \
|
||||
$$QCA_CPP/qca_securelayer.cpp \
|
||||
$$QCA_CPP/qca_securemessage.cpp \
|
||||
$$QCA_CPP/qca_default.cpp
|
||||
|
||||
unix:!mac: {
|
||||
SOURCES += $$QCA_CPP/qca_systemstore_flatfile.cpp
|
||||
}
|
||||
win: {
|
||||
SOURCES += $$QCA_CPP/qca_systemstore_win.cpp
|
||||
}
|
||||
mac: {
|
||||
SOURCES += $$QCA_CPP/qca_systemstore_mac.cpp
|
||||
LIBS += -framework Carbon -framework Security
|
||||
}
|
||||
|
||||
include($$QCA_BASE/conf.pri)
|
||||
|
||||
# install
|
||||
target.path = $$LIBDIR
|
||||
INSTALLS += target
|
||||
|
||||
incfiles.path = $$PREFIX/include/QtCrypto
|
||||
incfiles.files = $$PUBLIC_HEADERS
|
||||
incfiles.files += $$QCA_INC/qca.h $$QCA_INC/QtCrypto
|
||||
INSTALLS += incfiles
|
||||
|
@ -1,12 +1,18 @@
|
||||
QT -= gui
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
DESTDIR = ../../bin
|
||||
|
||||
INCLUDEPATH += ../../include/QtCrypto
|
||||
SOURCES = main.cpp
|
||||
|
||||
LIBS += -L../.. -lqca
|
||||
|
||||
include(../../conf.pri)
|
||||
|
||||
target.path=$$BINDIR
|
||||
INSTALLS += target
|
||||
|
||||
# temporarily build directly against openssl
|
||||
DEFINES += QT_STATICPLUGIN
|
||||
SOURCES += ../../plugins/qca-openssl/qca-openssl.cpp
|
||||
|
3
tools/tools.pro
Normal file
3
tools/tools.pro
Normal file
@ -0,0 +1,3 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = mozcerts qcatool
|
||||
|
Loading…
x
Reference in New Issue
Block a user