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

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20