1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit eutils flag-o-matic toolchain-funcs multilib
7 SRCTYPE
="opensource-src"
9 DESCRIPTION
="The Qt toolkit is a comprehensive C++ application development framework."
10 HOMEPAGE
="http://www.trolltech.com/"
14 SRC_URI
="mirror://gentoo/qt-x11-${SRCTYPE}-${PV}.tar.gz
15 ftp://ftp.trolltech.com/pub/qt/source/qt-x11-${SRCTYPE}-${PV}.tar.gz
16 qt-copy? ( http://jyujin.de/~creidiki/qt-copy/qt-copy-${PV}-patches-${QT_COPY_SNAP}.tar.lzma )"
17 S
=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
19 LICENSE
="|| ( QPL-1.0 GPL-2 )"
21 KEYWORDS
="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
23 IUSE_INPUT_DEVICES
="input_devices_wacom"
25 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}"
27 RDEPEND
="app-arch/lzma-utils
33 xinerama? ( x11-libs/libXinerama )
35 >=media-libs/freetype-2
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-2* )
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 xinerama? ( x11-proto/xineramaproto )
62 QTBASEDIR
=/usr
/$
(get_libdir
)/qt4
65 QTLIBDIR
=/usr
/$
(get_libdir
)/qt4
66 QTPCDIR
=/usr
/$
(get_libdir
)/pkgconfig
67 QTDATADIR
=/usr
/share
/qt4
68 QTDOCDIR
=/usr
/share
/doc
/${PV}
69 QTHEADERDIR
=/usr
/include
/qt4
70 QTPLUGINDIR
=${QTLIBDIR}/plugins
72 QTTRANSDIR
=${QTDATADIR}/translations
73 QTEXAMPLESDIR
=${QTDATADIR}/examples
74 QTDEMOSDIR
=${QTDATADIR}/demos
76 PLATFORM
=$
(qt_mkspecs_dir
)
85 [[ -n $2 ]] && feature
=$2
86 [[ -n $3 ]] && enableval
="-$3"
88 useq
$flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
93 # Allows us to define which mkspecs dir we want to use.
97 *-freebsd*|
*-dragonfly*)
108 die
"Unknown CHOST, no platform choosed."
112 if [[ ${CXX/g++/} != ${CXX} ]]; then
114 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
117 die
"Unknown compiler ${CXX}."
127 epatch
"${FILESDIR}"/qt-4.2
.3-hppa-ldcw-fix.
patch
129 # Apply QT Copy patches:
130 if use qt-copy
; then
131 EPATCH_MULTI_MSG
="Applying the KDE Qt Copy patches ..." \
132 EPATCH_SOURCE
="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX
="diff" epatch
135 cd "${S}"/mkspecs
/$
(qt_mkspecs_dir
)
136 # set c/xxflags and ldflags
138 # Don't let the user go too overboard with flags. If you really want to, uncomment
139 # out the line below and give 'er a whirl.
141 replace-flags
-O3 -O2
143 if [[ $
( gcc-fullversion
) == "3.4.6" && gcc-specs-ssp
]] ; then
144 ewarn
"Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
145 append-flags
-fno-stack-protector
148 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
149 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
150 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
151 -e "/CONFIG/s:$: nostrip:" \
154 # Do not link with -rpath. See bug #75181.
155 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
157 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
158 sed -i -e "s:X11R6/::" qmake.conf
160 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
161 # separately as well.
162 cd "${S}"/mkspecs
/common
164 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
165 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
166 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
169 # Do not link with -rpath. See bug #75181.
170 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g
++.conf
172 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
173 sed -i -e "s:X11R6/::" linux.conf
177 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
178 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
185 export PATH
="${S}/bin:${PATH}"
186 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
188 [ $
(get_libdir
) != "lib" ] && myconf
="${myconf} -L/usr/$(get_libdir)"
190 # Disable visibility explicitly if gcc version isn't 4
191 if [[ "$(gcc-major-version)" != "4" ]]; then
192 myconf
="${myconf} -no-reduce-exports"
195 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
196 # cases. From bug #178535
197 myconf
="${myconf} -reduce-relocations"
199 myconf
="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
200 myconf
="${myconf} $(qt_use opengl) $(qt_use nis)"
202 use nas
&& myconf
="${myconf} -system-nas-sound"
204 myconf
="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
205 myconf
="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
206 myconf
="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
208 use debug
&& myconf
="${myconf} -debug -no-separate-debug-info" || myconf
="${myconf} -release -no-separate-debug-info"
210 use mysql
&& myconf
="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf
="${myconf} -no-sql-mysql"
211 use postgres
&& myconf
="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf
="${myconf} -no-sql-psql"
212 use firebird
&& myconf
="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf
="${myconf} -no-sql-ibase"
213 use sqlite3
&& myconf
="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf
="${myconf} -no-sql-sqlite"
214 use sqlite
&& myconf
="${myconf} -plugin-sql-sqlite2" || myconf
="${myconf} -no-sql-sqlite2"
215 use odbc
&& myconf
="${myconf} -plugin-sql-odbc" || myconf
="${myconf} -no-sql-odbc"
217 use dbus
&& myconf
="${myconf} -qdbus" || myconf
="${myconf} -no-qdbus"
218 use glib
&& myconf
="${myconf} -glib" || myconf
="${myconf} -no-glib"
219 use qt3support
&& myconf
="${myconf} -qt3support" || myconf
="${myconf} -no-qt3support"
220 use ssl
&& myconf
="${myconf} -openssl" || myconf
="${myconf} -no-openssl"
222 use pch
&& myconf
="${myconf} -pch" || myconf
="${myconf} -no-pch"
224 use input_devices_wacom
&& myconf
="${myconf} -tablet" || myconf
="${myconf} -no-tablet"
226 myconf
="${myconf} -xrender -xrandr -xkb -xshape -sm"
228 if ! use examples
; then
229 myconf
="${myconf} -nomake examples"
232 myconf
="-stl -verbose -largefile -confirm-license \
233 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
234 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
235 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
236 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
237 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
239 echo .
/configure
${myconf}
240 .
/configure
${myconf} || die
246 export PATH
="${S}/bin:${PATH}"
247 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
249 emake INSTALL_ROOT
="${D}" install_subtargets || die
250 emake INSTALL_ROOT
="${D}" install_qmake || die
251 emake INSTALL_ROOT
="${D}" install_mkspecs || die
254 emake INSTALL_ROOT
="${D}" install_htmldocs || die
257 # Install the translations. This may get use flagged later somehow
258 emake INSTALL_ROOT
="${D}" install_translations || die
260 keepdir
"${QTSYSCONFDIR}"
262 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
263 sed -i -e "s
:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
264 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
266 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
267 sed -i -e "s
:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig
/*.pc
269 # Move .pc files into the pkgconfig directory
271 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
273 # Install .desktop files, from bug #174033
274 insinto /usr/share/applications
275 doins "${FILESDIR}"/qt4/*.desktop
277 # List all the multilib libdirs
279 for libdir in $(get_all_libdirs); do
280 libdirs="${libdirs}:/usr
/${libdir}/qt4
"
283 cat > "${T}/44qt4
" << EOF