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 )"
18 S
=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
20 LICENSE
="|| ( QPL-1.0 GPL-2 )"
22 KEYWORDS
="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
24 IUSE_INPUT_DEVICES
="input_devices_wacom"
26 IUSE
="+accessibility cups dbus debug doc examples firebird gif glib jpeg mng mysql nas nis odbc opengl pch png postgres +qt-copy +qt3support sqlite sqlite3 ssl tiff xinerama zlib ${IUSE_INPUT_DEVICES}"
28 RDEPEND
="x11-libs/libXrandr
33 xinerama? ( x11-libs/libXinerama )
36 png? ( media-libs/libpng )
37 jpeg? ( media-libs/jpeg )
38 mng? ( >=media-libs/libmng-1.0.9 )
39 tiff? ( media-libs/tiff )
40 nas? ( >=media-libs/nas-1.5 )
41 odbc? ( dev-db/unixODBC )
42 mysql? ( virtual/mysql )
43 firebird? ( dev-db/firebird )
44 sqlite3? ( dev-db/sqlite:3 )
45 sqlite? ( dev-db/sqlite:0 )
46 opengl? ( virtual/opengl virtual/glu )
47 postgres? ( dev-db/libpq )
48 cups? ( net-print/cups )
49 zlib? ( sys-libs/zlib )
50 glib? ( dev-libs/glib )
51 dbus? ( >=sys-apps/dbus-1.0.2 )
52 ssl? ( dev-libs/openssl )
53 input_devices_wacom? ( x11-libs/libXi x11-drivers/linuxwacom )"
56 qt-copy? ( app-arch/lzma-utils )
57 xinerama? ( x11-proto/xineramaproto )
63 QTBASEDIR
=/usr
/$
(get_libdir
)/qt4
66 QTLIBDIR
=/usr
/$
(get_libdir
)/qt4
67 QTPCDIR
=/usr
/$
(get_libdir
)/pkgconfig
68 QTDATADIR
=/usr
/share
/qt4
69 QTDOCDIR
=/usr
/share
/doc
/${PV}
70 QTHEADERDIR
=/usr
/include
/qt4
71 QTPLUGINDIR
=${QTLIBDIR}/plugins
73 QTTRANSDIR
=${QTDATADIR}/translations
74 QTEXAMPLESDIR
=${QTDATADIR}/examples
75 QTDEMOSDIR
=${QTDATADIR}/demos
77 PLATFORM
=$
(qt_mkspecs_dir
)
86 [[ -n $2 ]] && feature
=$2
87 [[ -n $3 ]] && enableval
="-$3"
89 useq
$flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
94 # Allows us to define which mkspecs dir we want to use.
98 *-freebsd*|
*-dragonfly*)
109 die
"Unknown CHOST, no platform choosed."
113 if [[ ${CXX/g++/} != ${CXX} ]]; then
115 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
118 die
"Unknown compiler ${CXX}."
128 epatch
"${FILESDIR}"/qt-4.2
.3-hppa-ldcw-fix.
patch
130 # Apply QT Copy patches:
132 ebegin
"Applying the KDE Qt Copy patches"
133 for diff in $
(ls "${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}"/* |
sort); do
134 epatch
"${diff}" || die
136 einfo
"Done with patching"
139 cd "${S}"/mkspecs
/$
(qt_mkspecs_dir
)
140 # set c/xxflags and ldflags
142 # Don't let the user go too overboard with flags. If you really want to, uncomment
143 # out the line below and give 'er a whirl.
145 replace-flags
-O3 -O2
147 if [[ $
( gcc-fullversion
) == "3.4.6" && gcc-specs-ssp
]] ; then
148 ewarn
"Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
149 append-flags
-fno-stack-protector
152 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
153 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
154 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
155 -e "/CONFIG/s:$: nostrip:" \
158 # Do not link with -rpath. See bug #75181.
159 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
161 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
162 sed -i -e "s:X11R6/::" qmake.conf
164 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
165 # separately as well.
166 cd "${S}"/mkspecs
/common
168 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
169 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
170 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
173 # Do not link with -rpath. See bug #75181.
174 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g
++.conf
176 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
177 sed -i -e "s:X11R6/::" linux.conf
181 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
182 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
189 export PATH
="${S}/bin:${PATH}"
190 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
192 [ $
(get_libdir
) != "lib" ] && myconf
="${myconf} -L/usr/$(get_libdir)"
194 # Disable visibility explicitly if gcc version isn't 4
195 if [[ "$(gcc-major-version)" != "4" ]]; then
196 myconf
="${myconf} -no-reduce-exports"
199 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
200 # cases. From bug #178535
201 myconf
="${myconf} -reduce-relocations"
203 myconf
="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
204 myconf
="${myconf} $(qt_use opengl) $(qt_use nis)"
206 use nas
&& myconf
="${myconf} -system-nas-sound"
208 myconf
="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
209 myconf
="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
210 myconf
="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
212 use debug
&& myconf
="${myconf} -debug -no-separate-debug-info" || myconf
="${myconf} -release -no-separate-debug-info"
214 use mysql
&& myconf
="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf
="${myconf} -no-sql-mysql"
215 use postgres
&& myconf
="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf
="${myconf} -no-sql-psql"
216 use firebird
&& myconf
="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf
="${myconf} -no-sql-ibase"
217 use sqlite3
&& myconf
="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf
="${myconf} -no-sql-sqlite"
218 use sqlite
&& myconf
="${myconf} -plugin-sql-sqlite2" || myconf
="${myconf} -no-sql-sqlite2"
219 use odbc
&& myconf
="${myconf} -plugin-sql-odbc" || myconf
="${myconf} -no-sql-odbc"
221 use dbus
&& myconf
="${myconf} -qdbus" || myconf
="${myconf} -no-qdbus"
222 use glib
&& myconf
="${myconf} -glib" || myconf
="${myconf} -no-glib"
223 use qt3support
&& myconf
="${myconf} -qt3support" || myconf
="${myconf} -no-qt3support"
224 use ssl
&& myconf
="${myconf} -openssl" || myconf
="${myconf} -no-openssl"
226 use pch
&& myconf
="${myconf} -pch" || myconf
="${myconf} -no-pch"
228 use input_devices_wacom
&& myconf
="${myconf} -tablet" || myconf
="${myconf} -no-tablet"
230 myconf
="${myconf} -xrender -xrandr -xkb -xshape -sm"
232 if ! use examples
; then
233 myconf
="${myconf} -nomake examples"
236 myconf
="-stl -verbose -largefile -confirm-license \
237 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
238 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
239 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
240 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
241 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
243 echo .
/configure
${myconf}
244 .
/configure
${myconf} || die
250 export PATH
="${S}/bin:${PATH}"
251 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
253 emake INSTALL_ROOT
="${D}" install_subtargets || die
254 emake INSTALL_ROOT
="${D}" install_qmake || die
255 emake INSTALL_ROOT
="${D}" install_mkspecs || die
258 emake INSTALL_ROOT
="${D}" install_htmldocs || die
261 # Install the translations. This may get use flagged later somehow
262 emake INSTALL_ROOT
="${D}" install_translations || die
264 keepdir
"${QTSYSCONFDIR}"
266 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
267 sed -i -e "s
:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
268 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
270 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
271 sed -i -e "s
:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig
/*.pc
273 # Move .pc files into the pkgconfig directory
275 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
277 # Install .desktop files, from bug #174033
278 insinto /usr/share/applications
279 doins "${FILESDIR}"/qt4/*.desktop
281 # List all the multilib libdirs
283 for libdir in $(get_all_libdirs); do
284 libdirs="${libdirs}:/usr
/${libdir}/qt4
"
287 cat > "${T}/44qt4
" << EOF
294 if use qt-copy ; then
295 ewarn "Do NOT report bugs to Gentoo
's bugzilla when built with qt-copy!!!"