3 # Slackware build script for qt5
5 # Copyright 2013-2017 Larry Hajali <larryhaja[at]gmail[dot]com>
6 # Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, MN, USA
9 # Redistribution and use of this script, with or without modification, is
10 # permitted provided that the following conditions are met:
12 # 1. Redistributions of this script must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 # Merged some ideas from Alex Sarmardzic's script for qt4 at SlackBuilds.org
27 # ^^ Modified by Robby Workman <rworkman@slackware.com> for QT4 & KDE4
29 # We're using qt-copy instead of a released qt version, as this git release
30 # has at least one bugfix strongly recommended by the kde developers.
33 # git clone git://gitorious.org/+kde-developers/qt/kde-qt.git
34 # git checkout origin/4.5.3-patched
35 # git checkout origin/4.6.0-stable-patched
36 # git checkout origin/4.6.1-patched
37 # git checkout origin/4.7.0-patched
39 # Alternate method (we don't use this):
40 # wget http://qt.gitorious.org/qt/kde-qt/archive-tarball/4.6.2-patched
42 # Modifications 2010, 2011, 2012 Eric Hameleers, Eindhoven, NL
43 # qt 4.7.3, 4.7.4, 4.8.0, 4.8.1, 4.8.2, 4.8.4 are built from original nokia sources.
45 # This is the highly modified version qt.SlackBuild found in Slackware
46 # tailored to Qt 5. Modified by Larry Hajali.
49 VERSION=${VERSION:-5.9.3}
53 if [ -z "$ARCH" ]; then
54 case "$( uname -m )" in
57 *) ARCH=$( uname -m ) ;;
63 PKG=$TMP/package-$PRGNAM
64 OUTPUT=${OUTPUT:-/tmp}
66 if [ "$ARCH" = "i586" ]; then
67 SLKCFLAGS="-O2 -march=i586 -mtune=i686"
69 elif [ "$ARCH" = "i686" ]; then
70 SLKCFLAGS="-O2 -march=i686 -mtune=i686"
72 elif [ "$ARCH" = "x86_64" ]; then
75 elif [ "$ARCH" = "armv7hl" ]; then
76 # To prevent "qatomic_armv6.h error: output number 2 not directly addressable"
77 # More permanent solution is to patch gcc:
78 # http://bazaar.launchpad.net/~linaro-toolchain-dev/gcc-linaro/4.6/revision/106731
79 SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -fno-strict-volatile-bitfields"
86 # http://doc.qt.io/qt-5/qtwebengine-platform-notes.html#audio-and-video-codec-support
88 [ "$PROPRIETARY_CODECS" = "yes" ] && PRCOD="WEBENGINE_CONFIG += use_proprietary_codecs"
93 mkdir -p $TMP $PKG $OUTPUT
95 rm -rf ${PRGNAM/5/}-everywhere-opensource-src-$VERSION
96 tar xvf $CWD/${PRGNAM/5/}-everywhere-opensource-src-$VERSION.tar.xz
97 cd ${PRGNAM/5/}-everywhere-opensource-src-$VERSION
100 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
101 -o -perm 511 \) -exec chmod 755 {} \; -o \
102 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
103 -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
105 # Slackware patch to build against MySQL/MariaDB.
106 #patch -p1 < $CWD/patches/qt5.mysql.h.diff
108 # Patch for the newer mozilla-nss
109 # patch -p1 < $CWD/patches/nss-update-sslv3-nonce.patch
111 # Limit -reduce-relocations to ix86 and x86_64.
112 # https://bugreports.qt-project.org/browse/QTBUG-36129
113 if echo $ARCH | grep -q '\(i.86\|x86_64\)' 2>/dev/null; then
114 RELOCATIONS="-reduce-relocations"
119 sed -i "s|-O2|$SLKCFLAGS|" qtbase/mkspecs/common/gcc-base.conf
121 # Build examples. Default is no.
122 if [ "${EXAMPLES:-no}" == "yes" ]; then
125 BUILD_EXAMPLES="-nomake examples"
128 echo "$PRCOD" >> qtwebengine/.qmake.conf
130 export CFLAGS="$SLKCFLAGS"
131 export CXXFLAGS="$SLKCFLAGS"
135 -prefix "/usr/lib${LIBDIRSUFFIX}/$PRGNAM" \
136 -sysconfdir "/etc/xdg" \
137 -headerdir "/usr/include/$PRGNAM" \
138 -libdir "/usr/lib${LIBDIRSUFFIX}" \
139 -docdir "/usr/doc/$PRGNAM-$VERSION" \
155 -no-separate-debug-info \
160 -no-use-gold-linker \
166 make install INSTALL_ROOT=$PKG
168 # Install documentation. Default is not to install documentation.
169 if [ "${DOCS:-no}" == "yes" ]; then
170 # Recreate Makefiles in order to use the just compiled qdoc.
171 for doc in $(find . -name "Makefile*" | xargs egrep "^\s/usr/lib${LIBDIRSUFFIX}/qt5/bin/" \
172 | cut -d':' -f1 | uniq)
177 make install_docs INSTALL_ROOT=$PKG
180 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
181 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
183 ln -s $PRGNAM $PKG/usr/lib${LIBDIRSUFFIX}/qt-$VERSION
185 mkdir -p $PKG/usr/bin
186 for BIN in $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/bin/*; do
187 TMP_FILE=$(echo $BIN | sed -e "s|$PKG||")
188 case $(basename $BIN) in
189 syncqt.pl|fixqt4headers.pl)
190 ln -s $TMP_FILE $PKG/usr/bin/$(basename $BIN)
193 ln -s $TMP_FILE $PKG/usr/bin/$(basename $BIN)-$PRGNAM
198 # Create Environment variables
199 mkdir -p $PKG/etc/profile.d
200 sed -e "s|@LIBDIRSUFFIX@|${LIBDIRSUFFIX}|g" $CWD/profile.d/$PRGNAM.sh \
201 > $PKG/etc/profile.d/$PRGNAM.sh
202 sed -e "s|@LIBDIRSUFFIX@|${LIBDIRSUFFIX}|g" $CWD/profile.d/$PRGNAM.csh \
203 > $PKG/etc/profile.d/$PRGNAM.csh
204 chmod 0755 $PKG/etc/profile.d/*
206 cat > $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/Qt5.pc << EOF
207 prefix=/usr/lib${LIBDIRSUFFIX}/$PRGNAM
208 bindir=\${prefix}/bin
210 docdir=/usr/doc/$PRGNAM-$VERSION
211 archdatadir=\${prefix}
212 examplesdir=\${prefix}/examples
213 headerdir=/usr/include/$PRGNAM
214 importdir=\${prefix}/imports
215 qmldir=\${prefix}/qml
216 libdir=/usr/lib${LIBDIRSUFFIX}
217 libexec=\${prefix}/libexec
219 plugindir=\${prefix}/plugins
220 qmake=\${bindir}/qmake
222 translationdir=\${prefix}/translations
225 Description: Qt5 Configuration
229 # Fix internal linking for Qt5WebEngineCore.pc.
231 -e 's|-Wl,--start-group.* -Wl,--end-group||' \
232 -e "s|-L${PWD}/qtwebengine/src/core/api/Release||" \
233 $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/Qt5WebEngineCore.pc
235 # While we are at it, there isn't any reason to keep references to $PKG in the *.prl files.
236 for PRL in $(find $PKG -name "*\.prl"); do
237 sed -i '/^QMAKE_PRL_BUILD_DIR/d' $PRL
240 # One more for the road.
241 sed -i "s|$PWD/qtbase|/usr/lib${LIBDIRSUFFIX}/$PRGNAM|" \
242 $PKG/usr/lib${LIBDIRSUFFIX}/$PRGNAM/mkspecs/modules/qt_lib_bootstrap_private.pri
244 sed -i "s|-L${PWD}/\w*/lib ||g" \
245 $PKG/usr/lib${LIBDIRSUFFIX}/libqgsttools_p.prl
247 for i in $CWD/desktop/*.desktop; do
248 install -D -m 0644 $i $PKG/usr/share/applications/$(basename $i)
250 sed -i "s|@LIBDIR@|$LIBDIRSUFFIX|" $PKG/usr/share/applications/*
252 # Currently not working for qt version 5.4.0. Extra layer added to *.ico file
253 # freaks out ImageMagick and fails image conversion.
255 # $ convert assistant.ico -resize 96x96! assistant.png
256 # convert: file format version mismatch `assistant.ico' @ error/xwd.c/ReadXWDImage/241.
257 # convert: no images defined `assistant.png' @ error/convert.c/ConvertImageCommand/3127.
258 #for i in $(find . -name "assistant.ico" -o -name "designer.ico" \
259 # -o -name "linguist.ico" -o -name "qdbusviewer.ico"); do
260 # for j in 16 24 32 48 64 96 128; do
261 # convert $i -resize ${j}x${j}! $(basename $i)-$j.png
262 # install -D -m 0644 $(basename $i)-$j-0.png \
263 # $PKG/usr/share/icons/hicolor/${j}x${j}/apps/$(basename $i | sed 's|.ico||')-$PRGNAM.png
267 install -D -m 0644 qttools/src/assistant/assistant/images/assistant-128.png \
268 $PKG/usr/share/icons/hicolor/128x128/apps/assistant-qt5.png
269 install -D -m 0644 qttools/src/designer/src/designer/images/designer.png \
270 $PKG/usr/share/icons/hicolor/128x128/apps/designer-qt5.png
271 install -D -m 0644 qttools/src/qdbus/qdbusviewer/images/qdbusviewer-128.png \
272 $PKG/usr/share/icons/hicolor/128x128/apps/qdbusviewer-qt5.png
273 for i in 16 32 48 64 128; do
274 install -D -m 0644 qttools/src/linguist/linguist/images/icons/linguist-${i}-32.png \
275 $PKG/usr/share/icons/hicolor/${i}x${i}/apps/linguist-qt5.png
278 # Remove executable bits from files.
279 find $PKG \( -name "*.qml" -o -name "*.app" \) -perm 755 -exec chmod 644 '{}' \;
281 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
283 README qtbase/{header*,LGPL_EXCEPTION.txt,LICENSE.*L} \
284 $PKG/usr/doc/$PRGNAM-$VERSION
285 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
287 mkdir -p $PKG/install
288 cat $CWD/slack-desc > $PKG/install/slack-desc
289 cat $CWD/doinst.sh > $PKG/install/doinst.sh
292 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}