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

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.20