From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1LSfgZ-0005Ts-2E for garchives@archives.gentoo.org; Thu, 29 Jan 2009 22:48:35 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 84A86E058B; Thu, 29 Jan 2009 22:48:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C7036E058B for ; Thu, 29 Jan 2009 22:48:33 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id DD28D6464B for ; Thu, 29 Jan 2009 22:48:32 +0000 (UTC) Received: from loki_val by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1LSfgK-0002jW-Mn for gentoo-commits@lists.gentoo.org; Thu, 29 Jan 2009 22:48:22 +0000 From: "Peter Alfredsen (loki_val)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, loki_val@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: gtk-sharp-module.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: gtk-sharp-module.eclass X-VCS-Directories: eclass X-VCS-Committer: loki_val X-VCS-Committer-Name: Peter Alfredsen Content-Type: text/plain; charset=utf8 Message-Id: Sender: Peter Alfredsen Date: Thu, 29 Jan 2009 22:48:20 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 129f38c6-4567-4e71-adc9-edfbedeb7f87 X-Archives-Hash: 82c34199e662f732faa3968f27b91c0c loki_val 09/01/29 22:48:20 Modified: gtk-sharp-module.eclass Log: New and spiffy version of the old eclass. Revision Changes Path 1.14 eclass/gtk-sharp-module.eclass file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gtk-sharp-m= odule.eclass?rev=3D1.14&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gtk-sharp-m= odule.eclass?rev=3D1.14&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gtk-sharp-m= odule.eclass?r1=3D1.13&r2=3D1.14 Index: gtk-sharp-module.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- gtk-sharp-module.eclass 23 Jan 2009 20:28:58 -0000 1.13 +++ gtk-sharp-module.eclass 29 Jan 2009 22:48:20 -0000 1.14 @@ -1,130 +1,173 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v 1.13= 2009/01/23 20:28:58 loki_val Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v 1.14= 2009/01/29 22:48:20 loki_val Exp $ =20 -# Author : Peter Johanson , butchered by ikelos, the= n loki_val. -# Based off of original work in gst-plugins.eclass by +# @ECLASS: gtk-sharp-module.eclass +# @MAINTAINER: +# dotnet@gentoo.org +# @BLURB: Manages the modules of the gtk-, gnome-, and gnome-desktop-sha= rp tarballs +# @DESCRIPTION: +# This eclass provides phase functions and helper functions for the modu= les +# of the gtk-sharp, gnome-sharp and gnome-desktop-sharp tarballs. +# PLEASE TAKE NOTE: ONLY FOR EAPI-2 EBUILDS =20 -# Note that this breaks compatibility with the original gtk-sharp-compon= ent -# eclass. +WANT_AUTOMAKE=3Dnone +WANT_AUTOCONF=3Dnone =20 inherit eutils mono multilib autotools base versionator =20 -# Get the name of the component to build and the build dir; by default, -# extract it from the ebuild's name. +# @ECLASS-VARIABLE: GTK_SHARP_MODULE +# @DESCRIPTION: +# The name of the Gtk# module. +# Default value: ${PN/-sharp/} GTK_SHARP_MODULE=3D${GTK_SHARP_MODULE:=3D${PN/-sharp/}} -GTK_SHARP_MODULE_DIR=3D${GTK_SHARP_MODULE_DIR:=3D${PN/-sharp/}} - -# Allow ebuilds to set a value for the required GtkSharp version. -GTK_SHARP_REQUIRED_VERSION=3D${GTK_SHARP_REQUIRED_VERSION} =20 -# Version number used to differentiate between unversioned 1.0 series an= d the -# versioned 2.0 series (2.0 series has 2 or 2.0 appended to various path= s and -# scripts). Default to ${SLOT}. -GTK_SHARP_SLOT=3D"${GTK_SHARP_SLOT:=3D${SLOT}}" -GTK_SHARP_SLOT_DEC=3D"${GTK_SHARP_SLOT_DEC:=3D-${GTK_SHARP_SLOT}.0}" +# @ECLASS-VARIABLE: GTK_SHARP_MODULE_DIR +# @DESCRIPTION: +# The subdirectory of S in which GTK_SHARP_MODULE is installed. +# Default value: ${PN/-sharp/} +GTK_SHARP_MODULE_DIR=3D${GTK_SHARP_MODULE_DIR:=3D${PN/-sharp/}} =20 -#Handy little var +# @ECLASS-VARIABLE: GTK_SHARP_REQUIRED_VERSION +# @DESCRIPTION: +# The version of the gtk-sharp tarball this package requires. +# Optional. +GTK_SHARP_REQUIRED_VERSION=3D"${GTK_SHARP_REQUIRED_VERSION}" + +# @ECLASS-VARIABLE: gapi_users_list +# @DESCRIPTION: +# List of modules that use one of gapi2-codegen, gapi2-fixup or gapi2-pa= rser +# No ebuild-serviceable parts inside. +gapi_users_list=3D"art gnome gnomevfs ${gnome_desktop_sharp_module_list}= atk gtk gdk glade pango" + +# @ECLASS-VARIABLE: PV_MAJOR +# @DESCRIPTION: +# The first two components of the PV variable. PV_MAJOR=3D$(get_version_component_range 1-2) =20 -# Set some defaults. -DESCRIPTION=3D"GtkSharp's ${GTK_SHARP_MODULE} module" -HOMEPAGE=3D"http://www.mono-project.com/GtkSharp" - -LICENSE=3D"LGPL-2.1" -DEPEND=3D" - >=3Ddev-lang/mono-2.0.1 - >=3Dsys-apps/sed-4 - >=3Ddev-util/pkgconfig-0.23 - " -RDEPEND=3D" - >=3Ddev-lang/mono-2.0.1 - " - -IUSE=3D"debug" - - -# The GtkSharp modules are currently divided into three seperate tarball -# distributions. Figure out which of these our component belongs to. - -gtk_sharp_module_list=3D"glib glade gtk gdk atk pango gtk-dotnet gtk-gap= i" -gnome_sharp_module_list=3D"art gnome gnomevfs gconf" -gnome_desktop_sharp_module_list=3D"gnome-desktop gnome-print gnome-panel= gtkhtml gtksourceview nautilusburn rsvg vte wnck" - -has "${GTK_SHARP_MODULE}" ${gtk_sharp_module_list} && GTK_SHARP_REQUIRED= _VERSION=3D${PV} - - +# @FUNCTION: add_bdepends +# @USAGE: +# @DESCRIPTION: +# Adds to the DEPEND variable add_bdepend() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument" DEPEND=3D"${DEPEND} $@" } =20 +# @FUNCTION: add_rdepends +# @USAGE: +# @DESCRIPTION: +# Adds to the RDEPEND variable add_rdepend() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument" RDEPEND=3D"${RDEPEND} $@" } =20 +# @FUNCTION: add_depend +# @USAGE: +# @DESCRIPTION: +# Adds to the DEPEND and RDEPEND variables add_depend() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument" DEPEND=3D"${DEPEND} $@" RDEPEND=3D"${RDEPEND} $@" } =20 -gsm_get_tarball() { - has "${GTK_SHARP_MODULE}" ${gtk_sharp_module_list} \ - && echo "gtk-sharp" && return 0 - has "${GTK_SHARP_MODULE}" ${gnome_sharp_module_list} \ - && echo "gnome-sharp" && return 0 - has "${GTK_SHARP_MODULE}" ${gnome_desktop_sharp_module_list} \ - && echo "gnome-desktop-sharp" && return 0 - die "unknown GtkSharp module: ${GTK_SHARP_MODULE}" -} - -[[ "${PN}" !=3D "gtk-sharp-gapi" ]] && add_bdepend "=3Ddev-dotnet/gtk-sh= arp-gapi-${GTK_SHARP_REQUIRED_VERSION}*" -[[ "${PN}" !=3D "gtk-sharp-gapi" ]] && add_bdepend "!!=3Ddev-dotnet/gtk-= sharp-gapi-2.12.7-r5" -[[ "${PN}" !=3D "gtk-sharp-gapi" ]] && add_bdepend "!!=3Ddev-dotnet/gtk-= sharp-gapi-2.12.7-r6" - -has "${GTK_SHARP_MODULE}" ${gnome_sharp_module_list} ${gnome_desktop_sha= rp_module_list} gtk-dotnet glade \ - && add_depend "=3Ddev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*" -has "${GTK_SHARP_MODULE}" gtk gdk atk pango gtk-dotnet parser \ - && add_depend "=3Ddev-dotnet/glib-sharp-${GTK_SHARP_REQUIRED_VERSION}*" -has "${GTK_SHARP_MODULE}" ${gnome_desktop_sharp_module_list} \ - && add_depend ">=3Ddev-dotnet/gnome-sharp-${PV_MAJOR}" +# @ECLASS-VARIABLE: TARBALL +# @DESCRIPTION: +# The GtkSharp modules are currently divided into three seperate tarball +# distributions. The TARBALL variable holds the name of the tarball +# to which GTK_SHARP_MODULE belongs. +case ${GTK_SHARP_MODULE} in + glib|glade|gtk|gdk|atk|pango|gtk-dotnet|gtk-gapi|gtk-docs) + TARBALL=3D"gtk-sharp" + case ${PVR} in + 2.12.7-r1*) + SRC_URI=3D"mirror://gentoo/gtk-sharp-2.12.0-patches.tar.bz2 + mirror://gentoo/gtk-sharp-2.12.7.patch.bz2" + #Upstream: https://bugzilla.novell.com/show_bug.cgi?id=3D$bugno + #Upstream bug #421063 for the parallel-make patches + #Upstream bug #470390 for the gtk-sharp-2.12.7.patch + PATCHES=3D( "${WORKDIR}/patches/${TARBALL}-2.12.0-parallelmake.patch= " + "${WORKDIR}/patches/${TARBALL}-2.12.0-doc-parallelmake.patch= " + "${WORKDIR}/${TARBALL}-2.12.7.patch" ) + EAUTORECONF=3D"YES" + add_bdepend "=3Dsys-devel/automake-1.10*" + add_bdepend ">=3Dsys-devel/autoconf-2.61" + ;; + esac + ;; + art|gnome|gnomevfs|gconf) + TARBALL=3D"gnome-sharp" + add_depend "=3Ddev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*" + has "${GTK_SHARP_MODULE}" "${gapi_users_list}" && \ + add_bdepend "=3Ddev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSIO= N}*" + ;; + gnome-desktop|gnome-print|gnome-panel|gtkhtml|gtksourceview|nautilusbur= n|rsvg|vte|wnck) + TARBALL=3D"gnome-desktop-sharp" + add_depend "=3Ddev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*" + add_depend "=3Ddev-dotnet/gnome-sharp-${PV_MAJOR}*" + add_bdepend "=3Ddev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION= }*" + ;; + *) + eerror "Huh? Sonny boy, looks like your GTK_SHARP_MODULE is not on the= approved list. BAILING!" + die "How did we get here!!?" + ;; +esac =20 case ${PF} in #gtk-sharp tarball + gtk-sharp-docs*) + add_depend ">=3Dvirtual/monodoc-2.0" + ;; gtk-sharp-gapi*) add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" add_depend "dev-perl/XML-LibXML" ;; gtk-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" add_depend "~dev-dotnet/atk-sharp-${PV}" add_depend "~dev-dotnet/gdk-sharp-${PV}" add_depend "~dev-dotnet/pango-sharp-${PV}" ;; gdk-sharp-*) - add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" add_depend "x11-libs/gtk+:2" add_depend "~dev-dotnet/pango-sharp-${PV}" + add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" ;; atk-sharp-*) - add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" add_depend "dev-libs/atk" + add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" ;; glib-sharp-*) add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" add_depend "dev-libs/glib:2" ;; pango-sharp-*) - add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" add_depend "x11-libs/pango" + add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" ;; gtk-dotnet-*) - add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" + add_depend "~dev-dotnet/glib-sharp-${PV}" add_depend "~dev-dotnet/gdk-sharp-${PV}" add_depend "~dev-dotnet/pango-sharp-${PV}" - add_depend "!dev-lang/mono[minimal]" + add_depend "~dev-dotnet/gtk-sharp-${PV}" + add_depend "dev-lang/mono[-minimal]" + add_rdepend "!<=3Ddev-dotnet/gtk-sharp-2.12.7:2" ;; glade-sharp-*) + add_bdepend "~dev-dotnet/gtk-sharp-gapi-${PV}" + add_depend "~dev-dotnet/glib-sharp-${PV}" add_depend "~dev-dotnet/atk-sharp-${PV}" add_depend "~dev-dotnet/gdk-sharp-${PV}" + add_depend "~dev-dotnet/gtk-sharp-${PV}" add_depend "~dev-dotnet/pango-sharp-${PV}" add_depend ">=3Dgnome-base/libglade-2.3.6" ;; @@ -182,206 +225,295 @@ ;; esac =20 +# @ECLASS-VARIABLE: DESCRIPTION +# @DESCRIPTION: +# Default value: GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL}= tarball +DESCRIPTION=3D"GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} t= arball" +# @ECLASS-VARIABLE: HOMEPAGE +# @DESCRIPTION: +# Default value: http://www.mono-project.com/GtkSharp +HOMEPAGE=3D"http://www.mono-project.com/GtkSharp" +# @ECLASS-VARIABLE: DESCRIPTION +# @DESCRIPTION: +# Default value: LGPL-2.1 +LICENSE=3D"LGPL-2.1" =20 +add_depend ">=3Ddev-lang/mono-2.0.1" +add_bdepend ">=3Dsys-apps/sed-4" +add_bdepend ">=3Ddev-util/pkgconfig-0.23" +add_bdepend ">=3Dapp-shells/bash-3.1" =20 -GSM_P=3D$(gsm_get_tarball)-${PV} -S=3D${WORKDIR}/${GSM_P} -SRC_URI=3D"mirror://gnome/sources/$(gsm_get_tarball)/${PV%.*}/${GSM_P}.t= ar.bz2" - -if [[ "${GSM_P%.*}" =3D "gtk-sharp-2.12" ]] -then - SRC_URI=3D"${SRC_URI} - mirror://gentoo/gtk-sharp-2.12.0-patches.tar.bz2" - #Upstream: https://bugzilla.novell.com/show_bug.cgi?id=3D$bugno - #Upstream bug #421063 - PATCHES=3D( "${WORKDIR}/patches/$(gsm_get_tarball)-2.12.0-parallelmake.= patch" - "${WORKDIR}/patches/$(gsm_get_tarball)-2.12.0-doc-parallelmake.= patch" ) - EAUTORECONF=3D"YES" -fi - - -### Public functions. - -gtk-sharp-module_fix_files() { - # Change references like "/r:../art/art-sharp.dll" -> - # "/r:/usr/lib/pkgconfig/../../lib/mono/gtk-sharp-2.0/art-sharp.dll" an= d references like - # "../glib/glib-sharp.xml" or "$(top_srcdir)/glib/glib-sharp.xml" -> - # "${gapi_dir}/glib-sharp.xml". - # - # We also make sure to call the installed gapi-fixup and gapi-codegen a= nd - # not the ones that would be built locally. - local gapi_dir=3D"${ROOT}/usr/share/gapi${GTK_SHARP_SLOT_DEC}" - local GAPI_FIXUP=3D"gapi2-fixup" - local GAPI_CODEGEN=3D"gapi2-codegen" - - local makefiles=3D( $(find "${S}" -name Makefile.in) ) - sed -i \ - -e "s;\(\.\.\|\$(top_srcdir)\|\$(srcdir)/\.\.\)/[[:alpha:]]*/\([[:alph= a:]]*\(-[[:alpha:]]*\)*\).xml;${gapi_dir}/\2.xml;g" \ - -e "s; \.\./glib/glib-sharp.dll; $(get_sharp_lib glib-sharp-2.0);g" \ - -e "s; \.\./pango/pango-sharp.dll; $(get_sharp_lib pango-sharp-2.0);g"= \ - -e "s; \.\./art/art-sharp.dll; $(get_sharp_lib art-sharp-2.0);g" \ - -e "s; \.\./atk/atk-sharp.dll; $(get_sharp_lib atk-sharp-2.0);g" \ - -e "s; \.\./gdk/gdk-sharp.dll; $(get_sharp_lib gdk-sharp-2.0);g" \ - -e "s; \.\./gtk/gtk-sharp.dll; $(get_sharp_lib gtk-sharp-2.0);g" \ - -e "s;\.\./gnomevfs/gnome-vfs-sharp.dll;$(get_sharp_lib gnome-vfs-shar= p-2.0);g" \ - -e "s;\$(top_builddir)/art/art-sharp.dll;$(get_sharp_lib art-sharp-2.0= );" \ - -e "s;\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_lib gnome-sha= rp-2.0);" \ - -e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;${GAPI_FIXUP}= ;" \ - -e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;${GAPI_C= ODEGEN};" \ - -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):"= \ - -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(I= NCLUDE_API):" \ - "${makefiles[@]}" || die "failed to fix GtkSharp makefiles" -} - -get_sharp_lib() { - S=3D"$(pkg-config --libs ${1})" - S=3D${S%% *} - printf ${S#-r:} -} - -gtk-sharp_tarball_src_prepare() { - local package - sed -i -e '/SUBDIRS/s/ glib / /' \ - -e '/SUBDIRS/s/ glade / /' \ - -e '/SUBDIRS/s/ sample / /' \ - -e '/SUBDIRS/s/ doc/ /' \ - Makefile.am || die "failed sedding sense into gtk-sharp's Makefile.am" - for package in GLIB PANGO ATK GTK +IUSE=3D"debug" +# @ECLASS-VARIABLE: HOMEPAGE +# @DESCRIPTION: +# Default value: ${WORKDIR}/${TARBALL}-${PV} +S=3D"${WORKDIR}/${TARBALL}-${PV}" +# @ECLASS-VARIABLE: SRC_URI +# @DESCRIPTION: +# Default value: mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL= }-${PV}.tar.bz2 +SRC_URI=3D"${SRC_URI} + mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2" + +# @FUNCTION: get_sharp_apis +# @USAGE: +# @RETURN: .NET API files +# @DESCRIPTION: +# Given a valid pkg-config package, will return a list of API xml files. +# can be either --prefixed or --bare. If prefixed, each API file +# will be prefixed with -I: +get_sharp_apis() { + [[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments" + get_sharp_assemblies "$@" +} + +# @FUNCTION: get_sharp_assemblies +# @USAGE: +# @RETURN: .NET .dll assemblies +# @DESCRIPTION: +# Given a valid pkg-config package, will return a list of .dll assemblie= s. +# can be either --prefixed or --bare. If prefixed, each .dll file +# will be prefixed with -r: +get_sharp_assemblies() { + [[ ${#@} -eq 2 ]] || die "${FUNCNAME} needs two arguments" + local string config=3Dlibs prefix=3D"-r:" + local -a rvalue + [[ "${FUNCNAME[1]}" =3D "get_sharp_apis" ]] && config=3Dcflags && prefi= x=3D"-I:" + for string in $(pkg-config --${config} ${2} 2> /dev/null) do - sed -r -i -e "s:(PKG_CHECK_MODULES\(${package}.*)\):\1,[foo=3Dbar],[ba= r=3Dfoo]):" \ - configure.in || die "failed sedding sense into gnome-sharp's configu= re.in" + rvalue+=3D( ${string#-?:} ) done - EAUTORECONF=3DYES + + case $1 in + --bare) + : + ;; + --prefixed) + for (( i=3D0 ; i< ${#rvalue[@]} ; i++ )) + do + rvalue[$i]=3D${prefix}${rvalue[$i]} + done + ;; + *) + die "${FUNCNAME}: Unknown parameter" + ;; + esac + echo "${rvalue[@]}" +} + +# @FUNCTION: phase_hook +# @USAGE: +# Looks for functions named _caller_suffix and executes them. +# _caller_suffix is the calling function with the prefix +# gtk-sharp-module removed. +phase_hook() { + [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs one argument" + if [[ "$(type -t ${1}${FUNCNAME[1]#gtk-sharp-module})" =3D "function" ]= ] + then + ebegin "Phase-hook: Running ${1}${FUNCNAME[1]#gtk-sharp-module}" + ${1}${FUNCNAME[1]#gtk-sharp-module} + eend 0 + fi } =20 -gnome-sharp_tarball_src_prepare() { - if ! [[ "${PN}" =3D "gconf-sharp" ]] +# @FUNCTION: ac_path_prog_override +# @USAGE: [path] +# @DESCRIPTION: +# Override AC_PATH_PROG() autoconf macros. Path will be set to " " if +# not specified. +ac_path_prog_override() { + if [[ ${#@} -lt 1 || ${#@} -gt 2 ]] then - sed -r -i -e "s:(PKG_CHECK_MODULES\(GLADESHARP.*)\):\1,[foo=3Dbar],[ba= r=3Dfoo]):" \ - configure.in || die "failed sedding sense into gnome-sharp's configu= re.in" - EAUTORECONF=3DYES + eerror "${FUNCNAME[0]} requires at least one parameter and takes at mo= st two:" + eerror "AC_PATH_PROG(PARAM1, param2)" + die "${FUNCNAME[0]} requires at least one parameter and takes at most = two:" fi + export ac_cv_path_${1}=3D"${2:- }" } =20 -gtk-sharp-module_src_prepare() { - if [[ "$(type -t $(gsm_get_tarball)_tarball_src_prepare)" =3D "function= " ]] + +# @FUNCTION: pkg_check_modules_override +# @USAGE: [package1] [package2] +# @DESCRIPTION: +# Will export the appropriate variables to override PKG_CHECK_MODULES au= toconf +# macros, with the string " " by default. If packages are specified, the= y will +# be looked up with pkg-config and the appropriate LIBS and CFLAGS subst= ituted. +# LIBS and CFLAGS can also be specified per-package with the following s= yntax: +# @CODE +# package=3DLIBS%CFLAGS +# @CODE +# =3D and % have no effect unless both are specified. +# Here is an example: +# @CODE +# pkg_check_modules_override GASH "gtk+-2.0=3D-jule%" gobject-2.0 +# @CODE +# The above example will do: +# export GASH_CFLAGS+=3D" -jule" +# export GASH_LIBS+=3D" " +# export GASH_CFLAGS+=3D" $(pkg-config --cflags gobject-2.0)" +# export GASH_LIBS+=3D" $(pkg-config --libs gobject-2.0)" +# +# NOTE: If a package is not found, the string " " will be inserted in pl= ace of +# _CFLAGS and _LIBS +pkg_check_modules_override() { + local package + local group=3D"${1}" + local packages=3D"${*:2}" + export ${group}_CFLAGS=3D" " + export ${group}_LIBS=3D" " + + if [[ ${#@} -lt 1 ]] then - ebegin "Running $(gsm_get_tarball)_tarball_src_prepare" - $(gsm_get_tarball)_tarball_src_prepare - eend $? + eerror "${FUNCNAME[0]} requires at least one parameter: GROUP" + eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)" + die "${FUNCNAME[0]} requires at least one parameter: GROUP" fi - base_src_util autopatch =20 - [[ ${EAUTORECONF} ]] && eautoreconf + for package in $packages + do + if [[ ${package/=3D} !=3D ${package} && ${package/\%} !=3D ${package} = ]] + then + package_cflag_libs=3D${package##*=3D} + export ${group}_CFLAGS+=3D" ${package_cflag_libs%%\%*}" + export ${group}_LIBS+=3D" ${package_cflag_libs##*\%}" + else + if pkg-config --exists $package + then + export ${group}_CFLAGS+=3D" $(pkg-config --cflags $package)" + export ${group}_LIBS+=3D" $(pkg-config --libs $package)" + else + export ${group}_CFLAGS+=3D" " + export ${group}_LIBS+=3D" " + fi + fi + done +} =20 +# @FUNCTION: gtk-sharp-tarball-post_src_prepare +# @DESCRIPTION: +# Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references= to +# local assemblies to the installed ones. Is only called by src_prepare = when +# $GTK_SHARP_MODULE is a member of $gtk_sharp_module_list. +gtk-sharp-tarball-post_src_prepare() { cd "${S}/${GTK_SHARP_MODULE_DIR}" - - gtk-sharp-module_fix_files &> /dev/null + sed -i \ + -e "s; \$(srcdir)/../glib/glib-api.xml; $(get_sharp_apis --bare glib-s= harp-2.0);" \ + -e "s; ../pango/pango-api.xml; $(get_sharp_apis --bare pango-sharp-2.0= );" \ + -e "s; ../atk/atk-api.xml; $(get_sharp_apis --bare atk-sharp-2.0);" = \ + -e "s; ../gdk/gdk-api.xml; $(get_sharp_apis --bare gdk-sharp-2.0);" = \ + -e "s; ../gtk/gtk-api.xml; $(get_sharp_apis --bare gtk-sharp-2.0);" = \ + -e "s; \.\./glib/glib-sharp.dll; $(get_sharp_assemblies --bare glib-sh= arp-2.0);g" \ + -e "s; \.\./pango/pango-sharp.dll; $(get_sharp_assemblies --bare pango= -sharp-2.0);g" \ + -e "s; \.\./atk/atk-sharp.dll; $(get_sharp_assemblies --bare atk-sharp= -2.0);g" \ + -e "s; \.\./gdk/gdk-sharp.dll; $(get_sharp_assemblies --bare gdk-sharp= -2.0);g" \ + -e "s; \.\./gtk/gtk-sharp.dll; $(get_sharp_assemblies --bare gtk-sharp= -2.0);g" \ + -e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;/usr/bin/gapi= 2-fixup;" \ + -e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;/usr/bin= /gapi2-codegen;" \ + -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):"= \ + -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(I= NCLUDE_API):" \ + $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball m= akefiles" +} + +# @FUNCTION: gnome-sharp-tarball-post_src_prepare +# @DESCRIPTION: +# Runs a M-m-m-monster sed on GTK_SHARP_MODULE_DIR to convert references= to +# local assemblies to the installed ones. Is only called by src_prepare = when +# $GTK_SHARP_MODULE is a member of $gnome_sharp_module_list. +gnome-sharp-tarball-post_src_prepare() { + cd "${S}/${GTK_SHARP_MODULE_DIR}" + sed -i \ + -e "s; ../gnomevfs/gnome-vfs-api.xml; $(get_sharp_apis --bare gnome-vf= s-sharp-2.0);" \ + -e "s; ../art/art-api.xml; $(get_sharp_apis --bare art-sharp-2.0);" = \ + -e "s; \.\./art/art-sharp.dll; $(get_sharp_assemblies --bare art-sharp= -2.0);g" \ + -e "s; \.\./gnomevfs/gnome-vfs-sharp.dll; $(get_sharp_assemblies --bar= e gnome-vfs-sharp-2.0);g" \ + -e "s;/r:\$(top_builddir)/art/art-sharp.dll;$(get_sharp_assemblies --p= refixed art-sharp-2.0);" \ + -e "s;/r:\$(top_builddir)/gnome/gnome-sharp.dll;$(get_sharp_assemblies= --prefixed gnome-sharp-2.0);" \ + $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball m= akefiles" +} + +# @FUNCTION: gtk-sharp-module_src_prepare +# @DESCRIPTION: +# Runs autopatch from base.eclass, eautoreconf if EAUTORECONF is set to = any +# value. +# Contains a phase_hook, runs very last. +# phase_hook prefix trigger: ${TARBALL}-tarball-post +# Is exported. +gtk-sharp-module_src_prepare() { + base_src_util autopatch +# @ECLASS-VARIABLE: EAUTORECONF +# @DESCRIPTION: +# If set, EAUTORECONF will be run during src_prepare. + [[ ${EAUTORECONF} ]] && eautoreconf + phase_hook ${TARBALL}-tarball-post } =20 +# @FUNCTION: gtk-sharp-tarball_src_configure +# @DESCRIPTION: +# Sets some environment variables that will allow us to make the depende= ncies +# for each ebuild be only its own dependencies, without patching configu= re. +# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODUL= E +# is a member of $gtk_sharp_module_list. +gtk-sharp-tarball_src_configure() { + pkg_check_modules_override GLIB gobject-2.0 + pkg_check_modules_override GIO gio-2.0 + pkg_check_modules_override PANGO pango + pkg_check_modules_override ATK atk + pkg_check_modules_override GTK gtk+-2.0 + pkg_check_modules_override GLADE libglade-2.0 +} + +# @FUNCTION: gnome-sharp-tarball_src_configure +# @DESCRIPTION: +# Sets some environment variables that will allow us to make the depende= ncies +# for each ebuild be only its own dependencies. Without patching configu= re. +# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODUL= E +# is a member of $gnome_sharp_module_list. +gnome-sharp-tarball_src_configure() { + pkg_check_modules_override GLADESHARP glade-sharp-2.0 + pkg_check_modules_override GAPI gapi-2.0 + ac_path_prog_override GAPI_PARSER /usr/bin/gapi2-parser + ac_path_prog_override GAPI_CODEGEN /usr/bin/gapi2-codegen + ac_path_prog_override GAPI_FIXUP /usr/bin/gapi2-fixup +} + +# @FUNCTION: gtk-sharp-module_src_configure +# @USAGE: [econf-arguments] +# @DESCRIPTION: +# Calls econf with some default values. +# Contains a phase_hook, run before econf. +# phase_hook prefix trigger: ${TARBALL}-tarball +# Is exported. gtk-sharp-module_src_configure() { + phase_hook ${TARBALL}-tarball econf --disable-static \ --disable-dependency-tracking \ --disable-maintainer-mode \ $(use debug &&echo "--enable-debug" ) \ - ${gtk_sharp_conf} \ ${@} || die "econf failed" } =20 +# @FUNCTION: gtk-sharp-module_src_compile +# @DESCRIPTION: +# Calls emake in the subdir of the module. +# Sets CSC=3D/usr/bin/gmcs. Deletes top_srcdir Makefiles to prevent recu= rsing in +# case we missed some dll references. +# Is exported. gtk-sharp-module_src_compile() { + rm -f "${S}"/Makefile* &> /dev/null cd "${S}/${GTK_SHARP_MODULE_DIR}" - emake || die "emake failed" + emake CSC=3D/usr/bin/gmcs || die "emake failed" } =20 +# @FUNCTION: gtk-sharp-module_src_install +# @DESCRIPTION: +# Installs the module. Fixes up lib paths so they're multilib-safe. +# Gets rid of .la files. +# Is exported. gtk-sharp-module_src_install() { - cd "${S}/${GTK_SHARP_MODULE_DIR}" - emake DESTDIR=3D${D} install || die "emake install failed" + emake DESTDIR=3D"${D}" install || die "emake install failed" mono_multilib_comply - find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal faile= d" - if has "${GTK_SHARP_MODULE}" gtk gdk atk pango - then - find "${D}" -name '*.pc' -exec rm -rf '{}' '+' || die "la removal fail= ed" - pkgconfig_filename=3D"${PN}${GTK_SHARP_SLOT_DEC}" - pkgconfig_pkgname=3D"${GTK_SHARP_MODULE}#" - pkgconfig_description=3D".NET/Mono bindings for ${GTK_SHARP_MODULE}" - pkgconfig_monodir=3D"$(gsm_get_tarball)${GTK_SHARP_SLOT_DEC}" - case ${GTK_SHARP_MODULE} in - gtk) - pkgconfig_requires=3D"glib-sharp${GTK_SHARP_SLOT_DEC} atk-sharp${GTK= _SHARP_SLOT_DEC} gdk-sharp${GTK_SHARP_SLOT_DEC} pango-sharp${GTK_SHARP_SL= OT_DEC}" - ;; - gdk) - pkgconfig_requires=3D"glib-sharp${GTK_SHARP_SLOT_DEC} pango-sharp${G= TK_SHARP_SLOT_DEC}" - ;; - atk) - pkgconfig_requires=3D"glib-sharp${GTK_SHARP_SLOT_DEC}" - ;; - pango) - pkgconfig_requires=3D"glib-sharp${GTK_SHARP_SLOT_DEC}" - ;; - *) - die "unhandled gtk_sharp_module" - ;; - esac - generate_pkgconfig - fi + find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la remov= al failed" + [[ $(find "${D}" -type f|wc -l) -lt 3 ]] && die "Too few files. This s= mells like a failed install." } =20 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install - -generate_pkgconfig() { - ebegin "Generating .pc file for ${P}" - local dll \ - gfile \ - pkgconfig_gapidir \ - apifile \ - LSTRING=3D'Libs:' \ - CSTRING=3D'Cflags:' \ - pkgconfig_filename=3D"${1:-${pkgconfig_filename:-${PN}}}" \ - pkgconfig_monodir=3D"${2:-${pkgconfig_monodir:-${pkgconfig_filename}}}= " \ - pkgconfig_pkgname=3D"${3:-${pkgconfig_pkgname:-${pkgconfig_filename}}}= " \ - pkgconfig_version=3D"${4:-${pkgconfig_version:-${PV}}}" \ - pkgconfig_description=3D"${5:-${pkgconfig_description:-${DESCRIPTION}}= }" \ - pkgconfig_requires=3D"${6:-${pkgconfig_requires}}" \ - - pushd "${D}/usr/" &> /dev/null - apifile=3D$(find share -name '*-api.xml' 2>/dev/null) - popd &> /dev/null - - pkgconfig_gapidir=3D${apifile:+\$\{prefix\}/${apifile%/*}} - - dodir "/usr/$(get_libdir)/pkgconfig" - cat <<- EOF -> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.= pc" - prefix=3D\${pcfiledir}/../.. - exec_prefix=3D\${prefix} - libdir=3D\${prefix}/$(get_libdir) - gapidir=3D${pkgconfig_gapidir} - Name: ${pkgconfig_pkgname} - Description: ${pkgconfig_description} - Version: ${pkgconfig_version} - EOF - - for gfile in "${D}"/usr/${apifile%/*}/*-api.xml - do - CSTRING=3D"${CSTRING} -I:"'${gapidir}'"/${gfile##*/}" - done - echo "${CSTRING}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_file= name}.pc" - - - for dll in "${D}"/usr/$(get_libdir)/mono/${pkgconfig_monodir}/*.dll - do - if ! [[ "${dll##*/}" =3D=3D "policy."*".dll" ]] - then - LSTRING=3D"${LSTRING} -r:"'${libdir}'"/mono/${pkgconfig_monodir}/${dl= l##*/}" - fi - done - echo "${LSTRING}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_file= name}.pc" - - if [[ "${pkgconfig_requires}" ]] - then - printf "Requires: ${pkgconfig_requires}" >> "${D}/usr/$(get_libdir)/pk= gconfig/${pkgconfig_filename}.pc" - fi - PKG_CONFIG_PATH=3D"${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --sile= nce-errors --libs ${pkgconfig_filename} &> /dev/null - eend $? -} -