summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Proschofsky <suka@gentoo.org>2010-10-16 08:16:49 +0000
committerAndreas Proschofsky <suka@gentoo.org>2010-10-16 08:16:49 +0000
commitc7826b07777715de515fbcf76c2e4c253f610616 (patch)
treebd256fa344d55283eaeb4ab1500750b552faae21
parentOutdated, remove for now, bring back an up-to-date version later (diff)
downloadsuka-c7826b07777715de515fbcf76c2e4c253f610616.tar.gz
suka-c7826b07777715de515fbcf76c2e4c253f610616.tar.bz2
suka-c7826b07777715de515fbcf76c2e4c253f610616.zip
gnome2 eclasses in recent versions...
svn path=/; revision=271
-rw-r--r--eclass/gnome2-utils.eclass247
-rw-r--r--eclass/gnome2.eclass166
2 files changed, 413 insertions, 0 deletions
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
new file mode 100644
index 0000000..4c7d4f3
--- /dev/null
+++ b/eclass/gnome2-utils.eclass
@@ -0,0 +1,247 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v 1.13 2008/10/22 21:04:53 eva Exp $
+
+#
+# gnome2-utils.eclass
+#
+# Set of auxiliary functions used to perform actions commonly needed by packages
+# using the GNOME framework.
+#
+# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
+#
+
+
+
+# Path to gconftool-2
+: ${GCONFTOOL_BIN:="${ROOT}usr/bin/gconftool-2"}
+
+# Directory where scrollkeeper-update should do its work
+: ${SCROLLKEEPER_DIR:="${ROOT}var/lib/scrollkeeper"}
+
+# Path to scrollkeeper-update
+: ${SCROLLKEEPER_UPDATE_BIN:="${ROOT}usr/bin/scrollkeeper-update"}
+
+
+
+DEPEND=">=sys-apps/sed-4"
+
+
+
+# Find the GConf schemas that are about to be installed and save their location
+# in the GNOME2_ECLASS_SCHEMAS environment variable
+gnome2_gconf_savelist() {
+ pushd "${D}" &> /dev/null
+ export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
+ popd &> /dev/null
+}
+
+
+# Applies any schema files installed by the current ebuild to Gconf's database
+# using gconftool-2
+gnome2_gconf_install() {
+ local F
+
+ if [[ ! -x "${GCONFTOOL_BIN}" ]]; then
+ return
+ fi
+
+ if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
+ einfo "No GNOME 2 GConf schemas found"
+ return
+ fi
+
+ # We are ready to install the GCONF Scheme now
+ unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
+ export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
+
+ einfo "Installing GNOME 2 GConf schemas"
+
+ for F in ${GNOME2_ECLASS_SCHEMAS}; do
+ if [[ -e "${ROOT}${F}" ]]; then
+ # echo "DEBUG::gconf install ${F}"
+ "${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" 1>/dev/null
+ fi
+ done
+
+ # have gconf reload the new schemas
+ pids=$(pgrep -x gconfd-2)
+ if [[ $? == 0 ]] ; then
+ ebegin "Reloading GConf schemas"
+ kill -HUP ${pids}
+ eend $?
+ fi
+}
+
+
+# Removes schema files previously installed by the current ebuild from Gconf's
+# database.
+gnome2_gconf_uninstall() {
+ local F
+
+ if [[ ! -x "${GCONFTOOL_BIN}" ]]; then
+ return
+ fi
+
+ if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
+ einfo "No GNOME 2 GConf schemas found"
+ return
+ fi
+
+ unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
+ export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"
+
+ einfo "Uninstalling GNOME 2 GConf schemas"
+
+ for F in ${GNOME2_ECLASS_SCHEMAS}; do
+ if [[ -e "${ROOT}${F}" ]]; then
+ # echo "DEBUG::gconf uninstall ${F}"
+ "${GCONFTOOL_BIN}" --makefile-uninstall-rule "${ROOT}${F}" 1>/dev/null
+ fi
+ done
+
+ # have gconf reload the new schemas
+ pids=$(pgrep -x gconfd-2)
+ if [[ $? == 0 ]] ; then
+ ebegin "Reloading GConf schemas"
+ kill -HUP ${pids}
+ eend $?
+ fi
+}
+
+
+# Find the icons that are about to be installed and save their location
+# in the GNOME2_ECLASS_ICONS environment variable
+# That function should be called from pkg_preinst
+gnome2_icon_savelist() {
+ pushd "${D}" &> /dev/null
+ export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
+ popd &> /dev/null
+}
+
+
+# Updates Gtk+ icon cache files under /usr/share/icons if the current ebuild
+# have installed anything under that location.
+gnome2_icon_cache_update() {
+ local updater="$(type -p gtk-update-icon-cache 2> /dev/null)"
+
+ if [[ ! -x "${updater}" ]] ; then
+ debug-print "${updater} is not executable"
+ return
+ fi
+
+ if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
+ return
+ fi
+
+
+ ebegin "Updating icons cache"
+
+ local retval=0
+ local fails=( )
+
+ for dir in ${GNOME2_ECLASS_ICONS}
+ do
+ if [[ -f "${ROOT}${dir}/index.theme" ]] ; then
+ local rv=0
+
+ "${updater}" -qf "${ROOT}${dir}"
+ rv=$?
+
+ if [[ ! $rv -eq 0 ]] ; then
+ debug-print "Updating cache failed on ${ROOT}${dir}"
+
+ # Add to the list of failures
+ fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}"
+
+ retval=2
+ fi
+ fi
+ done
+
+ eend ${retval}
+
+ for f in "${fails[@]}" ; do
+ eerror "Failed to update cache with icon $f"
+ done
+}
+
+
+# Workaround applied to Makefile rules in order to remove redundant
+# calls to scrollkeeper-update and sandbox violations.
+gnome2_omf_fix() {
+ local omf_makefiles filename
+
+ omf_makefiles="$@"
+
+ if [[ -f ${S}/omf.make ]] ; then
+ omf_makefiles="${omf_makefiles} ${S}/omf.make"
+ fi
+
+ # testing fixing of all makefiles found
+ # The sort is important to ensure .am is listed before the respective .in for
+ # maintainer mode regeneration not kicking in due to .am being newer than .in
+ for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
+ omf_makefiles="${omf_makefiles} ${filename}"
+ done
+
+ ebegin "Fixing OMF Makefiles"
+
+ local retval=0
+ local fails=( )
+
+ for omf in ${omf_makefiles} ; do
+ local rv=0
+
+ sed -i -e 's:scrollkeeper-update:true:' "${omf}"
+ retval=$?
+
+ if [[ ! $rv -eq 0 ]] ; then
+ debug-print "updating of ${omf} failed"
+
+ # Add to the list of failures
+ fails[$(( ${#fails[@]} + 1 ))]=$omf
+
+ retval=2
+ fi
+ done
+
+ eend $retval
+
+ for f in "${fails[@]}" ; do
+ eerror "Failed to update OMF Makefile $f"
+ done
+}
+
+
+# Updates the global scrollkeeper database.
+gnome2_scrollkeeper_update() {
+ if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then
+ einfo "Updating scrollkeeper database ..."
+ "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}"
+ fi
+}
+
+gnome2_schemas_savelist() {
+ pushd "${D}" &>/dev/null
+ export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
+ popd &>/dev/null
+}
+
+gnome2_schemas_update() {
+ local updater="$(type -P glib-compile-schemas 2>/dev/null)"
+
+ if [[ ! -x ${updater} ]]; then
+ debug-print "${updater} is not executable"
+ return
+ fi
+
+ if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
+ debug-print "no schemas to update"
+ return
+ fi
+
+ ebegin "Updating GSettings schemas"
+ ${updater} --allow-any-name "$@" "${ROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
+ eend $?
+}
diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
new file mode 100644
index 0000000..56e43eb
--- /dev/null
+++ b/eclass/gnome2.eclass
@@ -0,0 +1,166 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v 1.87 2010/04/26 19:37:25 abcd Exp $
+
+#
+# gnome2.eclass
+#
+# Exports portage base functions used by ebuilds written for packages using the
+# GNOME framework. For additional functions, see gnome2-utils.eclass.
+#
+# Maintained by Gentoo's GNOME herd <gnome@gentoo.org>
+#
+
+
+inherit fdo-mime libtool gnome.org gnome2-utils
+
+case "${EAPI:-0}" in
+ 0|1)
+ EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
+ ;;
+ 2|3)
+ EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm
+ ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+# Extra configure opts passed to econf
+G2CONF=${G2CONF:-""}
+
+# Extra options passed to elibtoolize
+ELTCONF=${ELTCONF:-""}
+
+# Should we use EINSTALL instead of DESTDIR
+USE_EINSTALL=${USE_EINSTALL:-""}
+
+# Run scrollkeeper for this package?
+SCROLLKEEPER_UPDATE=${SCROLLKEEPER_UPDATE:-"1"}
+
+
+
+if [[ ${GCONF_DEBUG} != "no" ]]; then
+ IUSE="debug"
+fi
+
+
+
+gnome2_src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ has ${EAPI:-0} 0 1 && gnome2_src_prepare
+}
+
+gnome2_src_prepare() {
+ # Prevent scrollkeeper access violations
+ gnome2_omf_fix
+
+ # Run libtoolize
+ elibtoolize ${ELTCONF}
+}
+
+gnome2_src_configure() {
+ # Update the GNOME configuration options
+ if [[ ${GCONF_DEBUG} != 'no' ]] ; then
+ if use debug ; then
+ G2CONF="${G2CONF} --enable-debug=yes"
+ fi
+ fi
+
+ # Prevent a QA warning
+ if hasq doc ${IUSE} ; then
+ G2CONF="${G2CONF} $(use_enable doc gtk-doc)"
+ fi
+
+ # Avoid sandbox violations caused by misbehaving packages (bug #128289)
+ addwrite "/root/.gnome2"
+
+ # GST_REGISTRY is to work around gst-inspect trying to read/write /root
+ GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed"
+}
+
+gnome2_src_compile() {
+ has ${EAPI:-0} 0 1 && gnome2_src_configure "$@"
+
+ # Whenever new API is added to glib/cairo/libxml2 etc, gobject-introspection
+ # needs to be rebuilt so that the typelibs/girs contain the new API data
+ if has introspection ${IUSE} && use introspection; then
+ ewarn "If you get a compilation failure related to introspection, try"
+ ewarn "rebuilding dev-libs/gobject-introspection so that it's updated"
+ ewarn "for any new glib, cairo, etc APIs"
+ fi
+
+ emake || die "compile failure"
+}
+
+gnome2_src_install() {
+ has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+ # if this is not present, scrollkeeper-update may segfault and
+ # create bogus directories in /var/lib/
+ local sk_tmp_dir="/var/lib/scrollkeeper"
+ dodir "${sk_tmp_dir}" || die "dodir failed"
+
+ # we must delay gconf schema installation due to sandbox
+ export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1"
+
+ if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then
+ debug-print "Installing with 'make install'"
+ emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${ED}${sk_tmp_dir} " "$@" install || die "install failed"
+ else
+ debug-print "Installing with 'einstall'"
+ einstall "scrollkeeper_localstate_dir=${ED}${sk_tmp_dir} " "$@" || die "einstall failed"
+ fi
+
+ unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
+
+ # Manual document installation
+ if [[ -n "${DOCS}" ]]; then
+ dodoc ${DOCS} || die "dodoc failed"
+ fi
+
+ # Do not keep /var/lib/scrollkeeper because:
+ # 1. The scrollkeeper database is regenerated at pkg_postinst()
+ # 2. ${ED}/var/lib/scrollkeeper contains only indexes for the current pkg
+ # thus it makes no sense if pkg_postinst ISN'T run for some reason.
+ if [[ -z "$(find "${D}" -name '*.omf')" ]]; then
+ export SCROLLKEEPER_UPDATE="0"
+ fi
+ rm -rf "${ED}${sk_tmp_dir}"
+
+ # Make sure this one doesn't get in the portage db
+ rm -fr "${ED}/usr/share/applications/mimeinfo.cache"
+}
+
+gnome2_pkg_preinst() {
+ gnome2_gconf_savelist
+ gnome2_icon_savelist
+ gnome2_schemas_savelist
+}
+
+gnome2_pkg_postinst() {
+ gnome2_gconf_install
+ fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update
+ gnome2_schemas_update
+
+ if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then
+ gnome2_scrollkeeper_update
+ fi
+}
+
+#gnome2_pkg_prerm() {
+# gnome2_gconf_uninstall
+#}
+
+gnome2_pkg_postrm() {
+ fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update
+ gnome2_schemas_update --uninstall
+
+ if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then
+ gnome2_scrollkeeper_update
+ fi
+}
+
+# pkg_prerm