Add qt-core block.
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.2-r1.ebuild
blobfc394d3fbfc53ba00cc5a954f8646dbfa5cf7be2
1 # Copyright 1999-2007 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="1.0"
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.lzma )"
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 !x11-libs/qt-core
32 xinerama? ( x11-libs/libXinerama )
33 media-libs/fontconfig
34 >=media-libs/freetype-2
35 png? ( media-libs/libpng )
36 jpeg? ( media-libs/jpeg )
37 mng? ( >=media-libs/libmng-1.0.9 )
38 tiff? ( media-libs/tiff )
39 nas? ( >=media-libs/nas-1.5 )
40 odbc? ( dev-db/unixODBC )
41 mysql? ( virtual/mysql )
42 firebird? ( dev-db/firebird )
43 sqlite3? ( =dev-db/sqlite-3* )
44 sqlite? ( =dev-db/sqlite-2* )
45 opengl? ( virtual/opengl virtual/glu )
46 postgres? ( dev-db/libpq )
47 cups? ( net-print/cups )
48 zlib? ( sys-libs/zlib )
49 glib? ( dev-libs/glib )
50 dbus? ( >=sys-apps/dbus-1.0.2 )
51 ssl? ( dev-libs/openssl )
52 input_devices_wacom? ( x11-libs/libXi x11-drivers/linuxwacom )"
54 DEPEND="${RDEPEND}
55 xinerama? ( x11-proto/xineramaproto )
56 x11-proto/xextproto
57 x11-proto/inputproto
58 dev-util/pkgconfig"
60 pkg_setup() {
61 QTBASEDIR=/usr/$(get_libdir)/qt4
62 QTPREFIXDIR=/usr
63 QTBINDIR=/usr/bin
64 QTLIBDIR=/usr/$(get_libdir)/qt4
65 QTPCDIR=/usr/$(get_libdir)/pkgconfig
66 QTDATADIR=/usr/share/qt4
67 QTDOCDIR=/usr/share/doc/${PF}
68 QTHEADERDIR=/usr/include/qt4
69 QTPLUGINDIR=${QTLIBDIR}/plugins
70 QTSYSCONFDIR=/etc/qt4
71 QTTRANSDIR=${QTDATADIR}/translations
72 QTEXAMPLESDIR=${QTDATADIR}/examples
73 QTDEMOSDIR=${QTDATADIR}/demos
75 PLATFORM=$(qt_mkspecs_dir)
79 qt_use() {
80 local flag="$1"
81 local feature="$1"
82 local enableval=
84 [[ -n $2 ]] && feature=$2
85 [[ -n $3 ]] && enableval="-$3"
87 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
88 return 0
91 qt_mkspecs_dir() {
92 # Allows us to define which mkspecs dir we want to use.
93 local spec
95 case ${CHOST} in
96 *-freebsd*|*-dragonfly*)
97 spec="freebsd" ;;
98 *-openbsd*)
99 spec="openbsd" ;;
100 *-netbsd*)
101 spec="netbsd" ;;
102 *-darwin*)
103 spec="darwin" ;;
104 *-linux-*|*-linux)
105 spec="linux" ;;
107 die "Unknown CHOST, no platform choosed."
108 esac
110 CXX=$(tc-getCXX)
111 if [[ ${CXX/g++/} != ${CXX} ]]; then
112 spec="${spec}-g++"
113 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
114 spec="${spec}-icc"
115 else
116 die "Unknown compiler ${CXX}."
119 echo "${spec}"
122 src_unpack() {
124 unpack ${A}
125 cd "${S}"
126 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
128 epatch "${FILESDIR}"/qsslsocket-fix.patch
130 # Apply QT Copy patches:
131 if use qt-copy ; then
132 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
133 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
136 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
137 # set c/xxflags and ldflags
139 # Don't let the user go too overboard with flags. If you really want to, uncomment
140 # out the line below and give 'er a whirl.
141 strip-flags
142 replace-flags -O3 -O2
144 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
145 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
146 append-flags -fno-stack-protector
149 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
150 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
151 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
152 -e "/CONFIG/s:$: nostrip:" \
153 qmake.conf
155 # Do not link with -rpath. See bug #75181.
156 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
158 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
159 sed -i -e "s:X11R6/::" qmake.conf
161 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
162 # separately as well.
163 cd "${S}"/mkspecs/common
165 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
166 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
167 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
168 g++.conf
170 # Do not link with -rpath. See bug #75181.
171 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
173 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
174 sed -i -e "s:X11R6/::" linux.conf
176 cd "${S}"/qmake
178 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
179 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
181 cd "${S}"
185 src_compile() {
186 export PATH="${S}/bin:${PATH}"
187 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
189 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
191 # Disable visibility explicitly if gcc version isn't 4
192 if [[ "$(gcc-major-version)" != "4" ]]; then
193 myconf="${myconf} -no-reduce-exports"
196 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
197 # cases. From bug #178535
198 myconf="${myconf} -reduce-relocations"
200 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
201 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
203 use nas && myconf="${myconf} -system-nas-sound"
205 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
206 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
207 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
209 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
211 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
212 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
213 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
214 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
215 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
216 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
218 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
219 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
220 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
221 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
223 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
225 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
227 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
229 if ! use examples; then
230 myconf="${myconf} -nomake examples"
233 myconf="-stl -verbose -largefile -confirm-license \
234 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
235 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
236 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
237 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
238 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
240 echo ./configure ${myconf}
241 ./configure ${myconf} || die
243 emake all || die
246 src_install() {
247 export PATH="${S}/bin:${PATH}"
248 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
250 emake INSTALL_ROOT="${D}" install_subtargets || die
251 emake INSTALL_ROOT="${D}" install_qmake || die
252 emake INSTALL_ROOT="${D}" install_mkspecs || die
254 if use doc; then
255 emake INSTALL_ROOT="${D}" install_htmldocs || die
258 # Install the translations. This may get use flagged later somehow
259 emake INSTALL_ROOT="${D}" install_translations || die
261 keepdir "${QTSYSCONFDIR}"
263 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
264 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
265 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
267 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
268 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
270 # Move .pc files into the pkgconfig directory
271 dodir ${QTPCDIR}
272 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
274 # Install .desktop files, from bug #174033
275 insinto /usr/share/applications
276 doins "${FILESDIR}"/qt4/*.desktop
278 # List all the multilib libdirs
279 local libdirs
280 for libdir in $(get_all_libdirs); do
281 libdirs="${libdirs}:/usr/${libdir}/qt4"
282 done
284 cat > "${T}/44qt4" << EOF
285 LDPATH=${libdirs:1}
286 QMAKESPEC=$(qt_mkspecs_dir)
288 doenvd "${T}/44qt4"