/[gentoo-x86]/eclass/fox.eclass
Gentoo

Contents of /eclass/fox.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Sat Sep 18 11:11:34 2010 UTC (4 years, 3 months ago) by mabi
Branch: MAIN
Changes since 1.8: +90 -109 lines
updated fox eclass for EAPI2

1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 # @ECLASS: fox.eclass
6 # @MAINTAINER:
7 # mabi@gentoo.org
8 # @BLURB: Functionality required the FOX Toolkit and it's applications
9 # @DESCRIPTION:
10 # This eclass allows building SLOT-able FOX Toolkit installations
11 # (x11-libs/fox: headers, libs, and docs), which are by design
12 # parallel-installable, while installing only one version of the utils
13 # (dev-util/reswrap) and apps (app-editors/adie, sci-calculators/calculator,
14 # x11-misc/pathfinder, and x11-misc/shutterbug).
15 #
16 # Version numbering follows the kernel-style odd-even minor version
17 # designation. Even-number minor versions are API stable, which patch
18 # releases aimed mostly at the library; apps generally won't need to be
19 # bumped for a patch release.
20 #
21 # Odd-number versions are development branches with their own SLOT and
22 # are API unstable; changes are made to the apps, and likely need to be
23 # bumped together with the library.
24 #
25 # Here are sample [R]DEPENDs for the fox apps
26 # 1.6: 'x11-libs/fox:1.6'
27 # 1.7: '~x11-libs/fox-${PV}'
28 #
29 # EAPI phase trickery borrowed from enlightenment.eclass
30
31 inherit autotools versionator
32
33
34 FOX_EXPF="src_unpack src_compile src_install pkg_postinst"
35 case "${EAPI:-0}" in
36 2|3|4) FOX_EXPF+=" src_prepare src_configure" ;;
37 *) ;;
38 esac
39 EXPORT_FUNCTIONS ${FOX_EXPF}
40
41 # @ECLASS-VARIABLE: FOX_PV
42 # @DESCRIPTION:
43 # The version of the FOX Toolkit provided or required by the package
44 : ${FOX_PV:=${PV}}
45
46 # @ECLASS-VARIABLE: FOXVER
47 # @INTERNAL
48 # @DESCRIPTION:
49 # The major.minor version of FOX_PV, usually acts as $SLOT and is used in
50 # building the applications
51 FOXVER=$(get_version_component_range 1-2 ${FOX_PV})
52
53 # @ECLASS-VARIABLE: FOX_APPS
54 # @INTERNAL
55 # @DESCRIPTION:
56 # The applications originally packaged in the FOX Toolkit
57 FOX_APPS="adie calculator pathfinder shutterbug"
58
59 # @ECLASS-VARIABLE: FOXCONF
60 # @DEFAULT_UNSET
61 # @DESCRIPTION:
62 # Set this to add additional configuration options during src_configure
63
64 DESCRIPTION="C++ based Toolkit for developing Graphical User Interfaces easily and effectively"
65 HOMEPAGE="http://www.fox-toolkit.org/"
66 SRC_URI="http://www.fox-toolkit.org/ftp/fox-${FOX_PV}.tar.gz"
67
68 IUSE="debug doc profile"
69
70 if [[ ${PN} != fox ]] ; then
71 FOX_COMPONENT="${FOX_COMPONENT:-${PN}}"
72 fi
73
74 if [[ -z ${FOX_COMPONENT} ]] ; then
75 DOXYGEN_DEP="doc? ( app-doc/doxygen )"
76 fi
77
78 if [[ ${PN} != reswrap ]] ; then
79 RESWRAP_DEP="dev-util/reswrap"
80 fi
81
82 DEPEND="${DOXYGEN_DEP}
83 ${RESWRAP_DEP}
84 =sys-devel/automake-1.4*
85 >=sys-apps/sed-4"
86
87 S="${WORKDIR}/fox-${FOX_PV}"
88
89 fox_src_unpack() {
90 unpack ${A}
91 cd "${S}"
92
93 hasq src_prepare ${FOX_EXPF} || fox_src_prepare
94 }
95
96 fox_src_prepare() {
97 # fox changed from configure.in to configure.am in 1.6.38
98 local confFile="configure.ac"
99 [[ -r "configure.in" ]] && confFile="configure.in"
100
101 # Respect system CXXFLAGS
102 sed -i -e 's:CXXFLAGS=""::' $confFile || die "sed ${confFile} error"
103
104 # don't build apps from top-level (i.e. x11-libs/fox)
105 # utils == reswrap
106 local d
107 for d in ${FOX_APPS} utils windows ; do
108 sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error"
109 done
110
111 # use the installed reswrap for everything else
112 for d in ${FOX_APPS} chart tests ; do
113 sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \
114 ${d}/Makefile.am || die "sed ${d}/Makefile.am error"
115 done
116
117 # use the installed headers and library for apps
118 for d in ${FOX_APPS} ; do
119 sed -i \
120 -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox-${FOXVER}:" \
121 -e 's:$(top_builddir)/src/libFOX:-lFOX:' \
122 -e 's:\.la::' \
123 ${d}/Makefile.am || die "sed ${d}/Makefile.am error"
124 done
125
126 eautoreconf
127 }
128
129 fox_src_configure() {
130 use debug && FOXCONF+=" --enable-debug" \
131 || FOXCONF+=" --enable-release"
132
133 econf ${FOXCONF} \
134 $(use_with profile profiling)
135 }
136
137
138 fox_src_compile() {
139 hasq src_configure ${FOX_EXPF} || fox_src_configure
140
141 cd "${S}/${FOX_COMPONENT}"
142 emake || die "compile error"
143
144 # build class reference docs (FOXVER >= 1.2)
145 if use doc && [[ -z ${FOX_COMPONENT} ]] ; then
146 emake -C "${S}"/doc docs || die "doxygen error"
147 fi
148 }
149
150 fox_src_install() {
151 cd "${S}/${FOX_COMPONENT}"
152
153 emake install \
154 DESTDIR="${D}" \
155 htmldir=/usr/share/doc/${PF}/html \
156 artdir=/usr/share/doc/${PF}/html/art \
157 screenshotsdir=/usr/share/doc/${PF}/html/screenshots \
158 || die "install error"
159
160 # create desktop menu items for apps
161 case ${FOX_COMPONENT} in
162 adie)
163 newicon big_gif.gif adie.gif
164 make_desktop_entry adie "Adie Text Editor" adie.gif
165 ;;
166 calculator)
167 newicon bigcalc.gif foxcalc.gif
168 make_desktop_entry calculator "FOX Calculator" foxcalc.gif
169 ;;
170 pathfinder)
171 newicon iconpath.gif pathfinder.gif
172 make_desktop_entry PathFinder "PathFinder" pathfinder.gif "FileManager"
173 ;;
174 shutterbug)
175 doicon shutterbug.gif
176 make_desktop_entry shutterbug "ShutterBug" shutterbug.gif "Graphics"
177 ;;
178 esac
179
180 for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do
181 [ -f $doc ] && dodoc $doc
182 done
183
184 # remove documentation if USE=-doc
185 use doc || rm -fr "${D}/usr/share/doc/${PF}/html"
186
187 # install class reference docs if USE=doc
188 if use doc && [[ -z ${FOX_COMPONENT} ]] ; then
189 dohtml -r "${S}/doc/ref"
190 fi
191
192 # slot fox-config
193 if [[ -f ${D}/usr/bin/fox-config ]] ; then
194 mv "${D}/usr/bin/fox-config" "${D}/usr/bin/fox-${FOXVER}-config" \
195 || die "failed to install fox-config"
196 fi
197 }
198
199 fox_pkg_postinst() {
200 if [ -z "${FOX_COMPONENT}" ] ; then
201 echo
202 einfo "Multiple versions of the FOX Toolkit library may now be installed"
203 einfo "in parallel SLOTs on the same system."
204 einfo
205 einfo "The reswrap utility and the applications included in the FOX Toolkit"
206 einfo "(adie, calculator, pathfinder, shutterbug) are now available as"
207 einfo "separate ebuilds."
208 echo
209 einfo "The fox-config script has been installed as fox-${FOXVER}-config."
210 einfo "The fox-wrapper package is used to direct calls to fox-config"
211 einfo "to the correct versioned script, based on the WANT_FOX variable."
212 einfo "For example:"
213 einfo
214 einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>"
215 einfo
216 fi
217 }

  ViewVC Help
Powered by ViewVC 1.1.20