1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils flag-o-matic toolchain-funcs multilib
8 SRCTYPE
="opensource-src"
10 DESCRIPTION
="The Qt toolkit is a comprehensive C++ application development framework."
11 HOMEPAGE
="http://www.trolltech.com/"
15 SRC_URI
="mirror://gentoo/qt-x11-${SRCTYPE}-${PV}.tar.gz
16 ftp://ftp.trolltech.com/pub/qt/source/qt-x11-${SRCTYPE}-${PV}.tar.gz
17 qt-copy? ( http://jyujin.de/~creidiki/qt-copy/qt-copy-${PV}-patches-${QT_COPY_SNAP}.tar.lzma )"
19 S
="${WORKDIR}"/qt-x11-${SRCTYPE}-${PV}
21 LICENSE="||
( QPL-1.0 GPL-2 GPL-3
)"
23 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd
"
25 IUSE_INPUT_DEVICES="input_devices_wacom
"
27 IUSE="+accessibility cups dbus debug doc examples firebird gif glib jpeg mng
28 mysql nas nis odbc opengl pch png postgres
+qt3support
+qt-copy sqlite sqlite3 ssl tiff
29 xinerama zlib
${IUSE_INPUT_DEVICES}"
31 RDEPEND="x11-libs
/libXrandr
36 xinerama?
( x11-libs
/libXinerama
)
39 png?
( media-libs
/libpng
:1.2 )
40 jpeg?
( media-libs
/jpeg
)
41 mng?
( >=media-libs
/libmng-1.0
.9 )
42 tiff?
( media-libs
/tiff
)
43 nas?
( >=media-libs
/nas-1.5
)
44 odbc?
( dev-db
/unixODBC
)
45 mysql?
( virtual
/mysql
)
46 firebird?
( dev-db
/firebird
)
47 sqlite3?
( dev-db
/sqlite
:3 )
48 sqlite?
( dev-db
/sqlite
:0 )
49 opengl?
( virtual
/opengl virtual
/glu
)
50 postgres?
( dev-db
/libpq
)
51 cups?
( net-print
/cups
)
52 zlib?
( sys-libs
/zlib
)
53 glib?
( dev-libs
/glib
)
54 dbus?
( >=sys-apps
/dbus-1.0
.2 )
55 ssl?
( dev-libs
/openssl
)
56 input_devices_wacom?
( x11-libs
/libXi x11-drivers
/linuxwacom
)"
59 qt-copy?
( app-arch
/lzma-utils
)
60 xinerama?
( x11-proto
/xineramaproto
)
66 QTBASEDIR=/usr/$(get_libdir)/qt4
69 QTLIBDIR=/usr/$(get_libdir)/qt4
70 QTPCDIR=/usr/$(get_libdir)/pkgconfig
71 QTDATADIR=/usr/share/qt4
72 QTDOCDIR=/usr/share/doc/${P}
73 QTHEADERDIR=/usr/include/qt4
74 QTPLUGINDIR=${QTLIBDIR}/plugins
76 QTTRANSDIR=${QTDATADIR}/translations
77 QTEXAMPLESDIR=${QTDATADIR}/examples
78 QTDEMOSDIR=${QTDATADIR}/demos
80 PLATFORM=$(qt_mkspecs_dir)
89 [[ -n $2 ]] && feature=$2
90 [[ -n $3 ]] && enableval="-$3"
92 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
97 # Allows us to define which mkspecs dir we want to use.
101 *-freebsd*|*-dragonfly*)
112 die "Unknown CHOST
, no platform choosed.
"
116 if [[ ${CXX/g++/} != ${CXX} ]]; then
118 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
121 die "Unknown compiler
${CXX}.
"
131 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
133 # Apply QT Copy patches:
135 EPATCH_MULTI_MSG="Applying QT-copy patches ...
" \
136 EPATCH_FORCE="yes" EPATCH_SUFFIX="" epatch \
137 "${WORKDIR}"/qt-copy-${PV}-patches-${QT_COPY_SNAP}
140 cd "${S}"/mkspecs
/$
(qt_mkspecs_dir
)
141 # set c/xxflags and ldflags
143 # Don't let the user go too overboard with flags. If you really want to, uncomment
144 # out the line below and give 'er a whirl.
146 replace-flags
-O3 -O2
148 if [[ $
( gcc-fullversion
) == "3.4.6" && gcc-specs-ssp
]] ; then
149 ewarn
"Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
150 append-flags
-fno-stack-protector
154 if [[ "$(gcc-major-version)" == "3" ]] && use amd64
; then
155 ewarn
"Appending -fno-gcse to CFLAGS/CXXFLAGS"
156 append-flags
-fno-gcse
159 # Anti-aliasing rules are broken in qt-4.3*, causing random runtime failures
160 # in Qt programs. bug 213411.
161 append-flags
-fno-strict-aliasing
163 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
164 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
165 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
166 -e "/CONFIG/s:$: nostrip:" \
169 # Do not link with -rpath. See bug #75181.
170 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
172 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
173 sed -i -e "s:X11R6/::" qmake.conf
175 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
176 # separately as well.
177 cd "${S}"/mkspecs
/common
179 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
180 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
181 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
184 # Do not link with -rpath. See bug #75181.
185 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g
++.conf
187 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
188 sed -i -e "s:X11R6/::" linux.conf
192 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
193 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
200 export PATH
="${S}/bin:${PATH}"
201 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
203 [[ $
(get_libdir
) != "lib" ]] && myconf
="${myconf} -L/usr/$(get_libdir)"
205 # Disable visibility explicitly if gcc version isn't 4
206 if [[ "$(gcc-major-version)" != "4" ]]; then
207 myconf
="${myconf} -no-reduce-exports"
210 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
211 # cases. From bug #178535
212 myconf
="${myconf} -reduce-relocations"
214 myconf
="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
215 myconf
="${myconf} $(qt_use opengl) $(qt_use nis)"
217 use nas
&& myconf
="${myconf} -system-nas-sound"
219 myconf
="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
220 myconf
="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
221 myconf
="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
223 use debug
&& myconf
="${myconf} -debug -no-separate-debug-info" || myconf
="${myconf} -release -no-separate-debug-info"
225 use mysql
&& myconf
="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf
="${myconf} -no-sql-mysql"
226 use postgres
&& myconf
="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf
="${myconf} -no-sql-psql"
227 use firebird
&& myconf
="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf
="${myconf} -no-sql-ibase"
228 use sqlite3
&& myconf
="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf
="${myconf} -no-sql-sqlite"
229 use sqlite
&& myconf
="${myconf} -plugin-sql-sqlite2" || myconf
="${myconf} -no-sql-sqlite2"
230 use odbc
&& myconf
="${myconf} -plugin-sql-odbc" || myconf
="${myconf} -no-sql-odbc"
232 use dbus
&& myconf
="${myconf} -qdbus" || myconf
="${myconf} -no-qdbus"
233 use glib
&& myconf
="${myconf} -glib" || myconf
="${myconf} -no-glib"
234 use qt3support
&& myconf
="${myconf} -qt3support" || myconf
="${myconf} -no-qt3support"
235 use ssl
&& myconf
="${myconf} -openssl" || myconf
="${myconf} -no-openssl"
237 use pch
&& myconf
="${myconf} -pch" || myconf
="${myconf} -no-pch"
239 use input_devices_wacom
&& myconf
="${myconf} -tablet" || myconf
="${myconf} -no-tablet"
241 myconf
="${myconf} -xrender -xrandr -xkb -xshape -sm"
243 if ! use examples
; then
244 myconf
="${myconf} -nomake examples"
247 myconf
="-stl -verbose -largefile -confirm-license \
248 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
249 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
250 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
251 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
252 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
254 echo .
/configure
${myconf}
255 .
/configure
${myconf} || die
261 export PATH
="${S}/bin:${PATH}"
262 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
264 emake INSTALL_ROOT
="${D}" install_subtargets || die
265 emake INSTALL_ROOT
="${D}" install_qmake || die
266 emake INSTALL_ROOT
="${D}" install_mkspecs || die
269 emake INSTALL_ROOT
="${D}" install_htmldocs || die
272 # Install the translations. This may get use flagged later somehow
273 emake INSTALL_ROOT
="${D}" install_translations || die
275 keepdir
"${QTSYSCONFDIR}"
277 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
278 sed -i -e "s
:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
279 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
281 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
282 sed -i -e "s
:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig
/*.pc
284 # Move .pc files into the pkgconfig directory
286 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
288 # Install .desktop files, from bug #174033
289 insinto /usr/share/applications
290 doins "${FILESDIR}"/qt4/*.desktop
292 # List all the multilib libdirs
294 for libdir in $(get_all_libdirs); do
295 libdirs="${libdirs}:/usr
/${libdir}/qt4
"
298 cat > "${T}/44qt4
" << EOF
305 if use qt-copy ; then
306 ewarn "Do NOT report bugs to Gentoo
's bugzilla when built with qt-copy!!!"