summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Alfredsen <loki_val@gentoo.org>2009-01-29 22:48:20 +0000
committerPeter Alfredsen <loki_val@gentoo.org>2009-01-29 22:48:20 +0000
commitcca5dd0961e0e79c0f1e64f3538f6e887cc331df (patch)
treed924bb4f5d4b2dc51d6ff598dac804d99e45d67a /eclass/gtk-sharp-module.eclass
parentInitial ebuild w.r.t. bug 249704. (diff)
downloadgentoo-2-cca5dd0961e0e79c0f1e64f3538f6e887cc331df.tar.gz
gentoo-2-cca5dd0961e0e79c0f1e64f3538f6e887cc331df.tar.bz2
gentoo-2-cca5dd0961e0e79c0f1e64f3538f6e887cc331df.zip
New and spiffy version of the old eclass.
Diffstat (limited to 'eclass/gtk-sharp-module.eclass')
-rw-r--r--eclass/gtk-sharp-module.eclass594
1 files changed, 363 insertions, 231 deletions
diff --git a/eclass/gtk-sharp-module.eclass b/eclass/gtk-sharp-module.eclass
index 3f019391abf5..9fa13d2e6d35 100644
--- a/eclass/gtk-sharp-module.eclass
+++ b/eclass/gtk-sharp-module.eclass
@@ -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 $
-# Author : Peter Johanson <latexer@gentoo.org>, butchered by ikelos, then loki_val.
-# Based off of original work in gst-plugins.eclass by <foser@gentoo.org>
+# @ECLASS: gtk-sharp-module.eclass
+# @MAINTAINER:
+# dotnet@gentoo.org
+# @BLURB: Manages the modules of the gtk-, gnome-, and gnome-desktop-sharp tarballs
+# @DESCRIPTION:
+# This eclass provides phase functions and helper functions for the modules
+# of the gtk-sharp, gnome-sharp and gnome-desktop-sharp tarballs.
+# PLEASE TAKE NOTE: ONLY FOR EAPI-2 EBUILDS
-# Note that this breaks compatibility with the original gtk-sharp-component
-# eclass.
+WANT_AUTOMAKE=none
+WANT_AUTOCONF=none
inherit eutils mono multilib autotools base versionator
-# 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=${GTK_SHARP_MODULE:=${PN/-sharp/}}
-GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}}
-
-# Allow ebuilds to set a value for the required GtkSharp version.
-GTK_SHARP_REQUIRED_VERSION=${GTK_SHARP_REQUIRED_VERSION}
-# Version number used to differentiate between unversioned 1.0 series and the
-# versioned 2.0 series (2.0 series has 2 or 2.0 appended to various paths and
-# scripts). Default to ${SLOT}.
-GTK_SHARP_SLOT="${GTK_SHARP_SLOT:=${SLOT}}"
-GTK_SHARP_SLOT_DEC="${GTK_SHARP_SLOT_DEC:=-${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=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}}
-#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="${GTK_SHARP_REQUIRED_VERSION}"
+
+# @ECLASS-VARIABLE: gapi_users_list
+# @DESCRIPTION:
+# List of modules that use one of gapi2-codegen, gapi2-fixup or gapi2-parser
+# No ebuild-serviceable parts inside.
+gapi_users_list="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=$(get_version_component_range 1-2)
-# Set some defaults.
-DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module"
-HOMEPAGE="http://www.mono-project.com/GtkSharp"
-
-LICENSE="LGPL-2.1"
-DEPEND="
- >=dev-lang/mono-2.0.1
- >=sys-apps/sed-4
- >=dev-util/pkgconfig-0.23
- "
-RDEPEND="
- >=dev-lang/mono-2.0.1
- "
-
-IUSE="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="glib glade gtk gdk atk pango gtk-dotnet gtk-gapi"
-gnome_sharp_module_list="art gnome gnomevfs gconf"
-gnome_desktop_sharp_module_list="gnome-desktop gnome-print gnome-panel gtkhtml gtksourceview nautilusburn rsvg vte wnck"
-
-has "${GTK_SHARP_MODULE}" ${gtk_sharp_module_list} && GTK_SHARP_REQUIRED_VERSION=${PV}
-
-
+# @FUNCTION: add_bdepends
+# @USAGE: <package atom>
+# @DESCRIPTION:
+# Adds to the DEPEND variable
add_bdepend() {
+ [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
DEPEND="${DEPEND} $@"
}
+# @FUNCTION: add_rdepends
+# @USAGE: <package atom>
+# @DESCRIPTION:
+# Adds to the RDEPEND variable
add_rdepend() {
+ [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
RDEPEND="${RDEPEND} $@"
}
+# @FUNCTION: add_depend
+# @USAGE: <package atom>
+# @DESCRIPTION:
+# Adds to the DEPEND and RDEPEND variables
add_depend() {
+ [[ ${#@} -eq 1 ]] || die "${FUNCNAME} needs ONE (1) argument"
DEPEND="${DEPEND} $@"
RDEPEND="${RDEPEND} $@"
}
-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}" != "gtk-sharp-gapi" ]] && add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*"
-[[ "${PN}" != "gtk-sharp-gapi" ]] && add_bdepend "!!=dev-dotnet/gtk-sharp-gapi-2.12.7-r5"
-[[ "${PN}" != "gtk-sharp-gapi" ]] && add_bdepend "!!=dev-dotnet/gtk-sharp-gapi-2.12.7-r6"
-
-has "${GTK_SHARP_MODULE}" ${gnome_sharp_module_list} ${gnome_desktop_sharp_module_list} gtk-dotnet glade \
- && add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
-has "${GTK_SHARP_MODULE}" gtk gdk atk pango gtk-dotnet parser \
- && add_depend "=dev-dotnet/glib-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
-has "${GTK_SHARP_MODULE}" ${gnome_desktop_sharp_module_list} \
- && add_depend ">=dev-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="gtk-sharp"
+ case ${PVR} in
+ 2.12.7-r1*)
+ SRC_URI="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=$bugno
+ #Upstream bug #421063 for the parallel-make patches
+ #Upstream bug #470390 for the gtk-sharp-2.12.7.patch
+ PATCHES=( "${WORKDIR}/patches/${TARBALL}-2.12.0-parallelmake.patch"
+ "${WORKDIR}/patches/${TARBALL}-2.12.0-doc-parallelmake.patch"
+ "${WORKDIR}/${TARBALL}-2.12.7.patch" )
+ EAUTORECONF="YES"
+ add_bdepend "=sys-devel/automake-1.10*"
+ add_bdepend ">=sys-devel/autoconf-2.61"
+ ;;
+ esac
+ ;;
+ art|gnome|gnomevfs|gconf)
+ TARBALL="gnome-sharp"
+ add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
+ has "${GTK_SHARP_MODULE}" "${gapi_users_list}" && \
+ add_bdepend "=dev-dotnet/gtk-sharp-gapi-${GTK_SHARP_REQUIRED_VERSION}*"
+ ;;
+ gnome-desktop|gnome-print|gnome-panel|gtkhtml|gtksourceview|nautilusburn|rsvg|vte|wnck)
+ TARBALL="gnome-desktop-sharp"
+ add_depend "=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
+ add_depend "=dev-dotnet/gnome-sharp-${PV_MAJOR}*"
+ add_bdepend "=dev-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
case ${PF} in
#gtk-sharp tarball
+ gtk-sharp-docs*)
+ add_depend ">=virtual/monodoc-2.0"
+ ;;
gtk-sharp-gapi*)
add_rdepend "!<=dev-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 "!<=dev-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 "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
atk-sharp-*)
- add_rdepend "!<=dev-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 "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
glib-sharp-*)
add_rdepend "!<=dev-dotnet/gtk-sharp-2.12.7:2"
add_depend "dev-libs/glib:2"
;;
pango-sharp-*)
- add_rdepend "!<=dev-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 "!<=dev-dotnet/gtk-sharp-2.12.7:2"
;;
gtk-dotnet-*)
- add_rdepend "!<=dev-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 "!<=dev-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 ">=gnome-base/libglade-2.3.6"
;;
@@ -182,206 +225,295 @@ case ${PF} in
;;
esac
+# @ECLASS-VARIABLE: DESCRIPTION
+# @DESCRIPTION:
+# Default value: GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball
+DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module of the ${TARBALL} tarball"
+# @ECLASS-VARIABLE: HOMEPAGE
+# @DESCRIPTION:
+# Default value: http://www.mono-project.com/GtkSharp
+HOMEPAGE="http://www.mono-project.com/GtkSharp"
+# @ECLASS-VARIABLE: DESCRIPTION
+# @DESCRIPTION:
+# Default value: LGPL-2.1
+LICENSE="LGPL-2.1"
+add_depend ">=dev-lang/mono-2.0.1"
+add_bdepend ">=sys-apps/sed-4"
+add_bdepend ">=dev-util/pkgconfig-0.23"
+add_bdepend ">=app-shells/bash-3.1"
-GSM_P=$(gsm_get_tarball)-${PV}
-S=${WORKDIR}/${GSM_P}
-SRC_URI="mirror://gnome/sources/$(gsm_get_tarball)/${PV%.*}/${GSM_P}.tar.bz2"
-
-if [[ "${GSM_P%.*}" = "gtk-sharp-2.12" ]]
-then
- SRC_URI="${SRC_URI}
- mirror://gentoo/gtk-sharp-2.12.0-patches.tar.bz2"
- #Upstream: https://bugzilla.novell.com/show_bug.cgi?id=$bugno
- #Upstream bug #421063
- PATCHES=( "${WORKDIR}/patches/$(gsm_get_tarball)-2.12.0-parallelmake.patch"
- "${WORKDIR}/patches/$(gsm_get_tarball)-2.12.0-doc-parallelmake.patch" )
- EAUTORECONF="YES"
-fi
-
+IUSE="debug"
+# @ECLASS-VARIABLE: HOMEPAGE
+# @DESCRIPTION:
+# Default value: ${WORKDIR}/${TARBALL}-${PV}
+S="${WORKDIR}/${TARBALL}-${PV}"
+# @ECLASS-VARIABLE: SRC_URI
+# @DESCRIPTION:
+# Default value: mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2
+SRC_URI="${SRC_URI}
+ mirror://gnome/sources/${TARBALL}/${PV_MAJOR}/${TARBALL}-${PV}.tar.bz2"
+
+# @FUNCTION: get_sharp_apis
+# @USAGE: <type> <pkgconfig-package>
+# @RETURN: .NET API files
+# @DESCRIPTION:
+# Given a valid pkg-config package, will return a list of API xml files.
+# <type> 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 "$@"
+}
-### Public functions.
+# @FUNCTION: get_sharp_assemblies
+# @USAGE: <type> <pkgconfig-package>
+# @RETURN: .NET .dll assemblies
+# @DESCRIPTION:
+# Given a valid pkg-config package, will return a list of .dll assemblies.
+# <type> 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=libs prefix="-r:"
+ local -a rvalue
+ [[ "${FUNCNAME[1]}" = "get_sharp_apis" ]] && config=cflags && prefix="-I:"
+ for string in $(pkg-config --${config} ${2} 2> /dev/null)
+ do
+ rvalue+=( ${string#-?:} )
+ done
-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" and 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 and
- # not the ones that would be built locally.
- local gapi_dir="${ROOT}/usr/share/gapi${GTK_SHARP_SLOT_DEC}"
- local GAPI_FIXUP="gapi2-fixup"
- local GAPI_CODEGEN="gapi2-codegen"
+ case $1 in
+ --bare)
+ :
+ ;;
+ --prefixed)
+ for (( i=0 ; i< ${#rvalue[@]} ; i++ ))
+ do
+ rvalue[$i]=${prefix}${rvalue[$i]}
+ done
+ ;;
+ *)
+ die "${FUNCNAME}: Unknown parameter"
+ ;;
+ esac
+ echo "${rvalue[@]}"
+}
- local makefiles=( $(find "${S}" -name Makefile.in) )
- sed -i \
- -e "s;\(\.\.\|\$(top_srcdir)\|\$(srcdir)/\.\.\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[: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-sharp-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-sharp-2.0);" \
- -e "s;\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe;${GAPI_FIXUP};" \
- -e "s;\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe;${GAPI_CODEGEN};" \
- -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \
- -e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \
- "${makefiles[@]}" || die "failed to fix GtkSharp makefiles"
+# @FUNCTION: phase_hook
+# @USAGE: <prefix>
+# Looks for functions named <prefix>_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})" = "function" ]]
+ then
+ ebegin "Phase-hook: Running ${1}${FUNCNAME[1]#gtk-sharp-module}"
+ ${1}${FUNCNAME[1]#gtk-sharp-module}
+ eend 0
+ fi
}
-get_sharp_lib() {
- S="$(pkg-config --libs ${1})"
- S=${S%% *}
- printf ${S#-r:}
+# @FUNCTION: ac_path_prog_override
+# @USAGE: <PROG> [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
+ eerror "${FUNCNAME[0]} requires at least one parameter and takes at most 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}="${2:- }"
}
-gtk-sharp_tarball_src_prepare() {
+
+# @FUNCTION: pkg_check_modules_override
+# @USAGE: <GROUP> [package1] [package2]
+# @DESCRIPTION:
+# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf
+# macros, with the string " " by default. If packages are specified, they will
+# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted.
+# LIBS and CFLAGS can also be specified per-package with the following syntax:
+# @CODE
+# package=LIBS%CFLAGS
+# @CODE
+# = and % have no effect unless both are specified.
+# Here is an example:
+# @CODE
+# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0
+# @CODE
+# The above example will do:
+# export GASH_CFLAGS+=" -jule"
+# export GASH_LIBS+=" "
+# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)"
+# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)"
+#
+# NOTE: If a package is not found, the string " " will be inserted in place of
+# <GROUP>_CFLAGS and <GROUP>_LIBS
+pkg_check_modules_override() {
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
+ local group="${1}"
+ local packages="${*:2}"
+ export ${group}_CFLAGS=" "
+ export ${group}_LIBS=" "
+
+ if [[ ${#@} -lt 1 ]]
+ then
+ 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
+
+ for package in $packages
do
- sed -r -i -e "s:(PKG_CHECK_MODULES\(${package}.*)\):\1,[foo=bar],[bar=foo]):" \
- configure.in || die "failed sedding sense into gnome-sharp's configure.in"
+ if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]]
+ then
+ package_cflag_libs=${package##*=}
+ export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}"
+ export ${group}_LIBS+=" ${package_cflag_libs##*\%}"
+ else
+ if pkg-config --exists $package
+ then
+ export ${group}_CFLAGS+=" $(pkg-config --cflags $package)"
+ export ${group}_LIBS+=" $(pkg-config --libs $package)"
+ else
+ export ${group}_CFLAGS+=" "
+ export ${group}_LIBS+=" "
+ fi
+ fi
done
- EAUTORECONF=YES
}
-gnome-sharp_tarball_src_prepare() {
- if ! [[ "${PN}" = "gconf-sharp" ]]
- then
- sed -r -i -e "s:(PKG_CHECK_MODULES\(GLADESHARP.*)\):\1,[foo=bar],[bar=foo]):" \
- configure.in || die "failed sedding sense into gnome-sharp's configure.in"
- EAUTORECONF=YES
- fi
+# @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}"
+ sed -i \
+ -e "s; \$(srcdir)/../glib/glib-api.xml; $(get_sharp_apis --bare glib-sharp-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-sharp-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/gapi2-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:\$(INCLUDE_API):" \
+ $(find . -name Makefile.in) || die "failed to fix ${TARBALL}-tarball makefiles"
+}
+
+# @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-vfs-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 --bare gnome-vfs-sharp-2.0);g" \
+ -e "s;/r:\$(top_builddir)/art/art-sharp.dll;$(get_sharp_assemblies --prefixed 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 makefiles"
}
+# @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() {
- if [[ "$(type -t $(gsm_get_tarball)_tarball_src_prepare)" = "function" ]]
- then
- ebegin "Running $(gsm_get_tarball)_tarball_src_prepare"
- $(gsm_get_tarball)_tarball_src_prepare
- eend $?
- fi
base_src_util autopatch
-
+# @ECLASS-VARIABLE: EAUTORECONF
+# @DESCRIPTION:
+# If set, EAUTORECONF will be run during src_prepare.
[[ ${EAUTORECONF} ]] && eautoreconf
+ phase_hook ${TARBALL}-tarball-post
+}
- cd "${S}/${GTK_SHARP_MODULE_DIR}"
+# @FUNCTION: gtk-sharp-tarball_src_configure
+# @DESCRIPTION:
+# Sets some environment variables that will allow us to make the dependencies
+# for each ebuild be only its own dependencies, without patching configure.
+# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE
+# 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
+}
- gtk-sharp-module_fix_files &> /dev/null
+# @FUNCTION: gnome-sharp-tarball_src_configure
+# @DESCRIPTION:
+# Sets some environment variables that will allow us to make the dependencies
+# for each ebuild be only its own dependencies. Without patching configure.
+# Is only called by gtk-sharp-module_src_configure when $GTK_SHARP_MODULE
+# 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"
}
+# @FUNCTION: gtk-sharp-module_src_compile
+# @DESCRIPTION:
+# Calls emake in the subdir of the module.
+# Sets CSC=/usr/bin/gmcs. Deletes top_srcdir Makefiles to prevent recursing 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=/usr/bin/gmcs || die "emake failed"
}
+# @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=${D} install || die "emake install failed"
+ emake DESTDIR="${D}" install || die "emake install failed"
mono_multilib_comply
- find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
- if has "${GTK_SHARP_MODULE}" gtk gdk atk pango
- then
- find "${D}" -name '*.pc' -exec rm -rf '{}' '+' || die "la removal failed"
- pkgconfig_filename="${PN}${GTK_SHARP_SLOT_DEC}"
- pkgconfig_pkgname="${GTK_SHARP_MODULE}#"
- pkgconfig_description=".NET/Mono bindings for ${GTK_SHARP_MODULE}"
- pkgconfig_monodir="$(gsm_get_tarball)${GTK_SHARP_SLOT_DEC}"
- case ${GTK_SHARP_MODULE} in
- gtk)
- 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}"
- ;;
- gdk)
- pkgconfig_requires="glib-sharp${GTK_SHARP_SLOT_DEC} pango-sharp${GTK_SHARP_SLOT_DEC}"
- ;;
- atk)
- pkgconfig_requires="glib-sharp${GTK_SHARP_SLOT_DEC}"
- ;;
- pango)
- pkgconfig_requires="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 removal failed"
+ [[ $(find "${D}" -type f|wc -l) -lt 3 ]] && die "Too few files. This smells like a failed install."
}
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='Libs:' \
- CSTRING='Cflags:' \
- pkgconfig_filename="${1:-${pkgconfig_filename:-${PN}}}" \
- pkgconfig_monodir="${2:-${pkgconfig_monodir:-${pkgconfig_filename}}}" \
- pkgconfig_pkgname="${3:-${pkgconfig_pkgname:-${pkgconfig_filename}}}" \
- pkgconfig_version="${4:-${pkgconfig_version:-${PV}}}" \
- pkgconfig_description="${5:-${pkgconfig_description:-${DESCRIPTION}}}" \
- pkgconfig_requires="${6:-${pkgconfig_requires}}" \
-
- pushd "${D}/usr/" &> /dev/null
- apifile=$(find share -name '*-api.xml' 2>/dev/null)
- popd &> /dev/null
-
- pkgconfig_gapidir=${apifile:+\$\{prefix\}/${apifile%/*}}
-
- dodir "/usr/$(get_libdir)/pkgconfig"
- cat <<- EOF -> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
- prefix=\${pcfiledir}/../..
- exec_prefix=\${prefix}
- libdir=\${prefix}/$(get_libdir)
- gapidir=${pkgconfig_gapidir}
- Name: ${pkgconfig_pkgname}
- Description: ${pkgconfig_description}
- Version: ${pkgconfig_version}
- EOF
-
- for gfile in "${D}"/usr/${apifile%/*}/*-api.xml
- do
- CSTRING="${CSTRING} -I:"'${gapidir}'"/${gfile##*/}"
- done
- echo "${CSTRING}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
-
-
- for dll in "${D}"/usr/$(get_libdir)/mono/${pkgconfig_monodir}/*.dll
- do
- if ! [[ "${dll##*/}" == "policy."*".dll" ]]
- then
- LSTRING="${LSTRING} -r:"'${libdir}'"/mono/${pkgconfig_monodir}/${dll##*/}"
- fi
- done
- echo "${LSTRING}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
-
- if [[ "${pkgconfig_requires}" ]]
- then
- printf "Requires: ${pkgconfig_requires}" >> "${D}/usr/$(get_libdir)/pkgconfig/${pkgconfig_filename}.pc"
- fi
- PKG_CONFIG_PATH="${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --silence-errors --libs ${pkgconfig_filename} &> /dev/null
- eend $?
-}
-