/[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.7 - (show annotations) (download)
Wed Dec 3 20:44:04 2008 UTC (5 years, 9 months ago) by loki_val
Branch: MAIN
Changes since 1.6: +2 -2 lines
Silence irrelevant error messages due to packages checked by pkg-config not being installed.

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.6 2008/11/28 00:20:08 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
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 # In some cases the desired module cannot be configured to be built on its own.
19 # This variable allows for the setting of additional configure-deps.
20 GTK_SHARP_MODULE_DEPS="${GTK_SHARP_MODULE_DEPS}"
21
22 # Allow ebuilds to set a value for the required GtkSharp version; default to
23 # ${PV}.
24 GTK_SHARP_REQUIRED_VERSION=${GTK_SHARP_REQUIRED_VERSION:=${PV%.*}}
25
26 # Version number used to differentiate between unversioned 1.0 series and the
27 # versioned 2.0 series (2.0 series has 2 or 2.0 appended to various paths and
28 # scripts). Default to ${SLOT}.
29 GTK_SHARP_SLOT="${GTK_SHARP_SLOT:=${SLOT}}"
30 GTK_SHARP_SLOT_DEC="${GTK_SHARP_SLOT_DEC:=-${GTK_SHARP_SLOT}.0}"
31
32 # Set some defaults.
33 DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module"
34 HOMEPAGE="http://www.mono-project.com/GtkSharp"
35
36 LICENSE="LGPL-2.1"
37
38 DEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*
39 >=sys-apps/sed-4
40 >=dev-util/pkgconfig-0.23"
41 RDEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
42
43 RESTRICT="test"
44
45 # The GtkSharp modules are currently divided into three seperate tarball
46 # distributions. Figure out which of these our component belongs to. This is
47 # done to avoid passing bogus configure parameters, as well as to return the
48 # correct tarball to download. Note that this makes ${GTK_SHARP_TARBALL_PREFIX}
49 # obsolete.
50 gnome_sharp_module_list="art gnome gnomevfs"
51 gnome_desktop_sharp_module_list="gnome-print gnome-panel gtkhtml gtksourceview nautilusburn rsvg vte wnck"
52
53 if [[ " ${gnome_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then
54 my_module_list="${gnome_sharp_module_list}"
55 my_tarball="gnome-sharp"
56
57 # While gnome-desktop-sharp is a part of gnome-desktop-sharp (0_o) it is not a
58 # configurable component, so we don't want to put it into the module list.
59 # Result is that we have to check for it manually here and in src_configure.
60 elif [[ " ${gnome_desktop_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ||
61 "${GTK_SHARP_MODULE}" == "gnome-desktop" ]] ; then
62 my_module_list="${gnome_desktop_sharp_module_list}"
63 my_tarball="gnome-desktop-sharp"
64 else
65 die "unknown GtkSharp module: ${GTK_SHARP_MODULE}"
66 fi
67
68 MY_P=${my_tarball}-${PV}
69 S=${WORKDIR}/${MY_P}
70
71 # Since all interesting versions are hosted on the GNOME server anyway it's the
72 # only one we support, for now.
73 SRC_URI="mirror://gnome/sources/${my_tarball}/${PV%.*}/${MY_P}.tar.bz2
74 mirror://gentoo/${MY_P}-configurable.diff.gz
75 http://dev.gentoo.org/~ikelos/devoverlay-distfiles/${MY_P}-configurable.diff.gz"
76
77
78 ### Public functions.
79
80 gtk-sharp-module_fix_files() {
81 # Change references like "/r:../art/art-sharp.dll" ->
82 # "/r:/usr/lib/pkgconfig/../../lib/mono/gtk-sharp-2.0/art-sharp.dll" and references like
83 # "../glib/glib-sharp.xml" or "$(top_srcdir)/glib/glib-sharp.xml" ->
84 # "${gapi_dir}/glib-sharp.xml".
85 #
86 # We also make sure to call the installed gapi-fixup and gapi-codegen and
87 # not the ones that would be built locally.
88 local gapi_dir="${ROOT}/usr/share/gapi${GTK_SHARP_SLOT_DEC}"
89
90 local makefiles=( $(find "${S}" -name Makefile.in) )
91 sed -i \
92 -e "s;\(\.\.\|\$(top_srcdir)\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).xml;${gapi_dir}/\2.xml;g" \
93 -e "s; \.\./art/art-sharp.dll; $(get_sharp_lib art-sharp-2.0);g" \
94 -e "s;\.\./gnomevfs/gnome-vfs-sharp.dll;$(get_sharp_lib gnome-vfs-sharp-2.0);g" \
95 -e "s;\$(top_builddir)/art/art-sharp.dll;$(get_sharp_lib art-sharp-2.0);" \
96 -e "s;\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_lib gnome-sharp-2.0);" \
97 "${makefiles[@]}" || die "failed to fix GtkSharp makefiles"
98 }
99
100 get_sharp_lib() {
101 S="$(pkg-config --libs ${1})"
102 S=${S%% *}
103 printf ${S#-r:}
104 }
105
106 gtk-sharp-module_src_prepare() {
107 # Make selecting components configurable.
108 epatch "${WORKDIR}/${MY_P}-configurable.diff"
109
110 # Disable building samples, #16015.
111 sed -i -e "s:sample::" "${S}/Makefile.am" || die
112
113 eautoreconf
114
115 cd "${S}/${GTK_SHARP_MODULE_DIR}"
116
117 gtk-sharp-module_fix_files &> /dev/null
118 }
119
120 gtk-sharp-module_src_configure() {
121 # Disable any module besides one(s) we want.
122 local module gtk_sharp_conf
123
124 einfo "Configuring to build ${PN} module ..."
125
126 # No bogus configure parameters please.
127 [[ ${GTK_SHARP_MODULE} == "gnome-desktop" ]] && GTK_SHARP_MODULE=
128
129 for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do
130 my_module_list=${my_module_list/${module}/}
131 done
132 for module in ${my_module_list} ; do
133 gtk_sharp_conf="${gtk_sharp_conf} --disable-${module} "
134 done
135 for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do
136 gtk_sharp_conf="${gtk_sharp_conf} --enable-${module} "
137 done
138
139 cd "${S}"
140 econf ${@} ${gtk_sharp_conf} || die "econf failed"
141 }
142
143 gtk-sharp-module_src_compile() {
144
145 cd "${S}/${GTK_SHARP_MODULE_DIR}"
146 LANG=C emake || die "emake failed"
147 }
148
149 gtk-sharp-module_src_install() {
150 cd "${GTK_SHARP_MODULE_DIR}"
151 LANG=C emake DESTDIR=${D} install || die "emake install failed"
152 }
153
154 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install

  ViewVC Help
Powered by ViewVC 1.1.20