From 053c9bd5896f7b6f4fcafa8b1612f4e798f92bc5 Mon Sep 17 00:00:00 2001 From: Dave Woodfall Date: Fri, 14 Dec 2018 21:16:13 +0000 Subject: libraries/qt5: Add CCACHE and WEBENGINE options. Add notes. I've added some benchmarking notes on building with various ways - with/without webengine, with/without ccache etc. Ought to save some time for anyone not wanting the web code. --- libraries/qt5/README | 108 +++++++++++++++++++++++++------------ libraries/qt5/README.benchmarks | 114 ++++++++++++++++++++++++++++++++++++++++ libraries/qt5/README.ccache | 46 ++++++++++++++++ libraries/qt5/qt5.SlackBuild | 83 ++++++++++++++++++++--------- 4 files changed, 293 insertions(+), 58 deletions(-) create mode 100644 libraries/qt5/README.benchmarks create mode 100644 libraries/qt5/README.ccache diff --git a/libraries/qt5/README b/libraries/qt5/README index 1aff0e6a62..c0fc3bbad5 100644 --- a/libraries/qt5/README +++ b/libraries/qt5/README @@ -7,61 +7,48 @@ against if they are detected at build time: libwebp opus pcre2 snappy - ============================================================ OPTIONS -To build the documentation pass DOCS=yes to the SlackBuild: - - DOCS=yes ./qt5.SlackBuild - -To build the examples pass EXAMPLES=yes to the SlackBuild: +To use Qt's built-in ccache option: - EXAMPLES=yes ./qt5.SlackBuild + CCACHE=yes ./qt5.SlackBuild -NOTE +See README.benchmarks for the benefits of using ccache. -Building the documentation and examples creates a -significantly larger package. +To build the documentation: + DOCS=yes ./qt5.SlackBuild -ROUGH SIZE GUIDE +To build the examples: -Package size: + EXAMPLES=yes ./qt5.SlackBuild - Qt alone: 102M - With documentation: 339M - With examples: 391M - With both documentation and examples: 628M +To build support for proprietary media codecs: -Minumum working space needed (size of source and package -directories at end of build): + PROPRIETARY_CODECS=yes ./qt5.SlackBuild - Qt alone: 5018M - With documentation: 6197M - With examples: 6388M - With both documentation and examples: 7604M +(this will produce a non-redistributable package in some +countries) +To disable support for pulseaudio: -To build support for proprietary media codecs pass -PROPRIETARY_CODECS=yes to the SlackBuild (this will produce -a non-redistributable package in some countries): + PULSEAUDIO=no ./qt5.SlackBuild - PROPRIETARY_CODECS=yes ./qt5.SlackBuild +(Qt will automatically detect if pulseaudio is not installed +at build time and disable it if it is missing.) -To disable support for pulseaudio pass PULSEAUDIO=no to the -SlackBuild: +To NOT build qtwebengine (EXPERIMENTAL): - PULSEAUDIO=no ./qt5.SlackBuild + WEBENGINE=no ./qt5.SlackBuild -Qt will automatically detect if it is not installed at build -time and not provide support for it. +Combine any or all of the above. ============================================================ -NOTE +GENERAL NOTES After upgrading Qt5 it is important to rebuild qt5ct too, if it is installed, or some applications may not display or @@ -69,7 +56,62 @@ function correctly. There is a qt5-legacy (5.7.1) SlackBuild that is available for older applications that do not run correctly with this -version. However it will not coexist with this version. +version. However it will not coexist with this version. Please report any problems about applications that don't work correctly to the Qt5 maintainer or to the mailing list. + +============================================================ + +ROUGH SPEED & SIZE GUIDE + + OPTION PKG SPACE TIME + Normal: 102M 5018M 9:55 + No Webengine: 50M 1895M 3:18 + With Documentation: 339M 6197M - + With Examples: 391M 6388M - + With Documentation and Examples: 628M 7604M - + + PKG: Package size. + SPACE: Package directory + source space needed. + TIME: Rough build time (- = unknown.) + +See README.benchmarks for more detailed information. +See README.ccache for information on setting up ccache. + +============================================================ + +NOTES ON OPTIONS + +* Using ccache should speed up subsequent rebuilds, but may + be slower for first time or one-off builds. + +* Building the documentation and/or examples creates a + significantly larger package. + +* Successfully tested so far without webengine (VERY quick + tests): + + QMPlay2 + qt5ct + qbittorrent-qt5 + speedcrunch + qca-qt5 + psi-plus + sddm + +============================================================ + +BUILDING WITHOUT WEBENGINE + +See README.benchmarks for the benefits of not building +webengine. + +YMMV whether it works with an application or not, but if you +have no intention of using the browser code, which includes +a chunk of 3rd party Google Chromium source, then it may +make sense to skip it and save yourself about 2/3 of the +build time. + +The package version has _nowebengine appended to it for +clarity. diff --git a/libraries/qt5/README.benchmarks b/libraries/qt5/README.benchmarks new file mode 100644 index 0000000000..466d6b924d --- /dev/null +++ b/libraries/qt5/README.benchmarks @@ -0,0 +1,114 @@ +ENVIRONMENT + + Linux 4.4.157 SMP x86_64 (stock 14.2 -huge.) + Using /usr/bin/time rather than shell built-in. + Jobs: 2. + Qt version: 5.9.7 + +DMI Info: + + Board: Lenovo Mahobay motherboard. + CPU: Version: Intel(R) Pentium(R) CPU G640 @ 2.80GHz + Family: Core i7 Core Count: 2 + Core Enabled: 2 + Thread Count: 2 + Max Speed: 2800 MHz + Current Speed: 2800 MHz + External Clock: 100 MHz + + CPUFREQ: Performance mode. + + RAM: 12G (1333 MHz) DDR3. + + An 8 GB tmpfs in /mnt/memory is used as a ramdisk for /tmp + while the package was output on the real HDD. i.e. + $TMP=/mnt/memory/SBo + $OUTPUT=/tmp + +System ccache setup: + + cache size: 18.3 GB + max_cache: 20.0 GB + cache_dir: /root/.ccache + CCACHE_TEMPDIR=/mnt/memory/ccache + +No special settings were used for Qt's -ccache. +All builds with either ccache option were performed a few +times to build up enough cache. + +BENCHMARKS + +BUILDS WITH WEBENGINE + +Normal build: + +45970.94 user +2408.58 system +9:55:02 elapsed +135% CPU (0 avgtext + 0 avgdata 7378176 maxresident) k +80232 inputs + 522800 outputs (263 major + 950621123 minor) pagefaults +0 swaps + +Using Qt's -ccache option: + +36223.82 user +1872.14 system +6:58:03 elapsed +151% CPU (0 avgtext + 0 avgdata 7375136 maxresident) k +274848 inputs + 578712 outputs (730 major + 724828690 minor) pagefaults +0 swaps + +Using system ccache: + +4008.03 user +289.34 system +1:17:11 elapsed +92% CPU (0 avgtext + 0 avgdata 7377248 maxresident) k +4396232 inputs + 391856 outputs (97 major + 59094442 minor) pagefaults +0 swaps + + +BUILDS WITHOUT WEBENGINE + +Normal build: + +10408.66 user +687.60 system +3:18:22 elapsed +93% CPU (0 avgtext + 0 avgdata 3850048 maxresident) k +48176 inputs + 414056 outputs (26 major + 265106108 minor) pagefaults +0 swaps + +Using Qt's -ccache option: + +1055.75 user +167.14 system +22:17.13 elapsed +91% CPU (0 avgtext + 0 avgdata 1188432 maxresident) k +936 inputs + 468464 outputs (8 major + 42575851 minor) pagefaults +0 swaps + +Using system ccache: + +922.05 user +159.25 system +19:42.82 elapsed +91% CPU (0 avgtext + 0 avgdata 504048 maxresident) k +5672 inputs + 158016 outputs (5 major + 38449127 minor) pagefaults +0 swaps + + +Average Packages Sizes: + +Normal: 102 MB +Without webengine: 50 MB + + +As is seen by the elapsed time in the results, using ccache +system-wide has a huge benefit. Qt's -ccache option showed +little gain when building the full package, but was good +when building without webengine. + +See README.ccache for information on setting up ccache. + +Last updated Mon 10 Dec 03:46:29 UTC 2018 diff --git a/libraries/qt5/README.ccache b/libraries/qt5/README.ccache new file mode 100644 index 0000000000..1053bcc5c9 --- /dev/null +++ b/libraries/qt5/README.ccache @@ -0,0 +1,46 @@ +NOTES ON SETTING UP CCACHE + +Using ccache can save a lot of time when building packages, +and this is not limited to Qt5. Ccache is installed by +default on stock Slackware. + +ccache(1) has a lot of useful info on using ccache, however +I don't recommend using its method of symlinking. Instead I +recommend the following way: + +mkdir -p /usr/local/bin +ln -s /usr/bin/ccache /usr/local/bin/cc +ln -s /usr/bin/ccache /usr/local/bin/c++ +ln -s /usr/bin/ccache /usr/local/bin/gcc +ln -s /usr/bin/ccache /usr/local/bin/g++ + +Doing it this way rather than copying the ccache binary as +the man page suggests will ensure that the ccache used is +updated whenever the ccache package is. + +The cache is created in the home directory of the user using +it, and since slackbuilds are run by root that will be in +/root/.ccache, therefore ensure that you have enough free +space on the root file system for it. It is possible to put +the cache directory elsewhere though. See the man page for +info. But it would probably be fastest when on the same +file system as the build directory. + +It's also possible to host the cache on a shared NFS +directory, but be sure to test the speed before committing +to that. The man page has some notes on this. + +Since Qt5 can take a lot of build space I recommend a max +cache size of AT LEAST 6 GB. If you intend to use it all +the time then use as much as you can. The default size is +5 GB. I use 20 GB on my main build box, but use 7 GB on +workstations and servers. + +Handy commands: + +ccache -s: To show some statistics. +ccache -M : To set the max cache size to N. + +(use G for GB with -M.) + +Last updated Mon 10 Dec 03:46:41 UTC 2018 diff --git a/libraries/qt5/qt5.SlackBuild b/libraries/qt5/qt5.SlackBuild index f4b56a8214..18ed17ca7e 100644 --- a/libraries/qt5/qt5.SlackBuild +++ b/libraries/qt5/qt5.SlackBuild @@ -67,6 +67,52 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} +EXAMPLES=${EXAMPLES:-no} +DOCS=${DOCS:-no} +PROPRIETARY_CODECS=${PROPRIETARY_CODECS:-no} +PULSEAUDIO=${PULSEAUDIO:-yes} +CCACHE=${CCACHE:-no} +WEBENGINE=${WEBENGINE:-yes} + +printf "\n%s\n\n" "SlackBuild Options:" +printf "%s\n" "CCACHE: $CCACHE" +printf "%s\n" "DOCS: $DOCS" +printf "%s\n" "EXAMPLES: $EXAMPLES" +printf "%s\n" "PROPRIETARY_CODECS: $PROPRIETARY_CODECS" +printf "%s\n" "PULSEAUDIO: $PULSEAUDIO" +printf "%s\n" "WEBENGINE: $WEBENGINE" +printf "\n" + +# Default is no. +if [ "$EXAMPLES" == "yes" ]; then + BUILD_EXAMPLES="" +else + BUILD_EXAMPLES="-nomake examples" +fi + +# Default is yes. +if [ "$PULSEAUDIO" = "no" ]; then + PULSE="-no-pulseaudio" +fi + +# Default is no. +if [ "$CCACHE" = "yes" ]; then + CCACHE="-ccache" +else + unset CCACHE +fi + +if [ "$WEBENGINE" = "no" ]; then + EXCLUDE="--exclude=qtweb*" + PKGVERSION="${VERSION}_nowebengine" +else + PKGVERSION="${VERSION}" + # Note that this changes to -webengine-proprietary-codecs in later versions + if [ "$PROPRIETARY_CODECS" = "yes" ]; then + CODECS="-proprietary-codecs" + fi +fi + if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" @@ -101,7 +147,7 @@ mkdir -p $TMP $PKG $OUTPUT cd $TMP echo "Removing any existing source directory. Please wait..." rm -rf ${PRGNAM/5/}-everywhere-opensource-src-$VERSION -tar xvf $CWD/${PRGNAM/5/}-everywhere-opensource-src-$VERSION.tar.xz +tar xvf $CWD/${PRGNAM/5/}-everywhere-opensource-src-$VERSION.tar.xz $EXCLUDE cd ${PRGNAM/5/}-everywhere-opensource-src-$VERSION chown -R root:root . find -L . \ @@ -120,23 +166,6 @@ fi sed -i "s|-O2|$SLKCFLAGS|" qtbase/mkspecs/common/gcc-base.conf -# Build examples. Default is no. -if [ "${EXAMPLES:-no}" == "yes" ]; then - BUILD_EXAMPLES="" -else - BUILD_EXAMPLES="-nomake examples" -fi - -if [ "${PULSEAUDIO:-yes}" = "no" ]; then - PULSE="-no-pulseaudio" -fi - -# New codec option. -# Note that this changes to -webengine-proprietary-codecs in later versions -if [ "${PROPRIETARY_CODECS:-no}" = "yes" ]; then - CODECS="-proprietary-codecs" -fi - export CFLAGS="$SLKCFLAGS" export CXXFLAGS="$SLKCFLAGS -std=c++11" ./configure -v \ @@ -167,6 +196,7 @@ export CXXFLAGS="$SLKCFLAGS -std=c++11" -release \ -no-use-gold-linker \ -c++std c++11 \ + $CCACHE \ $CODECS \ $PULSE \ $RELOCATIONS \ @@ -176,7 +206,7 @@ make make install INSTALL_ROOT=$PKG # Install documentation. Default is not to install documentation. -if [ "${DOCS:-no}" == "yes" ]; then +if [ "$DOCS" == "yes" ]; then # Recreate Makefiles in order to use the just compiled qdoc. for doc in $(find . -name "Makefile*" | xargs egrep "^\s/usr/lib${LIBDIRSUFFIX}/qt5/bin/" \ | cut -d':' -f1 | uniq) @@ -236,11 +266,13 @@ Description: Qt5 Configuration Version: $VERSION EOF -# Fix internal linking for Qt5WebEngineCore.pc. -sed -i \ - -e 's|-Wl,--start-group.* -Wl,--end-group||' \ - -e "s|-L${PWD}/qtwebengine/src/core/api/Release||" \ - $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/Qt5WebEngineCore.pc +if [ "$WEBENGINE" = "yes" ]; then + # Fix internal linking for Qt5WebEngineCore.pc. + sed -i \ + -e 's|-Wl,--start-group.* -Wl,--end-group||' \ + -e "s|-L${PWD}/qtwebengine/src/core/api/Release||" \ + $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/Qt5WebEngineCore.pc +fi # While we are at it, there isn't any reason to keep references to $PKG in the *.prl files. for PRL in $(find $PKG -name "*\.prl"); do @@ -291,6 +323,7 @@ find $PKG \( -name "*.qml" -o -name "*.app" \) -perm 755 -exec chmod 644 '{}' \; mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ README qtbase/{header*,LGPL_EXCEPTION.txt,LICENSE.*L} \ + $CWD/README.benchmarks $CWD/README.ccache \ $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild @@ -299,6 +332,6 @@ cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$PKGVERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} # vim: expandtab -- cgit v1.2.3