diff --git a/.gitignore b/.gitignore index 2291ec8d0..dc43aa39c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ phoenix.pro.user /phoenix-build-* /release* /build* +/config.tests/build* /debug* *.user *.user* diff --git a/phoenix.pro b/phoenix.pro index 6a83e4d7f..44cecc321 100644 --- a/phoenix.pro +++ b/phoenix.pro @@ -170,8 +170,12 @@ equals(QT_MAJOR_VERSION, 6) { RC_FILE = fritzing.rc RESOURCES += phoenixresources.qrc -# Disable this if you have (and want) libgit2 dynamically -LIBGIT_STATIC = true +# If you have installed libgit2 (dynamic version) +# pass the LIBGIT_STATIC variable to qmake during building: +# $ qmake LIBGIT_STATIC=false +# If you do not pass the variable, it will automatically set +# to true. +!defined(LIBGIT_STATIC, var): LIBGIT_STATIC = true include(pri/libgit2detect.pri) include(pri/boostdetect.pri) include(pri/spicedetect.pri) diff --git a/pri/libgit2detect.pri b/pri/libgit2detect.pri index 7458d3746..27aea5ea1 100644 --- a/pri/libgit2detect.pri +++ b/pri/libgit2detect.pri @@ -13,7 +13,6 @@ # along with Fritzing. If not, see . # ******************************************************************** - packagesExist(libgit2) { } else { LIBGIT_STATIC = true @@ -51,6 +50,9 @@ win32 { } unix { + # Look up Ubuntu distribution (codename) + LSB_INFO = $$system(lsb_release -sc 2> /dev/null) + if ($$LIBGIT_STATIC) { LIBGIT2LIB = $$_PRO_FILE_PWD_/../libgit2/build exists($$LIBGIT2LIB/libgit2.a) { @@ -61,7 +63,39 @@ unix { macx { LIBS += $$LIBGIT2LIB/libgit2.a -framework Security } else { - LIBS += $$LIBGIT2LIB/libgit2.a -lssl -lcrypto + # Ubuntu Bionic + if(contains(LSB_INFO, bionic)) { + message("we are on Ubuntu bionic.") + # Check if the http_parser library is installed + exists($$[QT_INSTALL_LIBS]/libhttp_parser.a) { + message("Using system-wide installed http-parser lib.") + LIBS += $$LIBGIT2LIB/libgit2.a -lhttp_parser -lssl -lcrypto + } else { + message("Using http-parser bundled with libgit2.") + LIBS += $$LIBGIT2LIB/libgit2.a -lssl -lcrypto + } + # Ubuntu Focal + } else:contains(LSB_INFO, focal) { + message("we are on Ubuntu focal.") + # Check if the http_parser library is installed + exists($$[QT_INSTALL_LIBS]/libhttp_parser.a) { + message("Using system-wide installed http-parser lib.") + LIBS += $$LIBGIT2LIB/libgit2.a -lhttp_parser -lssh2 -lssl -lcrypto + } else { + message("Using http-parser bundled with libgit2.") + LIBS += $$LIBGIT2LIB/libgit2.a -lssh2 -lssl -lcrypto + } + # Other Linux OS (tested on Fedora-30) + } else { + message("we are neither on Ubuntu focal nor on Ubuntu bionic.") + exists($$[QT_INSTALL_LIBS]/libhttp_parser.a) { + message("Using system-wide installed http-parser lib.") + LIBS += $$LIBGIT2LIB/libgit2.a -lhttp_parser -lssl -lcrypto + } else { + message("Using http-parser bundled with libgit2.") + LIBS += $$LIBGIT2LIB/libgit2.a -lssl -lcrypto + } + } } } else { !build_pass:warning("Using dynamic linking for libgit2.")