46082d0146f8a1b3e125ac46e21d909526f88f3e
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.3.ebuild
blob46082d0146f8a1b3e125ac46e21d909526f88f3e
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.1"
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 )"
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 mysql nas nis odbc opengl pch png postgres +qt-copy +qt3support sqlite sqlite3 ssl tiff xinerama zlib ${IUSE_INPUT_DEVICES}"
28 RDEPEND="x11-libs/libXrandr
29 x11-libs/libXcursor
30 x11-libs/libXfont
31 x11-libs/libSM
32 !x11-libs/qt-core
33 xinerama? ( x11-libs/libXinerama )
34 media-libs/fontconfig
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:0 )
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 )"
55 DEPEND="${RDEPEND}
56 qt-copy? ( app-arch/lzma-utils )
57 xinerama? ( x11-proto/xineramaproto )
58 x11-proto/xextproto
59 x11-proto/inputproto
60 dev-util/pkgconfig"
62 pkg_setup() {
63 QTBASEDIR=/usr/$(get_libdir)/qt4
64 QTPREFIXDIR=/usr
65 QTBINDIR=/usr/bin
66 QTLIBDIR=/usr/$(get_libdir)/qt4
67 QTPCDIR=/usr/$(get_libdir)/pkgconfig
68 QTDATADIR=/usr/share/qt4
69 QTDOCDIR=/usr/share/doc/${PV}
70 QTHEADERDIR=/usr/include/qt4
71 QTPLUGINDIR=${QTLIBDIR}/plugins
72 QTSYSCONFDIR=/etc/qt4
73 QTTRANSDIR=${QTDATADIR}/translations
74 QTEXAMPLESDIR=${QTDATADIR}/examples
75 QTDEMOSDIR=${QTDATADIR}/demos
77 PLATFORM=$(qt_mkspecs_dir)
79 }
81 qt_use() {
82 local flag="$1"
83 local feature="$1"
84 local enableval=
86 [[ -n $2 ]] && feature=$2
87 [[ -n $3 ]] && enableval="-$3"
89 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
90 return 0
91 }
93 qt_mkspecs_dir() {
94 # Allows us to define which mkspecs dir we want to use.
95 local spec
97 case ${CHOST} in
98 *-freebsd*|*-dragonfly*)
99 spec="freebsd" ;;
100 *-openbsd*)
101 spec="openbsd" ;;
102 *-netbsd*)
103 spec="netbsd" ;;
104 *-darwin*)
105 spec="darwin" ;;
106 *-linux-*|*-linux)
107 spec="linux" ;;
108 *)
109 die "Unknown CHOST, no platform choosed."
110 esac
112 CXX=$(tc-getCXX)
113 if [[ ${CXX/g++/} != ${CXX} ]]; then
114 spec="${spec}-g++"
115 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
116 spec="${spec}-icc"
117 else
118 die "Unknown compiler ${CXX}."
119 fi
121 echo "${spec}"
124 src_unpack() {
126 unpack ${A}
127 cd "${S}"
128 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
130 # Apply QT Copy patches:
131 if use qt-copy; then
132 ebegin "Applying the KDE Qt Copy patches"
133 for diff in $(ls "${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}"/* | sort); do
134 epatch "${diff}" || die
135 done
136 einfo "Done with patching"
137 fi
139 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
140 # set c/xxflags and ldflags
142 # Don't let the user go too overboard with flags. If you really want to, uncomment
143 # out the line below and give 'er a whirl.
144 strip-flags
145 replace-flags -O3 -O2
147 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
148 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
149 append-flags -fno-stack-protector
150 fi
152 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
153 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
154 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
155 -e "/CONFIG/s:$: nostrip:" \
156 qmake.conf
158 # Do not link with -rpath. See bug #75181.
159 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
161 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
162 sed -i -e "s:X11R6/::" qmake.conf
164 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
165 # separately as well.
166 cd "${S}"/mkspecs/common
168 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
169 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
170 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
171 g++.conf
173 # Do not link with -rpath. See bug #75181.
174 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
176 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
177 sed -i -e "s:X11R6/::" linux.conf
179 cd "${S}"/qmake
181 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
182 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
184 cd "${S}"
188 src_compile() {
189 export PATH="${S}/bin:${PATH}"
190 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
192 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
194 # Disable visibility explicitly if gcc version isn't 4
195 if [[ "$(gcc-major-version)" != "4" ]]; then
196 myconf="${myconf} -no-reduce-exports"
197 fi
199 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
200 # cases. From bug #178535
201 myconf="${myconf} -reduce-relocations"
203 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
204 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
206 use nas && myconf="${myconf} -system-nas-sound"
208 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
209 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
210 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
212 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
214 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
215 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
216 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
217 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
218 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
219 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
221 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
222 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
223 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
224 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
226 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
228 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
230 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
232 if ! use examples; then
233 myconf="${myconf} -nomake examples"
234 fi
236 myconf="-stl -verbose -largefile -confirm-license \
237 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
238 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
239 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
240 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
241 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
243 echo ./configure ${myconf}
244 ./configure ${myconf} || die
246 emake all || die
249 src_install() {
250 export PATH="${S}/bin:${PATH}"
251 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
253 emake INSTALL_ROOT="${D}" install_subtargets || die
254 emake INSTALL_ROOT="${D}" install_qmake || die
255 emake INSTALL_ROOT="${D}" install_mkspecs || die
257 if use doc; then
258 emake INSTALL_ROOT="${D}" install_htmldocs || die
259 fi
261 # Install the translations. This may get use flagged later somehow
262 emake INSTALL_ROOT="${D}" install_translations || die
264 keepdir "${QTSYSCONFDIR}"
266 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
267 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
268 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
270 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
271 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
273 # Move .pc files into the pkgconfig directory
274 dodir ${QTPCDIR}
275 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
277 # Install .desktop files, from bug #174033
278 insinto /usr/share/applications
279 doins "${FILESDIR}"/qt4/*.desktop
281 # List all the multilib libdirs
282 local libdirs
283 for libdir in $(get_all_libdirs); do
284 libdirs="${libdirs}:/usr/${libdir}/qt4"
285 done
287 cat > "${T}/44qt4" << EOF
288 LDPATH=${libdirs:1}
289 EOF
290 doenvd "${T}/44qt4"
293 pkg_postinst() {
294 if use qt-copy ; then
295 ewarn "Do NOT report bugs to Gentoo's bugzilla when built with qt-copy!!!"
296 fi