Update SRC_URIs.
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.3.ebuild
blobbf30b24294c1ffa9183509074a45ae50120f2bd6
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 inherit eutils flag-o-matic toolchain-funcs multilib
7 SRCTYPE="opensource-src"
8 QT_COPY_SNAP="1.1"
9 DESCRIPTION="The Qt toolkit is a comprehensive C++ application development framework."
10 HOMEPAGE="http://www.trolltech.com/"
12 RESTRICT="primaryuri"
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.bz2 )"
17 S=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
19 LICENSE="|| ( QPL-1.0 GPL-2 )"
20 SLOT="4"
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="x11-libs/libXrandr
28 x11-libs/libXcursor
29 x11-libs/libXfont
30 x11-libs/libSM
31 xinerama? ( x11-libs/libXinerama )
32 media-libs/fontconfig
33 >=media-libs/freetype-2
34 png? ( media-libs/libpng )
35 jpeg? ( media-libs/jpeg )
36 mng? ( >=media-libs/libmng-1.0.9 )
37 tiff? ( media-libs/tiff )
38 nas? ( >=media-libs/nas-1.5 )
39 odbc? ( dev-db/unixODBC )
40 mysql? ( virtual/mysql )
41 firebird? ( dev-db/firebird )
42 sqlite3? ( =dev-db/sqlite-3* )
43 sqlite? ( =dev-db/sqlite-2* )
44 opengl? ( virtual/opengl virtual/glu )
45 postgres? ( dev-db/libpq )
46 cups? ( net-print/cups )
47 zlib? ( sys-libs/zlib )
48 glib? ( dev-libs/glib )
49 dbus? ( >=sys-apps/dbus-1.0.2 )
50 ssl? ( dev-libs/openssl )
51 input_devices_wacom? ( x11-libs/libXi x11-drivers/linuxwacom )"
53 DEPEND="${RDEPEND}
54 xinerama? ( x11-proto/xineramaproto )
55 x11-proto/xextproto
56 x11-proto/inputproto
57 dev-util/pkgconfig"
59 pkg_setup() {
60 QTBASEDIR=/usr/$(get_libdir)/qt4
61 QTPREFIXDIR=/usr
62 QTBINDIR=/usr/bin
63 QTLIBDIR=/usr/$(get_libdir)/qt4
64 QTPCDIR=/usr/$(get_libdir)/pkgconfig
65 QTDATADIR=/usr/share/qt4
66 QTDOCDIR=/usr/share/doc/${PV}
67 QTHEADERDIR=/usr/include/qt4
68 QTPLUGINDIR=${QTLIBDIR}/plugins
69 QTSYSCONFDIR=/etc/qt4
70 QTTRANSDIR=${QTDATADIR}/translations
71 QTEXAMPLESDIR=${QTDATADIR}/examples
72 QTDEMOSDIR=${QTDATADIR}/demos
74 PLATFORM=$(qt_mkspecs_dir)
78 qt_use() {
79 local flag="$1"
80 local feature="$1"
81 local enableval=
83 [[ -n $2 ]] && feature=$2
84 [[ -n $3 ]] && enableval="-$3"
86 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
87 return 0
90 qt_mkspecs_dir() {
91 # Allows us to define which mkspecs dir we want to use.
92 local spec
94 case ${CHOST} in
95 *-freebsd*|*-dragonfly*)
96 spec="freebsd" ;;
97 *-openbsd*)
98 spec="openbsd" ;;
99 *-netbsd*)
100 spec="netbsd" ;;
101 *-darwin*)
102 spec="darwin" ;;
103 *-linux-*|*-linux)
104 spec="linux" ;;
106 die "Unknown CHOST, no platform choosed."
107 esac
109 CXX=$(tc-getCXX)
110 if [[ ${CXX/g++/} != ${CXX} ]]; then
111 spec="${spec}-g++"
112 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
113 spec="${spec}-icc"
114 else
115 die "Unknown compiler ${CXX}."
118 echo "${spec}"
121 src_unpack() {
123 unpack ${A}
124 cd "${S}"
125 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
127 # Apply QT Copy patches:
128 if use qt-copy ; then
129 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
130 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
133 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
134 # set c/xxflags and ldflags
136 # Don't let the user go too overboard with flags. If you really want to, uncomment
137 # out the line below and give 'er a whirl.
138 strip-flags
139 replace-flags -O3 -O2
141 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
142 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
143 append-flags -fno-stack-protector
146 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
147 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
148 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
149 -e "/CONFIG/s:$: nostrip:" \
150 qmake.conf
152 # Do not link with -rpath. See bug #75181.
153 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
155 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
156 sed -i -e "s:X11R6/::" qmake.conf
158 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
159 # separately as well.
160 cd "${S}"/mkspecs/common
162 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
163 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
164 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
165 g++.conf
167 # Do not link with -rpath. See bug #75181.
168 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
170 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
171 sed -i -e "s:X11R6/::" linux.conf
173 cd "${S}"/qmake
175 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
176 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
178 cd "${S}"
182 src_compile() {
183 export PATH="${S}/bin:${PATH}"
184 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
186 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
188 # Disable visibility explicitly if gcc version isn't 4
189 if [[ "$(gcc-major-version)" != "4" ]]; then
190 myconf="${myconf} -no-reduce-exports"
193 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
194 # cases. From bug #178535
195 myconf="${myconf} -reduce-relocations"
197 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
198 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
200 use nas && myconf="${myconf} -system-nas-sound"
202 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
203 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
204 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
206 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
208 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
209 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
210 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
211 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
212 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
213 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
215 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
216 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
217 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
218 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
220 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
222 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
224 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
226 if ! use examples; then
227 myconf="${myconf} -nomake examples"
230 myconf="-stl -verbose -largefile -confirm-license \
231 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
232 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
233 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
234 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
235 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
237 echo ./configure ${myconf}
238 ./configure ${myconf} || die
240 emake all || die
243 src_install() {
244 export PATH="${S}/bin:${PATH}"
245 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
247 emake INSTALL_ROOT="${D}" install_subtargets || die
248 emake INSTALL_ROOT="${D}" install_qmake || die
249 emake INSTALL_ROOT="${D}" install_mkspecs || die
251 if use doc; then
252 emake INSTALL_ROOT="${D}" install_htmldocs || die
255 # Install the translations. This may get use flagged later somehow
256 emake INSTALL_ROOT="${D}" install_translations || die
258 keepdir "${QTSYSCONFDIR}"
260 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
261 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
262 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
264 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
265 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
267 # Move .pc files into the pkgconfig directory
268 dodir ${QTPCDIR}
269 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
271 # Install .desktop files, from bug #174033
272 insinto /usr/share/applications
273 doins "${FILESDIR}"/qt4/*.desktop
275 # List all the multilib libdirs
276 local libdirs
277 for libdir in $(get_all_libdirs); do
278 libdirs="${libdirs}:/usr/${libdir}/qt4"
279 done
281 cat > "${T}/44qt4" << EOF
282 LDPATH=${libdirs:1}
284 doenvd "${T}/44qt4"