initial import
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.3.ebuild
blobe9b9ae50b367a8af21d95966cf6b999e22099fdd
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: Exp $
5 inherit eutils flag-o-matic toolchain-funcs multilib
7 SRCTYPE="opensource-src"
8 QT_COPY_SNAP="20080115"
9 DESCRIPTION="The Qt toolkit is a comprehensive C++ application development framework."
10 HOMEPAGE="http://www.trolltech.com/"
12 RESTRICT="primaryuri"
14 SRC_URI="ftp://ftp.trolltech.com/pub/qt/source/qt-x11-${SRCTYPE}-${PV}.tar.gz
15 qt-copy? ( http://eruonen.serveblog.net/patches/qt-copy-${PV}-patches-${QT_COPY_SNAP}.tar.bz2 )"
16 S=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
18 LICENSE="|| ( QPL-1.0 GPL-2 )"
19 SLOT="4"
20 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
22 IUSE_INPUT_DEVICES="input_devices_wacom"
24 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}"
26 RDEPEND="x11-libs/libXrandr
27 x11-libs/libXcursor
28 x11-libs/libXfont
29 x11-libs/libSM
30 xinerama? ( x11-libs/libXinerama )
31 media-libs/fontconfig
32 >=media-libs/freetype-2
33 png? ( media-libs/libpng )
34 jpeg? ( media-libs/jpeg )
35 mng? ( >=media-libs/libmng-1.0.9 )
36 tiff? ( media-libs/tiff )
37 nas? ( >=media-libs/nas-1.5 )
38 odbc? ( dev-db/unixODBC )
39 mysql? ( virtual/mysql )
40 firebird? ( dev-db/firebird )
41 sqlite3? ( =dev-db/sqlite-3* )
42 sqlite? ( =dev-db/sqlite-2* )
43 opengl? ( virtual/opengl virtual/glu )
44 postgres? ( dev-db/libpq )
45 cups? ( net-print/cups )
46 zlib? ( sys-libs/zlib )
47 glib? ( dev-libs/glib )
48 dbus? ( >=sys-apps/dbus-1.0.2 )
49 ssl? ( dev-libs/openssl )
50 input_devices_wacom? ( x11-libs/libXi x11-drivers/linuxwacom )"
52 DEPEND="${RDEPEND}
53 xinerama? ( x11-proto/xineramaproto )
54 x11-proto/xextproto
55 x11-proto/inputproto
56 dev-util/pkgconfig"
58 pkg_setup() {
59 QTBASEDIR=/usr/$(get_libdir)/qt4
60 QTPREFIXDIR=/usr
61 QTBINDIR=/usr/bin
62 QTLIBDIR=/usr/$(get_libdir)/qt4
63 QTPCDIR=/usr/$(get_libdir)/pkgconfig
64 QTDATADIR=/usr/share/qt4
65 QTDOCDIR=/usr/share/doc/${PV}
66 QTHEADERDIR=/usr/include/qt4
67 QTPLUGINDIR=${QTLIBDIR}/plugins
68 QTSYSCONFDIR=/etc/qt4
69 QTTRANSDIR=${QTDATADIR}/translations
70 QTEXAMPLESDIR=${QTDATADIR}/examples
71 QTDEMOSDIR=${QTDATADIR}/demos
73 PLATFORM=$(qt_mkspecs_dir)
77 qt_use() {
78 local flag="$1"
79 local feature="$1"
80 local enableval=
82 [[ -n $2 ]] && feature=$2
83 [[ -n $3 ]] && enableval="-$3"
85 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
86 return 0
89 qt_mkspecs_dir() {
90 # Allows us to define which mkspecs dir we want to use.
91 local spec
93 case ${CHOST} in
94 *-freebsd*|*-dragonfly*)
95 spec="freebsd" ;;
96 *-openbsd*)
97 spec="openbsd" ;;
98 *-netbsd*)
99 spec="netbsd" ;;
100 *-darwin*)
101 spec="darwin" ;;
102 *-linux-*|*-linux)
103 spec="linux" ;;
105 die "Unknown CHOST, no platform choosed."
106 esac
108 CXX=$(tc-getCXX)
109 if [[ ${CXX/g++/} != ${CXX} ]]; then
110 spec="${spec}-g++"
111 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
112 spec="${spec}-icc"
113 else
114 die "Unknown compiler ${CXX}."
117 echo "${spec}"
120 src_unpack() {
122 unpack ${A}
123 cd "${S}"
124 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
126 # Apply QT Copy patches:
127 if use qt-copy ; then
128 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
129 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
132 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
133 # set c/xxflags and ldflags
135 # Don't let the user go too overboard with flags. If you really want to, uncomment
136 # out the line below and give 'er a whirl.
137 strip-flags
138 replace-flags -O3 -O2
140 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
141 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
142 append-flags -fno-stack-protector
145 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
146 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
147 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
148 -e "/CONFIG/s:$: nostrip:" \
149 qmake.conf
151 # Do not link with -rpath. See bug #75181.
152 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
154 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
155 sed -i -e "s:X11R6/::" qmake.conf
157 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
158 # separately as well.
159 cd "${S}"/mkspecs/common
161 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
162 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
163 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
164 g++.conf
166 # Do not link with -rpath. See bug #75181.
167 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
169 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
170 sed -i -e "s:X11R6/::" linux.conf
172 cd "${S}"/qmake
174 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
175 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
177 cd "${S}"
181 src_compile() {
182 export PATH="${S}/bin:${PATH}"
183 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
185 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
187 # Disable visibility explicitly if gcc version isn't 4
188 if [[ "$(gcc-major-version)" != "4" ]]; then
189 myconf="${myconf} -no-reduce-exports"
192 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
193 # cases. From bug #178535
194 myconf="${myconf} -reduce-relocations"
196 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
197 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
199 use nas && myconf="${myconf} -system-nas-sound"
201 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
202 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
203 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
205 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
207 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
208 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
209 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
210 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
211 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
212 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
214 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
215 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
216 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
217 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
219 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
221 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
223 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
225 if ! use examples; then
226 myconf="${myconf} -nomake examples"
229 myconf="-stl -verbose -largefile -confirm-license \
230 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
231 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
232 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
233 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
234 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
236 echo ./configure ${myconf}
237 ./configure ${myconf} || die
239 emake all || die
242 src_install() {
243 export PATH="${S}/bin:${PATH}"
244 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
246 emake INSTALL_ROOT="${D}" install_subtargets || die
247 emake INSTALL_ROOT="${D}" install_qmake || die
248 emake INSTALL_ROOT="${D}" install_mkspecs || die
250 if use doc; then
251 emake INSTALL_ROOT="${D}" install_htmldocs || die
254 # Install the translations. This may get use flagged later somehow
255 emake INSTALL_ROOT="${D}" install_translations || die
257 keepdir "${QTSYSCONFDIR}"
259 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
260 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
261 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
263 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
264 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
266 # Move .pc files into the pkgconfig directory
267 dodir ${QTPCDIR}
268 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
270 # Install .desktop files, from bug #174033
271 insinto /usr/share/applications
272 doins "${FILESDIR}"/qt4/*.desktop
274 # List all the multilib libdirs
275 local libdirs
276 for libdir in $(get_all_libdirs); do
277 libdirs="${libdirs}:/usr/${libdir}/qt4"
278 done
280 cat > "${T}/44qt4" << EOF
281 LDPATH=${libdirs:1}
283 doenvd "${T}/44qt4"