On Wednesday 26 November 2008, Donnie Berkholz wrote:
> On 23:52 Tue 25 Nov     , Peter Alfredsen (loki_val) wrote:
> > loki_val    08/11/25 23:52:04
> >
> >   Added:                gtk-sharp-module.eclass
> >   Log:
> >   eclass required for gnome-sharp and gnome-desktop-sharp packages
>
> Did I miss this on gentoo-dev? All eclasses must be sent there for
> review before addition to the tree.

*loki_val bumps his head into the wall.
See, what happened was...
I have been doing nothing else but testing and bumping dotnet packages 
for the last 3 days when not at work, so I kind of forgot that step. 
Fortunately all packages using this eclass are still in package.mask.

Anyway, the eclass is derived from the gtk-sharp-component eclass (which 
is a real bitrot mess that has to support 3 or 4 different naming 
schemes) and is basically a simplification of that.

> > if [[ " ${gtk_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]]
> > ; then my_module_list="${gtk_sharp_module_list}"
> >     my_tarball="gtk-sharp"
> > elif [[ " ${gnome_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "*
> > ]] ; then
>
> This seems like a really strange strategy for checking whether a
> certain item is in a list.

I disagree.

> >     # Make selecting components configurable.
> >     epatch ${WORKDIR}/${MY_P}-configurable.diff
>
> This seems like something you might want optional, depending on some
> variable.

It really isn't. That patch adds AC_ARG_ENABLEs to configure so we can 
split up the gnome-sharp and gnome-desktop-sharp tarballs into smaller 
pieces.

> >     # Fixes support with pkgconfig-0.17, #92503.
> >     sed -i -e 's/\<PKG_PATH\>/GTK_SHARP_PKG_PATH/g' \
> >                     -e ':^CFLAGS=:d' \
> >                     ${S}/configure.in
>
> It would be nice to quote all instances of $S, $D etc.

CanDo.

> >     LANG=C emake -j1 || die "emake failed"
>
> Worth a comment about parallel make being broken, with a reference to
> the upstream bug.

This is inherited from the old eclass. Upstream does not care and 
there's only work enough for one make job anyway.

Attached is a diff from the old eclass to the new eclass, generated 
thusly:
diff -wU5 gtk-sharp-component.eclass gtk-sharp-module.eclass



-- 
/PA
--- gtk-sharp-component.eclass	2008-11-25 22:05:58.000000000 +0100
+++ gtk-sharp-module.eclass	2008-11-26 02:06:17.000000000 +0100
@@ -1,192 +1,180 @@
-# Copyright 1999-2004 Gentoo Foundation
+# Copyright 1999-2008 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-component.eclass,v 1.29 2008/11/25 20:44:25 loki_val Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gtk-sharp-module.eclass,v 1.2 2008/11/26 00:54:41 loki_val Exp $
 
-# Author : Peter Johanson <[EMAIL PROTECTED]>
+# Author : Peter Johanson <[EMAIL PROTECTED]>, butchered by ikelos, then loki_val.
 # Based off of original work in gst-plugins.eclass by <[EMAIL PROTECTED]>
 
+# Note that this breaks compatibility with the original gtk-sharp-component
+# eclass.
+
 inherit eutils mono multilib autotools
 
-LICENSE="LGPL-2"
+# Get the name of the component to build and the build dir; by default,
+# extract it from the ebuild's name.
+GTK_SHARP_MODULE=${GTK_SHARP_MODULE:=${PN/-sharp/}}
+GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}}
+
+# In some cases the desired module cannot be configured to be built on its own.
+# This variable allows for the setting of additional configure-deps.
+GTK_SHARP_MODULE_DEPS="${GTK_SHARP_MODULE_DEPS}"
+
+# Allow ebuilds to set a value for the required GtkSharp version; default to
+# ${PV}.
+GTK_SHARP_REQUIRED_VERSION=${GTK_SHARP_REQUIRED_VERSION:=${PV%.*}}
+
+# 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}"
+
+# Set some defaults.
+DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module"
+HOMEPAGE="http://www.mono-project.com/GtkSharp";
 
-HOMEPAGE="http://gtk-sharp.sourceforge.net/";
 LICENSE="LGPL-2.1"
-RESTRICT="test"
-
-: GTK_SHARP_TARBALL_PREFIX=${GTK_SHARP_TARBALL_PREFIX:="gtk-sharp"}
-
-: GTK_SHARP_REQUIRED_VERSION=${GTK_SHARP_REQUIRED_VERSION:=${PV%.*}}
-
-[ "${PV:0:1}" == "2" ] \
-	&& SOURCE_SERVER="http://www.go-mono.com/sources/gtk-sharp-2.0/";
-
-# Can be switched to [ "${PV:0:3}" == "2.8" ] when 2.8.0 is out of the tree.
-[ "${PV}" == "2.8.2" ] \
-	&& SOURCE_SERVER="http://www.go-mono.com/sources/gtk-sharp-2.8/";
-
-[ "${PV%.*}" == "2.10" ] || [ "${PV%.*}" == "2.16" ] && \
-	SOURCE_SERVER="mirror://gnome/sources/${GTK_SHARP_TARBALL_PREFIX}/${PV%.*}/"
-
-[ "${PV}" == "1.0.10" ] \
-	&& SOURCE_SERVER="http://www.go-mono.com/sources/gtk-sharp/";
-
-[ -z "${SOURCE_SERVER}" ] \
-	&& SOURCE_SERVER="mirror://sourceforge/gtk-sharp/"
-
-###
-# variable declarations
-###
 
-MY_P=${GTK_SHARP_TARBALL_PREFIX}-${PV}
-
-# From gtk-sharp-1.0 series
-my_gtk_sharp_components="art gda glade gnome gnomedb gtkhtml rsvg vte"
-
-# Added in gtk-sharp-2.0 series
-my_gtk_sharp_components="${my_gtk_sharp_components} gnomevfs panelapplet"
-
-# 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)
-GTK_SHARP_COMPONENT_SLOT=""
-GTK_SHARP_COMPONENT_SLOT_DEC=""
-
-# Extract the component to build from the ebuild name
-# May be set by an ebuild and contain more than one indentifier, space seperated
-# (only src_configure can handle mutiple plugins at this time)
-GTK_SHARP_COMPONENT_BUILD=${PN/-sharp/}
-
-# Use to enable any other dependancies needed to build this package
-GTK_SHARP_COMPONENT_BUILD_DEPS=""
+DEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*
+	>=sys-apps/sed-4"
+RDEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*"
 
-# Actual build dir, is the same as the configure switch name most of the time
-GTK_SHARP_COMPONENT_BUILD_DIR=${PN/-sharp/}
+RESTRICT="test"
 
-DESCRIPTION="${GTK_SHARP_COMPONENT_BUILD} component of gtk-sharp"
-SRC_URI="${SOURCE_SERVER}/${MY_P}.tar.gz
-		mirror://gentoo/${MY_P}-configurable.diff.gz"
+# The GtkSharp modules are currently divided into three seperate tarball
+# distributions. Figure out which of these our component belongs to. This is
+# done to avoid passing bogus configure parameters, as well as to return the
+# correct tarball to download. Note that this makes ${GTK_SHARP_TARBALL_PREFIX}
+# obsolete.
+gtk_sharp_module_list="glade"
+gnome_sharp_module_list="art gnome gnomevfs"
+gnome_desktop_sharp_module_list="gnome-print gnome-panel gtkhtml gtksourceview nautilusburn rsvg vte wnck"
+
+if [[ " ${gtk_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then
+	my_module_list="${gtk_sharp_module_list}"
+	my_tarball="gtk-sharp"
+elif [[ " ${gnome_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then
+	my_module_list="${gnome_sharp_module_list}"
+	my_tarball="gnome-sharp"
+
+# While gnome-desktop-sharp is a part of gnome-desktop-sharp (0_o) it is not a
+# configurable component, so we don't want to put it into the module list.
+# Result is that we have to check for it manually here and in src_configure.
+elif [[ " ${gnome_desktop_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ||
+		"${GTK_SHARP_MODULE}" == "gnome-desktop" ]] ; then
+	my_module_list="${gnome_desktop_sharp_module_list}"
+	my_tarball="gnome-desktop-sharp"
+else
+	die "unknown GtkSharp module: ${GTK_SHARP_MODULE}"
+fi
 
+MY_P=${my_tarball}-${PV}
 S=${WORKDIR}/${MY_P}
 
-# Make sure we're building with the same version.
-[[ "${ECLASS_DEPENDS}" = "no" ]] || DEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}*
-	>=sys-apps/sed-4"
-
-
-###
-# public functions
-###
-
-gtk-sharp-component_fix_makefiles() {
-	GAPI_DIR="${ROOT}/usr/share/gapi${GTK_SHARP_COMPONENT_SLOT_DEC}"
-	GAPI_FIXUP="gapi${GTK_SHARP_COMPONENT_SLOT}-fixup"
-	GAPI_CODEGEN="gapi${GTK_SHARP_COMPONENT_SLOT}-codegen"
-	GTK_SHARP_LIB_DIR="${ROOT}/usr/$(get_libdir)/mono/gtk-sharp${GTK_SHARP_COMPONENT_SLOT_DEC}"
+# Since all interesting versions are hosted on the GNOME server anyway it's the
+# only one we support, for now.
+SRC_URI="mirror://gnome/sources/${my_tarball}/${PV%.*}/${MY_P}.tar.bz2
+		mirror://gentoo/${MY_P}-configurable.diff.gz
+		http://dev.gentoo.org/~ikelos/devoverlay-distfiles/${MY_P}-configurable.diff.gz";
+
+
+### Public functions.
+
+gtk-sharp-module_fix_files() {
+	# Change references like "/r:../glib/glib-sharp.dll" ->
+	# "/r:${GTK_SHARP_LIB_DIR}/glib-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="gapi${GTK_SHARP_SLOT}-fixup"
+	local gapi_codegen="gapi${GTK_SHARP_SLOT}-codegen"
+
+	# This is very likely to be of use outside of this function as well, so make
+	# it public.
+	GTK_SHARP_LIB_DIR="${ROOT}/usr/$(get_libdir)/mono/gtk-sharp${GTK_SHARP_SLOT_DEC}"
 
 	local makefiles="$(find ${S} -name Makefile.in)"
-	# Universal changes needed for all versions
-	sed -i -e "s;\(\.\.\|\$(top_srcdir)\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).xml;${GAPI_DIR}/\2.xml;g" \
-		-i -e "s;/r:\(\.\./\)*[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;/r:${GTK_SHARP_LIB_DIR}/\2.dll;g" \
-			${makefiles} || die "Failed to fix the gtk-sharp makefiles"
-
-	if [ "${PV:0:1}" == "2" ] ; then
-		sed -i -e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \
-			-e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \
-			-e "s:\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe:${GAPI_FIXUP}:" \
-			-e "s:\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe:${GAPI_CODEGEN}:" \
+	sed -i -e "s;\(\.\.\|\$(top_srcdir)\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).xml;${gapi_dir}/\2.xml;g" \
+			-e "s;/r:\(\.\./\)*[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;/r:${GTK_SHARP_LIB_DIR}/\2.dll;g" \
 			-e "s;\.\./[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;${GTK_SHARP_LIB_DIR}/\1.dll;g" \
-			${makefiles} || die "Failed to fix the gtk-sharp makefiles"
-	fi
-
-	# Changes specific to *-sharp-1.0.x
-	if [ "${PV:0:3}" = "1.0" ] ; then
-		sed -i -e "s:\$(RUNTIME) \.\./parser/gapi-fixup.exe:${GAPI_FIXUP}:" \
-			-e "s:\$(RUNTIME) \.\./generator/gapi_codegen.exe:${GAPI_CODEGEN}:" \
-			-e "s: \.\./generator/gapi_codegen.exe::" \
-			${makefiles} || die "Failed to fix the gtk-sharp makefiles"
-	fi
+			-e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \
+			-e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \
+			-e "s:\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe:${gapi_fixup}:" \
+			-e "s:\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe:${gapi_codegen}:" \
+			${makefiles} || die "failed to fix GtkSharp makefiles"
+
+	# Oh GtkSharp, why do your pkgconfig entries suck donkey ass? Why do
+	# gnome-desktop-sharp modules use ${assemblies_dir} for Libs: instead of
+	# the convention you yourself introduced for gnome-sharp, which just uses
+	# @[EMAIL PROTECTED] Are you just trying to annoy me?
+	local pcins="$(find ${S} -name *.pc.in)"
+	sed -i -e 's:^libdir.*:[EMAIL PROTECTED]@:' \
+			-e "s:\${assemblies_dir}:\${libdir}/mono/gtk-sharp${GTK_SHARP_SLOT_DEC}:" \
+			${pcins} || die "failed to fix GtkSharp pkgconfig entries"
 }
 
-gtk-sharp-component_src_unpack() {
-	unpack ${A}
-	cd ${S}
-
-	# Make the components configurable
+gtk-sharp-module_src_prepare() {
+	# Make selecting components configurable.
 	epatch ${WORKDIR}/${MY_P}-configurable.diff
 
-	# XXX: Gross hack to disable the GLADESHARP checks
-	# in the gnome-sharp-2.16.0 release unless you really
-	# need it. Remove this hack once this is moved into the
-	# next iteration of 2.x.0-configurable.diff.gz
-	if [ "${PV}" == "2.16.0" ] && [ "${PN}" != "gconf-sharp" ]
-	then
-		sed -i "s/\(.*GLADESHARP.*\)/# \1/g" configure.in || die
-	fi
-
-	# fixes support with pkgconfig-0.17, bug #92503
+	# Fixes support with pkgconfig-0.17, #92503.
 	sed -i -e 's/\<PKG_PATH\>/GTK_SHARP_PKG_PATH/g' \
 		-e ':^CFLAGS=:d' \
 		${S}/configure.in
 
-	# Use correct libdir in pkgconfig files
-	sed -i -e 's:^libdir.*:[EMAIL PROTECTED]@:' \
-		${S}/*/*.pc.in || die
-
-	if [ -d "${S}/gconf/GConf" ]
-	then
-		sed -i -e 's:^libdir.*:[EMAIL PROTECTED]@:' \
-			${S}/gconf/GConf/*.pc.in || die
-	fi
-
+	# Fix install data hook, #161093.
 	if [ -f "${S}/sample/gconf/Makefile.am" ]
 	then
-		# Fix install data hook (bug #161093)
 		sed -i -e 's/^install-hook/install-data-hook/' \
-			${S}/sample/gconf/Makefile.am || die "sed failed"
+				${S}/sample/gconf/Makefile.am || die
 	fi
 
-	# disable building of samples (#16015)
+	# Disable building samples, #16015.
 	sed -i -e "s:sample::" ${S}/Makefile.am || die
 
 	eautoreconf
 
-	cd ${S}/${GTK_SHARP_COMPONENT_BUILD_DIR}
+	cd ${S}/${GTK_SHARP_MODULE_DIR}
 
-	gtk-sharp-component_fix_makefiles
+	gtk-sharp-module_fix_files
 }
 
-gtk-sharp-component_src_configure() {
+gtk-sharp-module_src_configure() {
+	# Disable any module besides one(s) we want.
+	local module gtk_sharp_conf
 
-	# disable any external plugin besides the plugin we want
-	local component deps gtk_sharp_conf
+	einfo "Configuring to build ${PN} module ..."
 
-	einfo "Configuring to build ${PN} component ..."
+	# No bogus configure parameters please.
+	[[ ${GTK_SHARP_MODULE} == "gnome-desktop" ]] && GTK_SHARP_MODULE=
 
-	for component in ${GTK_SHARP_COMPONENT_BUILD} ${GTK_SHARP_COMPONENT_BUILD_DEPS}; do
-		my_gtk_sharp_components=${my_gtk_sharp_components/${component}/}
+	for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do
+		my_module_list=${my_module_list/${module}/}
 	done
-	for component in ${my_gtk_sharp_components}; do
-		gtk_sharp_conf="${gtk_sharp_conf} --disable-${component} "
+	for module in ${my_module_list} ; do
+		gtk_sharp_conf="${gtk_sharp_conf} --disable-${module} "
 	done
-	for component in ${GTK_SHARP_COMPONENT_BUILD} ${GTK_SHARP_COMPONENT_BUILD_DEPS}; do
-		gtk_sharp_conf="${gtk_sharp_conf} --enable-${component} "
+	for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do
+		gtk_sharp_conf="${gtk_sharp_conf} --enable-${module} "
 	done
 
 	cd ${S}
-	econf [EMAIL PROTECTED] ${gtk_sharp_conf} || die "./configure failure"
+	econf [EMAIL PROTECTED] ${gtk_sharp_conf} || die "econf failed"
 }
 
-gtk-sharp-component_src_compile() {
-	gtk-sharp-component_src_configure [EMAIL PROTECTED]
+gtk-sharp-module_src_compile() {
 
-	cd ${S}/${GTK_SHARP_COMPONENT_BUILD_DIR}
-	LANG=C emake -j1 || die "compile failure"
+	cd ${S}/${GTK_SHARP_MODULE_DIR}
+	LANG=C emake -j1 || die "emake failed"
 }
 
-gtk-sharp-component_src_install() {
-	cd ${GTK_SHARP_COMPONENT_BUILD_DIR}
-	LANG=C make GACUTIL_FLAGS="/root ${D}/usr/$(get_libdir) /gacdir /usr/$(get_libdir) /package gtk-sharp${GTK_SHARP_COMPONENT_SLOT_DEC}" \
-		DESTDIR=${D} install || die
+gtk-sharp-module_src_install() {
+	cd ${GTK_SHARP_MODULE_DIR}
+	LANG=C emake GACUTIL_FLAGS="/root ${D}/usr/$(get_libdir) /gacdir /usr/$(get_libdir) /package gtk-sharp${GTK_SHARP_SLOT_DEC}" \
+			DESTDIR=${D} install || die "emake install failed"
 }
 
-EXPORT_FUNCTIONS src_unpack src_compile src_install
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to