Skip to content

Commit

Permalink
Use shared zlib on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rion committed Apr 18, 2012
1 parent 02064b1 commit a21b8f3
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 40 deletions.
3 changes: 0 additions & 3 deletions conf_windows.pri
Expand Up @@ -4,9 +4,6 @@
CONFIG += release
#CONFIG += qca-static

# tell iris to use our internal libz
CONFIG += psi-winzlib

# OpenSSL
qca-static {
DEFINES += HAVE_OPENSSL
Expand Down
28 changes: 13 additions & 15 deletions configure
Expand Up @@ -867,8 +867,8 @@ public:
if(!success)
return false;
conf->addIncludePath(ossl_inc);
conf->addLib(QString("-L") + ossl_lib);
conf->addIncludePath(ossl_inc.replace("\\\", "\\\\\\\"));
conf->addLib(QString("-L") + ossl_lib.replace("\\\", "\\\\\\\"));
conf->addLib(libname_success);
conf->addDefine("HAVE_OPENSSL");
Expand Down Expand Up @@ -962,20 +962,9 @@ public:
qc_zlib(Conf *c) : ConfObj(c) {}
QString name() const { return "zlib"; }
QString shortname() const { return "zlib"; }
#ifdef Q_OS_WIN
QString resultString() const
{
return "using bundled";
}
#endif
bool exec()
{
#ifdef Q_OS_WIN
// HACK: on windows, always use psi's bundled zlib
conf->addExtra("CONFIG += psi-winzlib psi-minizip");
return true;
#else
QStringList incs;
QString version, libs, other;
QString s;
Expand All @@ -991,7 +980,7 @@ public:
if(!conf->findHeader("zlib.h", QStringList(), &s))
return false;
}
incs.append(s);
incs.append(s.replace("\\\", "\\\\\\\"));
s = conf->getenv("QC_WITH_ZLIB_LIB");
if(!s.isEmpty()) {
Expand All @@ -1002,14 +991,23 @@ public:
if(!conf->findLibrary("z", &s))
return false;
}
libs = s.isEmpty()? "-lz" : QString("-L%1 -lz").arg(s);
if (!s.isEmpty()) {
libs = QString("-L%1 -lz").arg(s.replace("\\\", "\\\\\\\"));
} else {
libs = s.isEmpty()? "-lz" : QString("-L%1 -lz").arg(s);
}
}
foreach(const QString &inc, incs) {
conf->addIncludePath(inc);
}
conf->addLib(libs);
#ifdef Q_OS_WIN
// HACK: on windows, always use psi's bundled minizip
conf->addExtra("CONFIG += psi-minizip");
return true;
#else
incs.clear();
libs.clear();
if(!conf->findPkgConfig("minizip", VersionAny, "", &version, &incs, &libs, &other)) {
Expand Down
Binary file modified configure.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions qcm/openssl.qcm
Expand Up @@ -68,8 +68,8 @@ public:
if(!success)
return false;

conf->addIncludePath(ossl_inc);
conf->addLib(QString("-L") + ossl_lib);
conf->addIncludePath(ossl_inc.replace("\\\", "\\\\\\\"));
conf->addLib(QString("-L") + ossl_lib.replace("\\\", "\\\\\\\"));
conf->addLib(libname_success);

conf->addDefine("HAVE_OPENSSL");
Expand Down
24 changes: 11 additions & 13 deletions qcm/zlib.qcm
Expand Up @@ -15,20 +15,9 @@ public:
qc_zlib(Conf *c) : ConfObj(c) {}
QString name() const { return "zlib"; }
QString shortname() const { return "zlib"; }
#ifdef Q_OS_WIN
QString resultString() const
{
return "using bundled";
}
#endif

bool exec()
{
#ifdef Q_OS_WIN
// HACK: on windows, always use psi's bundled zlib
conf->addExtra("CONFIG += psi-winzlib psi-minizip");
return true;
#else
QStringList incs;
QString version, libs, other;
QString s;
Expand All @@ -44,7 +33,7 @@ public:
if(!conf->findHeader("zlib.h", QStringList(), &s))
return false;
}
incs.append(s);
incs.append(s.replace("\\\", "\\\\\\\"));

s = conf->getenv("QC_WITH_ZLIB_LIB");
if(!s.isEmpty()) {
Expand All @@ -55,14 +44,23 @@ public:
if(!conf->findLibrary("z", &s))
return false;
}
libs = s.isEmpty()? "-lz" : QString("-L%1 -lz").arg(s);
if (!s.isEmpty()) {
libs = QString("-L%1 -lz").arg(s.replace("\\\", "\\\\\\\"));
} else {
libs = s.isEmpty()? "-lz" : QString("-L%1 -lz").arg(s);
}
}

foreach(const QString &inc, incs) {
conf->addIncludePath(inc);
}
conf->addLib(libs);

#ifdef Q_OS_WIN
// HACK: on windows, always use psi's bundled minizip
conf->addExtra("CONFIG += psi-minizip");
return true;
#else
incs.clear();
libs.clear();
if(!conf->findPkgConfig("minizip", VersionAny, "", &version, &incs, &libs, &other)) {
Expand Down
6 changes: 0 additions & 6 deletions src/conf_iris.pri
Expand Up @@ -13,12 +13,6 @@ else {
CONFIG += crypto
}

psi-winzlib {
INCLUDEPATH += $$PWD/libpsi/tools/zip/minizip/win32
DEPENDPATH += $$PWD/libpsi/tools/zip/minizip/win32
LIBS += $$PWD/libpsi/tools/zip/minizip/win32/libz.a
}

mac {
# Universal binaries
qc_universal:contains(QT_CONFIG,x86):contains(QT_CONFIG,ppc) {
Expand Down
2 changes: 1 addition & 1 deletion src/libpsi

0 comments on commit a21b8f3

Please sign in to comment.