GARNAME = beagle
GARVERSION = 0.3.3
CATEGORIES = mono
DISTFILES = $(GARNAME)-$(GARVERSION).tar.bz2

LIBDEPS = mono/ndesk-dbus-glib mono/gtk-sharp2.0 mono/gecko-sharp2.0 mono/evolution-sharp mono/gnome-sharp geektoys/gmime

DESCRIPTION = beagle
MAINTAINER = Joseph Sacco <jsacco@gnome.org>
define BLURB
 #FIXME: blurb goes here
endef

CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS = $(WORKSRC)/Makefile
INSTALL_SCRIPTS = $(WORKSRC)/Makefile

CONFIGURE_ARGS = $(DIRPATHS)

include ../category.mk

pre-configure:
	@echo -n " ==> Does gmime need to be rebuilt with mono extensions? "
	@if test ! -e $(libdir)/pkgconfig/gmime-sharp.pc; then \
	    echo "Yes." ; \
	    $(MAKE) -C ../../geektoys/gmime cookieclean ; \
	    $(MAKE) -C ../../geektoys/gmime install ; \
	else \
	    echo "No." ; \
	fi

pre-install:
	@echo " ==> Install the firefox/mozilla plugin..."
	@if test -e $(libdir)/pkgconfig/firefox-nss.pc; then \
	    ffver=`pkg-config --modversion firefox-nss`; \
	    beagle_xpi=`pwd`/$(WORKSRC)/mozilla-extension/beagle.xpi; \
	    if [ -f $$beagle_xpi ]; then \
		cd $(libdir)/firefox-$$ffver/extensions; \
		mkdir beagle-extension; \
	        unzip -q -d beagle-extension $$beagle_xpi; \
	        id=`grep em:id beagle-extension/install.rdf | head -1 | \
	            sed -e 's/^ *//' -e "s/<[^<]*>//g" | tr -d "\n\r"`; \
	        if [ -e "$$id" ]; then \
	            rm -rf beagle-extension; \
	        else \
	            mv beagle-extension "$$id"; \
	        fi; \
	    fi; \
	fi
	@$(MAKECOOKIE)

post-install:
	@echo " ==> Building Nautilus with beagle support... "
	@$(MAKE) -C ../../desktop/nautilus cookieclean
	@$(MAKE) -C ../../desktop/nautilus install
	@echo " ==> Building yelp with beagle support... "
	@$(MAKE) -C ../../desktop/yelp cookieclean
	@$(MAKE) -C ../../desktop/yelp install
	@$(MAKECOOKIE)
