diff --git a/build.sh b/build.sh index 3f9906037..7797b244f 100755 --- a/build.sh +++ b/build.sh @@ -34,6 +34,7 @@ if [[ "$COMPILE_JOBS" -gt 8 ]]; then fi SILENT='' +QTDEPLIBS=bundled QTCORE=bundled QTWEBKIT=bundled @@ -57,10 +58,15 @@ until [ -z "$1" ]; do "--silent") SILENT=silent shift;; + "--system-qtdeps") + QTDEPLIBS=system + shift;; "--system-qt") + QTDEPLIBS=system QTCORE=system shift;; "--system-qtwebkit") + QTDEPLIBS=system QTCORE=system QTWEBKIT=system shift;; @@ -71,7 +77,8 @@ until [ -z "$1" ]; do echo " --qt-config CONFIG Specify extra config options to be used when configuring Qt" echo " --jobs NUM How many parallel compile jobs to use. Defaults to 4." echo " --silent Produce less verbose output." - echo " --system-qt Use system-provided Qt core libraries. EXPERIMENTAL, build may not succeed." + echo " --system-qtdeps Use system-provided libraries for all of Qt's dependencies (e.g. freetype, libpng). EXPERIMENTAL." + echo " --system-qt Use system-provided Qt core libraries. EXPERIMENTAL, build may not succeed. Implies --system-qtdeps." echo " --system-qtwebkit Use system-provided QtWebkit. EXPERIMENTAL, build may not succeed. Implies --system-qt." echo exit 0 @@ -125,8 +132,7 @@ echo if [[ "$QTCORE" == "bundled" ]]; then export QMAKE=$PWD/src/qt/qtbase/bin/qmake - export SQLITE3SRCDIR=$PWD/src/qt/qtbase/src/3rdparty/sqlite/ - ( cd src/qt && ./preconfig.sh $QT_CFG ) + ( cd src/qt && ./preconfig.sh $QTDEPLIBS $QT_CFG ) echo echo "Building Qt..." @@ -144,6 +150,9 @@ if [[ "$QTWEBKIT" == "bundled" ]]; then echo echo "Building QtWebkit..." echo + if [[ "$QTDEPLIBS" == "bundled" ]]; then + export SQLITE3SRCDIR=$PWD/src/qt/qtbase/src/3rdparty/sqlite/ + fi ( cd src/qt/qtwebkit && $QMAKE $QMAKE_ARGS && make -j$COMPILE_JOBS $MAKE_S ) diff --git a/src/qt/preconfig.sh b/src/qt/preconfig.sh index 6d03835e3..a9f5ea19d 100755 --- a/src/qt/preconfig.sh +++ b/src/qt/preconfig.sh @@ -2,14 +2,22 @@ set -e +if [[ $1 == "system" ]] || [[ $1 == "bundled" ]]; then + QTDEPLIBS=$1 + shift +else + QTDEPLIBS=bundled +fi + QT_CFG='' QT_CFG+=' -opensource' # Use the open-source license QT_CFG+=' -confirm-license' # Silently acknowledge the license confirmation -QT_CFG+=' -v' # Makes it easier to see what header dependencies are missing +QT_CFG+=' -v' # Reveal what header dependencies are missing QT_CFG+=' -static' # No shared libraries QT_CFG+=' -qpa phantom' # Default to our custom QPA platform QT_CFG+=' -release' # Build only for release (no debugging support) QT_CFG+=' -nomake examples' # Don't build any examples +QT_CFG+=' -no-compile-examples' # Seriously, don't build any examples QT_CFG+=' -nomake tools' # Don't build the tools if [[ $OSTYPE == darwin* ]]; then @@ -40,32 +48,61 @@ QT_CFG+=' -no-libudev' QT_CFG+=' -no-linuxfb' QT_CFG+=' -no-mtdev' QT_CFG+=' -no-nis' -QT_CFG+=' -no-pkg-config' QT_CFG+=' -no-sm' QT_CFG+=' -no-xcb' QT_CFG+=' -no-xcb-xlib' QT_CFG+=' -no-xinerama' +QT_CFG+=' -no-xinput2' QT_CFG+=' -no-xkb' +QT_CFG+=' -no-xrender' -# Use the bundled libraries, vs system-installed -# Note: pcre cannot be disabled, even though webkit has its own regex engine -# Note: as best I can tell, webkitcore has a hard dependency on sqlite -QT_CFG+=' -qt-harfbuzz' -QT_CFG+=' -qt-libjpeg' -QT_CFG+=' -qt-libpng' -QT_CFG+=' -qt-pcre' -QT_CFG+=' -qt-sql-sqlite' -QT_CFG+=' -qt-zlib' +# These are also unnecessary, but it's not possible to turn them off. +#QT_CFG+=' -no-pulseaudio' +#QT_CFG+=' -no-xlib' -# Explicitly compile with support for certain optional features enabled, -# so the build will fail if headers are missing. +# Explicitly compile with support for OpenSSL enabled, so the build +# will fail if headers are missing. QT_CFG+=' -openssl' +# ICU support in QtBase is reported to be unnecessary for Darwin. if [[ $OSTYPE != darwin* ]]; then - # These are reported to be unnecessary and/or not work correctly - # on Darwin. QT_CFG+=' -icu' - QT_CFG+=' -fontconfig' +fi + +# PCRE cannot be disabled, even though WebKit has its own regex +# engine. The Qt probe for system PCRE is hardwired to look for +# -lpcre16, which is ancient and not present on current Linux +# installs. +QT_CFG+=' -qt-pcre' + +if [[ $QTDEPLIBS == bundled ]]; then + # Use the bundled libraries. + # Note: as best I can tell, webkitcore has a hard dependency on sqlite. + QT_CFG+=' -no-pkg-config' + QT_CFG+=' -qt-freetype' + QT_CFG+=' -qt-harfbuzz' + QT_CFG+=' -qt-libjpeg' + QT_CFG+=' -qt-libpng' + QT_CFG+=' -qt-sql-sqlite' + QT_CFG+=' -qt-zlib' + + # There is no bundled copy of fontconfig, and if activated it will + # pull in the system copies of several of the above libraries. + QT_CFG+=' -no-fontconfig' + +else + # Use system-provided libraries. + QT_CFG+=' -system-freetype' + QT_CFG+=' -system-harfbuzz' + QT_CFG+=' -system-libjpeg' + QT_CFG+=' -system-libpng' + QT_CFG+=' -system-sqlite -sql-sqlite' + QT_CFG+=' -system-zlib' + + # Fontconfig is reported to not work correctly on Darwin. + if [[ $OSTYPE != darwin* ]]; then + QT_CFG+=' -fontconfig' + fi fi # Useless styles