net-fs/openafs-kernel: remove vulnerable versions
[gentoo.git] / eclass / gtk-sharp-module.eclass
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: gtk-sharp-module.eclass
6 # @MAINTAINER:
7 # dotnet@gentoo.org
8 # @BLURB: Manages the modules of the gtk-, gnome-, and gnome-desktop-sharp tarballs
9 # @DESCRIPTION:
10 # This eclass provides phase functions and helper functions for the modules
11 # of the gtk-sharp, gnome-sharp and gnome-desktop-sharp tarballs.
12 # PLEASE TAKE NOTE: ONLY FOR EAPI-2 EBUILDS
13
14 WANT_AUTOMAKE=none
15 WANT_AUTOCONF=none
16
17 inherit eutils mono multilib libtool autotools base versionator
18
19 case ${EAPI:-0} in
20         2|3|4|5) ;;
21         *) die "Unknown EAPI." ;;
22 esac
23
24 # @ECLASS-VARIABLE: GTK_SHARP_MODULE
25 # @DESCRIPTION:
26 # The name of the Gtk# module.
27 # Default value: ${PN/-sharp/}
28 GTK_SHARP_MODULE=${GTK_SHARP_MODULE:=${PN/-sharp/}}
29
30 # @ECLASS-VARIABLE: GTK_SHARP_MODULE_DIR
31 # @DESCRIPTION:
32 # The subdirectory of S in which GTK_SHARP_MODULE is installed.
33 # Default value: ${PN/-sharp/}
34 GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}}
35
36 # @ECLASS-VARIABLE: GTK_SHARP_REQUIRED_VERSION
37 # @DESCRIPTION:
38 # The version of the gtk-sharp tarball this package requires.
39 # Optional.
40 GTK_SHARP_REQUIRED_VERSION="${GTK_SHARP_REQUIRED_VERSION}"
41
42 # @ECLASS-VARIABLE: gapi_users_list
43 # @DESCRIPTION:
44 # List of modules that use one of gapi2-codegen, gapi2-fixup or gapi2-parser
45 # No ebuild-serviceable parts inside.
46 gapi_users_list="art gnome gnomevfs ${gnome_desktop_sharp_module_list} atk gtk gdk glade pango"
47
48 # @ECLASS-VARIABLE: PV_MAJOR
49 # @DESCRIPTION:
50 # The first two components of the PV variable.
51 PV_MAJOR=$(get_version_component_range 1-2)
52
53 # @FUNCTION: add_bdepend
54 # @USAGE: <package atom>
55 # @DESCRIPTION:
56 # Adds to the DEPEND variable
57 add_bdepend() {
58         [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
59         DEPEND="${DEPEND} $@"
60 }
61
62 # @FUNCTION: add_rdepend
63 # @USAGE: <package atom>
64 # @DESCRIPTION:
65 # Adds to the RDEPEND variable
66 add_rdepend() {
67         [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
68         RDEPEND="${RDEPEND} $@"
69 }
70
71 # @FUNCTION: add_depend
72 # @USAGE: <package atom>
73 # @DESCRIPTION:
74 # Adds to the DEPEND and RDEPEND variables
75 add_depend() {
76         [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
77         DEPEND="${DEPEND} $@"
78         RDEPEND="${RDEPEND} $@"
79 }
80
81 # @ECLASS-VARIABLE: TARBALL
82 # @DESCRIPTION:
83 # The GtkSharp modules are currently divided into three seperate tarball
84 # distributions. The TARBALL variable holds the name of the tarball
85 # to which GTK_SHARP_MODULE belongs.
86 case ${GTK_SHARP_MODULE} in
87         glib|glade|gtk|gdk|atk|pango|gtk-dotnet|gtk-gapi|gtk-docs)
88                 TARBALL="gtk-sharp"
89                 case ${PVR} in
90                         2.12.10*)
91                                 SRC_URI="mirror://gentoo/${TARBALL}-2.12.7.patch.bz2"
92                                 #Upstream: https://bugzilla.novell.com/show_bug.cgi?id=$bugno
93                                 #Upstream bug #470390 for the gtk-sharp-2.12.7.patch
94                                 PATCHES=(
95                                         "${WORKDIR}/${TARBALL}-2.12.7.patch"
96                                 )
97                                 ;;
98                         2.12.11*)
99                                 SRC_URI="mirror://gentoo/${TARBALL}-2.12.11.patch.bz2"
100                                 PATCHES=(
101                                         "${WORKDIR}/${TARBALL}-2.12.11.patch"
102                                 )
103                                 ;;
104                 esac
105                 case ${PVR} in
106                         2.12.1*)
107                                 EAUTORECONF="YES"
108                                 add_bdepend "=sys-devel/automake-1.10*"
109                                 add_bdepend ">=sys-devel/autoconf-2.61"
110                                 ;;
111                 esac
112                 ;;
113         art|gnome|gnomevfs|gconf)
114                 TARBALL="gnome-sharp"
115                 add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
116                 has "${GTK_SHARP_MODULE}" "${gapi_users_list}" && \
117                         add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*"
118                 case ${PVR} in
119                         2.24.1*)
120                                 SRC_URI="mirror://gentoo/${TARBALL}-2.24.1.patch.bz2"
121                                 # Upstream bug: https://bugzilla.novell.com/show_bug.cgi?id=483251
122                                 PATCHES=(
123                                         "${WORKDIR}/${TARBALL}-2.24.1.patch"
124                                 )
125                                 EAUTORECONF="YES"
126                                 add_bdepend "=sys-devel/automake-1.10*"
127                                 add_bdepend ">=sys-devel/autoconf-2.61"
128                                 ;;
129                         2.24.2*)
130                                 add_depend ">=dev-lang/mono-2.7"
131                                 ;;
132                 esac
133                 ;;
134         gnome-desktop|gnome-print|gnome-panel|gtkhtml|gtksourceview|nautilusburn|rsvg|vte|wnck)
135                 TARBALL="gnome-desktop-sharp"
136                 add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
137                 add_depend "=dev-dotnet/gnome-sharp-2.24*"
138                 add_depend "gnome-base/gnome-desktop:2"
139                 add_bdepend "|| ( >=dev-dotnet/gtk-sharp-2.12.21 =dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}* )"
140                 ;;
141         *)
142                 eerror "Huh? Sonny boy, looks like your GTK_SHARP_MODULE is not on the approved list. BAILING!"
143                 die "How did we get here!!?"
144                 ;;
145 esac
146
147 case ${PF} in
148         #gtk-sharp tarball
149         gtk-sharp-docs*)
150                 add_depend ">=dev-lang/mono-2.0"
151                 ;;
152         gtk-sharp-gapi*)
153                 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
154                 add_depend "dev-perl/XML-LibXML"
155                 ;;
156         gtk-sharp-*)
157                 add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
158                 add_depend "~dev-dotnet/glib-sharp-${PV}"
159                 add_depend "~dev-dotnet/atk-sharp-${PV}"
160                 add_depend "~dev-dotnet/gdk-sharp-${PV}"
161                 add_depend "~dev-dotnet/pango-sharp-${PV}"
162                 ;;
163         gdk-sharp-*)
164                 add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
165                 add_depend "~dev-dotnet/glib-sharp-${PV}"
166                 add_depend "x11-libs/gtk+:2"
167                 add_depend "~dev-dotnet/pango-sharp-${PV}"
168                 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
169                 ;;
170         atk-sharp-*)
171                 add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
172                 add_depend "~dev-dotnet/glib-sharp-${PV}"
173                 add_depend "dev-libs/atk"
174                 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
175                 ;;
176         glib-sharp-*)
177                 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
178                 add_depend "dev-libs/glib:2"
179                 ;;
180         pango-sharp-*)
181                 add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
182                 add_depend "~dev-dotnet/glib-sharp-${PV}"
183                 add_depend "x11-libs/pango"
184                 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
185                 ;;
186         gtk-dotnet-*)
187                 add_depend "~dev-dotnet/glib-sharp-${PV}"
188                 add_depend "~dev-dotnet/gdk-sharp-${PV}"
189                 add_depend "~dev-dotnet/pango-sharp-${PV}"
190                 add_depend "~dev-dotnet/gtk-sharp-${PV}"
191                 add_depend "dev-lang/mono[-minimal]"
192                 add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
193                 ;;
194         glade-sharp-*)
195                 add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}"
196                 add_depend "~dev-dotnet/glib-sharp-${PV}"
197                 add_depend "~dev-dotnet/atk-sharp-${PV}"
198                 add_depend "~dev-dotnet/gdk-sharp-${PV}"
199                 add_depend "~dev-dotnet/gtk-sharp-${PV}"
200                 add_depend "~dev-dotnet/pango-sharp-${PV}"
201                 add_depend ">=gnome-base/libglade-2.3.6:2.0"
202                 ;;
203         #gnome-sharp tarball
204         art-sharp-*)
205                 add_depend ">=media-libs/libart_lgpl-2.3.20"
206                 ;;
207         gnome-sharp-*)
208                 add_depend ">=gnome-base/libgnomeui-${PV_MAJOR}"
209                 add_depend "~dev-dotnet/gnomevfs-sharp-${PV}"
210                 add_depend "~dev-dotnet/art-sharp-${PV}"
211                 add_depend ">=gnome-base/libgnomecanvas-${GNOMECANVAS_REQUIRED_VERSION}"
212                 add_depend ">=x11-libs/gtk+-2.14.0:2"
213                 ;;
214         gconf-sharp-*)
215                 add_depend ">=gnome-base/gconf-${PV_MAJOR}:2"
216                 add_depend "=dev-dotnet/glade-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
217                 add_depend "~dev-dotnet/gnome-sharp-${PV}"
218                 add_depend "~dev-dotnet/art-sharp-${PV}"
219                 ;;
220         gnomevfs-sharp-*)
221                 add_depend ">=gnome-base/gnome-vfs-${PV_MAJOR}:2"
222                 ;;
223         #gnome-desktop-sharp tarball
224         gnome-desktop-sharp-*)
225                 # NOTE: libgnome-desktop-2.so has been known to make binary-
226                 # incompatible changes, requiring .so bumps. gnome-desktop-sharp
227                 # is locked to a specific .so.n version, so strict dependencies
228                 # may be required in the future (as it has in the past).
229                 add_depend ">=gnome-base/gnome-desktop-${PV_MAJOR}:2"
230                 ;;
231         gnome-panel-sharp-*)
232                 add_depend ">=gnome-base/gnome-panel-${PV_MAJOR}"
233                 ;;
234         gnome-print-sharp-*)
235                 add_depend "gnome-base/libgnomeprint:2.2"
236                 add_depend "gnome-base/libgnomeprintui:2.2"
237                 ;;
238         gtkhtml-sharp-*)
239                 #NOTE: gtkhtml dependency must follow gtkhtml-sharp version.
240                 #i.e.   gtkhtml-sharp-2.24.0 >=gtkhtml-3.24
241                 #       gtkhtml-sharp-2.16.0 >=gtkhtml-3.16
242                 #       See bug 249540 for unpleasant side effects.
243                 add_depend ">=gnome-extra/gtkhtml-$(($(get_version_component_range 1) + 1 )).$(get_version_component_range 2):3.14"
244                 ;;
245         gtksourceview-sharp-*)
246                 add_depend ">=x11-libs/gtksourceview-${GTKSOURCEVIEW_REQUIRED_VERSION}:2.0"
247                 ;;
248         nautilusburn-sharp-*)
249                 add_depend ">=gnome-extra/nautilus-cd-burner-2.24.0"
250                 ;;
251         rsvg-sharp-*)
252                 add_depend ">=gnome-base/librsvg-${RSVG_REQUIRED_VERSION}:2"
253                 ;;
254         vte-sharp-*)
255                 add_depend ">=x11-libs/vte-${VTE_REQUIRED_VERSION}:0"
256                 ;;
257         wnck-sharp-*)
258                 add_depend ">=x11-libs/libwnck-${PV_MAJOR}:1"
259                 ;;
260 esac
261
262 # @ECLASS-VARIABLE: DESCRIPTION
263 # @DESCRIPTION:
264 # Default value: GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball
265 DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball"
266 # @ECLASS-VARIABLE: HOMEPAGE
267 # @DESCRIPTION:
268 # Default value: http://www.mono-project.com/GtkSharp
269 HOMEPAGE="http://www.mono-project.com/GtkSharp"
270 # @ECLASS-VARIABLE: LICENSE
271 # @DESCRIPTION:
272 # Default value: LGPL-2.1
273 LICENSE="LGPL-2.1"
274
275 add_depend      ">=dev-lang/mono-2.0.1"
276 add_bdepend     ">=sys-apps/sed-4"
277 add_bdepend     "virtual/pkgconfig"
278 add_bdepend     ">=app-shells/bash-3.1"
279
280 IUSE="debug"
281 # @ECLASS-VARIABLE: S
282 # @DESCRIPTION:
283 # Default value: ${WORKDIR}/${TARBALL}-${PV}
284 S="${WORKDIR}/${TARBALL}-${PV}"
285 # @ECLASS-VARIABLE: SRC_URI
286 # @DESCRIPTION:
287 # Default value: mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2
288 if [[ ${TARBALL} == "gtk-sharp" ]]; then
289         SRC_URI="${SRC_URI}
290                 http://download.mono-project.com/sources/gtk-sharp212/${TARBALL}-${PV}.tar.bz2"
291 else
292         SRC_URI="${SRC_URI}
293                 mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2"
294 fi
295
296 # @FUNCTION: get_sharp_apis
297 # @USAGE: <type> <pkgconfig-package>
298 # @RETURN: .NET API files
299 # @DESCRIPTION:
300 # Given a valid pkg-config package, will return a list of API xml files.
301 # <type> can be either --prefixed or --bare. If prefixed, each API file
302 # will be prefixed with -I:
303 get_sharp_apis() {
304         [[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments"
305         get_sharp_assemblies "$@"
306 }
307
308 # @FUNCTION: get_sharp_assemblies
309 # @USAGE: <type> <pkgconfig-package>
310 # @RETURN: .NET .dll assemblies
311 # @DESCRIPTION:
312 # Given a valid pkg-config package, will return a list of .dll assemblies.
313 # <type> can be either --prefixed or --bare. If prefixed, each .dll file
314 # will be prefixed with -r:
315 get_sharp_assemblies() {
316         [[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments"
317         local string config=libs prefix="-r:"
318         local -a rvalue
319         [[ "${FUNCNAME[1]}" = "get_sharp_apis" ]] && config=cflags && prefix="-I:"
320         for string in $(pkg-config --${config} ${2} 2> /dev/null)
321         do
322                 rvalue+=( ${string#-?:} )
323         done
324
325         case $1 in
326                 --bare)
327                         :
328                         ;;
329                 --prefixed)
330                         for (( i=0 ; i< ${#rvalue[@]} ; i++ ))
331                         do
332                                 rvalue[$i]=${prefix}${rvalue[$i]}
333                         done
334                         ;;
335                 *)
336                         die "${FUNCNAME}: Unknown parameter"
337                         ;;
338         esac
339         echo "${rvalue[@]}"
340 }
341
342 # @FUNCTION: phase_hook
343 # @USAGE: <prefix>
344 # @DESCRIPTION:
345 # Looks for functions named <prefix>_caller_suffix and executes them.
346 # _caller_suffix is the calling function with the prefix
347 # gtk-sharp-module removed.
348 phase_hook() {
349         [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs one argument"
350         if [[ "$(type -t ${1}${FUNCNAME[1]#gtk-sharp-module})" = "function" ]]
351         then
352                 ebegin "Phase-hook: Running ${1}${FUNCNAME[1]#gtk-sharp-module}"
353                 ${1}${FUNCNAME[1]#gtk-sharp-module}
354                 eend 0
355         fi
356 }
357
358 # @FUNCTION: ac_path_prog_override
359 # @USAGE: <PROG> [path]
360 # @DESCRIPTION:
361 # Override AC_PATH_PROG() autoconf macros. Path will be set to " " if
362 # not specified.
363 ac_path_prog_override() {
364         if [[ ${#@} -lt 1 || ${#@} -gt 2 ]]
365         then
366                 eerror "${FUNCNAME[0]} requires at least one parameter and takes at most two:"
367                 eerror "AC_PATH_PROG(PARAM1, param2)"
368                 die "${FUNCNAME[0]} requires at least one parameter and takes at most two:"
369         fi
370         export  ac_cv_path_${1}="${2:- }"
371 }
372
373
374 # @FUNCTION: pkg_check_modules_override
375 # @USAGE: <GROUP> [package1] [package2]
376 # @DESCRIPTION:
377 # Will export the appropriate variables to override PKG_CHECK_MODULES autoconf
378 # macros, with the string " " by default. If packages are specified, they will
379 # be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted.
380 # LIBS and CFLAGS can also be specified per-package with the following syntax:
381 # @CODE
382 #       package=LIBS%CFLAGS
383 # @CODE
384 # = and % have no effect unless both are specified.
385 # Here is an example:
386 # @CODE
387 #       pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0
388 # @CODE
389 # The above example will do:
390 # export GASH_CFLAGS+=" -jule"
391 # export GASH_LIBS+=" "
392 # export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)"
393 # export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)"
394 #
395 # NOTE: If a package is not found, the string " " will be inserted in place of
396 # <GROUP>_CFLAGS  and <GROUP>_LIBS
397 pkg_check_modules_override() {
398         local package
399         local group="${1}"
400         local packages="${*:2}"
401         export ${group}_CFLAGS=" "
402         export ${group}_LIBS=" "
403
404         if [[ ${#@} -lt 1 ]]
405         then
406                 eerror "${FUNCNAME[0]} requires at least one parameter: GROUP"
407                 eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)"
408                 die "${FUNCNAME[0]} requires at least one parameter: GROUP"
409         fi
410
411         for package in $packages
412         do
413                 if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]]
414                 then
415                         package_cflag_libs=${package##*=}
416                         export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}"
417                         export ${group}_LIBS+=" ${package_cflag_libs##*\%}"
418                 else
419                         if pkg-config --exists $package
420                         then
421                                 export ${group}_CFLAGS+=" $(pkg-config --cflags $package)"
422                                 export ${group}_LIBS+=" $(pkg-config --libs $package)"
423                         else
424                         export ${group}_CFLAGS+=" "
425                         export ${group}_LIBS+=" "
426                         fi
427                 fi
428         done
429 }
430
431 # @FUNCTION: gtk-sharp-tarball-post_src_prepare
432 # @DESCRIPTION:
433 # Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references to
434 # local assemblies to the installed ones. Is only called by src_prepare when
435 # $GTK_SHARP_MODULE is a member of $gtk_sharp_module_list.
436 gtk-sharp-tarball-post_src_prepare() {
437         has "${EAPI:-0}" 2 && ! use prefix && EPREFIX=
438         cd "${S}/${GTK_SHARP_MODULE_DIR}"
439         sed -i \
440                 -e "s; \$(srcdir)/../glib/glib-api.xml; $(get_sharp_apis --bare glib-sharp-2.0);"                       \
441                 -e "s; ../pango/pango-api.xml; $(get_sharp_apis --bare pango-sharp-2.0);"                               \
442                 -e "s; ../atk/atk-api.xml; $(get_sharp_apis --bare atk-sharp-2.0);"                                     \
443                 -e "s; ../gdk/gdk-api.xml; $(get_sharp_apis --bare gdk-sharp-2.0);"                                     \
444                 -e "s; ../gtk/gtk-api.xml; $(get_sharp_apis --bare gtk-sharp-2.0);"                                     \
445                 -e "s; \.\./glib/glib-sharp.dll; $(get_sharp_assemblies --bare glib-sharp-2.0);g"                       \
446                 -e "s; \.\./pango/pango-sharp.dll; $(get_sharp_assemblies --bare pango-sharp-2.0);g"                    \
447                 -e "s; \.\./atk/atk-sharp.dll; $(get_sharp_assemblies --bare atk-sharp-2.0);g"                          \
448                 -e "s; \.\./gdk/gdk-sharp.dll; $(get_sharp_assemblies --bare gdk-sharp-2.0);g"                          \
449                 -e "s; \.\./gtk/gtk-sharp.dll; $(get_sharp_assemblies --bare gtk-sharp-2.0);g"                          \
450                 -e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;${EPREFIX}/usr/bin/gapi2-fixup;"                               \
451                 -e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;${EPREFIX}/usr/bin/gapi2-codegen;"                        \
452                 -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):"                                  \
453                 -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):"                     \
454                 $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles"
455 }
456
457 # @FUNCTION: gnome-sharp-tarball-post_src_prepare
458 # @DESCRIPTION:
459 # Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references to
460 # local assemblies to the installed ones. Is only called by src_prepare when
461 # $GTK_SHARP_MODULE is a member of $gnome_sharp_module_list.
462 gnome-sharp-tarball-post_src_prepare() {
463         cd "${S}/${GTK_SHARP_MODULE_DIR}"
464         sed -i  \
465                 -e "s; ../gnomevfs/gnome-vfs-api.xml; $(get_sharp_apis --bare gnome-vfs-sharp-2.0);"                    \
466                 -e "s; ../art/art-api.xml; $(get_sharp_apis --bare art-sharp-2.0);"                                     \
467                 -e "s; \.\./art/art-sharp.dll; $(get_sharp_assemblies --bare art-sharp-2.0);g"                          \
468                 -e "s; \.\./gnomevfs/gnome-vfs-sharp.dll; $(get_sharp_assemblies --bare gnome-vfs-sharp-2.0);g"         \
469                 -e "s;/r:\$(top_builddir)/art/art-sharp.dll;$(get_sharp_assemblies --prefixed art-sharp-2.0);"          \
470                 -e "s;/r:\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_assemblies --prefixed gnome-sharp-2.0);"    \
471                 $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles"
472 }
473
474 # @FUNCTION: gtk-sharp-module_src_prepare
475 # @DESCRIPTION:
476 # Runs autopatch from base.eclass, eautoreconf if EAUTORECONF is set to any
477 # value.
478 # Contains a phase_hook, runs very last.
479 # phase_hook prefix trigger: ${TARBALL}-tarball-post
480 # Is exported.
481 gtk-sharp-module_src_prepare() {
482         base_src_prepare
483 # @ECLASS-VARIABLE: EAUTORECONF
484 # @DESCRIPTION:
485 # If set, EAUTORECONF will be run during src_prepare.
486         [[ ${EAUTORECONF} ]] && eautoreconf
487         phase_hook ${TARBALL}-tarball-post
488         elibtoolize
489 }
490
491 # @FUNCTION: gtk-sharp-tarball_src_configure
492 # @DESCRIPTION:
493 # Sets some environment variables that will allow us to make the dependencies
494 # for each ebuild be only its own dependencies, without patching configure.
495 # Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE
496 # is a member of $gtk_sharp_module_list.
497 gtk-sharp-tarball_src_configure() {
498         pkg_check_modules_override GLIB gobject-2.0
499         pkg_check_modules_override GIO gio-2.0
500         pkg_check_modules_override PANGO pango
501         pkg_check_modules_override ATK atk
502         pkg_check_modules_override GTK gtk+-2.0
503         pkg_check_modules_override GLADE libglade-2.0
504 }
505
506 # @FUNCTION: gnome-sharp-tarball_src_configure
507 # @DESCRIPTION:
508 # Sets some environment variables that will allow us to make the dependencies
509 # for each ebuild be only its own dependencies. Without patching configure.
510 # Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE
511 # is a member of $gnome_sharp_module_list.
512 gnome-sharp-tarball_src_configure() {
513         has "${EAPI:-0}" 2 && ! use prefix && EPREFIX=
514         pkg_check_modules_override GLADESHARP glade-sharp-2.0
515         pkg_check_modules_override GAPI gapi-2.0
516         ac_path_prog_override GAPI_PARSER "${EPREFIX}"/usr/bin/gapi2-parser
517         ac_path_prog_override GAPI_CODEGEN "${EPREFIX}"/usr/bin/gapi2-codegen
518         ac_path_prog_override GAPI_FIXUP "${EPREFIX}"/usr/bin/gapi2-fixup
519 }
520
521 # @FUNCTION: gtk-sharp-module_src_configure
522 # @USAGE: [econf-arguments]
523 # @DESCRIPTION:
524 # Calls econf with some default values.
525 # Contains a phase_hook, run before econf.
526 # phase_hook prefix trigger: ${TARBALL}-tarball
527 # Is exported.
528 gtk-sharp-module_src_configure() {
529         phase_hook ${TARBALL}-tarball
530         econf   --disable-static \
531                 --disable-dependency-tracking \
532                 --disable-maintainer-mode \
533                 $(use debug &&echo "--enable-debug" ) \
534                 ${@} || die "econf failed"
535 }
536
537 # @FUNCTION: gtk-sharp-module_src_compile
538 # @DESCRIPTION:
539 # Calls emake in the subdir of the module.
540 # Sets CSC=/usr/bin/mcs. Deletes top_srcdir Makefiles to prevent recursing in
541 # case we missed some dll references.
542 # Is exported.
543 gtk-sharp-module_src_compile() {
544         rm -f "${S}"/Makefile* &> /dev/null
545         cd "${S}/${GTK_SHARP_MODULE_DIR}"
546         emake CSC=/usr/bin/mcs || die "emake failed"
547 }
548
549 # @FUNCTION: gtk-sharp-module_src_install
550 # @DESCRIPTION:
551 # Installs the module. Fixes up lib paths so they're multilib-safe.
552 # Gets rid of .la files.
553 # Is exported.
554 gtk-sharp-module_src_install() {
555         cd "${S}/${GTK_SHARP_MODULE_DIR}"
556         emake DESTDIR="${D}" install || die "emake install failed"
557         mono_multilib_comply
558         find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
559         [[  $(find "${D}" -type f|wc -l) -lt 3 ]] && die "Too few files. This smells like a failed install."
560 }
561
562 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install