Add 4.4.0_rc1
[gentoo-soor-overlay.git] / x11-libs / qt / qt-4.3.2-r1.ebuild
blobdb19014026c56f7e576d799de8ee81219f6b9005
1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: Exp $
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 )"
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 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/${PF}
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)
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
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" ;;
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}."
121 echo "${spec}"
124 src_unpack() {
126 unpack ${A}
127 cd "${S}"
128 epatch "${FILESDIR}"/qt-4.2.3-hppa-ldcw-fix.patch
130 epatch "${FILESDIR}"/qsslsocket-fix.patch
132 # Apply QT Copy patches:
133 if use qt-copy; then
134 ebegin "Applying the KDE Qt Copy patches"
135 for diff in $(ls "${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}"/* | sort); do
136 epatch "${diff}" || die
137 done
138 einfo "Done with patching"
141 cd "${S}"/mkspecs/$(qt_mkspecs_dir)
142 # set c/xxflags and ldflags
144 # Don't let the user go too overboard with flags. If you really want to, uncomment
145 # out the line below and give 'er a whirl.
146 strip-flags
147 replace-flags -O3 -O2
149 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
150 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
151 append-flags -fno-stack-protector
154 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
155 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
156 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
157 -e "/CONFIG/s:$: nostrip:" \
158 qmake.conf
160 # Do not link with -rpath. See bug #75181.
161 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" qmake.conf
163 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
164 sed -i -e "s:X11R6/::" qmake.conf
166 # The trolls moved the definitions of the above stuff for g++, so we need to edit those files
167 # separately as well.
168 cd "${S}"/mkspecs/common
170 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CPPFLAGS} ${CFLAGS} ${ASFLAGS}:" \
171 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS}:" \
172 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
173 g++.conf
175 # Do not link with -rpath. See bug #75181.
176 sed -i -e "s:QMAKE_RPATH.*=.*:QMAKE_RPATH=:" g++.conf
178 # Replace X11R6/ directories, so /usr/X11R6/lib -> /usr/lib
179 sed -i -e "s:X11R6/::" linux.conf
181 cd "${S}"/qmake
183 sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CPPFLAGS} ${CXXFLAGS} ${ASFLAGS} :" \
184 -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" Makefile.unix
186 cd "${S}"
190 src_compile() {
191 export PATH="${S}/bin:${PATH}"
192 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
194 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
196 # Disable visibility explicitly if gcc version isn't 4
197 if [[ "$(gcc-major-version)" != "4" ]]; then
198 myconf="${myconf} -no-reduce-exports"
201 # Add a switch that will attempt to use recent binutils to reduce relocations. Should be harmless for other
202 # cases. From bug #178535
203 myconf="${myconf} -reduce-relocations"
205 myconf="${myconf} $(qt_use accessibility) $(qt_use cups) $(qt_use xinerama)"
206 myconf="${myconf} $(qt_use opengl) $(qt_use nis)"
208 use nas && myconf="${myconf} -system-nas-sound"
210 myconf="${myconf} $(qt_use gif gif qt) $(qt_use png libpng system)"
211 myconf="${myconf} $(qt_use jpeg libjpeg system) $(qt_use tiff libtiff system)"
212 myconf="${myconf} $(qt_use zlib zlib system) $(qt_use mng libmng system)"
214 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info"
216 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
217 use postgres && myconf="${myconf} -plugin-sql-psql -I/usr/include/postgresql/pgsql" || myconf="${myconf} -no-sql-psql"
218 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
219 use sqlite3 && myconf="${myconf} -plugin-sql-sqlite -system-sqlite" || myconf="${myconf} -no-sql-sqlite"
220 use sqlite && myconf="${myconf} -plugin-sql-sqlite2" || myconf="${myconf} -no-sql-sqlite2"
221 use odbc && myconf="${myconf} -plugin-sql-odbc" || myconf="${myconf} -no-sql-odbc"
223 use dbus && myconf="${myconf} -qdbus" || myconf="${myconf} -no-qdbus"
224 use glib && myconf="${myconf} -glib" || myconf="${myconf} -no-glib"
225 use qt3support && myconf="${myconf} -qt3support" || myconf="${myconf} -no-qt3support"
226 use ssl && myconf="${myconf} -openssl" || myconf="${myconf} -no-openssl"
228 use pch && myconf="${myconf} -pch" || myconf="${myconf} -no-pch"
230 use input_devices_wacom && myconf="${myconf} -tablet" || myconf="${myconf} -no-tablet"
232 myconf="${myconf} -xrender -xrandr -xkb -xshape -sm"
234 if ! use examples; then
235 myconf="${myconf} -nomake examples"
238 myconf="-stl -verbose -largefile -confirm-license \
239 -platform ${PLATFORM} -xplatform ${PLATFORM} -no-rpath \
240 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \
241 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \
242 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \
243 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} ${myconf}"
245 echo ./configure ${myconf}
246 ./configure ${myconf} || die
248 emake all || die
251 src_install() {
252 export PATH="${S}/bin:${PATH}"
253 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
255 emake INSTALL_ROOT="${D}" install_subtargets || die
256 emake INSTALL_ROOT="${D}" install_qmake || die
257 emake INSTALL_ROOT="${D}" install_mkspecs || die
259 if use doc; then
260 emake INSTALL_ROOT="${D}" install_htmldocs || die
263 # Install the translations. This may get use flagged later somehow
264 emake INSTALL_ROOT="${D}" install_translations || die
266 keepdir "${QTSYSCONFDIR}"
268 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la
269 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl
270 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
272 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
273 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc
275 # Move .pc files into the pkgconfig directory
276 dodir ${QTPCDIR}
277 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR}
279 # Install .desktop files, from bug #174033
280 insinto /usr/share/applications
281 doins "${FILESDIR}"/qt4/*.desktop
283 # List all the multilib libdirs
284 local libdirs
285 for libdir in $(get_all_libdirs); do
286 libdirs="${libdirs}:/usr/${libdir}/qt4"
287 done
289 cat > "${T}/44qt4" << EOF
290 LDPATH=${libdirs:1}
291 QMAKESPEC=$(qt_mkspecs_dir)
293 doenvd "${T}/44qt4"
296 pkg_postinst() {
297 if use qt-copy ; then
298 ewarn "Do NOT report bugs to Gentoo's bugzilla when built with qt-copy!!!"