/[gentoo-x86]/eclass/kde4-base.eclass
Gentoo

Contents of /eclass/kde4-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Mon Feb 18 17:00:32 2008 UTC (6 years, 9 months ago) by ingmar
Branch: MAIN
Changes since 1.2: +2 -5 lines
kde4-base.eclass: No reason why NEED_KDE=none should be fatal for kde-base ebuilds.

1 ingmar 1.1 # Copyright 2007-2008 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 ingmar 1.3 # $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.2 2008/01/18 02:37:08 ingmar Exp $
4 ingmar 1.1
5     # @ECLASS: kde4-base.eclass
6     # @MAINTAINER:
7     # kde@gentoo.org
8     # @BLURB: This eclass provides functions for kde 4.0 ebuilds
9     # @DESCRIPTION:
10     # The kde4-base.eclass provides support for building KDE4 monolithic ebuilds
11     # and KDE4 applications.
12     #
13     # NOTE: This eclass uses the SLOT dependencies from EAPI="1" or compatible,
14     # hence you must define EAPI="1" in the ebuild, before inheriting any eclasses.
15    
16     inherit base eutils multilib cmake-utils kde4-functions
17    
18     EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm
19    
20     COMMONDEPEND=">=x11-libs/qt-4.3.3:4"
21     DEPEND="${DEPEND} ${COMMONDEPEND}
22     >=dev-util/cmake-2.4.7-r1
23     dev-util/pkgconfig
24     x11-libs/libXt
25     x11-proto/xf86vidmodeproto"
26     RDEPEND="${RDEPEND} ${COMMONDEPEND}"
27    
28     if has test ${IUSE//+}; then
29     DEPEND="${DEPEND}
30     test? ( dev-util/cppunit )"
31     fi
32    
33     # @ECLASS-VARIABLE: NEED_KDE
34     # @DESCRIPTION:
35     # This variable sets the version of KDE4 which will be used by the eclass.
36     # This variable must be set by the ebuild, for all categories except for "kde-base".
37     # For kde-base packages, if it is not set by the ebuild,
38     # it's assumed that the required KDE4 version is the latest, non-live, available.
39     #
40     # @CODE
41     # Acceptable values are:
42     # - latest - Use latest version in the portage tree
43     # Default for kde-base ebuilds. Banned for ebuilds not part of kde or koffice.
44     # - svn - Use svn release (live ebuilds)
45     # - :SLOT - Use any version in the SLOT specified in the NEED_KDE value.
46     # - VERSION_NUMBER - Use the minimum KDE4 version specified in the NEED_KDE value.
47     # - VERSION_NUMBER:SLOT - Use the minimum KDE4 version and the SLOT specified in the NEED_KDE value.
48     # - none - Let the ebuild handle SLOT, kde dependencies, KDEDIR, ...
49     # @CODE
50     #
51     # Note: There is no default NEED_KDE for ebuilds not in kde-base or part of
52     # koffice, so you must set it explicitly in the ebuild, in all other cases.
53     if [[ -z ${NEED_KDE} ]]; then
54     if [[ -n ${KDEBASE} ]]; then
55     NEED_KDE="latest"
56     else
57     die "kde4-base.eclass inherited but NEED_KDE not defined - broken ebuild"
58     fi
59     fi
60     export NEED_KDE
61    
62     case ${NEED_KDE} in
63     latest)
64     # Should only be used by 'kde-base'-ebuilds
65     if [[ "${KDEBASE}" == "kde-base" ]]; then
66     case ${PV} in
67     3.9*) _kdedir="3.9" ;;
68     4*) _kdedir="4.0" ;;
69     *) die "NEED_KDE=latest not supported for PV=${PV}" ;;
70     esac
71     _operator=">="
72     _pv="-${PV}:kde-4"
73     else
74     _kdedir="4.0"
75     _pv=":kde-4"
76     fi
77     ;;
78     svn|9999*|:kde-svn)
79     _kdedir="svn"
80     _pv=":kde-svn"
81     export NEED_KDE="svn"
82     ;;
83     *:kde-svn)
84     _kdedir="svn"
85     _operator=">="
86     _pv="-${NEED_KDE}"
87     export NEED_KDE="svn"
88     ;;
89     # The ebuild handles dependencies, KDEDIR, SLOT.
90     none)
91 ingmar 1.3 :
92 ingmar 1.1 ;;
93     # NEED_KDE=":${SLOT}"
94     :kde-4)
95     _kdedir="4.0"
96     _pv="${NEED_KDE}"
97     ;;
98     # NEED_KDE="${PV}:${SLOT}"
99     *:kde-4)
100     _kdedir="4.0"
101     _operator=">="
102     _pv="-${NEED_KDE}"
103     ;;
104     3.9*)
105     _kdedir="3.9"
106     _operator=">="
107     _pv="-${NEED_KDE}:kde-4"
108     ;;
109     4*)
110     _kdedir="4.0"
111     _operator=">="
112     _pv="-${NEED_KDE}:kde-4"
113     ;;
114     *) die "NEED_KDE=${NEED_KDE} currently not supported."
115     ;;
116     esac
117    
118     if [[ ${NEED_KDE} != none ]]; then
119     KDEDIR="/usr/kde/${_kdedir}"
120     KDEDIRS="/usr:/usr/local:${KDEDIR}"
121    
122     if [[ -n ${KDEBASE} ]]; then
123     if [[ ${NEED_KDE} = svn ]]; then
124     SLOT="kde-svn"
125     else
126     SLOT="kde-4"
127     fi
128     fi
129    
130     # We only need to add the dependencies if ${PN} is not "kdelibs" or "kdepimlibs"
131     if [[ ${PN} != "kdelibs" ]]; then
132     DEPEND="${DEPEND}
133     ${_operator}kde-base/kdelibs${_pv}"
134     RDEPEND="${RDEPEND}
135     ${_operator}kde-base/kdelibs${_pv}"
136     if [[ ${PN} != "kdepimlibs" ]]; then
137     DEPEND="${DEPEND}
138     ${_operator}kde-base/kdepimlibs${_pv}"
139     RDEPEND="${RDEPEND}
140     ${_operator}kde-base/kdepimlibs${_pv}"
141     fi
142     fi
143    
144     unset _operator _pv _kdedir
145     fi
146    
147     # Fetch section - If the ebuild's category is not 'kde-base' and if it is not a
148     # koffice ebuild, the URI should be set in the ebuild itself
149     if [[ -n ${KDEBASE} ]]; then
150     if [[ -n ${KMNAME} ]]; then
151     _kmname=${KMNAME}
152     else
153     _kmname=${PN}
154     fi
155     _kmname_pv="${_kmname}-${PV}"
156     if [[ ${NEED_KDE} != "svn" ]]; then
157     case ${KDEBASE} in
158     kde-base)
159     case ${PV} in
160     *) SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.bz2";;
161     esac
162     ;;
163     koffice)
164     SRC_URI="mirror://kde/unstable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2"
165     ;;
166     esac
167     fi
168     unset _kmname _kmname_pv
169     fi
170    
171     debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
172     debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND ${DEPEND} - before blockers"
173    
174     # Monolithic ebuilds should add blockers for split ebuilds in the same slot.
175     # If KMNAME is not set then this is not a split package
176     if [[ -n ${KDEBASE} && -z ${KMNAME} ]]; then
177     for _x in $(get-child-packages ${CATEGORY}/${PN}); do
178     DEPEND="${DEPEND} !${_x}:${SLOT}"
179     RDEPEND="${RDEPEND} !${_x}:${SLOT}"
180     done
181     unset _x
182     fi
183    
184     debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND ${DEPEND} - after blockers"
185    
186     # @ECLASS-VARIABLE: PREFIX
187     # @DESCRIPTION:
188     # Set the installation PREFIX. All kde-base ebuilds go into the KDE4 installation directory.
189     # Applications installed by the other ebuilds go into /usr/ by default, this value
190     # can be superseded by defining PREFIX before inheriting kde4-base.
191     if [[ -n ${KDEBASE} ]]; then
192     PREFIX=${KDEDIR}
193     else
194     # if PREFIX is not defined we set it to the default value of /usr
195     PREFIX="${PREFIX:-/usr}"
196     fi
197    
198     debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SLOT ${SLOT} - KDEDIR ${KDEDIR} - KDEDIRS ${KDEDIRS}- PREFIX ${PREFIX} - NEED_KDE ${NEED_KDE}"
199    
200     # @FUNCTION: kde4-base_pkg_setup
201     # @DESCRIPTION:
202     # Adds flags needed by all of KDE 4 to $QT4_BUILT_WITH_USE_CHECK. Uses
203     # kde4-functions_check_use from kde4-functions.eclass to print appropriate
204     # errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or
205     # $KDE4_BUILT_WITH_USE_CHECK are missing.
206     kde4-base_pkg_setup() {
207     debug-print-function $FUNCNAME "$@"
208    
209 ingmar 1.2 # KDE4 applications require qt4 compiled with USE="accessibility dbus gif jpeg png qt3support ssl zlib".
210     QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib"
211 ingmar 1.1
212     if has debug ${IUSE//+} && use debug; then
213     QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug"
214     fi
215    
216     if has opengl ${IUSE//+} && use opengl; then
217     QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
218     fi
219    
220     kde4-functions_check_use
221     }
222    
223     # @FUNCTION: kde4-base_src_unpack
224     # @DESCRIPTION:
225     # This function unpacks the source tarballs for KDE4 applications.
226     #
227     # If no argument is passed to this function, then standard src_unpack is
228     # executed. Otherwise options are passed to base_src_unpack.
229     #
230     # If the directory ${WORKDIR}/patches/ exists, we apply all patches in that
231     # directory, provided they follow this format:
232     # @CODE
233     # - Monolithic ebuilds, (from kde-base)
234     # - $CATEGORY=kde-base:
235     # Apply ${CHILD_EBUILD_NAME}-${SLOT}-*{diff,patch}
236     # - $CATEGORY=!kde-base:
237     # Apply ${CHILD_EBUILD_NAME}-${PV}-*{diff,patch}
238     # - Split ebuilds:
239     # - $CATEGORY=kde-base:
240     # Apply ${PN}-${SLOT}-*{diff,patch}
241     # - $CATEGORY!=kde-base:
242     # Apply ${PN}-${PV}-*{diff,patch}
243     # @CODE
244     #
245     # If ${PATCHES} is non-zero all patches in it gets applied.
246     kde4-base_src_unpack() {
247     debug-print-function $FUNCNAME "$@"
248    
249     [[ -z "${KDE_S}" ]] && KDE_S="${S}"
250    
251     local _patchdir _packages _p
252     _patchdir="${WORKDIR}/patches/"
253     if [[ -z $* ]]; then
254     # Unpack first and deal with KDE patches after examing possible patch sets.
255     # To be picked up, patches need to conform to the guidelines stated before.
256     # Monolithic ebuilds will use the split ebuild patches.
257     [[ -d "${KDE_S}" ]] || unpack ${A}
258     if [[ -d "${_patchdir}" ]]; then
259     if is-parent-package ${CATEGORY}/${PN} ; then
260     _packages="$(get-child-packages ${CATEGORY}/${PN})"
261     _packages="${_packages//${CATEGORY}\//} ${PN}"
262     else
263     _packages="${PN}"
264     fi
265     for _p in ${_packages}; do
266     PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)"
267     if [[ -n "${KDEBASE}" ]]; then
268     PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)"
269     fi
270     done
271     fi
272     [[ -n ${PATCHES} ]] && base_src_unpack autopatch
273     else
274     # Call base_src_unpack, which unpacks and patches
275     # step by step transparently as defined in the ebuild.
276     base_src_unpack $*
277     fi
278    
279     # Updated cmake dir
280     if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
281     ebegin "Updating cmake/ directory..."
282     rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory"
283     ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
284     eend 0
285     fi
286     }
287    
288     # @FUNCTION: kde4-base_src_compile
289     # @DESCRIPTION:
290     # General function for compiling KDE4 applications.
291     kde4-base_src_compile() {
292     debug-print-function ${FUNCNAME} "$@"
293    
294     kde4-base_src_configure
295     kde4-base_src_make
296     }
297    
298     # @FUNCTION: kde4-base_src_configure
299     # @DESCRIPTION:
300     # Function for configuring the build of KDE4 applications.
301     kde4-base_src_configure() {
302     debug-print-function ${FUNCNAME} "$@"
303    
304     # Final flag handling
305     if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
306     einfo "Activating enable-final flag"
307     mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON"
308     fi
309    
310     # Enable generation of HTML handbook
311     if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
312     einfo "Enabling building of HTML handbook"
313     mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
314     fi
315    
316     # Build tests in src_test only, where we override this value
317     mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF"
318    
319     # Set distribution name
320     [[ ${PN} == "kdelibs" ]] && mycmakeargs="${mycmakeargs} -DKDE_DISTRIBUTION_TEXT=Gentoo"
321    
322     # runpath linking
323     mycmakeargs="${mycmakeargs} -DKDE4_USE_ALWAYS_FULL_RPATH=ON"
324    
325     # Here we set the install prefix
326     mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=${PREFIX}"
327    
328     # Set environment
329     QTEST_COLORED=1
330     QT_PLUGIN_PATH=${KDEDIR}/$(get_libdir)/kde4/plugins/
331    
332     cmake-utils_src_configureout
333     }
334    
335     # @FUNCTION: kde4-base_src_make
336     # @DESCRIPTION:
337     # Function for building KDE4 applications.
338     # Options are passed to cmake-utils_src_make.
339     kde4-base_src_make() {
340     debug-print-function ${FUNCNAME} "$@"
341    
342     cmake-utils_src_make "$@"
343     }
344    
345     # @FUNCTION: kde4-base_src_test
346     # @DESCRIPTION:
347     # Function for testing KDE4 applications.
348     kde4-base_src_test() {
349     debug-print-function ${FUNCNAME} "$@"
350    
351     # Override this value, set in kde4-base_src_configure()
352     mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=ON"
353     cmake-utils_src_compile
354    
355     cmake-utils_src_test
356     }
357    
358     # @FUNCTION: kde4-base_src_install
359     # @DESCRIPTION:
360     # Function for installing KDE4 applications.
361     kde4-base_src_install() {
362     debug-print-function ${FUNCNAME} "$@"
363    
364     kde4-base_src_make_doc
365     cmake-utils_src_install
366     }
367    
368     # @FUNCTION: kde4-base_src_make_doc
369     # @DESCRIPTION:
370     # Function for installing the documentation of KDE4 applications.
371     kde4-base_src_make_doc() {
372     debug-print-function ${FUNCNAME} "$@"
373    
374     local doc
375     for doc in AUTHORS ChangeLog* README* NEWS TODO; do
376     [[ -s $doc ]] && dodoc ${doc}
377     done
378    
379     if [[ -z ${KMNAME} ]]; then
380     for doc in {apps,runtime,workspace,.}/*/{AUTHORS,README*}; do
381     if [[ -s $doc ]]; then
382     local doc_complete=${doc}
383     doc="${doc#*/}"
384     newdoc "$doc_complete" "${doc%/*}.${doc##*/}"
385     fi
386     done
387     fi
388    
389     if [[ -n ${KDEBASE} && -d "${D}"/usr/share/doc/${PF} ]]; then
390     # work around bug #97196
391     dodir /usr/share/doc/kde && \
392     mv "${D}"/usr/share/doc/${PF} "${D}"/usr/share/doc/kde/ || \
393     die "Failed to move docs to kde/ failed."
394     fi
395     }
396    
397     # @FUNCTION: kde4-base_pkg_postinst
398     # @DESCRIPTION:
399     # Function to rebuild the KDE System Configuration Cache after an application has been installed.
400     kde4-base_pkg_postinst() {
401     buildsycoca
402     }
403    
404     # @FUNCTION: kde4-base_pkg_postrm
405     # @DESCRIPTION:
406     # Function to rebuild the KDE System Configuration Cache after an application has been removed.
407     kde4-base_pkg_postrm() {
408     buildsycoca
409     }

  ViewVC Help
Powered by ViewVC 1.1.20