/[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.2 - (show annotations) (download)
Wed Nov 26 00:54:41 2008 UTC (5 years, 8 months ago) by loki_val
Branch: MAIN
Changes since 1.1: +2 -1 lines
sed is only a dep

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.1 2008/11/25 23:52:03 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 RDEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
41
42 RESTRICT="test"
43
44 # The GtkSharp modules are currently divided into three seperate tarball
45 # distributions. Figure out which of these our component belongs to. This is
46 # done to avoid passing bogus configure parameters, as well as to return the
47 # correct tarball to download. Note that this makes ${GTK_SHARP_TARBALL_PREFIX}
48 # obsolete.
49 gtk_sharp_module_list="glade"
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 [[ " ${gtk_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then
54 my_module_list="${gtk_sharp_module_list}"
55 my_tarball="gtk-sharp"
56 elif [[ " ${gnome_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then
57 my_module_list="${gnome_sharp_module_list}"
58 my_tarball="gnome-sharp"
59
60 # While gnome-desktop-sharp is a part of gnome-desktop-sharp (0_o) it is not a
61 # configurable component, so we don't want to put it into the module list.
62 # Result is that we have to check for it manually here and in src_configure.
63 elif [[ " ${gnome_desktop_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ||
64 "${GTK_SHARP_MODULE}" == "gnome-desktop" ]] ; then
65 my_module_list="${gnome_desktop_sharp_module_list}"
66 my_tarball="gnome-desktop-sharp"
67 else
68 die "unknown GtkSharp module: ${GTK_SHARP_MODULE}"
69 fi
70
71 MY_P=${my_tarball}-${PV}
72 S=${WORKDIR}/${MY_P}
73
74 # Since all interesting versions are hosted on the GNOME server anyway it's the
75 # only one we support, for now.
76 SRC_URI="mirror://gnome/sources/${my_tarball}/${PV%.*}/${MY_P}.tar.bz2
77 mirror://gentoo/${MY_P}-configurable.diff.gz
78 http://dev.gentoo.org/~ikelos/devoverlay-distfiles/${MY_P}-configurable.diff.gz"
79
80
81 ### Public functions.
82
83 gtk-sharp-module_fix_files() {
84 # Change references like "/r:../glib/glib-sharp.dll" ->
85 # "/r:${GTK_SHARP_LIB_DIR}/glib-sharp.dll" and references like
86 # "../glib/glib-sharp.xml" or "$(top_srcdir)/glib/glib-sharp.xml" ->
87 # "${GAPI_DIR}/glib-sharp.xml".
88 #
89 # We also make sure to call the installed gapi-fixup and gapi-codegen and
90 # not the ones that would be built locally.
91 local gapi_dir="${ROOT}/usr/share/gapi${GTK_SHARP_SLOT_DEC}"
92 local gapi_fixup="gapi${GTK_SHARP_SLOT}-fixup"
93 local gapi_codegen="gapi${GTK_SHARP_SLOT}-codegen"
94
95 # This is very likely to be of use outside of this function as well, so make
96 # it public.
97 GTK_SHARP_LIB_DIR="${ROOT}/usr/$(get_libdir)/mono/gtk-sharp${GTK_SHARP_SLOT_DEC}"
98
99 local makefiles="$(find ${S} -name Makefile.in)"
100 sed -i -e "s;\(\.\.\|\$(top_srcdir)\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).xml;${gapi_dir}/\2.xml;g" \
101 -e "s;/r:\(\.\./\)*[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;/r:${GTK_SHARP_LIB_DIR}/\2.dll;g" \
102 -e "s;\.\./[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;${GTK_SHARP_LIB_DIR}/\1.dll;g" \
103 -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \
104 -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \
105 -e "s:\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe:${gapi_fixup}:" \
106 -e "s:\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe:${gapi_codegen}:" \
107 ${makefiles} || die "failed to fix GtkSharp makefiles"
108
109 # Oh GtkSharp, why do your pkgconfig entries suck donkey ass? Why do
110 # gnome-desktop-sharp modules use ${assemblies_dir} for Libs: instead of
111 # the convention you yourself introduced for gnome-sharp, which just uses
112 # @PACKAGE_VERSION@? Are you just trying to annoy me?
113 local pcins="$(find ${S} -name *.pc.in)"
114 sed -i -e 's:^libdir.*:libdir=@libdir@:' \
115 -e "s:\${assemblies_dir}:\${libdir}/mono/gtk-sharp${GTK_SHARP_SLOT_DEC}:" \
116 ${pcins} || die "failed to fix GtkSharp pkgconfig entries"
117 }
118
119 gtk-sharp-module_src_prepare() {
120 # Make selecting components configurable.
121 epatch ${WORKDIR}/${MY_P}-configurable.diff
122
123 # Fixes support with pkgconfig-0.17, #92503.
124 sed -i -e 's/\<PKG_PATH\>/GTK_SHARP_PKG_PATH/g' \
125 -e ':^CFLAGS=:d' \
126 ${S}/configure.in
127
128 # Fix install data hook, #161093.
129 if [ -f "${S}/sample/gconf/Makefile.am" ]
130 then
131 sed -i -e 's/^install-hook/install-data-hook/' \
132 ${S}/sample/gconf/Makefile.am || die
133 fi
134
135 # Disable building samples, #16015.
136 sed -i -e "s:sample::" ${S}/Makefile.am || die
137
138 eautoreconf
139
140 cd ${S}/${GTK_SHARP_MODULE_DIR}
141
142 gtk-sharp-module_fix_files
143 }
144
145 gtk-sharp-module_src_configure() {
146 # Disable any module besides one(s) we want.
147 local module gtk_sharp_conf
148
149 einfo "Configuring to build ${PN} module ..."
150
151 # No bogus configure parameters please.
152 [[ ${GTK_SHARP_MODULE} == "gnome-desktop" ]] && GTK_SHARP_MODULE=
153
154 for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do
155 my_module_list=${my_module_list/${module}/}
156 done
157 for module in ${my_module_list} ; do
158 gtk_sharp_conf="${gtk_sharp_conf} --disable-${module} "
159 done
160 for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do
161 gtk_sharp_conf="${gtk_sharp_conf} --enable-${module} "
162 done
163
164 cd ${S}
165 econf ${@} ${gtk_sharp_conf} || die "econf failed"
166 }
167
168 gtk-sharp-module_src_compile() {
169
170 cd ${S}/${GTK_SHARP_MODULE_DIR}
171 LANG=C emake -j1 || die "emake failed"
172 }
173
174 gtk-sharp-module_src_install() {
175 cd ${GTK_SHARP_MODULE_DIR}
176 LANG=C emake GACUTIL_FLAGS="/root ${D}/usr/$(get_libdir) /gacdir /usr/$(get_libdir) /package gtk-sharp${GTK_SHARP_SLOT_DEC}" \
177 DESTDIR=${D} install || die "emake install failed"
178 }
179
180 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install

  ViewVC Help
Powered by ViewVC 1.1.20