[PATCH] new mozilla.sh and pkg scripts for mozilla

Jose M Rodriguez josemi at freebsd.jazztel.es
Sat Feb 19 11:29:00 PST 2005


>Submitter-Id:	current-users
>Originator:	Jose M Rodriguez
>Organization:	Redes JM
>Confidential:	no
>Synopsis:	[PATCH] new mozilla.sh and pkg scripts for mozilla
>Severity:	non-critical
>Priority:	low
>Category:	ports
>Class:		change-request
>Release:	FreeBSD 5.3-STABLE i386
>Environment:
System: FreeBSD orion.redesjm.local 5.3-STABLE FreeBSD 5.3-STABLE #0: Sat Feb 19 01:42:27 CET 2005 root at orion.redesjm.local:/usr/obj/usr/src/sys/ORION i386


>Description:
	translate and correct PR ports/75836 to mozilla-devel.
	Add a fix for IDN in the way of mozilla.org plans.
	(Duplicate of previous post this morning)
	- Remove LIB_DEPENDS on devel/nspr
	- Add support for moz_pis scripts install
	- Add a default disabled option for IDN
	- Add a default enabled option for artsdsp
	- GFLAGS minor tweak
	- take out files/mozilla.sh
	- support for outer (${PREFIX}/bin) scripts from pkg scripts
	- support for browser_plugins/ from pkg scripts
	- support for java plugin from pkg scripts

>How-To-Repeat:
>Fix:

	apply patch and remove files/mozilla.sh

--- patch-mozilla-devel begins here ---
diff -Nru /usr/HEAD/ports/www/mozilla-devel/Makefile www/mozilla-devel/Makefile
--- /usr/HEAD/ports/www/mozilla-devel/Makefile	Sun Feb 13 14:50:23 2005
+++ www/mozilla-devel/Makefile	Fri Feb 18 23:20:18 2005
@@ -7,7 +7,7 @@
 
 PORTNAME?=	mozilla
 PORTVERSION=	1.8.a6
-PORTREVISION?=	0
+PORTREVISION?=	1
 PORTEPOCH?=	2
 CATEGORIES?=	www
 MASTER_SITES=	${MASTER_SITE_MOZILLA}
@@ -22,8 +22,7 @@
 LIB_DEPENDS=	jpeg.9:${PORTSDIR}/graphics/jpeg \
 		png.5:${PORTSDIR}/graphics/png \
 		mng.1:${PORTSDIR}/graphics/libmng \
-		freetype.9:${PORTSDIR}/print/freetype2 \
-		nspr4.1:${PORTSDIR}/devel/nspr
+		freetype.9:${PORTSDIR}/print/freetype2
 
 WRKSRC=		${WRKDIR}/${PORTNAME}
 
@@ -47,6 +46,7 @@
 WANT_GNOME=	yes
 USE_REINPLACE=	yes
 HAS_CONFIGURE=	yes
+#FIXME, move to mozconfig like firefox/thunderbird
 CONFIGURE_ARGS=					\
 		--disable-auto-deps		\
 		--enable-chrome-format=jar	\
@@ -96,6 +96,7 @@
 	${LOCALBASE}/jdk1.4.1/jre/plugin/${ARCH}/ns610/libjavaplugin_oji.so \
 	${LOCALBASE}/diablo-jdk1.3.1/jre/plugin/${ARCH}/ns600/libjavaplugin_oji.so \
 	${LOCALBASE}/jdk1.3.1/jre/plugin/${ARCH}/ns600/libjavaplugin_oji.so
+MOZ_PIS_SCRIPTS=	# no default scripts
 
 OPTIONS=XFT "Enable Xft font anti-aliasing" on \
 	CALENDAR "Enable the Calendar module" off \
@@ -107,7 +108,9 @@
 	XMLTERM "Enable the XMLTerm module" on \
 	JAVASCRIPT_DEBUGGER "Enable the DTD and JavaScript debuggers" off \
 	OPTIMIZED_CFLAGS "Enable -O2 optimizations" off \
-	SMB "Enable smb:// URI support using gnomevfs" off
+	SMB "Enable smb:// URI support via gnomevfs" off \
+	IDN "Enable International Domain Names" off \
+	ARTSDSP "Add support for KDE arts (artsdsp)" on
 
 .include <bsd.port.pre.mk>
 
@@ -131,6 +134,7 @@
 CONFIGURE_ENV+=		MOZ_INTERNAL_LIBART_LGPL=1
 .endif
 
+# FIXME, take out WITHOUT_XFT knob in a gtk2 world
 .if !defined(WITHOUT_XFT)
 LIB_DEPENDS+=	Xft.2:${PORTSDIR}/x11-fonts/libXft
 CONFIGURE_ARGS+=--enable-xft --disable-freetype2
@@ -194,6 +198,8 @@
 		MOZ_INTERNAL_LIBART_LGPL=1
 ALL_TARGET=	default
 FAKEDIR=	${WRKDIR}/fake
+SCRIPTS_DIR=	${FAKEDIR}/lib/${MOZILLA}
+MOZ_PIS_DIR=	${SCRIPTS_DIR}/init.d
 
 .if ${ARCH} == "i386"
 CONFIGURE_ARGS+=	--enable-reorder
@@ -206,8 +212,16 @@
 .endif
 
 .if defined(WITH_OPTIMIZED_CFLAGS)
-CFLAGS+=		-O2
+CFLAGS:=		-O2 -fno-strict-aliasing ${CFLAGS:N-O*}
+#FIXME, add -fno-strict-aliasing to --enable-optimize
 CONFIGURE_ARGS+=	--enable-optimize=-O2
+.else
+# May need this for 'official builds'
+# CFLAGS:=		-O ${CFLAGS:N-O*:N-march=*:N-mcpu=*:N-mtune=*}
+.endif
+
+.if !defined(WITHOUT_ARTSDSP)
+MOZ_PIS_SCRIPTS+=	S90dsp.sh
 .endif
 
 .if ${ARCH} == "alpha" && ${OSVERSION} < 500035
@@ -226,6 +240,13 @@
 	@${ECHO_MSG} "http://mozilla.org/projects/calendar/"
 	@${ECHO_MSG} ""
 .endif
+.if defined(WITH_IDN)
+	@${ECHO_MSG} ""
+	@${ECHO_MSG} "Building with IDN enabled."
+	@${ECHO_MSG} "this makes homograph spoofing attacks possible"
+	@${ECHO_MSG} "Use at your own risk."
+	@${ECHO_MSG} ""
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
@@ -259,11 +280,19 @@
 			s|mozilla-nspr|mozilla-nspr${MOZ_SUFX}|g' \
 			${WRKSRC}/build/unix/$${pcfile}.pc.in; \
 	done
-	@${SED} -e 's|%%MOZDIR%%|${PREFIX}/lib/${MOZILLA}|g ; \
+	@${SED} -e 's|%%MOZILLA%%|${MOZILLA}|g ; \
+		s|%%JPI_LIST%%|${JPI_LIST}|g ; \
+		s|%%X11BASE%%|${X11BASE}|g ; \
 		s|%%PREFIX%%|${PREFIX}|g' \
 		< ${MASTERDIR}/pkg-install.in > ${PKGINSTALL}
-	@${SED} -e 's|%%MOZDIR%%|${PREFIX}/lib/${MOZILLA}|g' \
+	@${SED} -e 's|%%MOZILLA%%|${MOZILLA}|g ; \
+		s|%%X11BASE%%|${X11BASE}|g ; \
+		s|%%PREFIX%%|${PREFIX}|g' \
 		< ${MASTERDIR}/pkg-deinstall.in > ${PKGDEINSTALL}
+.if defined(WITH_IDN)
+	@${REINPLACE_CMD} -e '/network.enableIDN/s/false/true/' \
+		${WRKSRC}/modules/libpref/src/init/all.js
+.endif
 
 pre-configure:
 	@if [ -n "`${PKG_INFO} -xI '^bind[0-9]*-base-[0-9]'`" ]; then \
@@ -271,34 +300,22 @@
 		${FALSE}; \
 	fi
 
-post-build:
-	${SED} -e "s|%%PREFIX%%|${PREFIX}|g" -e "s|%%MOZILLA%%|${MOZILLA}|g" \
-		${FILESDIR}/mozilla.sh >${WRKSRC}/${MOZILLA}
-
 pre-install:
 	${RM} -rf ${PLIST} ${FAKEDIR}
 	${TOUCH} -f ${PLIST}
 	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} \
 		Makefile ${MAKE_ARGS} install
+	${MKDIR} ${SCRIPTS_DIR}
+	${MKDIR} ${MOZ_PIS_DIR}
 	${REINPLACE_CMD} -e 's|${FAKEDIR}|${PREFIX}|g' \
 		${FAKEDIR}/bin/mozilla \
 		${FAKEDIR}/bin/mozilla-config
-	if [ ! -x ${PREFIX}/bin/mozilla -a ! -L ${PREFIX}/bin/mozilla ]; then \
-		${ECHO_CMD} bin/mozilla >> ${PLIST} ; \
-	fi
-	${ECHO_CMD} bin/${MOZILLA} >> ${PLIST}
-	if [ ! -L ${PREFIX}/lib/browser_plugins/libjavaplugin_oji.so ]; then \
-		for jpi in ${JPI_LIST}; do \
-			if [ -f $${jpi} ]; then \
-				${ECHO_CMD} lib/browser_plugins/libjavaplugin_oji.so >> ${PLIST} ; \
-				break; \
-			fi; \
-		done; \
-	fi
-	${ECHO_CMD} lib/browser_plugins/.${PORTNAME}.keep >> ${PLIST}
-	${ECHO_CMD} "@unexec ${RMDIR} %D/lib/browser_plugins 2>/dev/null || ${TRUE}" >> ${PLIST}
-	${ECHO_CMD} lib/${MOZILLA}/mozilla >> ${PLIST}
-	${ECHO_CMD} lib/${MOZILLA}/mozilla-config >> ${PLIST}
+	${INSTALL_SCRIPT} ${FAKEDIR}/bin/mozilla ${SCRIPTS_DIR}/${MOZILLA}
+	${INSTALL_SCRIPT} ${FAKEDIR}/bin/mozilla ${SCRIPTS_DIR}
+	${INSTALL_SCRIPT} ${FAKEDIR}/bin/mozilla-config ${SCRIPTS_DIR}
+.for ii in ${MOZ_PIS_SCRIPTS}
+	${INSTALL_SCRIPT} ${FILESDIR}/moz_pis_${ii} ${MOZ_PIS_DIR}/${ii}
+.endfor
 .if !defined(WITHOUT_MAILNEWS)
 	@${CP} -RL ${WRKSRC}/dist/bin/defaults/isp ${FAKEDIR}/lib/${MOZILLA}/defaults
 .endif
@@ -319,27 +336,8 @@
 do-install:
 	${MKDIR} ${PREFIX}/lib/${MOZILLA}
 	${CHMOD} 755 ${PREFIX}/lib/${MOZILLA}
-	${INSTALL_SCRIPT} ${FAKEDIR}/bin/mozilla ${PREFIX}/lib/${MOZILLA}
-	${INSTALL_SCRIPT} ${FAKEDIR}/bin/mozilla-config ${PREFIX}/lib/${MOZILLA}
 	cd ${FAKEDIR}/lib/${MOZILLA} && ${FIND} . | \
 		${CPIO} -pdm -L -R ${LIBOWN}:${LIBGRP} ${PREFIX}/lib/${MOZILLA}
-	${INSTALL_SCRIPT} ${WRKSRC}/${MOZILLA} ${PREFIX}/bin
-	if [ ! -x ${PREFIX}/bin/mozilla -a ! -L ${PREFIX}/bin/mozilla ]; then \
-		${LN} -sf ${PREFIX}/bin/${MOZILLA} ${PREFIX}/bin/mozilla ; \
-	fi
-	if [ ! -d ${PREFIX}/lib/browser_plugins ]; then \
-		${MKDIR} ${PREFIX}/lib/browser_plugins ; \
-	fi
-	${TOUCH} -f ${PREFIX}/lib/browser_plugins/.${PORTNAME}.keep
-	if [ ! -L ${PREFIX}/lib/browser_plugins/libjavaplugin_oji.so ]; then \
-		for jpi in ${JPI_LIST}; do \
-			if [ -f $${jpi} ]; then \
-		    		${LN} -sf $${jpi} \
-			    		${PREFIX}/lib/browser_plugins/libjavaplugin_oji.so ; \
-				break; \
-			fi; \
-		done; \
-	fi
 	for pcfile in ${PKGCONFIG_FILES}; do \
 		${REINPLACE_CMD} -e 's|${FAKEDIR}|${PREFIX}|g' \
 			${WRKSRC}/build/unix/$${pcfile}.pc; \
diff -Nru /usr/HEAD/ports/www/mozilla-devel/files/moz_pis_S90dsp.sh www/mozilla-devel/files/moz_pis_S90dsp.sh
--- /usr/HEAD/ports/www/mozilla-devel/files/moz_pis_S90dsp.sh	Thu Jan  1 01:00:00 1970
+++ www/mozilla-devel/files/moz_pis_S90dsp.sh	Wed Feb 16 09:32:09 2005
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+
+# S90dsp.sh
+# dsp aids for mozilla
+# WARN, this is sourced in the main mozilla.sh script.  Be carefull
+
+# esd support seems to be built-in in mozilla now
+# support only artsdsp
+
+if [ ${MOZ_PIS_API} -eq 2 -a "X$1" = "Xstart" -a -x "${run_moz}" ]; then
+    case "${MOZILLA_DSP}" in
+	[Aa][Rr][Tt][Ss] | artsdsp)
+	    MOZILLA_DSP="artsdsp"
+	    ;;
+	[Nn][Oo][Nn][Ee])
+	    MOZILLA_DSP=""
+	    ;;
+	*) # auto
+	    if [ -n "${KDE_FULL_SESSION}" ]; then
+		MOZILLA_DSP="artsdsp"
+	    else
+		MOZILLA_DSP=""
+	    fi
+	    ;;
+    esac
+    [ -n "${MOZILLA_DSP}" ] && MOZILLA_DSP=`which "${MOZILLA_DSP}"` &&
+    run_moz="${MOZILLA_DSP} ${run_moz}"
+    if [ -n "${debuggin}" ]; then
+	echo "dsp: ${run_moz}"
+    fi
+fi
diff -Nru /usr/HEAD/ports/www/mozilla-devel/files/mozilla.sh www/mozilla-devel/files/mozilla.sh
--- /usr/HEAD/ports/www/mozilla-devel/files/mozilla.sh	Fri Dec 24 19:25:45 2004
+++ www/mozilla-devel/files/mozilla.sh	Thu Jan  1 01:00:00 1970
@@ -1,85 +0,0 @@
-#!/bin/sh
-
-MOZILLA_DIR="%%PREFIX%%/lib/%%MOZILLA%%"
-MOZILLA_EXEC="./mozilla"
-MOZILLA_REMOTE_EXEC="${MOZILLA_EXEC} -remote"
-APPLICATION_ID="mozilla"
-
-LOCATION='new-tab'
-#MOZILLA_UILOCALE="en-US"
-#MOZILLA_UIREGION="US"
-#MOZILLA_DSP="auto"
-
-cd $MOZILLA_DIR                                     || exit 1
-
-# LANG, MOZILLA_UILOCALE, MOZILLA_UIREGION
-if [ -n "$LANG" -a ! -n "${MOZILLA_UILOCALE}" ]; then
-    _locale="${LANG%%.*}"
-    if [ "${_locale}" != "en_US" -a "${_locale}" != "C" ]; then
-	_region="${_locale##*_}"
-	_locale="${_locale%_*}"
-	[ -r chrome/${_locale}-${_region}.jar ] && \
-	    MOZILLA_EXEC="${MOZILLA_EXEC} -UILocale ${_locale}-${_region}"
-    fi
-elif [ -n "${MOZILLA_UILOCALE}" ]; then
-    MOZILLA_EXEC="${MOZILLA_EXEC} -UILocale ${MOZILLA_UILOCALE}"
-    if [ -n "${MOZILLA_UIREGION}" ]; then
-	MOZILLA_EXEC="${MOZILLA_EXEC} -UIRegion ${MOZILLA_UIREGION}"
-    fi
-fi
-
-# find a /dev/dsp handler
-case "${MOZILLA_DSP}" in
-#    [Ee][Ss][Dd]|esddsp) # Use the esd dsp wrapper
-#	MOZILLA_DSP="esddsp"
-#	;;
-    [Aa][Rr][Tt][Ss]|artsdsp) # Use the arts dsp wrapper
-	MOZILLA_DSP="artsdsp"
-	;;
-    [Nn][Oo][Nn][Ee]) # Direct dsp output
-	MOZILLA_DSP=""
-	;;
-    *) # Guest one (auto)
-	if [ -n "${KDE_FULL_SESSION}" ]; then
-		MOZILLA_DSP="artsdsp"
-#	elif [ -r ${HOME}/.esd_auth ]; then
-#		MOZILLA_DSP="esddsp"
-	else
-		MOZILLA_DSP=""
-	fi
-	;;
-esac
-
-if [ -n "${MOZILLA_DSP}" ] && type "${MOZILLA_DSP}" > /dev/null 2>&1; then
-	MOZILLA_EXEC="${MOZILLA_DSP} ${MOZILLA_EXEC}"
-fi
-
-case $1 in
-    -browser)
-    	REMOTE_COMMAND="xfeDoCommand (openBrowser)"
-	;;
-    -mail)
-    	REMOTE_COMMAND="xfeDoCommand (openInbox)"
-	;;
-    -compose)
-    	REMOTE_COMMAND="xfeDoCommand (composeMessage)"
-	;;
-    -*)
-    	exec ${MOZILLA_EXEC} "$@"
-	;;
-    *)
-	if [ -n "${LOCATION}" ]; then
-    		REMOTE_COMMAND="openURL($@,$LOCATION)"
-	else
-		REMOTE_COMMAND="openURL($@)"
-	fi
-	;;
-esac
-
-# process found
-${MOZILLA_REMOTE_EXEC} "ping()" >/dev/null 2>&1     &&
-${MOZILLA_REMOTE_EXEC} "${REMOTE_COMMAND}"          && exit 0
-
-# no existing process
-exec ${MOZILLA_EXEC} "$@"
-
diff -Nru /usr/HEAD/ports/www/mozilla-devel/files/patch-modules_libpref_src_init_all.js www/mozilla-devel/files/patch-modules_libpref_src_init_all.js
--- /usr/HEAD/ports/www/mozilla-devel/files/patch-modules_libpref_src_init_all.js	Thu Jan  1 01:00:00 1970
+++ www/mozilla-devel/files/patch-modules_libpref_src_init_all.js	Fri Feb 18 21:32:25 2005
@@ -0,0 +1,13 @@
+--- modules/libpref/src/init/all.js.orig	Fri Feb 18 21:27:17 2005
++++ modules/libpref/src/init/all.js	Fri Feb 18 21:30:27 2005
+@@ -552,7 +552,9 @@
+ 
+ // This preference controls whether or not internationalized domain names (IDN)
+ // are handled.  IDN requires a nsIIDNService implementation.
+-pref("network.enableIDN", true);
++// Due to registar problems to protect against homograph spoofing attacks,
++// This is disable by default.  Enable at your own risk.
++pref("network.enableIDN", false);
+ 
+ // This preference specifies a list of domains for which DNS lookups will be
+ // IPv4 only. Works around broken DNS servers which can't handle IPv6 lookups
diff -Nru /usr/HEAD/ports/www/mozilla-devel/files/patch-xpfe_bootstrap_mozilla.in www/mozilla-devel/files/patch-xpfe_bootstrap_mozilla.in
--- /usr/HEAD/ports/www/mozilla-devel/files/patch-xpfe_bootstrap_mozilla.in	Thu Jan  1 01:00:00 1970
+++ www/mozilla-devel/files/patch-xpfe_bootstrap_mozilla.in	Thu Feb 17 14:56:48 2005
@@ -0,0 +1,425 @@
+--- xpfe/bootstrap/mozilla.in.orig	Sat Apr 17 18:51:11 2004
++++ xpfe/bootstrap/mozilla.in	Thu Feb 17 14:55:17 2005
+@@ -49,139 +49,314 @@
+ ## the mozilla-bin binary to work.
+ ##
+ 
++#
++# MOZ_PIS, "Mozilla Plugable Init Scripts"
++# MOZ_PIS_ is the name space used
++# These variables and there meaning are specified in
++# mozilla/xpfe/bootstrap/init.d/README
+ moz_pis_startstop_scripts()
+ {
+-  MOZ_USER_DIR="%MOZ_USER_DIR%"
+-  # MOZ_PIS_ is the name space for "Mozilla Plugable Init Scripts"
+-  # These variables and there meaning are specified in
+-  # mozilla/xpfe/bootstrap/init.d/README
+-  MOZ_PIS_API=2
+-  MOZ_PIS_MOZBINDIR="${dist_bin}"
+-  MOZ_PIS_SESSION_PID="$$"
+-  MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
+-  export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
+-  
+-  case "${1}" in
+-    "start")
+-      for curr_pis in "${dist_bin}/init.d"/S* "${HOME}/${MOZ_USER_DIR}/init.d"/S* ; do
+-        if [ -x "${curr_pis}" ] ; then
+-          case "${curr_pis}" in
+-            *.sh) .  "${curr_pis}"         ;;
+-            *)       "${curr_pis}" "start" ;;
+-          esac
+-        fi
+-      done
+-      ;;
+-    "stop")
+-      for curr_pis in "${HOME}/${MOZ_USER_DIR}/init.d"/K* "${dist_bin}/init.d"/K* ; do
+-        if [ -x "${curr_pis}" ] ; then
+-          case "${curr_pis}" in
+-            *.sh) . "${curr_pis}"        ;;
+-            *)      "${curr_pis}" "stop" ;;
+-          esac
+-        fi
+-      done
+-      ;;
+-    *)
+-      echo 1>&2 "$0: Internal error in moz_pis_startstop_scripts."
+-      exit 1
+-      ;;
+-  esac
++    MOZ_PIS_API=2
++    MOZ_PIS_MOZBINDIR="${dist_bin}"
++    MOZ_PIS_SESSION_PID="$$"
++    MOZ_PIS_USER_DIR="${MOZ_USER_DIR}"
++    export MOZ_PIS_API MOZ_PIS_MOZBINDIR MOZ_PIS_SESSION_PID MOZ_PIS_USER_DIR
++
++    case "${1}" in
++	"start")
++	    for curr_pis in "${MOZ_PIS_MOZBINDIR}/init.d"/S* \
++		    "${HOME}/${MOZ_PIS_USER_DIR}/init.d"/S*; do
++		if [ -x "${curr_pis}" ]; then
++		    case "${curr_pis}" in
++			*.sh)
++			    . "${curr_pis}"
++			    ;;
++			*)
++			    ${curr_pis} "start"
++			    ;;
++		    esac
++		fi
++	    done
++	    ;;
++	"stop")
++	    for curr_pis in "${MOZ_PIS_MOZBINDIR}/init.d"/K* \
++		    "${HOME}/${MOZ_PIS_USER_DIR}/init.d"/K*; do
++		if [ -x "${curr_pis}" ]; then
++		    case "${curr_pis}" in
++			*.sh)
++			    . "${curr_pis}"
++			    ;;
++			*)
++			    ${curr_pis} "stop"
++			    ;;
++		    esac
++		fi
++	    done
++	    ;;
++	*)
++	    echo "$0: Internal error in moz_pis_startstop_scripts." 1>&2
++	    exit 1
++	    ;;
++    esac
+ }
+ 
+ #uncomment for debugging
+ #set -x
+ 
+-moz_libdir=%MOZAPPDIR%
+-MRE_HOME=%MREDIR%
++#
++# variables
++#
++location="new-tab"
++#MOZILLA_UILOCALE="en-US"
++#MOZILLA_UIREGION="US"
+ 
+-# honor MOZILLA_FIVE_HOME if it's there
+-if [ -n "$MOZILLA_FIVE_HOME" ] ; then
+-  dist_bin="$MOZILLA_FIVE_HOME"
+-else
+-  # Use run-mozilla.sh in the current dir if it exists
+-  # If not, then start resolving symlinks until we find run-mozilla.sh
+-  found=0
+-  progname=$0
+-  curdir=`dirname "$progname"`
+-  run_moz="$curdir/run-mozilla.sh"
+-  if test -x "$run_moz"; then
+-    dist_bin=$curdir
++#
++# working definitions
++#
++MOZ_USER_DIR="%MOZ_USER_DIR%"
++moz_libdir="%MOZAPPDIR%"
++MRE_HOME="%MREDIR%"
++
++debugging=		# set the debugging level
++use_openFile="yes"	# use openFile() for file/dir
++here=`pwd`
++
++if [ ! -d "${MRE_HOME}" ]; then
++    # use moz_libdir as MRE_HOME
++    MRE_HOME="${moz_libdir}"
++fi
++export MRE_HOME
++
++# Use run-mozilla.sh in the current dir if it exists
++# If not, then start resolving symlinks until we find run-mozilla.sh
++found=0
++progname="$0"
++curdir=`dirname "$progname"`
++progbase=`basename "$progname"`
++run_moz="$curdir/run-mozilla.sh"
++# mozilla must obey MOZILLA_FIVE_HOME
++if [ -n "$MOZILLA_FIVE_HOME" -a -d "$MOZILLA_FIVE_HOME" -a \
++	-x "$MOZILLA_FIVE_HOME/run-mozilla.sh" ]; then
++    curdir="$MOZILLA_FIVE_HOME"
++    run_moz="$curdir/run-mozilla.sh"
++    dist_bin="$curdir"
++    found=1
++elif [ -x "$run_moz" ]; then
++    dist_bin="$curdir"
+     found=1
+-  else
+-    here=`/bin/pwd`
+-    while [ -h "$progname" ]; do
+-      bn=`basename "$progname"`
+-      cd `dirname "$progname"`
+-      progname=`/bin/ls -l "$bn" |sed -e 's/^.* -> //' `
+-      if [ ! -x "$progname" ]; then
+-        break
+-      fi
+-      curdir=`dirname "$progname"`
+-      run_moz="$curdir/run-mozilla.sh"
+-      if [ -x "$run_moz" ]; then
+-        cd "$curdir"
+-        dist_bin=`pwd`
+-        found=1
+-        break
+-      fi
++else
++    while [ -h "${progname}" ]; do
++	bn=`basename "${progname}"`
++	cd `dirname "${progname}"`
++	progname=`ls -l "${bn}" | sed -e 's/^.* -> //'`
++	if [ ! -x "$progname" ]; then
++	    break
++	fi
++	curdir=`dirname "${progname}"`
++	run_moz="${curdir}/run-mozilla.sh"
++	if [ -x "${run_moz}" ]; then
++	    cd "$curdir"
++	    dist_bin=`pwd`
++	    run_moz="${dist_bin}/run-mozilla.sh"
++	    found=1
++	    break
++	fi
+     done
+-    cd "$here"
+-  fi
+-  if [ $found = 0 ]; then
++    cd "${here}"
++fi
++if [ $found = 0 ]; then
+     # Check default compile-time libdir
+-    if [ -x "$moz_libdir/run-mozilla.sh" ]; then
+-      dist_bin=$moz_libdir
+-    else 
+-      echo "Cannot find mozilla runtime directory. Exiting."
+-      exit 1
+-    fi
+-  fi
++    if [ -x "${moz_libdir}/run-mozilla.sh" ]; then
++	dist_bin="$moz_libdir"
++	run_moz="${dist_bin}/run-mozilla.sh"
++    else
++	echo "$0: Cannot find mozilla runtime directory. Exiting." 1>&2
++	exit 1
++    fi
+ fi
+ 
+-script_args=""
+-moreargs=""
+-debugging=0
+-MOZILLA_BIN="%MOZILLA-BIN%"
+-
++MOZILLA_BIN="${progbase}-bin"
+ if [ "$OSTYPE" = "beos" ]; then
+-  mimeset -F $MOZILLA_BIN
++    mimeset -F "$MOZILLA_BIN"
++fi
++MOZILLA_BIN="${dist_bin}/${progbase}-bin"
++
++# test for binary apps in ${dist_bin}
++if [ -x "${dist_bin}/mozilla-xremote-client" ]; then
++    MOZ_CLIENT_PROGRAM="${dist_bin}/mozilla-xremote-client -a ${progbase}"
++elif [ -x "${MOZILLA_BIN}" ]; then
++    MOZ_CLIENT_PROGRAM="${MOZILLA_BIN} -remote -a ${progbase}"
++else
++    echo "$0: Cannot find mozilla binary executable. Exiting." 1>&2
++    exit 1
++fi
++
++# guest a default remote command
++_remote_cmd="xfeDoCommand(openBrowser)"
++
++# test for a running copy of mozilla
++ALREADY_RUNNING=	# null
++if [ -n "${DISPLAY}" ]; then
++    if [ -n "${debugging}" ]; then
++	echo "${run_moz} ${MOZ_CLIENT_PROGRAM} ping()"
++	${run_moz} ${MOZ_CLIENT_PROGRAM} 'ping()' && ALREADY_RUNNING="yes"
++    else
++	${run_moz} ${MOZ_CLIENT_PROGRAM} 'ping()' >/dev/null 2>&1 &&
++		ALREADY_RUNNING="yes"
++    fi
++elif [ -n "${debugging}" ]; then
++    echo "$0: WARN, no DISPLAY environment" 1>&2
+ fi
+ 
++# parse options
++script_args=	# null
++moreargs=	# null
++target=		# null
+ while [ $# -gt 0 ]
+ do
+-  case "$1" in
+-    -p | -pure)
+-      MOZILLA_BIN="%MOZILLA-BIN%.pure"
+-      shift
+-      ;;
+-    -g | --debug)
+-      script_args="$script_args -g"
+-      debugging=1
+-      shift
+-      ;;
+-    -d | --debugger)
+-      script_args="$script_args -d $2"
+-      shift 2
+-      ;;
+-    *)
+-      moreargs="$moreargs \"$1\""
+-      shift 1
+-      ;;
+-  esac
++    if [ -n "${target}" ]; then
++	# well, this can't be the target if not last
++	moreargs="${moreargs} ${target}"
++	target=	# null
++    fi
++    case "$1" in
++	-p | --pure | -pure)
++	    MOZILLA_BIN="${MOZILLA_BIN}.pure"
++	    shift
++	    ;;
++	-g | --debug)
++	    script_args="${script_args} -g"
++	    debugging=1
++	    shift
++	    ;;
++	-d | --debugger)
++	    if [ -n "$2" ]; then
++		script_args="${script_args} -d $2"
++		shift 2
++	    else
++		"$0: ERROR, -d needs an argument. Exiting" 1>&2
++		exit 1
++	    fi
++	    ;;
++	-UILocale)
++	    if [ -n "$2" ]; then
++		uilocale="$2"
++		shift 2
++	    else
++		echo "$0: ERROR, -UILocale needs an argument. Exiting" 1>&2
++		exit 1
++	    fi
++	    ;;
++	-UIRegion)
++	    if [ -n "$2" ]; then
++		uiregion="$2"
++		shift 2
++	    else
++		echo "$0: ERROR, -UIRegion needs an argument. Exiting" 1>&2
++		exit 1
++	    fi
++	    ;;
++	-browser)
++	    _remote_cmd="xfeDoCommand(openBrowser)"
++	    moreargs="${moreargs} $1"
++	    shift
++	    ;;
++	-mail)
++	    _remote_cmd="xfeDoCommand(openInbox)"
++	    moreargs="${moreargs} $1"
++	    shift
++	    ;;
++	-compose)
++	    _remote_cmd="xfeDoCommand(composeMessage)"
++	    moreargs="${moreargs} $1"
++	    shift
++	    ;;
++	-chat | -edit | -webcal)
++	    # don't use remote for this
++	    ALREADY_RUNNING=    # null
++	    moreargs="${moreargs} $1"
++	    shift
++	    ;;
++	-*)
++	    moreargs="${moreargs} $1"
++	    shift
++	    ;;
++	*)
++	    target="$1"
++	    shift
++	    ;;
++    esac
+ done
+ 
+-export MRE_HOME
+-eval "set -- $moreargs"
++# process target
++if [ -n "${target}" ]; then
++    if [ `expr "${target}" : '.*:.*'` -eq 0 ]; then
++	if [ `expr "${target}" : '/.*'` -eq 0 ]; then
++	    target="${here}/${target}"
++	fi
++	if [ -r "${target}" -o -d "${target}" ]; then
++	    [ -n "${use_openFile}" ] || target="file://${target}"
++	else
++	    echo "$0: WARN, target: ${target} not an URI/file/dir" 1>&2
++	    ALREADY_RUNNING=    # null
++	fi
++    else
++	# an former URI, don't use openFile
++	use_openFile=	# null
++    fi
++fi
++
++# try remote protocol if running
++if [ -n "${ALREADY_RUNNING}" ]; then
++    if [ -n "${target}" ]; then
++	if [ -n "${use_openFile}" ]; then
++	    _remote_cmd="openFile(${target})"
++	elif [ -n "${location}" ]; then
++	    _remote_cmd="openURL(${target},${location})"
++	else
++	    _remote_cmd="openURL(${target})"
++	fi
++    fi
++    # FIXME problems with freedesktop StartupNotify
++    if [ -n "${debugging}" ]; then
++	echo "${run_moz} ${script_args} ${MOZ_CLIENT_PROGRAM} ${_remote_cmd}"
++    fi
++    ${run_moz} ${script_args} ${MOZ_CLIENT_PROGRAM} ${_remote_cmd} && exit 0
++fi
++
++# fallback to direct invocation
++
++# UILocale, UIRegion
++if [ -z "${uilocale}" -a -n "${MOZILLA_UILOCALE}" ]; then
++    uilocale="${MOZILLA_UILOCALE}"
++fi
++if [ -z "${uiregion}" -a -n "${MOZILLA_UIREGION}" ]; then
++    uiregion="${MOZILLA_UIREGION}"
++fi
++if [ -n "${uiregion}" -a -z "${uilocale}" ]; then
++    uilocale="en-US"
++fi
++if [ -n "${uilocale}" ]; then
++    if [ -n "${uiregion}" ]; then
++	moreargs="-UIRegion ${uiregion} ${more_args}"
++    fi
++    moreargs="-UILocale ${uilocale} ${more_args}"
++fi
++
++# real invocation
++if [ -n "${target}" ]; then
++    eval "set -- ${moreargs} \"${target}\""
++else
++    eval "set -- ${moreargs}"
++fi
+ 
+ ## Start addon scripts
+ moz_pis_startstop_scripts "start"
+ 
+-if [ $debugging = 1 ]
+-then
+-  echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
++if [ -n "${debugging}" ]; then
++    echo "${run_moz} ${script_args} ${MOZILLA_BIN} $@"
+ fi
+-"$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
++${run_moz} ${script_args} ${MOZILLA_BIN} "$@"
+ exitcode=$?
+ 
+ ## Stop addon scripts
diff -Nru /usr/HEAD/ports/www/mozilla-devel/pkg-deinstall.in www/mozilla-devel/pkg-deinstall.in
--- /usr/HEAD/ports/www/mozilla-devel/pkg-deinstall.in	Sun Oct 24 04:35:07 2004
+++ www/mozilla-devel/pkg-deinstall.in	Wed Feb 16 09:59:52 2005
@@ -9,14 +9,62 @@
 umask 022
 PATH=/bin:/usr/bin
 
+prefix="${PKG_PREFIX:-%%PREFIX%%}"
+
 [ "x$1" = "x" ] && exit 1
 [ "x$2" != "xDEINSTALL" ] && exit 0
 
-MOZDIR=%%MOZDIR%%
+MOZDIR="${prefix}/lib/%%MOZILLA%%"
 
 rm -rf ${MOZDIR}/chrome/overlayinfo
 rm -f ${MOZDIR}/chrome/*.rdf
 rm -f ${MOZDIR}/component.reg
 rm -f ${MOZDIR}/components/*.dat
+
+# support for outer scripts
+for script in %%MOZILLA%% mozilla mozilla-config; do
+    rm -f "${prefix}/bin/${script}"
+done
+for mozdir in ${prefix}/lib/mozilla* %%X11BASE%%/lib/mozilla*; do
+    if [ -d "${mozdir}" -a "${mozdir}" != "${MOZDIR}" -a \
+	-x "${mozdir}/run-mozilla.sh" -a -x "${mozdir}/mozilla" ]; then
+	for prog in %%MOZILLA%% mozilla-config; do
+	    if [ -x "${mozdir}/${prog}" ]; then
+		install -m 555 ${mozdir}/${prog} ${prefix}/bin
+	    fi
+	done
+	install -m 555 ${mozdir}/mozilla ${prefix}/bin
+    fi
+done
+
+# support for shared browser-plugins directory (X11BASE)
+# FIXME: go for a www/browser-hier port
+PLUGINDIR="%%X11BASE%%/lib/browser-plugins"
+# this is what we do now
+# But may be better use MOZLIB after tr / _
+KEEPFILE="${PLUGINDIR}/.%%MOZILLA%%.keep"
+
+# sure someone can work a clever way to do this
+rm -f "${KEEPFILE}"
+for file in ${PLUGINDIR}/.*.keep; do
+    if [ -f "${file}" ]; then
+	break
+    fi
+    rm -rf "${PLUGINDIR}"
+    break
+done
+	
+# alternate way to register browser-plugins
+# this makes ${KEEPFILE} usable by moz_pis to age tests
+#
+# PLUGINDIR="%%X11BASE%%/lib/browser-plugins"
+# KEEPFILE="${PLUGINDIR}/.keepme"
+# if [ -r "${KEEPFILE}" ]; then
+#     if grep -hqv "${MOZDIR}" "${KEEPFILE}" > "${KEEPFILE}-%%MOZILLA%%"; then
+# 	mv "${KEEPFILE}-%%MOZILLA%%" "${KEEPFILE}"
+#     else
+# 	rm -rf "${PLUGINDIR}"
+#     fi
+# fi
 
 exit 0
diff -Nru /usr/HEAD/ports/www/mozilla-devel/pkg-install.in www/mozilla-devel/pkg-install.in
--- /usr/HEAD/ports/www/mozilla-devel/pkg-install.in	Sat Dec  4 10:47:25 2004
+++ www/mozilla-devel/pkg-install.in	Fri Feb 18 23:18:08 2005
@@ -9,25 +9,67 @@
 umask 022
 PATH=/bin:/usr/bin
 
+prefix="${PKG_PERFIX:-%%PREFIX%%}"
+
 [ "x$1" = "x" ] && exit 1
 [ "x$2" != "xPOST-INSTALL" ] && exit 0
 
-MOZDIR=%%MOZDIR%%
-REGXPCOM=${MOZDIR}/regxpcom
-REGCHROME=${MOZDIR}/regchrome
-
-echo "===> Building Chrome's registry..."
-rm -rf ${MOZDIR}/chrome/overlayinfo
-rm -f ${MOZDIR}/chrome/*.rdf
-mkdir -p ${MOZDIR}/chrome/overlayinfo
-rm -f ${MOZDIR}/component.reg
-
-cd ${MOZDIR} || exit 1
-./run-mozilla.sh ${REGXPCOM} || true
-./run-mozilla.sh ${REGCHROME} || true
+MOZDIR="${prefix}/lib/%%MOZILLA%%"
+REGXPCOM="${MOZDIR}/regxpcom"
+REGCHROME="${MOZDIR}/regchrome"
+
+if [ -x "${MOZDIR}/register.sh" ]; then
+    # do registration via register.sh, shareable with extensions
+    . ${MOZDIR}/register.sh
+else
+    # default fallback
+    echo "===> Building Chrome's registry..."
+    rm -rf ${MOZDIR}/chrome/overlayinfo
+    rm -f ${MOZDIR}/chrome/*.rdf
+    mkdir -p ${MOZDIR}/chrome/overlayinfo
+    rm -f ${MOZDIR}/component.reg
 
-if [ ! -d %%PREFIX%%/lib/browser_plugins ]; then
-    mkdir -p %%PREFIX%%/lib/browser_plugins
+    cd ${MOZDIR} || exit 1
+    ./run-mozilla.sh ${REGXPCOM} || true
+    ./run-mozilla.sh ${REGCHROME} || true
 fi
+
+# support for shared browser-plugins directory (X11BASE)
+PLUGINDIR="%%X11BASE%%/lib/browser-plugins"
+# this is what we do now
+# But may be better use MOZLIB after tr / _
+KEEPFILE="${PLUGINDIR}/.%%MOZILLA%%.keep"
+mkdir -p "${PLUGINDIR}"
+touch "${KEEPFILE}"
+
+# an alternate way to register browser-plugins
+# PLUGINDIR="%%X11BASE%%/lib/browser-plugins"
+# KEEPFILE="${PLUGINDIR}/.keepme"
+# mkdir -p "${PLUGINDIR}"
+# touch "${KEEPFILE}"
+# grep -hqv "${MOZDIR}" "${KEEPFILE}" > "${KEEPFILE}-%%MOZILLA%%"
+# echo "${MOZDIR}" >> "${KEEPFILE}-%%MOZILLA%%"
+# mv "${KEEPFILE}-%%MOZILLA%%" "${KEEPFILE}"
+
+# java plugin
+# FIXME, this must be done from plugins pkg_install
+jpidst="${PLUGINDIR}/libjavaplugin_oji.so"
+if [ ! -L "${jpidst}" ]; then
+    rm -f "${jpidst}"
+    jpilist="%%JPI_LIST%%"
+    for jpi in ${jpilist}; do
+	if [ -r "${jpi}" ]; then
+	    ln -s "${jpi}" "${jpidst}"
+	    break
+	fi
+    done
+fi
+
+# install outer scripts
+for script in %%MOZILLA%% mozilla mozilla-config; do
+    if [ -x "${MOZDIR}/${script}" ]; then
+	install -m 555 ${MOZDIR}/${script} ${prefix}/bin
+    fi
+done
 
 exit 0
--- patch-mozilla-devel ends here ---




More information about the freebsd-gnome mailing list