summaryrefslogtreecommitdiff
path: root/extra/qt4/PKGBUILD
blob: a35a577f3d460580f9245ca14bfbd314aacf94a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# $Id: PKGBUILD 201436 2013-12-11 15:31:04Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=qt4
pkgver=4.8.5
pkgrel=7
arch=('i686' 'x86_64' 'mips64el')
url='http://qt-project.org/'
license=('GPL3' 'LGPL' 'FDL' 'custom')
pkgdesc='A cross-platform application and UI framework'
depends=('libtiff' 'libpng' 'sqlite' 'ca-certificates' 'dbus'
        'fontconfig' 'libgl' 'libxrandr' 'libxv' 'libxi' 'alsa-lib'
        'xdg-utils' 'hicolor-icon-theme' 'desktop-file-utils' 'libmng')
makedepends=('postgresql-libs' 'mariadb' 'unixodbc' 'cups' 'gtk2' 'libfbclient'
             'mesa')
optdepends=('qtchooser: set the default Qt toolkit'
            'postgresql-libs: PostgreSQL driver'
            'libmariadbclient: MariaDB driver'
            'unixodbc: ODBC driver'
            'libxinerama: Xinerama support'
            'libxcursor: Xcursor support'
            'libxfixes: Xfixes support'
            'icu: Unicode support')
if [ "$CARCH" != "mips64el" ]; then
  makedepends+=('libfbclient')
  optdepends+=('libfbclient: Firebird/iBase driver')
fi
install="${pkgname}.install"
replaces=('qt<=4.8.4')
conflicts=('qt')
options=('staticlibs') # libQtUiTools builds as static only
_pkgfqn="qt-everywhere-opensource-src-${pkgver}"
source=("http://download.qt-project.org/official_releases/qt/4.8/${pkgver}/${_pkgfqn}.tar.gz"
        'qtconfig-qt4.desktop' 'assistant-qt4.desktop' 'designer-qt4.desktop'
        'linguist-qt4.desktop' 'qdbusviewer-qt4.desktop'
        'improve-cups-support.patch'
	      'declarative-fix-sigbus.patch'
        'qtbug-31579.patch' 'qtbug-32534.patch' 'qtbug-32908.patch'
        'libmng2.patch' 'CVE-2013-4549.patch')
md5sums=('1864987bdbb2f58f8ae8b350dfdbe133'
         'a16638f4781e56e7887ff8212a322ecc'
         '8a28b3f52dbeb685d4b69440b520a3e1'
         '9727c406c240990870c905696a8c5bd1'
         '0e384663d3dd32abe35f5331c4147569'
         'b859c5673e5098c39f72b2252947049e'
         'c439c7731c25387352d8453ca7574971'
         'aac963d05a9d5733e2bfce9e26607f51'
         '6ed8d26a8e4a9bba1f6c08fb99cc8357'
         'bb0e0fa6ba953fa590d81ac612374e11'
         'db343dcae522bc90d802ad1e83b7f5dd'
         '0ba4ffc9ff1acb9bf8a5f592ba956d48'
         '8701bd7445426c1ad5da3ddbd72df6b4')

prepare() {
  cd ${_pkgfqn}

  # (FS#28381) (KDEBUG#180051)
  patch -p1 -i "${srcdir}"/improve-cups-support.patch

  # MIPS N32-specific fix, shouldn't affect correctness on other platforms.
  patch -Np1 -i "${srcdir}/declarative-fix-sigbus.patch"

  # (FS#36028) (QTBUG#31579)
  patch -p1 -i "${srcdir}"/qtbug-31579.patch
  # (FS#36394) (QTBUG#32534)
  patch -p1 -i "${srcdir}"/qtbug-32534.patch
  # (FS#36947) (QTBUG#32908)
  patch -p1 -i "${srcdir}"/qtbug-32908.patch

  # (FS#38081)
  patch -p1 -i "${srcdir}"/CVE-2013-4549.patch
  # (QTBUG#34894)
  patch -p1 -i "${srcdir}"/libmng2.patch

  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
}

build() {
  export QT4DIR="${srcdir}"/${_pkgfqn}
  export LD_LIBRARY_PATH=${QT4DIR}/lib:${LD_LIBRARY_PATH}

  if [ "${CARCH}" = "mips64el" ]; then
    export CXXFLAGS="${CXXFLAGS} -fpermissive"
  fi
  
  cd ${_pkgfqn}

  ./configure -confirm-license -opensource \
    -prefix /usr \
    -bindir /usr/lib/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,mysql,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 \
    -reduce-relocations \
    -dbus-linked \
    -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 -m644 tools/qdbus/qdbusviewer/images/qdbusviewer.png \
      "${pkgdir}"/usr/share/icons/hicolor/32x32/apps/qdbusviewer-qt4.png
    install -D -m644 tools/qdbus/qdbusviewer/images/qdbusviewer-128.png \
      "${pkgdir}"/usr/share/icons/hicolor/128x128/apps/qdbusviewer-qt4.png

    install -d "${pkgdir}"/usr/share/applications
    install -m644 "${srcdir}"/{assistant,designer,linguist,qtconfig,qdbusviewer}-qt4.desktop \
      "${pkgdir}"/usr/share/applications/

    # Useful symlinks for cmake and configure scripts
    install -d "${pkgdir}"/usr/bin
    for b in "${pkgdir}"/usr/lib/qt4/bin/*; do
      ln -s /usr/lib/qt4/bin/$(basename $b) "${pkgdir}"/usr/bin/$(basename $b)-qt4
    done

    # install license addition
    install -D -m644 LGPL_EXCEPTION.txt \
      ${pkgdir}/usr/share/licenses/${pkgname}/LGPL_EXCEPTION.txt

    # 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/lib/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
}