/[gentoo-x86]/eclass/gtk-sharp-module.eclass
Gentoo

Contents of /eclass/gtk-sharp-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download)
Tue Jan 6 19:37:18 2009 UTC (5 years, 11 months ago) by grobian
Branch: MAIN
Changes since 1.10: +5 -5 lines
spaces -> tabs

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v 1.10 2009/01/05 22:10:44 loki_val Exp $
4
5 # Author : Peter Johanson <latexer@gentoo.org>, butchered by ikelos, then loki_val.
6 # Based off of original work in gst-plugins.eclass by <foser@gentoo.org>
7
8 # Note that this breaks compatibility with the original gtk-sharp-component
9 # eclass.
10
11 inherit eutils mono multilib autotools base versionator
12
13 # Get the name of the component to build and the build dir; by default,
14 # extract it from the ebuild's name.
15 GTK_SHARP_MODULE=${GTK_SHARP_MODULE:=${PN/-sharp/}}
16 GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}}
17
18 # Allow ebuilds to set a value for the required GtkSharp version.
19 GTK_SHARP_REQUIRED_VERSION=${GTK_SHARP_REQUIRED_VERSION}
20
21 # Version number used to differentiate between unversioned 1.0 series and the
22 # versioned 2.0 series (2.0 series has 2 or 2.0 appended to various paths and
23 # scripts). Default to ${SLOT}.
24 GTK_SHARP_SLOT="${GTK_SHARP_SLOT:=${SLOT}}"
25 GTK_SHARP_SLOT_DEC="${GTK_SHARP_SLOT_DEC:=-${GTK_SHARP_SLOT}.0}"
26
27 #Handy little var
28 PV_MAJOR=$(get_version_component_range 1-2)
29
30 # Set some defaults.
31 DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module"
32 HOMEPAGE="http://www.mono-project.com/GtkSharp"
33
34 LICENSE="LGPL-2.1"
35 DEPEND="
36 >=dev-lang/mono-2.0.1
37 >=sys-apps/sed-4
38 >=dev-util/pkgconfig-0.23
39 "
40 RDEPEND="
41 >=dev-lang/mono-2.0.1
42 "
43
44 IUSE="debug"
45
46
47 # The GtkSharp modules are currently divided into three seperate tarball
48 # distributions. Figure out which of these our component belongs to.
49
50 gtk_sharp_module_list="glib glade gtk gdk atk pango gtk-dotnet gtk-gapi"
51 gnome_sharp_module_list="art gnome gnomevfs gconf"
52 gnome_desktop_sharp_module_list="gnome-desktop gnome-print gnome-panel gtkhtml gtksourceview nautilusburn rsvg vte wnck"
53
54 has "${GTK_SHARP_MODULE}" ${gtk_sharp_module_list} && GTK_SHARP_REQUIRED_VERSION=${PV}
55
56
57 add_bdepend() {
58 DEPEND="${DEPEND} $@"
59 }
60
61 add_rdepend() {
62 RDEPEND="${RDEPEND} $@"
63 }
64
65 add_depend() {
66 DEPEND="${DEPEND} $@"
67 RDEPEND="${RDEPEND} $@"
68 }
69
70 gsm_get_tarball() {
71 has "${GTK_SHARP_MODULE}" ${gtk_sharp_module_list} \
72 && echo "gtk-sharp" && return 0
73 has "${GTK_SHARP_MODULE}" ${gnome_sharp_module_list} \
74 && echo "gnome-sharp" && return 0
75 has "${GTK_SHARP_MODULE}" ${gnome_desktop_sharp_module_list} \
76 && echo "gnome-desktop-sharp" && return 0
77 die "unknown GtkSharp module: ${GTK_SHARP_MODULE}"
78 }
79
80 [[ "${PN}" != "gtk-sharp-gapi" ]] && add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*"
81 has "${GTK_SHARP_MODULE}" ${gnome_sharp_module_list} ${gnome_desktop_sharp_module_list} gtk-dotnet glade \
82 && add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
83 has "${GTK_SHARP_MODULE}" gtk gdk atk pango gtk-dotnet parser \
84 && add_depend "=dev-dotnet/glib-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
85 has "${GTK_SHARP_MODULE}" ${gnome_desktop_sharp_module_list} \
86 && add_depend ">=dev-dotnet/gnome-sharp-${PV_MAJOR}"
87
88 case ${PF} in
89 #gtk-sharp tarball
90 gtk-sharp-gapi*)
91 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
92 add_depend "dev-perl/XML-LibXML"
93 ;;
94 gtk-sharp-*)
95 add_depend "~dev-dotnet/atk-sharp-${PV}"
96 add_depend "~dev-dotnet/gdk-sharp-${PV}"
97 add_depend "~dev-dotnet/pango-sharp-${PV}"
98 ;;
99 gdk-sharp-*)
100 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
101 add_depend "x11-libs/gtk+:2"
102 add_depend "~dev-dotnet/pango-sharp-${PV}"
103 ;;
104 atk-sharp-*)
105 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
106 add_depend "dev-libs/atk"
107 ;;
108 glib-sharp-*)
109 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
110 add_depend "dev-libs/glib:2"
111 ;;
112 pango-sharp-*)
113 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
114 add_depend "x11-libs/pango"
115 ;;
116 gtk-dotnet-*)
117 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
118 add_depend "~dev-dotnet/gdk-sharp-${PV}"
119 add_depend "~dev-dotnet/pango-sharp-${PV}"
120 add_depend "!dev-lang/mono[minimal]"
121 ;;
122 glade-sharp-*)
123 add_depend "~dev-dotnet/atk-sharp-${PV}"
124 add_depend "~dev-dotnet/gdk-sharp-${PV}"
125 add_depend "~dev-dotnet/pango-sharp-${PV}"
126 add_depend ">=gnome-base/libglade-2.3.6"
127 ;;
128 #gnome-sharp tarball
129 art-sharp-*)
130 add_depend ">=media-libs/libart_lgpl-2.3.20"
131 ;;
132 gnome-sharp-*)
133 add_depend ">=gnome-base/libgnomeui-${PV_MAJOR}"
134 add_depend ">=gnome-base/gnome-panel-${PV_MAJOR}"
135 add_depend "~dev-dotnet/gnomevfs-sharp-${PV}"
136 add_depend "~dev-dotnet/art-sharp-${PV}"
137 add_depend ">=gnome-base/libgnomecanvas-${GNOMECANVAS_REQUIRED_VERSION}"
138 ;;
139 gconf-sharp-*)
140 add_depend ">=gnome-base/gconf-${PV_MAJOR}"
141 add_depend ">=dev-dotnet/glade-sharp-${GTK_SHARP_REQUIRED_VERSION}"
142 add_depend "~dev-dotnet/gnome-sharp-${PV}"
143 add_depend "~dev-dotnet/art-sharp-${PV}"
144 ;;
145 gnomevfs-sharp-*)
146 add_depend ">=gnome-base/gnome-vfs-${PV_MAJOR}"
147 ;;
148 #gnome-desktop-sharp tarball
149 gnome-desktop-sharp-*)
150 add_depend "=gnome-base/gnome-desktop-${PV_MAJOR}*"
151 ;;
152 gnome-panel-sharp-*)
153 add_depend "=gnome-base/gnome-panel-${PV_MAJOR}*"
154 ;;
155 gnome-print-sharp-*)
156 add_depend ">=gnome-base/libgnomeprint-${API_VERSION}"
157 ;;
158 gtkhtml-sharp-*)
159 #NOTE: gtkhtml dependency must follow gtkhtml-sharp version.
160 #i.e. gtkhtml-sharp-2.24.0 >=gtkhtml-3.24
161 # gtkhtml-sharp-2.16.0 >=gtkhtml-3.16
162 # See bug 249540 for unpleasant side effects.
163 add_depend ">=gnome-extra/gtkhtml-$(($(get_version_component_range 1) + 1 )).$(get_version_component_range 2)"
164 ;;
165 gtksourceview-sharp-*)
166 add_depend ">=x11-libs/gtksourceview-${GTKSOURCEVIEW_REQUIRED_VERSION}:2.0"
167 ;;
168 nautilusburn-sharp-*)
169 add_depend ">=gnome-extra/nautilus-cd-burner-${PV_MAJOR}"
170 ;;
171 rsvg-sharp-*)
172 add_depend ">=gnome-base/librsvg-${RSVG_REQUIRED_VERSION}"
173 ;;
174 vte-sharp-*)
175 add_depend ">=x11-libs/vte-${VTE_REQUIRED_VERSION}"
176 ;;
177 wnck-sharp-*)
178 add_depend ">=x11-libs/libwnck-${PV_MAJOR}"
179 ;;
180 esac
181
182
183
184 GSM_P=$(gsm_get_tarball)-${PV}
185 S=${WORKDIR}/${GSM_P}
186 SRC_URI="mirror://gnome/sources/$(gsm_get_tarball)/${PV%.*}/${GSM_P}.tar.bz2"
187
188 if [[ "${GSM_P%.*}" = "gtk-sharp-2.12" ]]
189 then
190 SRC_URI="${SRC_URI}
191 mirror://gentoo/gtk-sharp-2.12.0-patches.tar.bz2"
192 #Upstream: https://bugzilla.novell.com/show_bug.cgi?id=$bugno
193 #Upstream bug #421063
194 PATCHES=( "${WORKDIR}/patches/$(gsm_get_tarball)-2.12.0-parallelmake.patch"
195 "${WORKDIR}/patches/$(gsm_get_tarball)-2.12.0-doc-parallelmake.patch" )
196 EAUTORECONF="YES"
197 fi
198
199
200 ### Public functions.
201
202 gtk-sharp-module_fix_files() {
203 # Change references like "/r:../art/art-sharp.dll" ->
204 # "/r:/usr/lib/pkgconfig/../../lib/mono/gtk-sharp-2.0/art-sharp.dll" and references like
205 # "../glib/glib-sharp.xml" or "$(top_srcdir)/glib/glib-sharp.xml" ->
206 # "${gapi_dir}/glib-sharp.xml".
207 #
208 # We also make sure to call the installed gapi-fixup and gapi-codegen and
209 # not the ones that would be built locally.
210 local gapi_dir="${ROOT}/usr/share/gapi${GTK_SHARP_SLOT_DEC}"
211 local GAPI_FIXUP="gapi2-fixup"
212 local GAPI_CODEGEN="gapi2-codegen"
213
214 local makefiles=( $(find "${S}" -name Makefile.in) )
215 sed -i \
216 -e "s;\(\.\.\|\$(top_srcdir)\|\$(srcdir)/\.\.\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).xml;${gapi_dir}/\2.xml;g" \
217 -e "s; \.\./glib/glib-sharp.dll; $(get_sharp_lib glib-sharp-2.0);g" \
218 -e "s; \.\./pango/pango-sharp.dll; $(get_sharp_lib pango-sharp-2.0);g" \
219 -e "s; \.\./art/art-sharp.dll; $(get_sharp_lib art-sharp-2.0);g" \
220 -e "s; \.\./atk/atk-sharp.dll; $(get_sharp_lib atk-sharp-2.0);g" \
221 -e "s; \.\./gdk/gdk-sharp.dll; $(get_sharp_lib gdk-sharp-2.0);g" \
222 -e "s; \.\./gtk/gtk-sharp.dll; $(get_sharp_lib gtk-sharp-2.0);g" \
223 -e "s;\.\./gnomevfs/gnome-vfs-sharp.dll;$(get_sharp_lib gnome-vfs-sharp-2.0);g" \
224 -e "s;\$(top_builddir)/art/art-sharp.dll;$(get_sharp_lib art-sharp-2.0);" \
225 -e "s;\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_lib gnome-sharp-2.0);" \
226 -e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;${GAPI_FIXUP};" \
227 -e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;${GAPI_CODEGEN};" \
228 -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \
229 -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \
230 "${makefiles[@]}" || die "failed to fix GtkSharp makefiles"
231 }
232
233 get_sharp_lib() {
234 S="$(pkg-config --libs ${1})"
235 S=${S%% *}
236 printf ${S#-r:}
237 }
238
239 gtk-sharp_tarball_src_prepare() {
240 local package
241 sed -i -e '/SUBDIRS/s/ glib / /' \
242 -e '/SUBDIRS/s/ glade / /' \
243 -e '/SUBDIRS/s/ sample / /' \
244 -e '/SUBDIRS/s/ doc/ /' \
245 Makefile.am || die "failed sedding sense into gtk-sharp's Makefile.am"
246 for package in GLIB PANGO ATK GTK
247 do
248 sed -r -i -e "s:(PKG_CHECK_MODULES\(${package}.*)\):\1,[foo=bar],[bar=foo]):" \
249 configure.in || die "failed sedding sense into gnome-sharp's configure.in"
250 done
251 EAUTORECONF=YES
252 }
253
254 gnome-sharp_tarball_src_prepare() {
255 if ! [[ "${PN}" = "gconf-sharp" ]]
256 then
257 sed -r -i -e "s:(PKG_CHECK_MODULES\(GLADESHARP.*)\):\1,[foo=bar],[bar=foo]):" \
258 configure.in || die "failed sedding sense into gnome-sharp's configure.in"
259 EAUTORECONF=YES
260 fi
261 }
262
263 gtk-sharp-module_src_prepare() {
264 if [[ "$(type -t $(gsm_get_tarball)_tarball_src_prepare)" = "function" ]]
265 then
266 ebegin "Running $(gsm_get_tarball)_tarball_src_prepare"
267 $(gsm_get_tarball)_tarball_src_prepare
268 eend $?
269 fi
270 base_src_util autopatch
271
272 [[ ${EAUTORECONF} ]] && eautoreconf
273
274 cd "${S}/${GTK_SHARP_MODULE_DIR}"
275
276 gtk-sharp-module_fix_files &> /dev/null
277 }
278
279 gtk-sharp-module_src_configure() {
280 econf --disable-static \
281 --disable-dependency-tracking \
282 --disable-maintainer-mode \
283 $(use debug &&echo "--enable-debug" ) \
284 ${gtk_sharp_conf} \
285 ${@} || die "econf failed"
286 }
287
288 gtk-sharp-module_src_compile() {
289 cd "${S}/${GTK_SHARP_MODULE_DIR}"
290 emake || die "emake failed"
291 }
292
293 gtk-sharp-module_src_install() {
294
295 cd "${GTK_SHARP_MODULE_DIR}"
296 emake DESTDIR=${D} install || die "emake install failed"
297 mono_multilib_comply
298 find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
299 if has "${GTK_SHARP_MODULE}" gtk gdk atk pango
300 then
301 find "${D}" -name '*.pc' -exec rm -rf '{}' '+' || die "la removal failed"
302 pkgconfig_filename="${PN}${GTK_SHARP_SLOT_DEC}"
303 pkgconfig_pkgname="${GTK_SHARP_MODULE}#"
304 pkgconfig_description=".NET/Mono bindings for ${GTK_SHARP_MODULE}"
305 pkgconfig_monodir="$(gsm_get_tarball)${GTK_SHARP_SLOT_DEC}"
306 case ${GTK_SHARP_MODULE} in
307 gtk)
308 pkgconfig_requires="glib-sharp${GTK_SHARP_SLOT_DEC} atk-sharp${GTK_SHARP_SLOT_DEC} gdk-sharp${GTK_SHARP_SLOT_DEC} pango-sharp${GTK_SHARP_SLOT_DEC}"
309 ;;
310 gdk)
311 pkgconfig_requires="glib-sharp${GTK_SHARP_SLOT_DEC} pango-sharp${GTK_SHARP_SLOT_DEC}"
312 ;;
313 atk)
314 pkgconfig_requires="glib-sharp${GTK_SHARP_SLOT_DEC}"
315 ;;
316 pango)
317 pkgconfig_requires="glib-sharp${GTK_SHARP_SLOT_DEC}"
318 ;;
319 *)
320 die "unhandled gtk_sharp_module"
321 ;;
322 esac
323 generate_pkgconfig
324 fi
325 }
326
327 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install
328
329 generate_pkgconfig() {
330 ebegin "Generating .pc file for ${P}"
331 local dll \
332 gfile \
333 pkgconfig_gapidir \
334 apifile \
335 LSTRING='Libs:' \
336 CSTRING='Cflags:' \
337 pkgconfig_filename="${1:-${pkgconfig_filename:-${PN}}}" \
338 pkgconfig_monodir="${2:-${pkgconfig_monodir:-${pkgconfig_filename}}}" \
339 pkgconfig_pkgname="${3:-${pkgconfig_pkgname:-${pkgconfig_filename}}}" \
340 pkgconfig_version="${4:-${pkgconfig_version:-${PV}}}" \
341 pkgconfig_description="${5:-${pkgconfig_description:-${DESCRIPTION}}}" \
342 pkgconfig_requires="${6:-${pkgconfig_requires}}" \
343
344 pushd "${D}/usr/" &> /dev/null
345 apifile=$(find share -name '*-api.xml' 2>/dev/null)
346 popd &> /dev/null
347
348 pkgconfig_gapidir=${apifile:+\$\{prefix\}/${apifile%/*}}
349
350 dodir "/usr/$(get_libdir)/pkgconfig"
351 cat <<- EOF -> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
352 prefix=\${pcfiledir}/../..
353 exec_prefix=\${prefix}
354 libdir=\${prefix}/$(get_libdir)
355 gapidir=${pkgconfig_gapidir}
356 Name: ${pkgconfig_pkgname}
357 Description: ${pkgconfig_description}
358 Version: ${pkgconfig_version}
359 EOF
360
361 for gfile in "${D}"/usr/${apifile%/*}/*-api.xml
362 do
363 CSTRING="${CSTRING} -I:"'${gapidir}'"/${gfile##*/}"
364 done
365 echo "${CSTRING}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
366
367
368 for dll in "${D}"/usr/$(get_libdir)/mono/${pkgconfig_monodir}/*.dll
369 do
370 if ! [[ "${dll##*/}" == "policy."*".dll" ]]
371 then
372 LSTRING="${LSTRING} -r:"'${libdir}'"/mono/${pkgconfig_monodir}/${dll##*/}"
373 fi
374 done
375 echo "${LSTRING}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
376
377 if [[ "${pkgconfig_requires}" ]]
378 then
379 printf "Requires: ${pkgconfig_requires}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
380 fi
381 PKG_CONFIG_PATH="${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --silence-errors --libs ${pkgconfig_filename} &> /dev/null
382 eend $?
383 }

  ViewVC Help
Powered by ViewVC 1.1.20