รน
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.4-r1.ebuild
blob6ae55e9ecb370f4a2447d63b4f3d78625a1b8387
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:0 )
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 app-arch/lzma-utils
59 xinerama? ( x11-proto/xineramaproto )
60 x11-proto/xextproto
61 x11-proto/inputproto
62 dev-util/pkgconfig"
64 pkg_setup() {
65 QTBASEDIR=/usr/$(get_libdir)/qt4
66 QTPREFIXDIR=/usr
67 QTBINDIR=/usr/bin
68 QTLIBDIR=/usr/$(get_libdir)/qt4
69 QTPCDIR=/usr/$(get_libdir)/pkgconfig
70 QTDATADIR=/usr/share/qt4
71 QTDOCDIR=/usr/share/doc/${P}
72 QTHEADERDIR=/usr/include/qt4
73 QTPLUGINDIR=${QTLIBDIR}/plugins
74 QTSYSCONFDIR=/etc/qt4
75 QTTRANSDIR=${QTDATADIR}/translations
76 QTEXAMPLESDIR=${QTDATADIR}/examples
77 QTDEMOSDIR=${QTDATADIR}/demos
79 PLATFORM=$(qt_mkspecs_dir)
83 qt_use() {
84 local flag="$1"
85 local feature="$1"
86 local enableval=
88 [[ -n $2 ]] && feature=$2
89 [[ -n $3 ]] && enableval="-$3"
91 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}"
92 return 0
95 qt_mkspecs_dir() {
96 # Allows us to define which mkspecs dir we want to use.
97 local spec
99 case ${CHOST} in
100 *-freebsd*|*-dragonfly*)
101 spec="freebsd" ;;
102 *-openbsd*)
103 spec="openbsd" ;;
104 *-netbsd*)
105 spec="netbsd" ;;
106 *-darwin*)
107 spec="darwin" ;;
108 *-linux-*|*-linux)
109 spec="linux" ;;
111 die "Unknown CHOST, no platform choosed."
112 esac
114 CXX=$(tc-getCXX)
115 if [[ ${CXX/g++/} != ${CXX} ]]; then
116 spec="${spec}-g++"
117 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
118 spec="${spec}-icc"
119 else
120 die "Unknown compiler ${CXX}."
123 echo "${spec}"
126 src_unpack() {
128 unpack ${A}
129 cd "${S}"
130 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
132 # Apply QT Copy patches:
133 if use qt-copy; then
134 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
135 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
138 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
139 # set c/xxflags and ldflags
141 # Don't let the user go too overboard with flags. If you really want to, uncomment
142 # out the line below and give 'er a whirl.
143 strip-flags
144 replace-flags -O3 -O2
146 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
147 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
148 append-flags -fno-stack-protector
151 # Bug 178652
152 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
153 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
154 append-flags -fno-gcse
157 # Anti-aliasing rules are broken in qt-4.3*, causing random runtime failures
158 # in Qt programs. bug 213411.
159 append-flags -fno-strict-aliasing
161 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
162 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
163 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
164 -e "/CONFIG/s:$: nostrip:" \
165 qmake.conf
167 # Do not link with -rpath. See bug #75181.
168 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
170 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
171 sed -i -e "s:X11R6/::" qmake.conf
173 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
174 # separately as well.
175 cd "${S}"/mkspecs/common
177 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
178 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
179 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
180 g++.conf
182 # Do not link with -rpath. See bug #75181.
183 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
185 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
186 sed -i -e "s:X11R6/::" linux.conf
188 cd "${S}"/qmake
190 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
191 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
193 cd "${S}"
197 src_compile() {
198 export PATH="${S}/bin:${PATH}"
199 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
201 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
203 # Disable visibility explicitly if gcc version isn't 4
204 if [[ "$(gcc-major-version)" != "4" ]]; then
205 myconf="${myconf} -no-reduce-exports"
208 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
209 # cases. From bug #178535
210 myconf="${myconf} -reduce-relocations"
212 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
213 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
215 use nas && myconf="${myconf} -system-nas-sound"
217 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
218 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
219 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
221 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
223 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
224 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
225 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
226 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
227 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
228 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
230 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
231 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
232 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
233 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
235 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
237 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
239 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
241 if ! use examples; then
242 myconf="${myconf} -nomake examples"
245 myconf="-stl -verbose -largefile -confirm-license \
246 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
247 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
248 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
249 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
250 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
252 echo ./configure ${myconf}
253 ./configure ${myconf} || die
255 emake all || die
258 src_install() {
259 export PATH="${S}/bin:${PATH}"
260 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
262 emake INSTALL_ROOT="${D}" install_subtargets || die
263 emake INSTALL_ROOT="${D}" install_qmake || die
264 emake INSTALL_ROOT="${D}" install_mkspecs || die
266 if use doc; then
267 emake INSTALL_ROOT="${D}" install_htmldocs || die
270 # Install the translations. This may get use flagged later somehow
271 emake INSTALL_ROOT="${D}" install_translations || die
273 keepdir "${QTSYSCONFDIR}"
275 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
276 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
277 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
279 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
280 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
282 # Move .pc files into the pkgconfig directory
283 dodir ${QTPCDIR}
284 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
286 # Install .desktop files, from bug #174033
287 insinto /usr/share/applications
288 doins "${FILESDIR}"/qt4/*.desktop
290 # List all the multilib libdirs
291 local libdirs
292 for libdir in $(get_all_libdirs); do
293 libdirs="${libdirs}:/usr/${libdir}/qt4"
294 done
296 cat > "${T}/44qt4" << EOF
297 LDPATH=${libdirs:1}
299 doenvd "${T}/44qt4"