summaryrefslogtreecommitdiff
path: root/extra/qt3/PKGBUILD
blob: 0145907e89c7a63a416439f3805881a7c4ee8622 (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
# $Id: PKGBUILD 148906 2012-02-05 11:55:17Z ibiru $
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=qt3
pkgver=3.3.8
pkgrel=22
pkgdesc="The QT3 gui toolkit"
arch=('i686' 'x86_64')
url="http://www.trolltech.com/products/qt/index.html"
license=('GPL')
depends=('libpng' 'libxmu' 'libxcursor' 'libxinerama' 'mesa' 'libxft'
         'libxrandr' 'libmng')
makedepends=('mysql' 'postgresql' 'unixodbc' 'sqlite3')
optdepends=('libmysqlclient' 'postgresql-libs' 'unixodbc')
options=('!libtool')
install=qt.install
source=(ftp://ftp.trolltech.com/qt/source/qt-x11-free-${pkgver}.tar.bz2
        qt.profile qt3-png15.patch qt-copy-kde-patches.tar.bz2
        qt-patches.tar.bz2 utf8-bug-qt3.diff qt-font-default-subst.diff
        mysql.patch eastern_asian_languagues.diff qt-odbc.patch gcc-4.6.patch)
sha1sums=('91b192cb8e80679607d24ae35d6e20ed68d149d7'
          'd2e257a9011208b2cb81b9cf47915b9a2f9dab83'
          '3d19510c46016a1a211d97bf8f82b01498b1b33c'
          '9cb2e5bec782069692ee337cfa171539d9d73753'
          '116afa0e737bdf27ea27f9b3653aeb56db9ec151'
          'ca5ecb29c7f1c826d48703339a3371038e306bb7'
          'd928ff55adb52c4bab2fb268df022651551cd70c'
          'bb6aad81cce143c23ff7840b1d79f6b2007a0c04'
          '40c7b8f06a21f809ddeb8b5560e9da63ccac6a17'
          '1346320614f6f86fbeb10b9fbad721dea29f5b61'
          'd9b83b8f6f9c8bd98d290dc1d0e9913a00b62c3f')

# qt-copy-kde-patches come from http://websvn.kde.org/trunk/qt-copy/patches/
# other qt-patches come from fedora and gentoo

build() {
  unset QMAKESPEC
  export QTDIR="${srcdir}"/qt-x11-free-${pkgver}
  export PATH=${QTDIR}/bin:${PATH}
  export LD_LIBRARY_PATH=${QTDIR}/lib:${LD_LIBRARY_PATH}
  export QMAKESPEC=$QTDIR/mkspecs/linux-g++
  cd "${srcdir}"/qt-x11-free-${pkgver}
  # apply qt patches from kde.org
  for i in ../qt-copy-kde-patches/*; do
    patch -Np0 -i $i 
  done
  # apply other qt patches and one security fix from debian/gentoo
  for i in ../qt-patches/*; do
    patch -Np1 -i $i 
  done
  # fix utf8 bug
  patch -p0 -i "${srcdir}"/utf8-bug-qt3.diff 
  # fix asia fonts
  patch -p0 -i "${srcdir}"/qt-font-default-subst.diff 
  # fix segfaults on exit when using mysql DB driver
  patch -p0 -i "${srcdir}"/mysql.patch 
  # fix CJK font/chars select error (FS#11245)
  patch -p1 -i "${srcdir}"/eastern_asian_languagues.diff 
  # fix build problem against new unixODBC
  patch -p1 -i "${srcdir}"/qt-odbc.patch 
  # fix build with gcc 4.6.0
  patch -p1 -i "${srcdir}"/gcc-4.6.patch

  patch -p0 -i "${srcdir}"/qt3-png15.patch 
  # start compiling qt
  sed -i 's|-cp -P -f|-cp -L -f|' qmake/Makefile.unix
  rm -rf doc/html examples tutorial
  sed -i "s|sub-tutorial sub-examples||" Makefile
  sed -i "s|-O2|$CXXFLAGS|" mkspecs/linux-g++/qmake.conf
  sed -i "s|-O2|$CXXFLAGS|" mkspecs/linux-g++-32/qmake.conf
  sed -i "s|-O2|$CXXFLAGS|" mkspecs/linux-g++-64/qmake.conf
  sed -i "s|-I. |$CXXFLAGS -I. |" qmake/Makefile.unix
  sed -i "s|read acceptance|acceptance=yes|" configure

 # remove unwanted mkspecs
  rm -rf mkspecs/{*aix*,*bsd*,cygwin*,dgux*,darwin*,hpux*,hurd*,irix*,lynxos*,macx*,qnx*,reliant*,sco*,solaris*,tru64*,unixware*,win32*}

  if [ "$CARCH" = "x86_64" ]; then
      export ARCH="-64"	
    else unset ARCH
  fi

  ./configure -prefix /opt/qt \
    -platform linux-g++$ARCH \
    -system-zlib \
    -qt-gif \
    -release \
    -shared \
    -sm \
    -nis \
    -thread \
    -stl \
    -system-lib{png,jpeg,mng} \
    -no-g++-exceptions \
    -plugin-sql-{mysql,psql,sqlite,odbc}

  # fix /opt/qt/lib path
  [ "$CARCH" = "x86_64" ] && sed -i "s|/opt/qt/lib64|/opt/qt/lib|g" "${srcdir}"/qt-x11-free-${pkgver}/src/Makefile
  [ "$CARCH" = "x86_64" ] && sed -i "s|/opt/qt/lib64|/opt/qt/lib|g" "${srcdir}"/qt-x11-free-${pkgver}/tools/designer/designer/Makefile
  [ "$CARCH" = "x86_64" ] && sed -i "s|/opt/qt/lib64|/opt/qt/lib|g" "${srcdir}"/qt-x11-free-${pkgver}/tools/designer/editor/Makefile
  [ "$CARCH" = "x86_64" ] && sed -i "s|/opt/qt/lib64|/opt/qt/lib|g" "${srcdir}"/qt-x11-free-${pkgver}/tools/assistant/lib/Makefile
  [ "$CARCH" = "x86_64" ] && sed -i "s|/opt/qt/lib64|/opt/qt/lib|g" "${srcdir}"/qt-x11-free-${pkgver}/tools/designer/uilib/Makefile

  cd "${srcdir}"/qt-x11-free-${pkgver}
  make -C qmake 
  cd "${srcdir}"/qt-x11-free-${pkgver}/plugins/src/sqldrivers/mysql
  "${srcdir}"/qt-x11-free-${pkgver}/bin/qmake -o Makefile "INCPATH+=/usr/include/mysql" "LIBS+=-L/usr/lib/mysql -lmysqlclient" mysql.pro
  cd "${srcdir}"/qt-x11-free-${pkgver}/plugins/src/sqldrivers/psql
  "${srcdir}"/qt-x11-free-${pkgver}/bin/qmake -o Makefile "INCPATH+=/usr/src/include /usr/include/postgresql/server" "LIBS+=-L/usr/lib -lpq" psql.pro

  cd "${srcdir}"/qt-x11-free-${pkgver}
  # fix the broken makefiles
  #sed -i 's|[[:space:]]*strip.*doc/html.*$|#|g' src/Makefile
  make
}

package() {
  cd "${srcdir}"/qt-x11-free-${pkgver}
  make INSTALL_ROOT="${pkgdir}" install
  rm -rf "${pkgdir}"/opt/qt/{phrasebooks,templates,translations}
  sed -i "s|-L${srcdir}/qt-x11-free-${pkgver}/lib ||g" "${pkgdir}"/opt/qt/lib/*.prl
  install -D -m755 qmake/qmake "${pkgdir}"/opt/qt/bin/qmake
  install -D -m755 "${srcdir}"/qt.profile "${pkgdir}"/etc/profile.d/qt3.sh
  ln -sf /opt/qt/bin/qtconfig "${pkgdir}"/opt/qt/bin/qt3config 
  rm -f "${pkgdir}"/opt/qt/mkspecs/linux-g++$ARCH/linux-g++$ARCH

  # install man pages
  install -d -m755 "${pkgdir}"/opt/qt/man
  cp -r "${srcdir}"/qt-x11-free-${pkgver}/doc/man/{man1,man3} "${pkgdir}"/opt/qt/man/

  install -d -m755 "${pkgdir}"/etc/ld.so.conf.d/
  echo '/opt/qt/lib' > "${pkgdir}"/etc/ld.so.conf.d/qt3.conf
}