remove unneeded comments
[fwz-overlay.git] / x11-libs / qt / qt-3.3.8b.ebuild
blob7b54730efde03b06ff4da193ba6a082ece99350e
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/qt-3.3.8b.ebuild,v 1.1 2008/07/26 21:01:44 carlo Exp $
5 # *** Please remember to update qt3.eclass when revbumping this ***
7 inherit eutils flag-o-matic toolchain-funcs
9 SRCTYPE="free"
10 DESCRIPTION="The Qt toolkit is a comprehensive C++ application development framework."
11 HOMEPAGE="http://www.trolltech.com/"
13 IMMQT_P="qt-x11-immodule-unified-qt3.3.8-20070321-gentoo"
15 SRC_URI="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${PV}.tar.gz
16 immqt? ( mirror://gentoo/${IMMQT_P}.diff.bz2 )
17 immqt-bc? ( mirror://gentoo/${IMMQT_P}.diff.bz2 )"
18 LICENSE="|| ( QPL-1.0 GPL-2 GPL-3 )"
20 SLOT="3"
21 KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
22 IUSE="cups debug doc examples firebird ipv6 mysql nas nis odbc opengl postgres sqlite xinerama immqt immqt-bc"
24 RDEPEND="
25 media-libs/jpeg
26 >=media-libs/freetype-2
27 >=media-libs/libmng-1.0.9
28 media-libs/libpng
29 sys-libs/zlib
30 virtual/xft
31 x11-libs/libXcursor
32 x11-libs/libXi
33 x11-libs/libXrandr
34 x11-libs/libSM
35 cups? ( net-print/cups )
36 firebird? ( dev-db/firebird )
37 mysql? ( virtual/mysql )
38 nas? ( >=media-libs/nas-1.5 )
39 opengl? ( virtual/opengl virtual/glu )
40 postgres? ( virtual/postgresql-base )
41 xinerama? ( x11-libs/libXinerama )"
42 DEPEND="${RDEPEND}
43 x11-proto/inputproto
44 x11-proto/xextproto
45 xinerama? ( x11-proto/xineramaproto )
46 immqt? ( x11-proto/xineramaproto )
47 immqt-bc? ( x11-proto/xineramaproto )"
48 PDEPEND="odbc? ( ~dev-db/qt-unixODBC-$PV )"
50 S="${WORKDIR}/qt-x11-${SRCTYPE}-${PV}"
52 QTBASE="/usr/qt/3"
54 libdir="$(get_libdir)"
56 pkg_setup() {
57 if use immqt && use immqt-bc ; then
58 ewarn
59 ewarn "immqt and immqt-bc are exclusive. You cannot set both."
60 ewarn "Please specify either immqt or immqt-bc."
61 ewarn
62 die
63 elif use immqt ; then
64 ewarn
65 ewarn "You are going to compile binary imcompatible immodule for Qt. This means"
66 ewarn "you have to recompile everything depending on Qt after you install it."
67 ewarn "Be aware."
68 ewarn
71 export QTDIR="${S}"
73 CXX=$(tc-getCXX)
74 if [[ ${CXX/g++/} != ${CXX} ]]; then
75 PLATCXX="g++"
76 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
77 PLATCXX="icc"
78 else
79 die "Unknown compiler ${CXX}."
82 case ${CHOST} in
83 *-freebsd*|*-dragonfly*)
84 PLATNAME="freebsd" ;;
85 *-openbsd*)
86 PLATNAME="openbsd" ;;
87 *-netbsd*)
88 PLATNAME="netbsd" ;;
89 *-darwin*)
90 PLATNAME="darwin" ;;
91 *-linux-*|*-linux)
92 PLATNAME="linux" ;;
94 die "Unknown CHOST, no platform choosed."
95 esac
97 # probably this should be '*-64' for 64bit archs
98 # in a fully multilib environment (no compatibility symlinks)
99 export PLATFORM="${PLATNAME}-${PLATCXX}"
102 src_unpack() {
103 unpack ${A}
104 cd "${S}"
106 sed -i -e 's:read acceptance:acceptance=yes:' configure
108 # Do not link with -rpath. See bug #75181.
109 find "${S}"/mkspecs -name qmake.conf | xargs \
110 sed -i -e 's:QMAKE_RPATH.*:QMAKE_RPATH =:'
112 # Patch for uic includehint errors (aseigo patch)
113 epatch "${FILESDIR}"/qt-3.3.8-uic-fix.patch
115 # KDE related patches
116 epatch "${FILESDIR}"/0001-dnd_optimization.patch
117 epatch "${FILESDIR}"/0002-dnd_active_window_fix.patch
118 epatch "${FILESDIR}"/0038-dragobject-dont-prefer-unknown.patch
119 epatch "${FILESDIR}"/0044-qscrollview-windowactivate-fix.diff
120 epatch "${FILESDIR}"/0047-fix-kmenu-widget.diff
121 epatch "${FILESDIR}"/0048-qclipboard_hack_80072.patch
123 # ulibc patch (bug #100246)
124 epatch "${FILESDIR}"/qt-ulibc.patch
126 # xinerama patch: http://ktown.kde.org/~seli/xinerama/
127 epatch "${FILESDIR}"/qt-3.3.8-seli-xinerama.patch
129 # Visibility patch, apply only on GCC 4.1 and later for safety
130 # [[ $(gcc-major-version)$(gcc-minor-version) -ge 41 ]] && \
131 epatch "${FILESDIR}"/qt-3.3.8-visibility.patch
133 if use immqt || use immqt-bc ; then
134 epatch ../${IMMQT_P}.diff
135 sh make-symlinks.sh || die "make symlinks failed"
137 epatch "${FILESDIR}"/qt-3.3.8-immqt+gcc-4.3.patch
140 if use mips; then
141 epatch "${FILESDIR}"/qt-3.3.8-mips.patch
143 # KDEMod Patches
144 epatch "${FILESDIR}"/qt-3.3.8-eyecandy.patch
145 # qt-copy
146 epatch "${FILESDIR}"/qtcopy/*
147 # known working flags wrt #77623
148 use sparc && export CFLAGS="-O1" && export CXXFLAGS="${CFLAGS}"
149 # set c/xxflags and ldflags
150 strip-flags
151 append-flags -fno-strict-aliasing
153 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
154 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
155 append-flags -fno-stack-protector
158 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
159 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
160 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
161 -e "s:\<QMAKE_CC\>.*=.*:QMAKE_CC=$(tc-getCC):" \
162 -e "s:\<QMAKE_CXX\>.*=.*:QMAKE_CXX=$(tc-getCXX):" \
163 -e "s:\<QMAKE_LINK\>.*=.*:QMAKE_LINK=$(tc-getCXX):" \
164 -e "s:\<QMAKE_LINK_SHLIB\>.*=.*:QMAKE_LINK_SHLIB=$(tc-getCXX):" \
165 "${S}"/mkspecs/${PLATFORM}/qmake.conf || die
167 if [ ${libdir} != "lib" ] ; then
168 sed -i -e "s:/lib$:/${libdir}:" \
169 "${S}"/mkspecs/${PLATFORM}/qmake.conf || die
173 src_compile() {
174 export SYSCONF="${D}"${QTBASE}/etc/settings
176 # Let's just allow writing to these directories during Qt emerge
177 # as it makes Qt much happier.
178 addwrite "${QTBASE}/etc/settings"
179 addwrite "${HOME}/.qt"
181 [ "${libdir}" != "lib" ] && myconf="${myconf} -L/usr/${libdir}"
183 # unixODBC support is now a PDEPEND on dev-db/qt-unixODBC; see bug 14178.
184 use nas && myconf+=" -system-nas-sound"
185 use nis && myconf+=" -nis" || myconf+=" -no-nis"
186 use mysql && myconf+=" -plugin-sql-mysql -I/usr/include/mysql -L/usr/${libdir}/mysql" || myconf+=" -no-sql-mysql"
187 use postgres && myconf+=" -plugin-sql-psql -I/usr/include/postgresql/server -I/usr/include/postgresql/pgsql -I/usr/include/postgresql/pgsql/server" || myconf+=" -no-sql-psql"
188 use firebird && myconf+=" -plugin-sql-ibase -I/opt/firebird/include" || myconf+=" -no-sql-ibase"
189 use sqlite && myconf+=" -plugin-sql-sqlite" || myconf+=" -no-sql-sqlite"
190 use cups && myconf+=" -cups" || myconf+=" -no-cups"
191 use opengl && myconf+=" -enable-module=opengl" || myconf+=" -disable-opengl"
192 use debug && myconf+=" -debug" || myconf+=" -release -no-g++-exceptions"
193 use xinerama && myconf+=" -xinerama" || myconf+=" -no-xinerama"
195 myconf="${myconf} -system-zlib -qt-gif"
197 use ipv6 && myconf+=" -ipv6" || myconf+=" -no-ipv6"
198 use immqt-bc && myconf+=" -inputmethod"
199 use immqt && myconf+=" -inputmethod -inputmethod-ext"
201 export YACC='byacc -d'
202 tc-export CC CXX
203 export LINK="$(tc-getCXX)"
205 ./configure -sm -thread -stl -system-libjpeg -verbose -largefile \
206 -qt-imgfmt-{jpeg,mng,png} -tablet -system-libmng \
207 -system-libpng -xft -platform ${PLATFORM} -xplatform \
208 ${PLATFORM} -xrender -prefix ${QTBASE} -libdir ${QTBASE}/${libdir} \
209 -fast -no-sql-odbc ${myconf} -dlopen-opengl || die
211 emake src-qmake src-moc sub-src || die
213 export DYLD_LIBRARY_PATH="${S}/lib:/usr/X11R6/lib:${DYLD_LIBRARY_PATH}"
214 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
216 emake sub-tools || die
218 if use examples; then
219 emake sub-tutorial sub-examples || die
222 # Make the msg2qm utility (not made by default)
223 cd "${S}"/tools/msg2qm
224 ../../bin/qmake
225 emake
227 # Make the qembed utility (not made by default)
228 cd "${S}"/tools/qembed
229 ../../bin/qmake
230 emake
234 src_install() {
235 # binaries
236 into ${QTBASE}
237 dobin bin/*
238 dobin tools/msg2qm/msg2qm
239 dobin tools/qembed/qembed
241 # libraries
242 dolib.so lib/lib{editor,qassistantclient,designercore}.a
243 dolib.so lib/libqt-mt.la
244 dolib.so lib/libqt-mt.so.${PV/b} lib/libqui.so.1.0.0
245 cd "${D}"/${QTBASE}/${libdir}
247 for x in libqui.so ; do
248 ln -s $x.1.0.0 $x.1.0
249 ln -s $x.1.0 $x.1
250 ln -s $x.1 $x
251 done
253 # version symlinks - 3.3.5->3.3->3->.so
254 ln -s libqt-mt.so.${PV/b} libqt-mt.so.3.3
255 ln -s libqt-mt.so.3.3 libqt-mt.so.3
256 ln -s libqt-mt.so.3 libqt-mt.so
258 # libqt -> libqt-mt symlinks
259 ln -s libqt-mt.so.${PV/b} libqt.so.${PV/b}
260 ln -s libqt-mt.so.3.3 libqt.so.3.3
261 ln -s libqt-mt.so.3 libqt.so.3
262 ln -s libqt-mt.so libqt.so
264 # plugins
265 cd "${S}"
266 local plugins=$(find plugins -name "lib*.so" -print)
267 for x in ${plugins}; do
268 exeinto ${QTBASE}/$(dirname ${x})
269 doexe ${x}
270 done
272 # Past this point just needs to be done once
273 is_final_abi || return 0
275 # includes
276 cd "${S}"
277 dodir ${QTBASE}/include/private
278 cp include/*\.h "${D}"/${QTBASE}/include/
279 cp include/private/*\.h "${D}"/${QTBASE}/include/private/
281 # prl files
282 sed -i -e "s:${S}:${QTBASE}:g" "${S}"/lib/*.prl
283 insinto ${QTBASE}/${libdir}
284 doins "${S}"/lib/*.prl
286 # pkg-config file
287 insinto ${QTBASE}/${libdir}/pkgconfig
288 doins "${S}"/lib/*.pc
290 # List all the multilib libdirs
291 local libdirs
292 for alibdir in $(get_all_libdirs); do
293 libdirs="${libdirs}:${QTBASE}/${alibdir}"
294 done
296 # environment variables
297 cat <<EOF > "${T}"/45qt3
298 PATH=${QTBASE}/bin
299 ROOTPATH=${QTBASE}/bin
300 LDPATH=${libdirs:1}
301 QMAKESPEC=${PLATFORM}
302 MANPATH=${QTBASE}/doc/man
303 PKG_CONFIG_PATH=${QTBASE}/${libdir}/pkgconfig
306 cat <<EOF > "${T}"/50qtdir3
307 QTDIR=${QTBASE}
310 cat <<EOF > "${T}"/50-qt3-revdep
311 SEARCH_DIRS="${QTBASE}"
314 insinto /etc/revdep-rebuild
315 doins "${T}"/50-qt3-revdep
317 doenvd "${T}"/45qt3 "${T}"/50qtdir3
319 if [ "${SYMLINK_LIB}" = "yes" ]; then
320 dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) ${QTBASE}/lib
323 insinto ${QTBASE}/tools/designer
324 doins -r tools/designer/templates
326 insinto ${QTBASE}
327 doins -r translations
329 keepdir ${QTBASE}/etc/settings
331 if use doc; then
332 insinto ${QTBASE}
333 doins -r "${S}"/doc
336 if use examples; then
337 find "${S}"/examples "${S}"/tutorial -name Makefile | \
338 xargs sed -i -e "s:${S}:${QTBASE}:g"
340 cp -r "${S}"/examples "${D}"${QTBASE}/
341 cp -r "${S}"/tutorial "${D}"${QTBASE}/
344 # misc build reqs
345 insinto ${QTBASE}/mkspecs
346 doins -r "${S}"/mkspecs/${PLATFORM}
348 sed -e "s:${S}:${QTBASE}:g" \
349 "${S}"/.qmake.cache > "${D}"${QTBASE}/.qmake.cache
351 dodoc FAQ README README-QT.TXT changes*
352 if use immqt || use immqt-bc ; then
353 dodoc "${S}"/README.immodule
357 pkg_postinst() {
358 echo
359 elog "After a rebuild of Qt, it can happen that Qt plugins (such as Qt/KDE styles,"
360 elog "or widgets for the Qt designer) are no longer recognized. If this situation"
361 elog "occurs you should recompile the packages providing these plugins,"
362 elog "and you should also make sure that Qt and its plugins were compiled with the"
363 elog "same version of GCC. Packages that may need to be rebuilt are, for instance,"
364 elog "kde-base/kdelibs, kde-base/kdeartwork and kde-base/kdeartwork-styles."
365 elog "See http://doc.trolltech.com/3.3/plugins-howto.html for more infos."
366 echo