initial commit

This commit is contained in:
mikhail "synzr" 2025-12-25 01:37:49 +05:00
commit 9d20827c46
2469 changed files with 470994 additions and 0 deletions

5
iris/qcm/README Normal file
View file

@ -0,0 +1,5 @@
qt42, buildmode, and universal modules are all copied from qca.
do not modify them here.
the qca module is copied from qca, but modified here. we should consider
pushing the changes back.

201
iris/qcm/buildmode.qcm Normal file
View file

@ -0,0 +1,201 @@
/*
-----BEGIN QCMOD-----
name: buildmode
section: project
arg: release,Build with debugging turned off (default).
arg: debug,Build with debugging turned on.
arg: debug-and-release,Build two versions, with and without debugging turned on (mac only).
arg: no-separate-debug-info,Do not store debug information in a separate file (default for mac).
arg: separate-debug-info,Strip debug information into a separate .debug file (default for non-mac).
arg: no-framework,Do not build as a Mac framework.
arg: framework,Build as a Mac framework (default).
-----END QCMOD-----
*/
#define QC_BUILDMODE
bool qc_buildmode_release = false;
bool qc_buildmode_debug = false;
bool qc_buildmode_framework = false;
bool qc_buildmode_separate_debug_info = 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()
{
// first, parse out the options
bool opt_release = false;
bool opt_debug = false;
bool opt_debug_and_release = false;
bool opt_no_framework = false;
bool opt_framework = false;
bool opt_no_separate_debug_info = false;
bool opt_separate_debug_info = false;
if(conf->getenv("QC_RELEASE") == "Y")
opt_release = true;
if(conf->getenv("QC_DEBUG") == "Y")
opt_debug = true;
if(conf->getenv("QC_DEBUG_AND_RELEASE") == "Y")
opt_debug_and_release = true;
if(conf->getenv("QC_NO_FRAMEWORK") == "Y")
opt_no_framework = true;
if(conf->getenv("QC_FRAMEWORK") == "Y")
opt_framework = true;
if(conf->getenv("QC_NO_SEPARATE_DEBUG_INFO") == "Y")
opt_no_separate_debug_info = true;
if(conf->getenv("QC_SEPARATE_DEBUG_INFO") == "Y")
opt_separate_debug_info = true;
bool staticmode = false;
if(conf->getenv("QC_STATIC") == "Y")
staticmode = true;
#ifndef Q_OS_MAC
if(opt_debug_and_release)
{
printf("\nError: The --debug-and-release option is for mac only.\n");
exit(1);
}
if(opt_framework)
{
printf("\nError: The --framework option is for mac only.\n");
exit(1);
}
#endif
if(opt_framework && opt_debug)
{
printf("\nError: Cannot use both --framework and --debug.\n");
exit(1);
}
// sanity check exclusive options
int x;
// build mode
x = 0;
if(opt_release)
++x;
if(opt_debug)
++x;
if(opt_debug_and_release)
++x;
if(x > 1)
{
printf("\nError: Use only one of --release, --debug, or --debug-and-release.\n");
exit(1);
}
// framework
if(opt_framework && staticmode)
{
printf("\nError: Cannot use both --framework and --static.\n");
exit(1);
}
x = 0;
if(opt_no_framework)
++x;
if(opt_framework)
++x;
if(x > 1)
{
printf("\nError: Use only one of --framework or --no-framework.\n");
exit(1);
}
// debug info
x = 0;
if(opt_no_separate_debug_info)
++x;
if(opt_separate_debug_info)
++x;
if(x > 1)
{
printf("\nError: Use only one of --separate-debug-info or --no-separate-debug-info\n");
exit(1);
}
// now process the options
if(opt_release)
qc_buildmode_release = true;
else if(opt_debug)
qc_buildmode_debug = true;
else if(opt_debug_and_release)
{
qc_buildmode_release = true;
qc_buildmode_debug = true;
}
else // default
qc_buildmode_release = true;
if(opt_framework)
qc_buildmode_framework = true;
else if(opt_no_framework)
{
// nothing to do
}
else // default
{
if(!staticmode && !opt_debug)
qc_buildmode_framework = true;
}
if(opt_separate_debug_info)
qc_buildmode_separate_debug_info = true;
else if(opt_no_separate_debug_info)
{
// nothing to do
}
else // default
{
#ifndef Q_OS_MAC
qc_buildmode_separate_debug_info = true;
#endif
}
// make the string
QStringList opts;
QString other;
if(qc_buildmode_release && qc_buildmode_debug)
{
opts += "debug_and_release";
opts += "build_all";
}
else if(qc_buildmode_release)
opts += "release";
else // qc_buildmode_debug
opts += "debug";
#ifdef Q_OS_MAC
if(qc_buildmode_framework)
opts += "lib_bundle";
#endif
if(qc_buildmode_separate_debug_info)
{
opts += "separate_debug_info";
other += "QMAKE_CFLAGS += -g\n";
other += "QMAKE_CXXFLAGS += -g\n";
}
QString str = QString("CONFIG += ") + opts.join(" ") + '\n';
conf->addExtra(str);
if(!other.isEmpty())
conf->addExtra(other);
return true;
}
};

90
iris/qcm/extra.qcm Normal file
View file

@ -0,0 +1,90 @@
/*
-----BEGIN QCMOD-----
name: extra
section: project
arg: disable-tests,Don't build examples and unittests.
-----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 str;
QFile f;
if(conf->getenv("QC_DISABLE_TESTS") == "Y")
str += "CONFIG += no_tests\n";
conf->addExtra(str);
bool release = true;
bool debug = false;
bool debug_info = false;
bool universal = false;
QString sdk;
#ifdef QC_BUILDMODE
release = qc_buildmode_release;
debug = qc_buildmode_debug;
debug_info = qc_buildmode_separate_debug_info;
#endif
#ifdef QC_UNIVERSAL
universal = qc_universal_enabled;
sdk = qc_universal_sdk;
#endif
// write confapp_unix.pri
str = QString();
QString var = conf->getenv("BINDIR");
if(!var.isEmpty())
str += QString("BINDIR = %1\n").arg(var);
if(debug) // debug or debug-and-release
str += QString("CONFIG += debug\n");
else // release
str += QString("CONFIG += release\n");
if(debug_info)
{
str += QString("CONFIG += separate_debug_info\n");
str += "QMAKE_CFLAGS += -g\n";
str += "QMAKE_CXXFLAGS += -g\n";
}
if(universal)
{
str +=
"contains(QT_CONFIG,x86):contains(QT_CONFIG,ppc) {\n"
" CONFIG += x86 ppc\n"
"}\n";
if(!sdk.isEmpty())
str += QString("QMAKE_MAC_SDK = %1\n").arg(sdk);
}
#ifdef QC_QCA
if(!qc_qca_procode.isEmpty())
str += qc_qca_procode;
#endif
f.setFileName("confapp_unix.pri");
if(f.open(QFile::WriteOnly | QFile::Truncate))
f.write(str.toLatin1());
f.close();
return true;
}
QString makeEscapedDefine(const QString &var, const QString &val)
{
QString str = QString(
"DEFINES += %1=\\\\\\\\\\\\\\"%2\\\\\\\\\\\\\\"\n"
).arg(var).arg(val);
return str;
}
};

126
iris/qcm/qca.qcm Normal file
View file

@ -0,0 +1,126 @@
/*
-----BEGIN QCMOD-----
name: QCA >= 2.0
arg: with-qca=[path],Specify path to QCA tree, mainly for building against an uninstalled QCA.
-----END QCMOD-----
*/
// based on crypto.prf. any changes made to that file need to be tracked here.
static QString internal_crypto_prf(const QString &incdir, const QString &libdir)
{
QString out = QString(
"QCA_INCDIR = %1\n"
"QCA_LIBDIR = %2\n"
"\n"
"CONFIG *= qt\n"
"\n"
"LINKAGE =\n"
"\n"
"# on mac, if qca was built as a framework, link against it\n"
"mac: {\n"
" framework_dir = $$QCA_LIBDIR\n"
" exists($$framework_dir/qca.framework) {\n"
" #QMAKE_FRAMEWORKPATH *= $$framework_dir\n"
" LIBS += -F$$framework_dir\n"
" INCLUDEPATH += $$framework_dir/qca.framework/Headers\n"
" LINKAGE = -framework qca\n"
" }\n"
"}\n"
"\n"
"# else, link normally\n"
"isEmpty(LINKAGE) {\n"
" INCLUDEPATH += $$QCA_INCDIR/QtCrypto\n"
" LIBS += -L$$QCA_LIBDIR\n"
" LINKAGE = -lqca\n"
" CONFIG(debug, debug|release) {\n"
" windows:LINKAGE = -lqcad\n"
" mac:LINKAGE = -lqca_debug\n"
" }\n"
"}\n"
"\n"
"LIBS += $$LINKAGE\n"
).arg(incdir, libdir);
return out;
}
#define QC_QCA
QString qc_qca_procode;
//----------------------------------------------------------------------------
// qc_qca
//----------------------------------------------------------------------------
class qc_qca : public ConfObj
{
public:
qc_qca(Conf *c) : ConfObj(c) {}
QString name() const { return "QCA >= 2.0"; }
QString shortname() const { return "qca"; }
bool exec()
{
// get the build mode
#ifdef QC_BUILDMODE
bool release = qc_buildmode_release;
bool debug = qc_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 qca_prefix, qca_incdir, qca_libdir, qca_crypto_prf;
qca_prefix = conf->getenv("QC_WITH_QCA");
QString proextra;
if(!qca_prefix.isEmpty()) {
qca_incdir = qca_prefix + "/include";
qca_libdir = qca_prefix + "/lib";
qca_crypto_prf = internal_crypto_prf(qca_incdir, qca_libdir);
proextra =
"CONFIG += qt\n"
"QT -= gui\n";
proextra += qca_crypto_prf;
} 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 && x < 0x030000) return 0; else return 1;\n"
"}\n";
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(!qca_prefix.isEmpty())
str = qca_crypto_prf;
else
str = "CONFIG += crypto\n";
qc_qca_procode = str;
conf->addExtra(str);
return true;
}
};

20
iris/qcm/qt42.qcm Normal file
View file

@ -0,0 +1,20 @@
/*
-----BEGIN QCMOD-----
name: Qt >= 4.2
-----END QCMOD-----
*/
class qc_qt42 : public ConfObj
{
public:
qc_qt42(Conf *c) : ConfObj(c) {}
QString name() const { return "Qt >= 4.2"; }
QString shortname() const { return "qt42"; }
bool exec()
{
conf->debug(QString("QT_VERSION = 0x%1").arg(QString::number(QT_VERSION, 16)));
if(QT_VERSION >= 0x040200)
return true;
else
return false;
}
};

49
iris/qcm/universal.qcm Normal file
View file

@ -0,0 +1,49 @@
/*
-----BEGIN QCMOD-----
name: Mac universal binary support
section: project
arg: universal,Build with Mac universal binary support.
arg: mac-sdk=[path],Path to Mac universal SDK (PPC host only).
-----END QCMOD-----
*/
#define QC_UNIVERSAL
bool qc_universal_enabled = false;
QString qc_universal_sdk;
//----------------------------------------------------------------------------
// qc_universal
//----------------------------------------------------------------------------
class qc_universal : public ConfObj
{
public:
qc_universal(Conf *c) : ConfObj(c) {}
QString name() const { return "Mac universal binary support"; }
QString shortname() const { return "universal"; }
QString checkString() const { return QString(); }
bool exec()
{
#ifdef Q_OS_MAC
if(qc_getenv("QC_UNIVERSAL") == "Y")
{
qc_universal_enabled = true;
QString str =
"contains(QT_CONFIG,x86):contains(QT_CONFIG,ppc) {\n"
" CONFIG += x86 ppc\n"
"}\n";
QString sdk = qc_getenv("QC_MAC_SDK");
if(!sdk.isEmpty())
{
str += QString("QMAKE_MAC_SDK = %1\n").arg(sdk);
qc_universal_sdk = sdk;
}
conf->addExtra(str);
}
#endif
return true;
}
};

55
iris/qcm/zlib.qcm Normal file
View file

@ -0,0 +1,55 @@
/*
-----BEGIN QCMOD-----
name: zlib
arg: with-zlib-inc=[path],Path to zlib include files
arg: with-zlib-lib=[path],Path to zlib library files
-----END QCMOD-----
*/
//----------------------------------------------------------------------------
// qc_zlib
//----------------------------------------------------------------------------
class qc_zlib : public ConfObj
{
public:
qc_zlib(Conf *c) : ConfObj(c) {}
QString name() const { return "zlib"; }
QString shortname() const { return "zlib"; }
bool exec()
{
QString inc, lib;
QString s;
s = conf->getenv("QC_WITH_ZLIB_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "zlib.h"))
return false;
inc = s;
}
else {
if(!conf->findHeader("zlib.h", QStringList(), &s))
return false;
inc = s;
}
s = conf->getenv("QC_WITH_ZLIB_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "z"))
return false;
lib = s;
}
else {
if(!conf->findLibrary("z", &s))
return false;
lib = s;
}
if(!inc.isEmpty())
conf->addIncludePath(inc);
if(!lib.isEmpty())
conf->addLib(QString("-L") + s);
conf->addLib("-lz");
return true;
}
};