/[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.13 - (show annotations) (download)
Fri Jan 23 20:28:58 2009 UTC (5 years, 6 months ago) by loki_val
Branch: MAIN
Changes since 1.12: +3 -3 lines
I always forget that its !!, not ! in EAPI-2 if you really mean it.

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

  ViewVC Help
Powered by ViewVC 1.1.20