/[gentoo-x86]/eclass/gtk-sharp-module.eclass
Gentoo

Diff of /eclass/gtk-sharp-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20