Make usage of sqlcipher explicit at compile time

Either the build fails if it is not available, or the user specifies
CONFIG+=NO_SQLCIPHER to build without it, even if it exists in the system.
This commit is contained in:
AsamK 2015-08-31 19:25:10 +02:00
parent dca295143a
commit 846f7d0204
3 changed files with 15 additions and 50 deletions

View File

@ -138,15 +138,22 @@ linux-* {
DEPENDPATH += . $${SSL_DIR} $${UPNP_DIR}
INCLUDEPATH += . $${SSL_DIR} $${UPNP_DIR}
SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
isEmpty(SQLCIPHER_OK) {
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
!exists(../../../lib/sqlcipher/.libs/libsqlcipher.a) {
message(libsqlcipher.a not found. Compilation will not use SQLCIPER. Database will be unencrypted.)
DEFINES *= NO_SQLCIPHER
contains(CONFIG, NO_SQLCIPHER) {
DEFINES *= NO_SQLCIPHER
LIBS *= -lsqlite3
} else {
SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
isEmpty(SQLCIPHER_OK) {
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
exists(../../../lib/sqlcipher/.libs/libsqlcipher.a) {
LIBS += ../../../lib/sqlcipher/.libs/libsqlcipher.a
DEPENDPATH += ../../../lib/
INCLUDEPATH += ../../../lib/
} else {
error("libsqlcipher is not installed and libsqlcipher.a not found. SQLCIPHER is necessary for encrypted database, to build with unencrypted database, run: qmake CONFIG+=NO_SQLCIPHER")
}
} else {
DEPENDPATH += ../../../lib/
INCLUDEPATH += ../../../lib/
LIBS *= -lsqlcipher
}
}

View File

@ -85,27 +85,6 @@ linux-* {
LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
isEmpty(SQLCIPHER_OK) {
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
exists(../../../lib/sqlcipher/.libs/libsqlcipher.a) {
LIBS += ../../../lib/sqlcipher/.libs/libsqlcipher.a
DEPENDPATH += ../../../lib/sqlcipher/src/
INCLUDEPATH += ../../../lib/sqlcipher/src/
DEPENDPATH += ../../../lib/sqlcipher/tsrc/
INCLUDEPATH += ../../../lib/sqlcipher/tsrc/
} else {
message(libsqlcipher.a not found. Compilation will not use SQLCIPHER. Database will be unencrypted.)
DEFINES *= NO_SQLCIPHER
LIBS *= -lsqlite3
}
} else {
LIBS += -lsqlcipher
}
LIBS *= -lglib-2.0
LIBS *= -rdynamic
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions

View File

@ -35,27 +35,6 @@ linux-* {
LIBS += -lssl -lupnp -lixml -lgnome-keyring
LIBS *= -lcrypto -ldl -lz -lpthread
LIBS *= -rdynamic
gxs {
SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
isEmpty(SQLCIPHER_OK) {
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
exists(../../../lib/sqlcipher/.libs/libsqlcipher.a) {
LIBS += ../../../lib/sqlcipher/.libs/libsqlcipher.a
DEPENDPATH += ../../../lib/sqlcipher/src/
INCLUDEPATH += ../../../lib/sqlcipher/src/
} else {
message(libsqlcipher.a not found. Compilation will not use SQLCIPHER. Database will be unencrypted.)
DEFINES *= NO_SQLCIPHER
LIBS *= -lsqlite3
}
} else {
LIBS *= -lsqlcipher
}
}
}
unix {