Fix URIs.
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.4-r1.ebuild
blob9bed01edd496995a0122ea4a8388bfbcdfb2d421
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 EAPI="1"
6 inherit eutils flag-o-matic toolchain-funcs multilib
8 SRCTYPE="opensource-src"
9 QT_COPY_SNAP="1.0"
10 DESCRIPTION="The Qt toolkit is a comprehensive C++ application development framework."
11 HOMEPAGE="http://www.trolltech.com/"
13 RESTRICT="primaryuri"
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 GPL-3 )"
21 SLOT="4"
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
27 mysql nas nis odbc opengl pch png postgres +qt3support qt-copy sqlite sqlite3 ssl tiff
28 xinerama zlib ${IUSE_INPUT_DEVICES}"
30 RDEPEND="x11-libs/libXrandr
31 x11-libs/libXcursor
32 x11-libs/libXfont
33 x11-libs/libSM
34 !x11-libs/qt-core
35 xinerama? ( x11-libs/libXinerama )
36 media-libs/fontconfig
37 >=media-libs/freetype-2
38 png? ( media-libs/libpng )
39 jpeg? ( media-libs/jpeg )
40 mng? ( >=media-libs/libmng-1.0.9 )
41 tiff? ( media-libs/tiff )
42 nas? ( >=media-libs/nas-1.5 )
43 odbc? ( dev-db/unixODBC )
44 mysql? ( virtual/mysql )
45 firebird? ( dev-db/firebird )
46 sqlite3? ( =dev-db/sqlite-3* )
47 sqlite? ( =dev-db/sqlite-2* )
48 opengl? ( virtual/opengl virtual/glu )
49 postgres? ( dev-db/libpq )
50 cups? ( net-print/cups )
51 zlib? ( sys-libs/zlib )
52 glib? ( dev-libs/glib )
53 dbus? ( >=sys-apps/dbus-1.0.2 )
54 ssl? ( dev-libs/openssl )
55 input_devices_wacom? ( x11-libs/libXi x11-drivers/linuxwacom )"
57 DEPEND="${RDEPEND}
58 xinerama? ( x11-proto/xineramaproto )
59 x11-proto/xextproto
60 x11-proto/inputproto
61 dev-util/pkgconfig"
63 pkg_setup() {
64 QTBASEDIR=/usr/$(get_libdir)/qt4
65 QTPREFIXDIR=/usr
66 QTBINDIR=/usr/bin
67 QTLIBDIR=/usr/$(get_libdir)/qt4
68 QTPCDIR=/usr/$(get_libdir)/pkgconfig
69 QTDATADIR=/usr/share/qt4
70 QTDOCDIR=/usr/share/doc/${P}
71 QTHEADERDIR=/usr/include/qt4
72 QTPLUGINDIR=${QTLIBDIR}/plugins
73 QTSYSCONFDIR=/etc/qt4
74 QTTRANSDIR=${QTDATADIR}/translations
75 QTEXAMPLESDIR=${QTDATADIR}/examples
76 QTDEMOSDIR=${QTDATADIR}/demos
78 PLATFORM=$(qt_mkspecs_dir)
82 qt_use() {
83 local flag="$1"
84 local feature="$1"
85 local enableval=
87 [[ -n $2 ]] && feature=$2
88 [[ -n $3 ]] && enableval="-$3"
90 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
91 return 0
94 qt_mkspecs_dir() {
95 # Allows us to define which mkspecs dir we want to use.
96 local spec
98 case ${CHOST} in
99 *-freebsd*|*-dragonfly*)
100 spec="freebsd" ;;
101 *-openbsd*)
102 spec="openbsd" ;;
103 *-netbsd*)
104 spec="netbsd" ;;
105 *-darwin*)
106 spec="darwin" ;;
107 *-linux-*|*-linux)
108 spec="linux" ;;
110 die "Unknown CHOST, no platform choosed."
111 esac
113 CXX=$(tc-getCXX)
114 if [[ ${CXX/g++/} != ${CXX} ]]; then
115 spec="${spec}-g++"
116 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
117 spec="${spec}-icc"
118 else
119 die "Unknown compiler ${CXX}."
122 echo "${spec}"
125 src_unpack() {
127 unpack ${A}
128 cd "${S}"
129 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
131 # Apply QT Copy patches:
132 if use qt-copy ; then
133 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
134 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
137 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
138 # set c/xxflags and ldflags
140 # Don't let the user go too overboard with flags. If you really want to, uncomment
141 # out the line below and give 'er a whirl.
142 strip-flags
143 replace-flags -O3 -O2
145 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
146 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
147 append-flags -fno-stack-protector
150 # Bug 178652
151 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
152 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
153 append-flags -fno-gcse
156 # Anti-aliasing rules are broken in qt-4.3*, causing random runtime failures
157 # in Qt programs. bug 213411.
158 append-flags -fno-strict-aliasing
160 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
161 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
162 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
163 -e "/CONFIG/s:$: nostrip:" \
164 qmake.conf
166 # Do not link with -rpath. See bug #75181.
167 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
169 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
170 sed -i -e "s:X11R6/::" qmake.conf
172 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
173 # separately as well.
174 cd "${S}"/mkspecs/common
176 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
177 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
178 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
179 g++.conf
181 # Do not link with -rpath. See bug #75181.
182 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
184 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
185 sed -i -e "s:X11R6/::" linux.conf
187 cd "${S}"/qmake
189 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
190 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
192 cd "${S}"
196 src_compile() {
197 export PATH="${S}/bin:${PATH}"
198 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
200 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
202 # Disable visibility explicitly if gcc version isn't 4
203 if [[ "$(gcc-major-version)" != "4" ]]; then
204 myconf="${myconf} -no-reduce-exports"
207 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
208 # cases. From bug #178535
209 myconf="${myconf} -reduce-relocations"
211 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
212 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
214 use nas && myconf="${myconf} -system-nas-sound"
216 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
217 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
218 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
220 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
222 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
223 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
224 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
225 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
226 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
227 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
229 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
230 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
231 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
232 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
234 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
236 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
238 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
240 if ! use examples; then
241 myconf="${myconf} -nomake examples"
244 myconf="-stl -verbose -largefile -confirm-license \
245 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
246 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
247 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
248 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
249 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
251 echo ./configure ${myconf}
252 ./configure ${myconf} || die
254 emake all || die
257 src_install() {
258 export PATH="${S}/bin:${PATH}"
259 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
261 emake INSTALL_ROOT="${D}" install_subtargets || die
262 emake INSTALL_ROOT="${D}" install_qmake || die
263 emake INSTALL_ROOT="${D}" install_mkspecs || die
265 if use doc; then
266 emake INSTALL_ROOT="${D}" install_htmldocs || die
269 # Install the translations. This may get use flagged later somehow
270 emake INSTALL_ROOT="${D}" install_translations || die
272 keepdir "${QTSYSCONFDIR}"
274 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
275 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
276 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
278 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
279 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
281 # Move .pc files into the pkgconfig directory
282 dodir ${QTPCDIR}
283 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
285 # Install .desktop files, from bug #174033
286 insinto /usr/share/applications
287 doins "${FILESDIR}"/qt4/*.desktop
289 # List all the multilib libdirs
290 local libdirs
291 for libdir in $(get_all_libdirs); do
292 libdirs="${libdirs}:/usr/${libdir}/qt4"
293 done
295 cat > "${T}/44qt4" << EOF
296 LDPATH=${libdirs:1}
298 doenvd "${T}/44qt4"