| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2012 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.1.1.1 2005/11/30 09:59:33 chriswhite Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/fox.eclass,v 1.17 2012/09/27 16:35:41 axs 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). |
| … | |
… | |
| 17 | # |
20 | # |
| 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, based on the first versions |
25 | # Here are sample [R]DEPENDs for the fox apps |
| 23 | # in each branch to use this eclass: |
26 | # 1.6: 'x11-libs/fox:1.6' |
| 24 | # 1.0: '>=x11-libs/fox-1.0.53 <x11-libs/fox-1.1' |
|
|
| 25 | # 1.2: '>=x11-libs/fox-1.2.15 <x11-libs/fox-1.3' |
|
|
| 26 | # 1.4: '>=x11-libs/fox-1.4.12 <x11-libs/fox-1.5' |
|
|
| 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 |
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|5) 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="ftp://ftp.fox-toolkit.org/pub/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 use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then |
74 | if [[ -z ${FOX_COMPONENT} ]] ; then |
| 62 | DOXYGEN_DEP="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 | DEPEND="${DOXYGEN_DEP} |
82 | DEPEND="${DOXYGEN_DEP} |
| 70 | ${RESWRAP_DEP} |
83 | ${RESWRAP_DEP} |
| 71 | =sys-devel/automake-1.4* |
|
|
| 72 | >=sys-apps/sed-4" |
84 | >=sys-apps/sed-4" |
| 73 | |
85 | |
| 74 | S="${WORKDIR}/fox-${FOX_PV}" |
86 | S="${WORKDIR}/fox-${FOX_PV}" |
| 75 | |
87 | |
| 76 | fox_src_unpack() { |
88 | fox_src_unpack() { |
| 77 | unpack ${A} |
89 | unpack ${A} |
| 78 | cd ${S} |
90 | cd "${S}" |
| 79 | |
91 | |
| 80 | ebegin "Fixing configure" |
92 | has src_prepare ${FOX_EXPF} || fox_src_prepare |
|
|
93 | } |
|
|
94 | |
|
|
95 | fox_src_prepare() { |
|
|
96 | # fox changed from configure.in to configure.am in 1.6.38 |
|
|
97 | local confFile="configure.ac" |
|
|
98 | [[ -r "configure.in" ]] && confFile="configure.in" |
| 81 | |
99 | |
| 82 | # Respect system CXXFLAGS |
100 | # Respect system CXXFLAGS |
| 83 | sed -i -e 's:CXXFLAGS=""::' configure.in || die "sed configure.in error" |
|
|
| 84 | touch aclocal.m4 |
|
|
| 85 | sed -i -e 's:CXXFLAGS=""::' configure || die "sed configure error" |
101 | sed -i -e 's:CXXFLAGS=""::' $confFile || die "sed ${confFile} error" |
| 86 | |
102 | |
| 87 | eend |
103 | # don't strip binaries |
| 88 | |
104 | sed -i -e '/LDFLAGS="-s ${LDFLAGS}"/d' $confFile || die "sed ${confFile} error" |
| 89 | ebegin "Fixing Makefiles" |
|
|
| 90 | |
105 | |
| 91 | # don't build apps from top-level (i.e. x11-libs/fox) |
106 | # don't build apps from top-level (i.e. x11-libs/fox) |
| 92 | # utils == reswrap |
107 | # utils == reswrap |
|
|
108 | local d |
| 93 | for d in ${FOX_APPS} utils windows ; do |
109 | for d in ${FOX_APPS} utils windows ; do |
| 94 | sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error" |
110 | sed -i -e "s:${d}::" Makefile.am || die "sed Makefile.am error" |
| 95 | done |
111 | done |
| 96 | |
112 | |
| 97 | # use the installed reswrap for everything else |
113 | # use the installed reswrap for everything else |
| 98 | for d in ${FOX_APPS} ${FOX_CHART} tests ; do |
114 | for d in ${FOX_APPS} chart controlpanel tests ; do |
|
|
115 | [[ -d ${d} ]] && |
| 99 | sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \ |
116 | (sed -i -e 's:$(top_builddir)/utils/reswrap:reswrap:' \ |
| 100 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
117 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error") |
| 101 | done |
118 | done |
| 102 | |
119 | |
| 103 | # use the installed headers and library for apps |
120 | # use the installed headers and library for apps |
| 104 | for d in ${FOX_APPS} ; do |
121 | for d in ${FOX_APPS} ; do |
| 105 | sed -i \ |
122 | sed -i \ |
| 106 | -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox${FOXVER_SUFFIX}:" \ |
123 | -e "s:-I\$(top_srcdir)/include -I\$(top_builddir)/include:-I\$(includedir)/fox-${FOXVER}:" \ |
| 107 | -e 's:../src/libFOX:-lFOX:' \ |
124 | -e 's:$(top_builddir)/src/libFOX:-lFOX:' \ |
|
|
125 | -e 's:$(top_builddir)/lib/libFOX:-lFOX:' \ |
| 108 | -e 's:\.la::' \ |
126 | -e 's:\.la::' \ |
| 109 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
127 | ${d}/Makefile.am || die "sed ${d}/Makefile.am error" |
| 110 | done |
128 | done |
| 111 | |
129 | |
| 112 | # Upstream often has trouble with version number transitions |
130 | eautoreconf |
| 113 | if [ "${FOXVER}" == "1.5" ] ; then |
|
|
| 114 | sed -i -e 's:1.4:1.5:g' chart/Makefile.am |
|
|
| 115 | fi |
|
|
| 116 | |
|
|
| 117 | eend |
|
|
| 118 | |
|
|
| 119 | ebegin "Running automake" |
|
|
| 120 | automake-1.4 -a -c || die "automake error" |
|
|
| 121 | eend |
|
|
| 122 | |
|
|
| 123 | elibtoolize |
|
|
| 124 | } |
131 | } |
|
|
132 | |
|
|
133 | fox_src_configure() { |
|
|
134 | use debug && FOXCONF+=" --enable-debug" \ |
|
|
135 | || FOXCONF+=" --enable-release" |
|
|
136 | |
|
|
137 | econf ${FOXCONF} \ |
|
|
138 | $(use_with profile profiling) |
|
|
139 | } |
|
|
140 | |
| 125 | |
141 | |
| 126 | fox_src_compile() { |
142 | fox_src_compile() { |
| 127 | local myconf |
143 | has src_configure ${FOX_EXPF} || fox_src_configure |
| 128 | use debug && myconf="${myconf} --enable-debug" \ |
|
|
| 129 | || myconf="${myconf} --enable-release" |
|
|
| 130 | |
144 | |
| 131 | econf \ |
|
|
| 132 | ${FOXCONF} \ |
|
|
| 133 | ${myconf} \ |
|
|
| 134 | $(use_with profile profiling) \ |
|
|
| 135 | || die "configure error" |
|
|
| 136 | |
|
|
| 137 | cd ${S}/${FOX_COMPONENT} |
145 | cd "${S}/${FOX_COMPONENT}" |
| 138 | emake || die "compile error" |
146 | emake || die "compile error" |
| 139 | |
147 | |
| 140 | # build class reference docs (FOXVER >= 1.2) |
148 | # build class reference docs (FOXVER >= 1.2) |
| 141 | if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then |
149 | if use doc && [[ -z ${FOX_COMPONENT} ]] ; then |
| 142 | cd ${S}/doc |
|
|
| 143 | make docs || die "doxygen error" |
150 | emake -C "${S}"/doc docs || die "doxygen error" |
| 144 | fi |
151 | fi |
| 145 | } |
152 | } |
| 146 | |
153 | |
| 147 | fox_src_install () { |
154 | fox_src_install() { |
| 148 | cd ${S}/${FOX_COMPONENT} |
155 | cd "${S}/${FOX_COMPONENT}" |
| 149 | |
156 | |
| 150 | make install \ |
157 | emake install \ |
| 151 | DESTDIR=${D} \ |
158 | DESTDIR="${D}" \ |
| 152 | htmldir=/usr/share/doc/${PF}/html \ |
159 | htmldir=/usr/share/doc/${PF}/html \ |
| 153 | artdir=/usr/share/doc/${PF}/html/art \ |
160 | artdir=/usr/share/doc/${PF}/html/art \ |
| 154 | screenshotsdir=/usr/share/doc/${PF}/html/screenshots \ |
161 | screenshotsdir=/usr/share/doc/${PF}/html/screenshots \ |
| 155 | || die "install error" |
162 | || die "install error" |
| 156 | |
163 | |
| … | |
… | |
| 177 | for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do |
184 | for doc in ADDITIONS AUTHORS LICENSE_ADDENDUM README TRACING ; do |
| 178 | [ -f $doc ] && dodoc $doc |
185 | [ -f $doc ] && dodoc $doc |
| 179 | done |
186 | done |
| 180 | |
187 | |
| 181 | # remove documentation if USE=-doc |
188 | # remove documentation if USE=-doc |
| 182 | if ( ! use doc ) && [ -d ${D}/usr/share/doc/${PF}/html ] ; then |
|
|
| 183 | rm -fr ${D}/usr/share/doc/${PF}/html |
189 | use doc || rm -fr "${D}/usr/share/doc/${PF}/html" |
| 184 | fi |
|
|
| 185 | |
190 | |
| 186 | # install class reference docs (FOXVER >= 1.2) if USE=doc |
191 | # install class reference docs if USE=doc |
| 187 | if use doc && [ "${FOXVER}" != "1.0" ] && [ -z "${FOX_COMPONENT}" ] ; then |
192 | if use doc && [[ -z ${FOX_COMPONENT} ]] ; then |
| 188 | dohtml -r ${S}/doc/ref |
193 | dohtml -r "${S}/doc/ref" |
| 189 | fi |
194 | fi |
| 190 | |
195 | |
| 191 | # slot fox-config where present (FOXVER >= 1.2) |
196 | # slot fox-config |
| 192 | if [ -f ${D}/usr/bin/fox-config ] ; then |
197 | if [[ -f ${D}/usr/bin/fox-config ]] ; then |
| 193 | mv ${D}/usr/bin/fox-config ${D}/usr/bin/fox-${FOXVER}-config |
198 | mv "${D}/usr/bin/fox-config" "${D}/usr/bin/fox-${FOXVER}-config" \ |
|
|
199 | || die "failed to install fox-config" |
| 194 | fi |
200 | fi |
| 195 | } |
201 | } |
| 196 | |
202 | |
| 197 | fox_pkg_postinst() { |
203 | fox_pkg_postinst() { |
| 198 | if [ -z "${FOX_COMPONENT}" ] ; then |
204 | if [ -z "${FOX_COMPONENT}" ] ; then |
| … | |
… | |
| 202 | einfo |
208 | einfo |
| 203 | einfo "The reswrap utility and the applications included in the FOX Toolkit" |
209 | einfo "The reswrap utility and the applications included in the FOX Toolkit" |
| 204 | einfo "(adie, calculator, pathfinder, shutterbug) are now available as" |
210 | einfo "(adie, calculator, pathfinder, shutterbug) are now available as" |
| 205 | einfo "separate ebuilds." |
211 | einfo "separate ebuilds." |
| 206 | echo |
212 | echo |
| 207 | if [ "${FOXVER}" != "1.0" ] ; then |
213 | |
|
|
214 | if version_is_at_least "1.7.25"; then |
|
|
215 | einfo "Fox versions after 1.7.25 ships a pkg-config file called fox17.pc" |
|
|
216 | einfo "instead of the previous fox-config tool." |
|
|
217 | einfo "You now get all info via pkg-config:" |
|
|
218 | einfo |
|
|
219 | einfo "pkg-config fox17 --libs (etc.)" |
|
|
220 | else |
| 208 | einfo "The fox-config script has been installed as fox-${FOXVER}-config." |
221 | einfo "The fox-config script has been installed as fox-${FOXVER}-config." |
| 209 | einfo "The fox-wrapper package is used to direct calls to fox-config" |
222 | einfo "The fox-wrapper package is used to direct calls to fox-config" |
| 210 | einfo "to the correct versioned script, based on the WANT_FOX variable." |
223 | einfo "to the correct versioned script, based on the WANT_FOX variable." |
| 211 | einfo "For example:" |
224 | einfo "For example:" |
| 212 | einfo |
225 | einfo |
| 213 | einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>" |
226 | einfo " WANT_FOX=\"${FOXVER}\" fox-config <options>" |
| 214 | einfo |
|
|
| 215 | epause |
|
|
| 216 | fi |
227 | fi |
|
|
228 | einfo |
| 217 | fi |
229 | fi |
| 218 | } |
230 | } |
| 219 | |
|
|
| 220 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst |
|
|