From 8dfd384e3df08b200c8eb382b740da6839961bf0 Mon Sep 17 00:00:00 2001 From: Peio Rigaux Date: Mon, 6 Jul 2020 18:23:48 +0200 Subject: [PATCH] * Parallelized qt build and install (with make -j) * Parallelized compression for rpm package (with pigz) * Fixed dependencies in docker files * Fixed qt configure in RPM spec file (added font support with fontconfig, accessibility options, text-to-speech...) * Little sed + xargs hack to workaround some distros refusing to build with python2 shebangs * Change Qt git repo for building docker image to https in order to pass firewall and avoid timeout while cloning --- docker-files/bc-dev-centos7-fuse-qt-wget | 32 +++++++++++++ docker-files/bc-dev-centos7-fuse-wget | 6 +++ docker-files/bc-dev-debian9 | 28 +++++++++++ docker-files/bc-dev-debian9-qt-fuse-wget-gpg2 | 34 ++++++++++++++ docker-files/bc-dev-ubuntu-18.04-LTS | 33 +++++++++++++ docker-files/bc-dev-ubuntu-rolling | 33 +++++++++++++ linphone-app/build/rpm/qt5.spec | 47 +++++++++---------- tools/build_qt_rpm | 16 ++++--- 8 files changed, 198 insertions(+), 31 deletions(-) create mode 100644 docker-files/bc-dev-centos7-fuse-qt-wget create mode 100644 docker-files/bc-dev-centos7-fuse-wget create mode 100644 docker-files/bc-dev-debian9 create mode 100644 docker-files/bc-dev-debian9-qt-fuse-wget-gpg2 create mode 100644 docker-files/bc-dev-ubuntu-18.04-LTS create mode 100644 docker-files/bc-dev-ubuntu-rolling diff --git a/docker-files/bc-dev-centos7-fuse-qt-wget b/docker-files/bc-dev-centos7-fuse-qt-wget new file mode 100644 index 000000000..dffa8cbe8 --- /dev/null +++ b/docker-files/bc-dev-centos7-fuse-qt-wget @@ -0,0 +1,32 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos:7 + +MAINTAINER Peio Rigaux + +#QT Dependenciesi (pigz is used to parallelize compression) +RUN sudo yum install -y libxkbcommon* libxcb pigz + + +# Build qt5.12.5 +RUN git clone -b master --single-branch https://gitlab.linphone.org/BC/public/linphone-desktop.git && \ + ./linphone-desktop/tools/build_qt_rpm && \ + sudo rpm -i ./linphone-desktop/rpm-linphone-qt-5.12.5/rpmbuild/RPMS/x86_64/*.rpm && \ + sudo mv ./linphone-desktop/rpm-linphone-qt-5.12.5/rpmbuild/RPMS/x86_64/*.rpm / && \ + sudo rm -rf ./linphone-desktop + +# Configure AppImages dependencies +RUN sudo yum install -y fuse fuse-libs wget + +RUN echo 'source /opt/rh/devtoolset-8/enable' >> /home/bc/.bashrc +RUN echo 'source /opt/rh/devtoolset-8/enable' >> /home/bc/.shrc + +# This tells /bin/sh to load '~/.shrc' on starting +ENV ENV=~/.shrc + + +ENV Qt5_DIR=/opt/com.belledonne-communications/linphone/lib/cmake +ENV PATH=$PATH:/opt/com.belledonne-communications/linphone/bin + +USER bc +WORKDIR /home/bc +ENV PS1='\[\e[34m\]\u@bc-dev-centos7>\[\e[0m\] ' +CMD bash diff --git a/docker-files/bc-dev-centos7-fuse-wget b/docker-files/bc-dev-centos7-fuse-wget new file mode 100644 index 000000000..6f94ff308 --- /dev/null +++ b/docker-files/bc-dev-centos7-fuse-wget @@ -0,0 +1,6 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-desktop/bc-dev-centos7-qt:5.12.5 + +MAINTAINER Peio Rigaux + +#Appimage deps +RUN sudo yum install -y wget fuse fuse-libs diff --git a/docker-files/bc-dev-debian9 b/docker-files/bc-dev-debian9 new file mode 100644 index 000000000..dbcb41ec6 --- /dev/null +++ b/docker-files/bc-dev-debian9 @@ -0,0 +1,28 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian:9 + +MAINTAINER Peio Rigaux + +#Tools for QT buid script +RUN sudo apt-get update && sudo apt-get install -y python3 pigz + + +#QT Dependencies +RUN sudo apt-get update && sudo apt-get install -y libxkbcommon* + +# Build qt5.12.5 +RUN git clone -b master --single-branch https://gitlab.linphone.org/BC/public/linphone-desktop.git && \ + ./linphone-desktop/tools/build_qt_rpm && \ + find "./linphone-desktop/rpm-linphone-qt-5.12.5/rpmbuild/RPMS/x86_64/" -iname "*.rpm" -exec sudo fakeroot alien -d {} + && \ + find "." -maxdepth 1 -iname "*.deb" -exec sudo dpkg -i {} + && \ + rm -rf ./linphone-desktop + +ENV Qt5_DIR=/opt/com.belledonne-communications/linphone/lib/cmake +ENV PATH=$PATH:/opt/com.belledonne-communications/linphone/bin + +#Appimage deps +RUN sudo apt-get install -y wget fuse fuse-libs + +USER bc +WORKDIR /home/bc +ENV PS1='\[\e[34m\]\u@bc-dev-centos7>\[\e[0m\] ' +CMD bash diff --git a/docker-files/bc-dev-debian9-qt-fuse-wget-gpg2 b/docker-files/bc-dev-debian9-qt-fuse-wget-gpg2 new file mode 100644 index 000000000..3ca2508a9 --- /dev/null +++ b/docker-files/bc-dev-debian9-qt-fuse-wget-gpg2 @@ -0,0 +1,34 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian:9 + +MAINTAINER Peio Rigaux + +#Tools for QT buid script +RUN sudo apt-get update && sudo apt-get install -y python3 pigz + + +#QT Dependencies +#atspi and dbus may be used to enable qt accessibility for screan reader +#xkbcommon is needed for special keyboard features +#flite1-dev, libspeechd-dev speech-dispatcher are needed for text to speech +#libfontconfig1-dev is needed to load correct fonts (support of ideograms, etc..) +RUN sudo apt-get update && sudo apt-get install -y libxkbcommon* flite1-dev libspeechd-dev speech-dispatcher libfontconfig1-dev qdbus-qt5 libqt5dbus5 libdbus-1-dev libdbus-glib-1-dev libatspi2.0-0 libatspi2.0-dev + +#needed fot qt to find dbus +ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig +# Build qt5.12.5 +RUN git clone -b master --single-branch https://gitlab.linphone.org/BC/public/linphone-desktop.git && \ + ./linphone-desktop/tools/build_qt_rpm && \ + find "./linphone-desktop/rpm-linphone-qt-5.12.5/rpmbuild/RPMS/x86_64/" -iname "*.rpm" -exec sudo fakeroot alien -d {} + && \ + find "." -maxdepth 1 -iname "*.deb" -exec sudo dpkg -i --force-overwrite {} + && \ + rm -rf ./linphone-desktop + +ENV Qt5_DIR=/opt/com.belledonne-communications/linphone/lib/cmake +ENV PATH=$PATH:/opt/com.belledonne-communications/linphone/bin + +#Appimage deps +RUN sudo apt-get install -y wget fuse libfuse2 gnupg2 + +USER bc +WORKDIR /home/bc +ENV PS1='\[\e[34m\]\u@bc-dev-centos7>\[\e[0m\] ' +CMD bash diff --git a/docker-files/bc-dev-ubuntu-18.04-LTS b/docker-files/bc-dev-ubuntu-18.04-LTS new file mode 100644 index 000000000..b0ae21b85 --- /dev/null +++ b/docker-files/bc-dev-ubuntu-18.04-LTS @@ -0,0 +1,33 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-ubuntu:18.04 + +MAINTAINER Peio Rigaux + +#Tools for QT buid script +RUN sudo apt-get update && sudo apt-get install -y python3 pigz + + +#QT Dependencies +#atspi and dbus may be used to enable qt accessibility for screan reader +#xkbcommon is needed for special keyboard features +#flite1-dev, libspeechd-dev speech-dispatcher are needed for text to speech +#libfontconfig1-dev is needed to load correct fonts (support of ideograms, etc..) +RUN sudo apt-get update && sudo apt-get install -y libxkbcommon* flite1-dev libspeechd-dev speech-dispatcher libfontconfig1-dev qdbus-qt5 libqt5dbus5 libdbus-1-dev libdbus-glib-1-dev libatspi2.0-0 libatspi2.0-dev + +#needed fot qt to find dbus +ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig +# Build qt5.12.5 +RUN git clone -b master --single-branch https://gitlab.linphone.org/BC/public/linphone-desktop.git && \ + ./linphone-desktop/tools/build_qt_rpm && \ + find "./linphone-desktop/rpm-linphone-qt-5.12.5/rpmbuild/RPMS/x86_64/" -iname "*.rpm" -exec sudo fakeroot alien -d {} + && \ + find "." -maxdepth 1 -iname "*.deb" -exec sudo dpkg -i --force-overwrite {} + && \ + rm -rf ./linphone-desktop + +ENV Qt5_DIR=/opt/com.belledonne-communications/linphone/lib/cmake +ENV PATH=$PATH:/opt/com.belledonne-communications/linphone/bin + +#Appimage deps +RUN sudo apt-get install -y wget fuse libfuse2 gnupg2 + +USER bc +WORKDIR /home/bc +CMD bash diff --git a/docker-files/bc-dev-ubuntu-rolling b/docker-files/bc-dev-ubuntu-rolling new file mode 100644 index 000000000..9483220cd --- /dev/null +++ b/docker-files/bc-dev-ubuntu-rolling @@ -0,0 +1,33 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-ubuntu:rolling + +MAINTAINER Peio Rigaux + +#Tools for QT buid script +RUN sudo apt-get update && sudo apt-get install -y python3 pigz + + +#QT Dependencies +#atspi and dbus may be used to enable qt accessibility for screan reader +#xkbcommon is needed for special keyboard features +#flite1-dev, libspeechd-dev speech-dispatcher are needed for text to speech +#libfontconfig1-dev is needed to load correct fonts (support of ideograms, etc..) +RUN sudo apt-get update && sudo apt-get install -y libxkbcommon* flite1-dev libspeechd-dev speech-dispatcher libfontconfig1-dev qdbus-qt5 libqt5dbus5 libdbus-1-dev libdbus-glib-1-dev libatspi2.0-0 libatspi2.0-dev + +#needed fot qt to find dbus +ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig +# Build qt5.12.5 +RUN git clone -b master --single-branch https://gitlab.linphone.org/BC/public/linphone-desktop.git && \ + ./linphone-desktop/tools/build_qt_rpm && \ + find "./linphone-desktop/rpm-linphone-qt-5.12.5/rpmbuild/RPMS/x86_64/" -iname "*.rpm" -exec sudo fakeroot alien -d {} + && \ + find "." -maxdepth 1 -iname "*.deb" -exec sudo dpkg -i --force-overwrite {} + && \ + rm -rf ./linphone-desktop + +ENV Qt5_DIR=/opt/com.belledonne-communications/linphone/lib/cmake +ENV PATH=$PATH:/opt/com.belledonne-communications/linphone/bin + +#Appimage deps +RUN sudo apt-get install -y wget fuse libfuse2 gnupg2 + +USER bc +WORKDIR /home/bc +CMD bash diff --git a/linphone-app/build/rpm/qt5.spec b/linphone-app/build/rpm/qt5.spec index 7ce584a3a..291f71489 100644 --- a/linphone-app/build/rpm/qt5.spec +++ b/linphone-app/build/rpm/qt5.spec @@ -1,6 +1,6 @@ # -*- rpm-spec -*- -%define _qt5_version 5.10 +%define _qt5_version 5.12.5 %define _qt5_dir /opt/com.belledonne-communications/linphone %define _qt5_archdatadir %{_qt5_dir} @@ -33,8 +33,14 @@ Requires: %{name} = %{version}-%{release} Qt is a software toolkit for developing applications. %prep + %setup -n %{name}-%{version} +#Notes for Qt 5.12 and above +#qt-xcb includes libxcb-* but libxcb +#qt-xkbcommon cannot be used anymore +#-xkbcommon enables xkb support using system libs + %build ./configure \ -opensource \ @@ -45,13 +51,18 @@ Qt is a software toolkit for developing applications. -silent \ -nomake examples \ -nomake tests \ + -dbus \ + -feature-dbus \ + -feature-accessibility \ -qt-freetype \ -qt-harfbuzz \ -qt-libjpeg \ -qt-libpng \ -qt-pcre \ -qt-xcb \ - -qt-xkbcommon \ + -xkbcommon \ + -system-freetype \ + -feature-freetype -fontconfig \ -skip wayland \ -system-zlib \ -archdatadir %{_qt5_archdatadir} \ @@ -63,38 +74,24 @@ Qt is a software toolkit for developing applications. -prefix %{_qt5_dir} \ -translationdir %{_qt5_translationdir} -make +make -j12 %install -make install INSTALL_ROOT=%{buildroot} +find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python3/g' +make install INSTALL_ROOT=%{buildroot} -j12 + +# Some files got ambiguous python shebangs, we fix them to avoid install errors +# Because in centos8 shebangs like #!/usr/bin/python are FORBIDDEN (see https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error) %files %defattr(-,root,root,-) -%license LICENSE.LGPL* LGPL_EXCEPTION.txt LICENSE.FDL +%license LICENSE.LGPL* LICENSE.FDL %{_qt5_archdatadir}/phrasebooks/*.qph %{_qt5_archdatadir}/qml/ %{_qt5_bindir}/ %{_qt5_docdir}/global/ -%{_qt5_libdir}/libQt5*.so.5* -%{_qt5_plugindir}/audio/*.so -%{_qt5_plugindir}/bearer/*.so -%{_qt5_plugindir}/canbus/*.so -%{_qt5_plugindir}/designer/libqquickwidget.so -%{_qt5_plugindir}/egldeviceintegrations/*.so -%{_qt5_plugindir}/gamepads/libevdevgamepad.so -%{_qt5_plugindir}/generic/*.so -%{_qt5_plugindir}/geometryloaders/*.so -%{_qt5_plugindir}/iconengines/libqsvgicon.so -%{_qt5_plugindir}/imageformats/*.so -%{_qt5_plugindir}/mediaservice/libqtmedia_audioengine.so -%{_qt5_plugindir}/platforminputcontexts/*.so -%{_qt5_plugindir}/platforms/*.so -%{_qt5_plugindir}/playlistformats/libqtmultimedia_m3u.so -%{_qt5_plugindir}/qmltooling/*.so -%{_qt5_plugindir}/renderplugins/libscene2d.so -%{_qt5_plugindir}/sceneparsers/*.so -%{_qt5_plugindir}/sqldrivers/*.so -%{_qt5_plugindir}/xcbglintegrations/*.so +%{_qt5_libdir}/libQt5*.so* +%{_qt5_plugindir}/*/*.so* %{_qt5_translationdir}/ %files devel diff --git a/tools/build_qt_rpm b/tools/build_qt_rpm index 2240b8d43..6b1a990e4 100755 --- a/tools/build_qt_rpm +++ b/tools/build_qt_rpm @@ -3,8 +3,8 @@ # See: http://wiki.qt.io/Building_Qt_5_from_Git # See: http://doc.qt.io/qt-5/configure-options.html -REPO_URL='git://code.qt.io/qt/qt5.git' -QT_VERSION='5.10' +REPO_URL='https://gitlab.linphone.org/BC/public/external/qt/qt5.git' +QT_VERSION='5.12.5' RPM_NAME=linphone-qt-${QT_VERSION} @@ -12,7 +12,6 @@ REPO_FOLDER=linphone-qt RPM_FOLDER=rpm-${RPM_NAME} # ============================================================================== - RED='\e[1;31m' NC='\e[0m' @@ -22,10 +21,12 @@ cd "${SCRIPT_DIR}/.." # ============================================================================== if [ ! -d "${REPO_FOLDER}/.git" ]; then - git clone "${REPO_URL}" "${REPO_FOLDER}" + + #Simplest way to use paralle fetch if available + #Otherwise we would have to parse the git version number + git clone "${REPO_URL}" "${REPO_FOLDER}" --recursive -j 12 || git clone "${REPO_URL}" "${REPO_FOLDER}" fi cd "${REPO_FOLDER}" - while test $# -gt 0 do case "$1" in @@ -40,6 +41,7 @@ do done git checkout "${QT_VERSION}" +git submodule foreach --recursive 'if [ -n "$(git branch -a | grep 5.12.5)" ]; then git checkout 5.12.5; fi' if [[ $? != 0 ]] ; then printf "${RED}Unable to checkout ${QT_VERSION}.${NC}\n" exit 1 @@ -72,6 +74,8 @@ fi cd .. mkdir -p ${RPM_FOLDER}/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} -tar --transform "s/^${REPO_FOLDER}/${RPM_NAME}/" -czvf ${RPM_FOLDER}/rpmbuild/SOURCES/${RPM_NAME}.tar.gz ${REPO_FOLDER}/ +#use pigz to parallelize compression +tar --transform "s/^${REPO_FOLDER}/${RPM_NAME}/" -c ${REPO_FOLDER}/ | pigz -p 24 > ${RPM_FOLDER}/rpmbuild/SOURCES/${RPM_NAME}.tar.gz +#tar --transform "s/^${REPO_FOLDER}/" -czvf ${RPM_FOLDER}/rpmbuild/SOURCES/${RPM_NAME}.tar.gz ${REPO_FOLDER}/ rpmbuild -bb --define "_topdir $PWD/${RPM_FOLDER}/rpmbuild" build/rpm/qt5.spec