From 3f780671de57717836d4fdbb06705ca550415a25 Mon Sep 17 00:00:00 2001
From: "Kevin F. Quinn" <kevquinn@gentoo.org>
Date: Fri, 28 Sep 2007 18:05:43 +0000
Subject: Use XulRunner if present; setup /etc/gre.d/gre.conf if only
 mozilla-firefox is present - follow-up for bug #192527 (Portage version:
 2.1.3.9)

---
 app-text/acroread/ChangeLog             |  6 ++++-
 app-text/acroread/acroread-8.1.1.ebuild | 47 +++++++++++++++++++++++----------
 2 files changed, 38 insertions(+), 15 deletions(-)

(limited to 'app-text/acroread')

diff --git a/app-text/acroread/ChangeLog b/app-text/acroread/ChangeLog
index 07297447cea3..45849ec52f72 100644
--- a/app-text/acroread/ChangeLog
+++ b/app-text/acroread/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog for app-text/acroread
 # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-text/acroread/ChangeLog,v 1.101 2007/09/27 21:13:17 kevquinn Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-text/acroread/ChangeLog,v 1.102 2007/09/28 18:05:43 kevquinn Exp $
+
+  28 Sep 2007; Kevin F. Quinn <kevquinn@gentoo.org> acroread-8.1.1.ebuild:
+  Use XULRunner if available; also set /etc/gre.d/gre.conf for mozilla-firefox
+  so that acroread can find libgtkembedmoz.so without setting preferences.
 
 *acroread-8.1.1 (27 Sep 2007)
 
diff --git a/app-text/acroread/acroread-8.1.1.ebuild b/app-text/acroread/acroread-8.1.1.ebuild
index 15c80ae9342b..8d35c805101f 100644
--- a/app-text/acroread/acroread-8.1.1.ebuild
+++ b/app-text/acroread/acroread-8.1.1.ebuild
@@ -1,6 +1,6 @@
 # Copyright 1999-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-text/acroread/acroread-8.1.1.ebuild,v 1.2 2007/09/28 07:19:50 mr_bones_ Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-text/acroread/acroread-8.1.1.ebuild,v 1.3 2007/09/28 18:05:43 kevquinn Exp $
 
 inherit eutils nsplugins
 
@@ -33,15 +33,17 @@ SLOT="0"
 KEYWORDS="-* ~amd64 ~x86"
 RESTRICT="strip mirror"
 
-# Firefox is needed for libgtkembedmoz.so which is used to render files with
-# HTML.
+# Needs libgtkembedmoz.so, which can come from xulrunner or mozilla-firefox.
+# In the case of mozilla-firefox, need to create /etc/gre.d/gre.conf with
+# GRE_PATH set to the /usr/lib/mozilla-firefox
+# TODO: sort out libgtkembedmoz.so for amd64.
 RDEPEND="x86? ( >=x11-libs/gtk+-2.0
 			cups? ( net-print/cups )
-			ldap? ( net-nds/openldap ) )
+			ldap? ( net-nds/openldap )
+			|| ( net-libs/xulrunner
+				www-client/mozilla-firefox ) )
 	amd64? ( >=app-emulation/emul-linux-x86-baselibs-2.4.2
-			>=app-emulation/emul-linux-x86-gtklibs-2.0 )
-	|| ( www-client/mozilla-firefox
-		www-client/mozilla-firefox-bin )"
+			>=app-emulation/emul-linux-x86-gtklibs-2.0 )"
 QA_TEXTRELS="opt/Acrobat8/Reader/intellinux/plug_ins/PPKLite.api
 	opt/Adobe/Adobe/Reader8/Browser/intellinux/nppdf.so
 	opt/netscape/plugins/nppdf.so"
@@ -208,6 +210,20 @@ src_install() {
 
 pkg_postinst () {
 	local ll lc
+	grep -q GRE_PATH= /etc/gre.d/* 2> /dev/null
+	if [[ $? != "0" ]]; then
+		for lib in /usr/lib/mozilla-firefox; do
+			if [[ -f ${lib}/libgtkembedmoz.so ]]; then
+				mkdir -p /etc/gre.d
+				cat > /etc/gre.d/gre.conf <<-EOF
+					GRE_PATH=${lib}
+				EOF
+				einfo "Acrobat Reader depends on libgtkembedmoz.so, which I've found"
+				einfo "on your system in ${lib}, and configured in /etc/gre.d/gre.conf"
+				break # don't search any more libraries
+			fi
+		done
+	fi
 	use ldap ||
 		elog "The Acrobat(TM) Security Plugin can be enabled with USE=ldap"
 	use nsplugin ||
@@ -223,11 +239,14 @@ pkg_postinst () {
 		elog "version is installed).  Users may need to remove their preferences in"
 		elog "~/.adobe to switch languages."
 	fi
-	ewarn "Acrobat Reader depends dynamically on libgtkembedmoz.so, which comes"
-	ewarn "with Mozilla Firefox.  The first time you start acroread, it will"
-	ewarn "complain about this, telling you to add the path to it to your"
-	ewarn "preferences.  Clear the error dialog, close the Beyond Acrobat"
-	ewarn "Reader dialog, go to Edit -> Preferences -> Internet, and set"
-	ewarn "the libgtkembedmoz directory to /usr/lib/mozilla-firefox, then"
-	ewarn "close and restart acroread."
+	grep -q GRE_PATH= /etc/gre.d/* 2> /dev/null
+	if [[ $? != "0" ]]; then
+		ewarn "Acrobat Reader depends dynamically on libgtkembedmoz.so, which should"
+		ewarn "come with Mozilla Firefox or XULRunner, however it couldn't be found."
+		ewarn "The first time you start acroread, it will complain about this, telling"
+		ewarn "you to add the path to it to your preferences.  Clear the error dialog,"
+		ewarn "close the Beyond Acrobat Reader dialog, go to Edit -> Preferences -> Internet"
+		ewarn "and set the libgtkembedmoz directory to the place where it exists,"
+		ewarn "then close and restart acroread."
+	fi
 }
-- 
cgit v1.2.3-65-gdbad