| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/fox.eclass,v 1.8 2008/10/12 12:31:36 mabi Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/fox.eclass,v 1.9 2010/09/18 11:11:34 mabi Exp $ |
| 4 | |
4 | |
| 5 | # fox eclass |
5 | # @ECLASS: fox.eclass |
| 6 | # |
6 | # @MAINTAINER: |
|
|
7 | # mabi@gentoo.org |
|
|
8 | # @BLURB: Functionality required the FOX Toolkit and it's applications |
|
|
9 | # @DESCRIPTION: |
| 7 | # This eclass allows building SLOT-able FOX Toolkit installations |
10 | # This eclass allows building SLOT-able FOX Toolkit installations |
| 8 | # (x11-libs/fox: headers, libs, and docs), which are by design |
11 | # (x11-libs/fox: headers, libs, and docs), which are by design |
| 9 | # parallel-installable, while installing only one version of the utils |
12 | # parallel-installable, while installing only one version of the utils |
| 10 | # (dev-util/reswrap) and apps (app-editors/adie, sci-calculators/calculator, |
13 | # (dev-util/reswrap) and apps (app-editors/adie, sci-calculators/calculator, |
| 11 | # x11-misc/pathfinder, and x11-misc/shutterbug). |
14 | # x11-misc/pathfinder, and x11-misc/shutterbug). |
| … | |
… | |
| 18 | # Odd-number versions are development branches with their own SLOT and |
21 | # Odd-number versions are development branches with their own SLOT and |
| 19 | # are API unstable; changes are made to the apps, and likely need to be |
22 | # are API unstable; changes are made to the apps, and likely need to be |
| 20 | # bumped together with the library. |
23 | # bumped together with the library. |
| 21 | # |
24 | # |
| 22 | # Here are sample [R]DEPENDs for the fox apps |
25 | # Here are sample [R]DEPENDs for the fox apps |
| 23 | # fox versions that do not use this eclass are blocked in INCOMPAT_DEP below |
|
|
| 24 | # 1.0: '=x11-libs/fox-1.0*' |
26 | # 1.6: 'x11-libs/fox:1.6' |
| 25 | # 1.2: '=x11-libs/fox-1.2*' |
|
|
| 26 | # 1.4: '=x11-libs/fox-1.4*' |
|
|
| 27 | # 1.5: '~x11-libs/fox-${PV}' |
27 | # 1.7: '~x11-libs/fox-${PV}' |
| 28 | # 1.6: '=x11-libs/fox-${FOXVER}*' |
|
|
| 29 | # |
28 | # |
| 30 | # Some concepts borrowed from gst-plugins and gtk-sharp-component eclasses |
29 | # EAPI phase trickery borrowed from enlightenment.eclass |
| 31 | |
30 | |
| 32 | inherit eutils libtool versionator |
31 | inherit autotools versionator |
| 33 | |
32 | |
| 34 | |
33 | |
| 35 | FOX_PV="${FOX_PV:-${PV}}" |
34 | FOX_EXPF="src_unpack src_compile src_install pkg_postinst" |
| 36 | PVP=(${FOX_PV//[-\._]/ }) |
35 | case "${EAPI:-0}" in |
| 37 | FOXVER="${PVP[0]}.${PVP[1]}" |
36 | 2|3|4) FOX_EXPF+=" src_prepare src_configure" ;; |
|
|
37 | *) ;; |
|
|
38 | esac |
|
|
39 | EXPORT_FUNCTIONS ${FOX_EXPF} |
| 38 | |
40 | |
| 39 | if [ "${FOXVER}" != "1.0" ] ; then |
41 | # @ECLASS-VARIABLE: FOX_PV |
| 40 | FOXVER_SUFFIX="-${FOXVER}" |
42 | # @DESCRIPTION: |
| 41 | fi |
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 |
| 42 | |
63 | |
| 43 | DESCRIPTION="C++ based Toolkit for developing Graphical User Interfaces easily and effectively" |
64 | DESCRIPTION="C++ based Toolkit for developing Graphical User Interfaces easily and effectively" |
| 44 | HOMEPAGE="http://www.fox-toolkit.org/" |
65 | HOMEPAGE="http://www.fox-toolkit.org/" |
| 45 | SRC_URI="http://www.fox-toolkit.org/ftp/fox-${FOX_PV}.tar.gz" |
66 | SRC_URI="http://www.fox-toolkit.org/ftp/fox-${FOX_PV}.tar.gz" |
| 46 | |
67 | |
| 47 | IUSE="debug doc profile" |
68 | IUSE="debug doc profile" |
| 48 | |
69 | |
| 49 | # from fox-1.0 |
|
|
| 50 | FOX_APPS="adie calculator pathfinder" |
|
|
| 51 | # from fox-1.2+ |
|
|
| 52 | if [ "${FOXVER}" != "1.0" ] ; then |
|
|
| 53 | FOX_APPS="${FOX_APPS} shutterbug" |
|
|
| 54 | FOX_CHART="chart" |
|
|
| 55 | fi |
|
|
| 56 | |
|
|
| 57 | if [ "${PN}" != fox ] ; then |
70 | if [[ ${PN} != fox ]] ; then |
| 58 | FOX_COMPONENT="${FOX_COMPONENT:-${PN}}" |
71 | FOX_COMPONENT="${FOX_COMPONENT:-${PN}}" |
| 59 | fi |
72 | fi |
| 60 | |
73 | |
| 61 | if [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then |
74 | if [[ -z ${FOX_COMPONENT} ]] ; then |
| 62 | DOXYGEN_DEP="doc? ( app-doc/doxygen )" |
75 | DOXYGEN_DEP="doc? ( app-doc/doxygen )" |
| 63 | fi |
76 | fi |
| 64 | |
77 | |
| 65 | if [ "${PN}" != reswrap ] ; then |
78 | if [[ ${PN} != reswrap ]] ; then |
| 66 | RESWRAP_DEP="dev-util/reswrap" |
79 | RESWRAP_DEP="dev-util/reswrap" |
| 67 | fi |
80 | fi |
| 68 | |
81 | |
| 69 | # These versions are not compatible with new fox layout |
|
|
| 70 | # and will cause collissions - we need to block them |
|
|
| 71 | INCOMPAT_DEP="!<x11-libs/fox-1.0.53 |
|
|
| 72 | !=x11-libs/fox-1.2.4 |
|
|
| 73 | !~x11-libs/fox-1.2.6 |
|
|
| 74 | !=x11-libs/fox-1.4.11" |
|
|
| 75 | |
|
|
| 76 | DEPEND="${INCOMPAT_DEP} |
|
|
| 77 | ${DOXYGEN_DEP} |
82 | DEPEND="${DOXYGEN_DEP} |
| 78 | ${RESWRAP_DEP} |
83 | ${RESWRAP_DEP} |
| 79 | =sys-devel/automake-1.4* |
84 | =sys-devel/automake-1.4* |
| 80 | >=sys-apps/sed-4" |
85 | >=sys-apps/sed-4" |
| 81 | |
86 | |
| 82 | S="${WORKDIR}/fox-${FOX_PV}" |
87 | S="${WORKDIR}/fox-${FOX_PV}" |
| 83 | |
88 | |
| 84 | fox_src_unpack() { |
89 | fox_src_unpack() { |
| 85 | unpack ${A} |
90 | unpack ${A} |
| 86 | cd ${S} |
91 | cd "${S}" |
| 87 | |
92 | |
| 88 | ebegin "Fixing configure" |
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" |
| 89 | |
100 | |
| 90 | # Respect system CXXFLAGS |
101 | # Respect system CXXFLAGS |
| 91 | sed -i -e 's:CXXFLAGS=""::' configure.in || die "sed configure.in error" |
|
|
| 92 | touch aclocal.m4 |
|
|
| 93 | sed -i -e 's:CXXFLAGS=""::' configure || die "sed configure error" |
102 | sed -i -e 's:CXXFLAGS=""::' $confFile || die "sed ${confFile} error" |
| 94 | |
|
|
| 95 | eend |
|
|
| 96 | |
|
|
| 97 | ebegin "Fixing Makefiles" |
|
|
| 98 | |
103 | |
| 99 | # don't build apps from top-level (i.e. x11-libs/fox) |
104 | # don't build apps from top-level (i.e. x11-libs/fox) |
| 100 | # utils == reswrap |
105 | # utils == reswrap |
|
|
106 | local d |
| 101 | for d in ${FOX_APPS} utils windows ; do |
107 | for d in ${FOX_APPS} utils windows ; do |
| 102 | sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error" |
108 | sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error" |
| 103 | done |
109 | done |
| 104 | |
110 | |
| 105 | # use the installed reswrap for everything else |
111 | # use the installed reswrap for everything else |
| 106 | for d in ${FOX_APPS} ${FOX_CHART} tests ; do |
112 | for d in ${FOX_APPS} chart tests ; do |
| 107 | sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \ |
113 | sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \ |
| 108 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
114 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
| 109 | done |
115 | done |
| 110 | |
116 | |
| 111 | # use the installed headers and library for apps |
117 | # use the installed headers and library for apps |
| 112 | for d in ${FOX_APPS} ; do |
118 | for d in ${FOX_APPS} ; do |
| 113 | if version_is_at_least "1.6.34" ${PV} ; then |
|
|
| 114 | sed -i \ |
119 | sed -i \ |
| 115 | -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox${FOXVER_SUFFIX}:" \ |
120 | -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox-${FOXVER}:" \ |
| 116 | -e 's:$(top_builddir)/src/libFOX:-lFOX:' \ |
121 | -e 's:$(top_builddir)/src/libFOX:-lFOX:' \ |
| 117 | -e 's:\.la::' \ |
122 | -e 's:\.la::' \ |
| 118 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
123 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
| 119 | else |
|
|
| 120 | sed -i \ |
|
|
| 121 | -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox${FOXVER_SUFFIX}:" \ |
|
|
| 122 | -e 's:../src/libFOX:-lFOX:' \ |
|
|
| 123 | -e 's:\.la::' \ |
|
|
| 124 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
|
|
| 125 | fi |
|
|
| 126 | done |
124 | done |
| 127 | |
125 | |
| 128 | # Upstream often has trouble with version number transitions |
126 | eautoreconf |
| 129 | if [ "${FOXVER}" == "1.5" ] ; then |
|
|
| 130 | sed -i -e 's:1.4:1.5:g' chart/Makefile.am |
|
|
| 131 | fi |
|
|
| 132 | |
|
|
| 133 | eend |
|
|
| 134 | |
|
|
| 135 | ebegin "Running automake" |
|
|
| 136 | automake-1.4 -a -c || die "automake error" |
|
|
| 137 | eend |
|
|
| 138 | |
|
|
| 139 | elibtoolize |
|
|
| 140 | } |
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 | |
| 141 | |
137 | |
| 142 | fox_src_compile() { |
138 | fox_src_compile() { |
| 143 | local myconf |
139 | hasq src_configure ${FOX_EXPF} || fox_src_configure |
| 144 | use debug && myconf="${myconf} --enable-debug" \ |
|
|
| 145 | || myconf="${myconf} --enable-release" |
|
|
| 146 | |
140 | |
| 147 | econf \ |
|
|
| 148 | ${FOXCONF} \ |
|
|
| 149 | ${myconf} \ |
|
|
| 150 | $(use_with profile profiling) \ |
|
|
| 151 | || die "configure error" |
|
|
| 152 | |
|
|
| 153 | cd ${S}/${FOX_COMPONENT} |
141 | cd "${S}/${FOX_COMPONENT}" |
| 154 | emake || die "compile error" |
142 | emake || die "compile error" |
| 155 | |
143 | |
| 156 | # build class reference docs (FOXVER >= 1.2) |
144 | # build class reference docs (FOXVER >= 1.2) |
| 157 | if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then |
145 | if use doc && [[ -z ${FOX_COMPONENT} ]] ; then |
| 158 | cd ${S}/doc |
|
|
| 159 | make docs || die "doxygen error" |
146 | emake -C "${S}"/doc docs || die "doxygen error" |
| 160 | fi |
147 | fi |
| 161 | } |
148 | } |
| 162 | |
149 | |
| 163 | fox_src_install () { |
150 | fox_src_install() { |
| 164 | cd ${S}/${FOX_COMPONENT} |
151 | cd "${S}/${FOX_COMPONENT}" |
| 165 | |
152 | |
| 166 | make install \ |
153 | emake install \ |
| 167 | DESTDIR=${D} \ |
154 | DESTDIR="${D}" \ |
| 168 | htmldir=/usr/share/doc/${PF}/html \ |
155 | htmldir=/usr/share/doc/${PF}/html \ |
| 169 | artdir=/usr/share/doc/${PF}/html/art \ |
156 | artdir=/usr/share/doc/${PF}/html/art \ |
| 170 | screenshotsdir=/usr/share/doc/${PF}/html/screenshots \ |
157 | screenshotsdir=/usr/share/doc/${PF}/html/screenshots \ |
| 171 | || die "install error" |
158 | || die "install error" |
| 172 | |
159 | |
| … | |
… | |
| 193 | for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do |
180 | for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do |
| 194 | [ -f $doc ] && dodoc $doc |
181 | [ -f $doc ] && dodoc $doc |
| 195 | done |
182 | done |
| 196 | |
183 | |
| 197 | # remove documentation if USE=-doc |
184 | # remove documentation if USE=-doc |
| 198 | if ( ! use doc ) && [ -d ${D}/usr/share/doc/${PF}/html ] ; then |
|
|
| 199 | rm -fr ${D}/usr/share/doc/${PF}/html |
185 | use doc || rm -fr "${D}/usr/share/doc/${PF}/html" |
| 200 | fi |
|
|
| 201 | |
186 | |
| 202 | # install class reference docs (FOXVER >= 1.2) if USE=doc |
187 | # install class reference docs if USE=doc |
| 203 | if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then |
188 | if use doc && [[ -z ${FOX_COMPONENT} ]] ; then |
| 204 | dohtml -r ${S}/doc/ref |
189 | dohtml -r "${S}/doc/ref" |
| 205 | fi |
190 | fi |
| 206 | |
191 | |
| 207 | # slot fox-config where present (FOXVER >= 1.2) |
192 | # slot fox-config |
| 208 | if [ -f ${D}/usr/bin/fox-config ] ; then |
193 | if [[ -f ${D}/usr/bin/fox-config ]] ; then |
| 209 | mv ${D}/usr/bin/fox-config ${D}/usr/bin/fox-${FOXVER}-config |
194 | mv "${D}/usr/bin/fox-config" "${D}/usr/bin/fox-${FOXVER}-config" \ |
|
|
195 | || die "failed to install fox-config" |
| 210 | fi |
196 | fi |
| 211 | } |
197 | } |
| 212 | |
198 | |
| 213 | fox_pkg_postinst() { |
199 | fox_pkg_postinst() { |
| 214 | if [ -z "${FOX_COMPONENT}" ] ; then |
200 | if [ -z "${FOX_COMPONENT}" ] ; then |
| … | |
… | |
| 218 | einfo |
204 | einfo |
| 219 | einfo "The reswrap utility and the applications included in the FOX Toolkit" |
205 | einfo "The reswrap utility and the applications included in the FOX Toolkit" |
| 220 | einfo "(adie, calculator, pathfinder, shutterbug) are now available as" |
206 | einfo "(adie, calculator, pathfinder, shutterbug) are now available as" |
| 221 | einfo "separate ebuilds." |
207 | einfo "separate ebuilds." |
| 222 | echo |
208 | echo |
| 223 | if [ "${FOXVER}" != "1.0" ] ; then |
|
|
| 224 | einfo "The fox-config script has been installed as fox-${FOXVER}-config." |
209 | einfo "The fox-config script has been installed as fox-${FOXVER}-config." |
| 225 | einfo "The fox-wrapper package is used to direct calls to fox-config" |
210 | einfo "The fox-wrapper package is used to direct calls to fox-config" |
| 226 | einfo "to the correct versioned script, based on the WANT_FOX variable." |
211 | einfo "to the correct versioned script, based on the WANT_FOX variable." |
| 227 | einfo "For example:" |
212 | einfo "For example:" |
| 228 | einfo |
213 | einfo |
| 229 | einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>" |
214 | einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>" |
| 230 | einfo |
215 | einfo |
| 231 | epause |
|
|
| 232 | fi |
216 | fi |
| 233 | fi |
|
|
| 234 | } |
217 | } |
| 235 | |
|
|
| 236 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst |
|
|