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