/[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.9 - (hide annotations) (download)
Mon Jan 5 20:49:10 2009 UTC (5 years, 11 months ago) by loki_val
Branch: MAIN
Changes since 1.8: +3 -3 lines
Fix gapi-fixup being sedded into makefiles instead of gapi2-fixup, w.r.t. bug 253903.

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

  ViewVC Help
Powered by ViewVC 1.1.20