Files
extra/qt4/PKGBUILD
2025-06-22 20:39:04 -05:00

218 lines
10 KiB
Bash

# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=qt4
pkgver=4.8.7
_debver=$pkgver
_debrel=18
pkgrel=23
arch=('i686' 'x86_64')
url='https://www.qt.io'
license=('custom:GPL-3+OpenSSL-Linking-Exception' 'LGPL-3' 'FDL-1.3' 'custom:LGPL-Exception-1.1')
pkgdesc="A cross-platform application and UI framework (legacy version)"
depends=('sqlite' 'ca-certificates' 'fontconfig' 'mesa-libgl' 'libxrandr' 'libxv' 'libxi' 'alsa-lib'
'xdg-utils' 'hicolor-icon-theme' 'desktop-file-utils' 'libmng' 'libressl')
makedepends=('postgresql-libs' 'unixodbc' 'cups' 'gtk2' 'mesa' 'libxtst' 'quilt')
optdepends=('postgresql-libs: PostgreSQL driver'
'unixodbc: ODBC driver'
'libxinerama: Xinerama support'
'libxcursor: Xcursor support'
'libxfixes: Xfixes support'
'icu: Unicode support')
replaces=('qt<=4.8.4')
_pkgfqn="qt-everywhere-opensource-src-${pkgver}"
source=("https://download.qt.io/archive/qt/4.8/${pkgver}/${_pkgfqn}.tar.gz"
"https://deb.debian.org/debian/pool/main/q/qt4-x11/qt4-x11_${_debver}+dfsg-${_debrel}+deb10u1.debian.tar.xz"
"qtconfig-qt4.desktop"
"assistant-qt4.desktop"
"designer-qt4.desktop"
"linguist-qt4.desktop"
"improve-cups-support.patch"
"moc-boost-workaround.patch"
"glib-honor-ExcludeSocketNotifiers-flag.diff"
"l-qclipboard_fix_recursive.patch"
"l-qclipboard_delay.patch"
"qt4-gcc6.patch"
"qt4-glibc-2.25.patch"
"qt4-icu59.patch"
"moc-syslib-workaround.patch"
"patch-src_network_ssl_qsslsocket_openssl_cpp.diff"
"patch-src_network_ssl_qsslsocket_openssl_symbols_cpp.diff"
"libressl-2.8.patch")
sha512sums=('f9f81a2e7205e1fd05c8d923dc73244f29aa33f951fa6b7c5c8193449328b37084796b9b71ad0c317e4e6fd00017c10ea5d67b1b2032551cde00548522218125'
'e5659aeef85cd1273bf28d53011758b2ae884931884b62d89f48c3a7703276463e16da7e2a4c38a369b94a83ab7495b4e14dc3a27ea7f418dd2bddbe9afa04e0'
'fbcc1ec9ca04b93941c37d02326f33f3a84cb7630ca83f234845eebdb1875676aa8b27553981d8d42b2d5fcf227c7423228f704efc74a5df25a9ae05c5385fda'
'c08b74d70e557d968672ad3251c70e23d0447f30f5d62bc63f6165cbb8c372e63b96b1e61e8888e48bc4f589705c95951f9e05723cf998963ddb7585b0f2e246'
'29b3f2b05e27b2c8db3967bb426dfd2ee96e0715e284fc524d58c33fff55756bbb327ba166af943ce5e3fe825b2a3fc44f85c96d5117d25036b3606d7a49047d'
'fbe3e343678b6cf7f94c97d5fb151028afdfa2fd27a19cbd583da999782f5a71c61a9282fb6284271290b3f5370e6b214b2edd1c05ee1e09d6345389b98be961'
'4a8f828c79bde81ab1e39c9eaba4ef553582d85b62d6d182dda02820c4c8e046de6a25cc77d228955ed37fbc5b55f697a0a464af0bb3e171849851639e9ef4ee'
'b4eced1fe34f09baa987be59fd21a02f4209551f491ae113c9d1cc3c44b00494a909808e22db306bcae0ee4c4f996097ce2c23994b2ac067cf9f599da5a5fc71'
'6d5216e539d93352cd5f5ca98b5296feba702feba1f198f81de650c399076f0161d8ae712ecd79f1c2833b00b5ce7d4c390e33bbeb7e5542c6860a58a6785cab'
'bd63961bcb695beebe8686142b84bff7702db4d85d737f5c2da927252b931700d03602f80048223cbbb05d85a5ddb9cb818321d756577f84843690b318f0c413'
'0215f81fd0ed3483d1f79f46a53d9378f7462901410f4bc3f235325974c155454b0e75cba5222180e5ca62099cba7b80419b5fab86380ac6d951b9ae12714444'
'efe8e1842882b784a14ba137bc6a8a579d5133e579f98c61674f5d3d9b79ff8e895775a79fcf757f7726377cd221396a678d181fa069416b0760a5241d39845a'
'a19e76d64bbbf148b088e3531135dc3ababd63ea8e71147dcf7d2966802abb2d83b839766882040e5c9efdea2e364d48bc38aa712dd35b850383c7747ffa9745'
'483b382da8ad57f9792df1ad0c85948992d8293819c2774a381544235d9b6a7498b12beb3f9d7d06c4a814f8ded514973453314d71381368148d2fcbbf854e65'
'087c76b5076708e9883a43f0fb7ff4016b937034823ec33edc95aab34a3d2dad7b184d8328d15f7efe6f33037e743bbee253d6c5450ee705f246ac755c9288db'
'dd87bdb2c3e12f5247b5c36ffa9065eb0bfa9040193d48dcf87f25b808cce47aece9b9dadbc238c0aab4b6fc35aa7b6a3ee3aeb0943ee7deef8315e46c21a3af'
'aaf3c7314c50717dce4697c69c316d516af47dff00c28355789f2e88ccdfb3d556b715a2ba5e54aae36900bb75ac03a15f2930ab4b9ee0e322326171617ac392'
'413ebafa62f7a39ad569c6ecac47ca32bfe6e87bc07bccf86a732eaf51f152311db172eb197711e0f263e47b7f2c573026b2ee69ab9393b75573c499fa1593a4')
prepare() {
cd ${_pkgfqn}
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
# Doesn't apply and seems unimportant
rm -v debian/patches/07_trust_dpkg-arch_over_uname-m.diff || true
rm -v debian/patches/94_armv6_uname_entry.diff || true
rm -v debian/patches/aarch64_arm64_qatomic_support.patch || true
rm -v debian/patches/kfreebsd_monotonic_clock.diff || true
rm -v debian/patches/no-ssl3.patch || true
rm -v debian/patches/parisc-atomic.patch || true
rm -v debian/patches/powerpc_designer_gstabs.diff || true
rm -v debian/patches/powerpcspe.diff || true
rm -v debian/patches/qt-everywhere-opensource-src-4.8.5-QTBUG-22829.patch || true
rm -v debian/patches/s390x_jscore.diff || true
rm -v debian/patches/sh.diff || true
rm -v debian/patches/x32.diff || true
rm -v debian/patches/openssl_1.1.patch || true
rm -v debian/patches/riscv64-support.patch || true
quilt push -av
else
# Fix build with GCC6 (Fedora)
patch -p1 -i "$srcdir"/qt4-gcc6.patch
# Fix build of Qt4 applications with glibc 2.25 (Fedora)
patch -p1 -i "$srcdir"/qt4-glibc-2.25.patch
fi
# QTBUG#22829
patch -p1 -i "${srcdir}"/moc-boost-workaround.patch
# Workaround a bug where newer kernel headers sys/sysmacros.h define macros like major, minor (Void)
patch -p1 -i "${srcdir}"/moc-syslib-workaround.patch
# (FS#28381) (KDEBUG#180051)
patch -p1 -i "${srcdir}"/improve-cups-support.patch
# fixes for LibreOffice from the upstream Qt bug tracker FS#46436, FS#41648, FS#39819
# https://bugreports.qt.io/browse/QTBUG-37380
patch -p1 -i "${srcdir}"/glib-honor-ExcludeSocketNotifiers-flag.diff
# https://bugreports.qt.io/browse/QTBUG-34614
patch -p0 -i "${srcdir}"/l-qclipboard_fix_recursive.patch
# https://bugreports.qt.io/browse/QTBUG-38585
patch -p0 -i "${srcdir}"/l-qclipboard_delay.patch
# React to OpenSSL's OPENSSL_NO_SSL3 define (OpenBSD)
patch -p1 -i "$srcdir"/patch-src_network_ssl_qsslsocket_openssl_cpp.diff
patch -p1 -i "$srcdir"/patch-src_network_ssl_qsslsocket_openssl_symbols_cpp.diff
sed -i "s|-O2|${CXXFLAGS}|" mkspecs/common/{g++,gcc}-base.conf
sed -i "/^QMAKE_LFLAGS_RPATH/s| -Wl,-rpath,||g" mkspecs/common/gcc-base-unix.conf
sed -i "/^QMAKE_LFLAGS\s/s|+=|+= ${LDFLAGS}|g" mkspecs/common/gcc-base.conf
cp mkspecs/common/linux{,32}.conf
sed -i "/^QMAKE_LIBDIR\s/s|=|= /usr/lib32|g" mkspecs/common/linux32.conf
sed -i "s|common/linux.conf|common/linux32.conf|" mkspecs/linux-g++-32/qmake.conf
# Fix build with ICU 59 (pld-linux)
patch -p1 -i "$srcdir"/qt4-icu59.patch
# Fix build with LibreSSL 2.8 (Void)
patch -p1 -i "$srcdir"/libressl-2.8.patch
}
build() {
export QT4DIR="${srcdir}"/${_pkgfqn}
export LD_LIBRARY_PATH=${QT4DIR}/lib:${LD_LIBRARY_PATH}
export CXXFLAGS+=" -std=gnu++98" # Fix build with GCC 6
cd ${_pkgfqn}
./configure -confirm-license -opensource \
-prefix /usr \
-bindir /usr/libexec/qt4/bin \
-headerdir /usr/include/qt4 \
-docdir /usr/share/doc/qt4 \
-plugindir /usr/lib/qt4/plugins \
-importdir /usr/lib/qt4/imports \
-datadir /usr/share/qt4 \
-translationdir /usr/share/qt4/translations \
-sysconfdir /etc/xdg \
-examplesdir /usr/share/doc/qt4/examples \
-demosdir /usr/share/doc/qt4/demos \
-plugin-sql-{psql,sqlite,odbc} \
-system-sqlite \
-no-phonon \
-no-phonon-backend \
-no-webkit \
-graphicssystem raster \
-openssl-linked \
-nomake demos \
-nomake examples \
-nomake docs \
-silent \
-no-rpath \
-optimized-qmake \
-no-reduce-relocations \
-no-dbus \
-no-openvg
make
}
package() {
cd ${_pkgfqn}
make INSTALL_ROOT="${pkgdir}" install
# install missing icons and desktop files
install -D -m644 src/gui/dialogs/images/qtlogo-64.png \
"${pkgdir}"/usr/share/icons/hicolor/64x64/apps/qt4logo.png
install -D -m644 tools/assistant/tools/assistant/images/assistant.png \
"${pkgdir}"/usr/share/icons/hicolor/32x32/apps/assistant-qt4.png
install -D -m644 tools/assistant/tools/assistant/images/assistant-128.png \
"${pkgdir}"/usr/share/icons/hicolor/128x128/apps/assistant-qt4.png
install -D -m644 tools/designer/src/designer/images/designer.png \
"${pkgdir}"/usr/share/icons/hicolor/128x128/apps/designer-qt4.png
for icon in tools/linguist/linguist/images/icons/linguist-*-32.png ; do
size=$(echo $(basename ${icon}) | cut -d- -f2)
install -D -m644 ${icon} \
"${pkgdir}"/usr/share/icons/hicolor/${size}x${size}/apps/linguist-qt4.png
done
install -d "${pkgdir}"/usr/share/applications
install -m644 "${srcdir}"/{assistant,designer,linguist,qtconfig}-qt4.desktop \
"${pkgdir}"/usr/share/applications/
# Useful symlinks for cmake and configure scripts
install -d "${pkgdir}"/usr/bin
for b in "${pkgdir}"/usr/libexec/qt4/bin/*; do
ln -s /usr/libexec/qt4/bin/$(basename $b) "${pkgdir}"/usr/bin/$(basename $b)-qt4
done
# install licenses
install -d -m755 ${pkgdir}/usr/share/licenses/${pkgname}
install -D -m644 LICENSE.{FDL,GPL3,LGPLv3} LGPL_EXCEPTION.txt \
${pkgdir}/usr/share/licenses/${pkgname}
# Fix wrong libs path in pkgconfig files
find "${pkgdir}/usr/lib/pkgconfig" -type f -name '*.pc' \
-exec perl -pi -e "s, -L${srcdir}/?\S+,,g" {} \;
# Fix wrong bins path in pkgconfig files
find "${pkgdir}/usr/lib/pkgconfig" -type f -name '*.pc' \
-exec sed -i 's|/usr/bin/|/usr/libexec/qt4/bin/|g' {} \;
# Fix wrong path in prl files
find "${pkgdir}/usr/lib" -type f -name '*.prl' \
-exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d;s/\(QMAKE_PRL_LIBS =\).*/\1/' {} \;
# The TGA plugin is broken (FS#33568)
rm "${pkgdir}"/usr/lib/qt4/plugins/imageformats/libqtga.so
}