From f1302b3a00d4e13f5f001d0235f37ed44b2a0d50 Mon Sep 17 00:00:00 2001
From: Martin Blapp <mbr@FreeBSD.org>
Date: Mon, 14 Oct 2002 16:00:22 +0000
Subject: Finally make the mozilla addressbook and ldap datasources working.
 Add a new "register-mozilla" target, add a openoffice mozilla 1.01 patch to
 the mozilla build. Fix the zipmoz.sh to catch up with the mozilla changes.

Bump portrevision.
---
 editors/openoffice-1.0/Makefile            | 37 +++++++++++++++++++++++++-----
 editors/openoffice-1.0/distinfo            |  1 +
 editors/openoffice-1.0/files/zipmoz.sh     | 36 ++++++++++++++++++++++-------
 editors/openoffice.org-1.0/Makefile        | 37 +++++++++++++++++++++++++-----
 editors/openoffice.org-1.0/distinfo        |  1 +
 editors/openoffice.org-1.0/files/zipmoz.sh | 36 ++++++++++++++++++++++-------
 editors/openoffice/Makefile                | 37 +++++++++++++++++++++++++-----
 editors/openoffice/distinfo                |  1 +
 editors/openoffice/files/zipmoz.sh         | 36 ++++++++++++++++++++++-------
 9 files changed, 180 insertions(+), 42 deletions(-)

diff --git a/editors/openoffice-1.0/Makefile b/editors/openoffice-1.0/Makefile
index 783772d184b6..f05c1a88119b 100644
--- a/editors/openoffice-1.0/Makefile
+++ b/editors/openoffice-1.0/Makefile
@@ -7,25 +7,30 @@
 
 PORTNAME=	openoffice
 PORTVERSION=	1.0.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES+=	editors
 MASTER_SITES+=	http://ny1.mirror.openoffice.org/%SUBDIR%/ \
 		http://ftp.gwdg.de/pub/misc/openoffice/%SUBDIR%/ \
 		${MASTER_SITE_RINGSERVER:S,%SUBDIR%,misc/openoffice/&,} \
 		ftp://ftp.cs.man.ac.uk/pub/toby/gpc/:gpc \
-		http://ny1.mirror.openoffice.org/miscellaneous/helpcontent/:help
+		http://ny1.mirror.openoffice.org/miscellaneous/helpcontent/:help \
+		http://people.freebsd.org/~mbr/patches/:moz
 MASTER_SITE_SUBDIR=	${PORTVERSION}
 DISTFILES+=	OOo_${PORTVERSION}_source.tar.bz2 \
-		gpc231.tar.Z:gpc
+		gpc231.tar.Z:gpc patch-openoffice-mozilla101-2002-10-14:moz
 .if defined(L10NHELP)
 DISTFILES+=	${L10NHELP:S/$/:help/}
 .endif
 
 SORT?=	/usr/bin/sort
+FIND?=	/usr/bin/find
 CUT?=	/usr/bin/cut
 AWK?=	/usr/bin/awk
 GREP?=	/usr/bin/grep
 MOUNT?=	/sbin/mount
+ZIP?=	${PREFIX}/bin/zip
+UNZIP?=	${PREFIX}/bin/unzip
+TCSH?=	/bin/tcsh
 
 .include <bsd.port.pre.mk>
 
@@ -354,6 +359,8 @@ extract-mozilla:
 	@cd ${WRKDIR}/mozilla && ${MAKE} extract WRKDIRPREFIX=""
 
 patch-mozilla:
+	@${CP} ${DISTDIR}/${DIST_SUBDIR}/patch-openoffice-mozilla101-2002-10-14 \
+		${WRKDIR}/mozilla/files/
 	@cd ${WRKDIR}/mozilla && ${MAKE} patch WRKDIRPREFIX=""
 
 build-mozilla:
@@ -387,11 +394,29 @@ install-mozilla:
 	@${CP} ${WRKDIR}/FREEBSDGCCIruntime.zip ${WRKSRC}/../moz/zipped/
 .endif
 
+register-mozilla:
+.if exists(${WRKDIR}/mozilla-runtime)
+	@${RM} -rf ${WRKDIR}/mozilla-runtime
+.endif
+	@${MKDIR} ${WRKDIR}/mozilla-runtime
+	@cd ${WRKDIR}/mozilla-runtime && ${UNZIP} -o ${WRKDIR}/FREEBSDGCCIruntime.zip
+	@cd ${WRKDIR}/mozilla-runtime && ${UNZIP} -o ${WRKDIR}/FREEBSDGCCIlib.zip
+	@${CP} ${WRKDIR}/mozilla/work/mozilla/dist/bin/regxpcom ${WRKDIR}/mozilla-runtime/
+	@${RM} ${WRKDIR}/mozilla-runtime/components/component.reg
+	@cd ${WRKDIR}/mozilla-runtime && export MOZILLA_FIVE_HOME=. \
+		&& export LD_LIBRARY_PATH=.:./lib && ./regxpcom 
+	@${CP} ${WRKDIR}/mozilla-runtime/components/xpti.dat \
+		${WRKDIR}/mozilla-runtime/components/xptitemp.dat
+	@${RM} ${WRKDIR}/FREEBSDGCCIruntime.zip ${WRKDIR}/mozilla-runtime/regxpcom
+	@cd ${WRKDIR}/mozilla-runtime && ${FIND} . -type f \
+		| ${ZIP} ${WRKDIR}/FREEBSDGCCIruntime.zip -@
+
 mozilla:
 	@${MAKE} extract-mozilla
 	@${MAKE} patch-mozilla
 	@${MAKE} build-mozilla
 	@${MAKE} install-mozilla
+	@${MAKE} register-mozilla
 
 do-build:
 	@${MAKE} mozilla
@@ -413,16 +438,16 @@ do-build:
 .endif
 .if !defined(DISPLAY)
 	@cd ${WRKSRC}/.. && DISPLAY=${DISPLAYHACK} PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
 	@-${CAT} ${WRKDIR}/.Xvfb.pid | xargs kill
 	@${RM} -f ${WRKDIR}/.Xvfb.pid
 .else
 	@cd ${WRKSRC}/.. && DISPLAY=${DISPLAY} PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
 .endif
 .if defined(LANG_PKGNAME)
 	@cd ${WRKSRC}/.. && PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && cd instsetoo/util && ${BUILD} LANGEXT=${LANGEXT}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && cd instsetoo/util && ${BUILD} LANGEXT=${LANGEXT}'
 .endif
 
 pre-install:
diff --git a/editors/openoffice-1.0/distinfo b/editors/openoffice-1.0/distinfo
index 92575f99c367..2ed3b84d0aa0 100644
--- a/editors/openoffice-1.0/distinfo
+++ b/editors/openoffice-1.0/distinfo
@@ -1,5 +1,6 @@
 MD5 (openoffice/OOo_1.0.1_source.tar.bz2) = 34f2ca644b7d70573148c82d64eb6064
 MD5 (openoffice/gpc231.tar.Z) = fdb06fdb5a4670b172f9fb738b717be9
+MD5 (openoffice/patch-openoffice-mozilla101-2002-10-14) = 463058a33377a9226f919d00e39dc28a
 MD5 (openoffice/helpcontent) = 832193e5f8954fea10392b73e8dab8c5
 MD5 (openoffice/helpcontent_33_unix.tgz) = 20dcbf3211c20afb27fc5677ab8f69e5
 MD5 (openoffice/helpcontent_34_unix.tgz) = ba6adc71dc5cb766dd75f5b13a7c6bc8
diff --git a/editors/openoffice-1.0/files/zipmoz.sh b/editors/openoffice-1.0/files/zipmoz.sh
index 6b6b199d0bd0..43a4591f3430 100644
--- a/editors/openoffice-1.0/files/zipmoz.sh
+++ b/editors/openoffice-1.0/files/zipmoz.sh
@@ -1,14 +1,30 @@
 #!/bin/sh -f
 
-RUNTIME_FILES="components/libabsyncsvc.so components/libaddrbook.so components/libmork.so components/libmozldap.so \
-		components/libnecko.so components/libprofile.so components/librdf.so components/libstrres.so \
-		components/libunicharutil.so components/libuconv.so components/libucvcn.so components/libucvibm.so \
+RUNTIME_FILES=" components/libabsyncsvc.so components/libaddrbook.so \
+		components/libmork.so components/libmozldap.so \
+		components/libnecko.so components/libprofile.so \
+		components/librdf.so components/libstrres.so \
+		components/libunicharutil.so components/libuconv.so \
+		components/libucvcn.so components/libucvibm.so \
 		components/libucvja.so components/libucvko.so \
-		components/libucvlatin.so components/libucvtw.so components/libucvtw2.so components/liburiloader.so \
-		components/libvcard.so components/libxpconnect.so components/libpref.so libmozjs.so libmsgbaseutil.so \
-		libldap50.so libnspr4.so libplc4.so libplds4.so libxpcom.so libmozz.so component.reg"
-
-LIB_FILES="lib/libembed_base_s.a lib/libmozreg_s.a lib/libnspr4.so lib/libxpcom.so"
+		components/libucvlatin.so components/libucvtw.so \
+		components/libucvtw2.so components/liburiloader.so \
+		components/libvcard.so components/libxpconnect.so \
+		components/libpref.so components/libchrome.so libmozjs.so \
+		libmsgbaseutil.so libldap50.so libnspr4.so libplc4.so \
+		libplds4.so libxpcom.so libmozz.so component.reg \
+		components/necko_dns.xpt components/xpcom_xpti.xpt \
+		components/xpcom_threads.xpt components/xpcom_io.xpt \
+		components/xpcom_ds.xpt components/xpcom_components.xpt \
+		components/xpcom_base.xpt components/xpti.dat \
+		defaults/pref/all.js defaults/pref/config.js \
+		defaults/pref/editor.js defaults/pref/initpref.js \
+		defaults/pref/inspector.js defaults/pref/mailnews.js \
+		defaults/pref/security-prefs.js defaults/pref/unix.js \
+		defaults/pref/xpinstall.js"
+
+LIB_FILES="	lib/libembed_base_s.a lib/libmozreg_s.a \
+		lib/libnspr4.so lib/libxpcom.so lib/libprldap50.so"
 
 INC_FILES="include/"
 INC_FILES2="public/"
@@ -49,6 +65,8 @@ echo --- creating zips for $TARGET, using mozilla distribution in $MOZ_DIST
 # Create the directories
 [ ! -d $TARGET_DIR/$TARGET/runtime ] && mkdir -p $TARGET_DIR/$TARGET/runtime
 [ ! -d $TARGET_DIR/$TARGET/runtime/components ] && mkdir -p $TARGET_DIR/$TARGET/runtime/components
+[ ! -d $TARGET_DIR/$TARGET/runtime/defaults ] && mkdir -p $TARGET_DIR/$TARGET/runtime/defaults
+[ ! -d $TARGET_DIR/$TARGET/runtime/defaults/pref ] && mkdir -p $TARGET_DIR/$TARGET/runtime/defaults/pref
 [ ! -d $TARGET_DIR/$TARGET/lib ] && mkdir -p $TARGET_DIR/$TARGET/lib
 [ ! -d $TARGET_DIR/$TARGET/inc ] && mkdir -p $TARGET_DIR/$TARGET/inc
 [ ! -d $TARGET_DIR/$TARGET/inc/nspr ] && mkdir -p $TARGET_DIR/$TARGET/inc/nspr
@@ -65,6 +83,8 @@ for i in $RUNTIME_FILES; do
 	else
 		if [ `echo $i | grep component` ]; then
 			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/components/
+		elif [ `echo $i | grep defaults` ]; then
+			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/defaults/pref/
 		else
 			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/
 		fi
diff --git a/editors/openoffice.org-1.0/Makefile b/editors/openoffice.org-1.0/Makefile
index 783772d184b6..f05c1a88119b 100644
--- a/editors/openoffice.org-1.0/Makefile
+++ b/editors/openoffice.org-1.0/Makefile
@@ -7,25 +7,30 @@
 
 PORTNAME=	openoffice
 PORTVERSION=	1.0.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES+=	editors
 MASTER_SITES+=	http://ny1.mirror.openoffice.org/%SUBDIR%/ \
 		http://ftp.gwdg.de/pub/misc/openoffice/%SUBDIR%/ \
 		${MASTER_SITE_RINGSERVER:S,%SUBDIR%,misc/openoffice/&,} \
 		ftp://ftp.cs.man.ac.uk/pub/toby/gpc/:gpc \
-		http://ny1.mirror.openoffice.org/miscellaneous/helpcontent/:help
+		http://ny1.mirror.openoffice.org/miscellaneous/helpcontent/:help \
+		http://people.freebsd.org/~mbr/patches/:moz
 MASTER_SITE_SUBDIR=	${PORTVERSION}
 DISTFILES+=	OOo_${PORTVERSION}_source.tar.bz2 \
-		gpc231.tar.Z:gpc
+		gpc231.tar.Z:gpc patch-openoffice-mozilla101-2002-10-14:moz
 .if defined(L10NHELP)
 DISTFILES+=	${L10NHELP:S/$/:help/}
 .endif
 
 SORT?=	/usr/bin/sort
+FIND?=	/usr/bin/find
 CUT?=	/usr/bin/cut
 AWK?=	/usr/bin/awk
 GREP?=	/usr/bin/grep
 MOUNT?=	/sbin/mount
+ZIP?=	${PREFIX}/bin/zip
+UNZIP?=	${PREFIX}/bin/unzip
+TCSH?=	/bin/tcsh
 
 .include <bsd.port.pre.mk>
 
@@ -354,6 +359,8 @@ extract-mozilla:
 	@cd ${WRKDIR}/mozilla && ${MAKE} extract WRKDIRPREFIX=""
 
 patch-mozilla:
+	@${CP} ${DISTDIR}/${DIST_SUBDIR}/patch-openoffice-mozilla101-2002-10-14 \
+		${WRKDIR}/mozilla/files/
 	@cd ${WRKDIR}/mozilla && ${MAKE} patch WRKDIRPREFIX=""
 
 build-mozilla:
@@ -387,11 +394,29 @@ install-mozilla:
 	@${CP} ${WRKDIR}/FREEBSDGCCIruntime.zip ${WRKSRC}/../moz/zipped/
 .endif
 
+register-mozilla:
+.if exists(${WRKDIR}/mozilla-runtime)
+	@${RM} -rf ${WRKDIR}/mozilla-runtime
+.endif
+	@${MKDIR} ${WRKDIR}/mozilla-runtime
+	@cd ${WRKDIR}/mozilla-runtime && ${UNZIP} -o ${WRKDIR}/FREEBSDGCCIruntime.zip
+	@cd ${WRKDIR}/mozilla-runtime && ${UNZIP} -o ${WRKDIR}/FREEBSDGCCIlib.zip
+	@${CP} ${WRKDIR}/mozilla/work/mozilla/dist/bin/regxpcom ${WRKDIR}/mozilla-runtime/
+	@${RM} ${WRKDIR}/mozilla-runtime/components/component.reg
+	@cd ${WRKDIR}/mozilla-runtime && export MOZILLA_FIVE_HOME=. \
+		&& export LD_LIBRARY_PATH=.:./lib && ./regxpcom 
+	@${CP} ${WRKDIR}/mozilla-runtime/components/xpti.dat \
+		${WRKDIR}/mozilla-runtime/components/xptitemp.dat
+	@${RM} ${WRKDIR}/FREEBSDGCCIruntime.zip ${WRKDIR}/mozilla-runtime/regxpcom
+	@cd ${WRKDIR}/mozilla-runtime && ${FIND} . -type f \
+		| ${ZIP} ${WRKDIR}/FREEBSDGCCIruntime.zip -@
+
 mozilla:
 	@${MAKE} extract-mozilla
 	@${MAKE} patch-mozilla
 	@${MAKE} build-mozilla
 	@${MAKE} install-mozilla
+	@${MAKE} register-mozilla
 
 do-build:
 	@${MAKE} mozilla
@@ -413,16 +438,16 @@ do-build:
 .endif
 .if !defined(DISPLAY)
 	@cd ${WRKSRC}/.. && DISPLAY=${DISPLAYHACK} PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
 	@-${CAT} ${WRKDIR}/.Xvfb.pid | xargs kill
 	@${RM} -f ${WRKDIR}/.Xvfb.pid
 .else
 	@cd ${WRKSRC}/.. && DISPLAY=${DISPLAY} PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
 .endif
 .if defined(LANG_PKGNAME)
 	@cd ${WRKSRC}/.. && PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && cd instsetoo/util && ${BUILD} LANGEXT=${LANGEXT}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && cd instsetoo/util && ${BUILD} LANGEXT=${LANGEXT}'
 .endif
 
 pre-install:
diff --git a/editors/openoffice.org-1.0/distinfo b/editors/openoffice.org-1.0/distinfo
index 92575f99c367..2ed3b84d0aa0 100644
--- a/editors/openoffice.org-1.0/distinfo
+++ b/editors/openoffice.org-1.0/distinfo
@@ -1,5 +1,6 @@
 MD5 (openoffice/OOo_1.0.1_source.tar.bz2) = 34f2ca644b7d70573148c82d64eb6064
 MD5 (openoffice/gpc231.tar.Z) = fdb06fdb5a4670b172f9fb738b717be9
+MD5 (openoffice/patch-openoffice-mozilla101-2002-10-14) = 463058a33377a9226f919d00e39dc28a
 MD5 (openoffice/helpcontent) = 832193e5f8954fea10392b73e8dab8c5
 MD5 (openoffice/helpcontent_33_unix.tgz) = 20dcbf3211c20afb27fc5677ab8f69e5
 MD5 (openoffice/helpcontent_34_unix.tgz) = ba6adc71dc5cb766dd75f5b13a7c6bc8
diff --git a/editors/openoffice.org-1.0/files/zipmoz.sh b/editors/openoffice.org-1.0/files/zipmoz.sh
index 6b6b199d0bd0..43a4591f3430 100644
--- a/editors/openoffice.org-1.0/files/zipmoz.sh
+++ b/editors/openoffice.org-1.0/files/zipmoz.sh
@@ -1,14 +1,30 @@
 #!/bin/sh -f
 
-RUNTIME_FILES="components/libabsyncsvc.so components/libaddrbook.so components/libmork.so components/libmozldap.so \
-		components/libnecko.so components/libprofile.so components/librdf.so components/libstrres.so \
-		components/libunicharutil.so components/libuconv.so components/libucvcn.so components/libucvibm.so \
+RUNTIME_FILES=" components/libabsyncsvc.so components/libaddrbook.so \
+		components/libmork.so components/libmozldap.so \
+		components/libnecko.so components/libprofile.so \
+		components/librdf.so components/libstrres.so \
+		components/libunicharutil.so components/libuconv.so \
+		components/libucvcn.so components/libucvibm.so \
 		components/libucvja.so components/libucvko.so \
-		components/libucvlatin.so components/libucvtw.so components/libucvtw2.so components/liburiloader.so \
-		components/libvcard.so components/libxpconnect.so components/libpref.so libmozjs.so libmsgbaseutil.so \
-		libldap50.so libnspr4.so libplc4.so libplds4.so libxpcom.so libmozz.so component.reg"
-
-LIB_FILES="lib/libembed_base_s.a lib/libmozreg_s.a lib/libnspr4.so lib/libxpcom.so"
+		components/libucvlatin.so components/libucvtw.so \
+		components/libucvtw2.so components/liburiloader.so \
+		components/libvcard.so components/libxpconnect.so \
+		components/libpref.so components/libchrome.so libmozjs.so \
+		libmsgbaseutil.so libldap50.so libnspr4.so libplc4.so \
+		libplds4.so libxpcom.so libmozz.so component.reg \
+		components/necko_dns.xpt components/xpcom_xpti.xpt \
+		components/xpcom_threads.xpt components/xpcom_io.xpt \
+		components/xpcom_ds.xpt components/xpcom_components.xpt \
+		components/xpcom_base.xpt components/xpti.dat \
+		defaults/pref/all.js defaults/pref/config.js \
+		defaults/pref/editor.js defaults/pref/initpref.js \
+		defaults/pref/inspector.js defaults/pref/mailnews.js \
+		defaults/pref/security-prefs.js defaults/pref/unix.js \
+		defaults/pref/xpinstall.js"
+
+LIB_FILES="	lib/libembed_base_s.a lib/libmozreg_s.a \
+		lib/libnspr4.so lib/libxpcom.so lib/libprldap50.so"
 
 INC_FILES="include/"
 INC_FILES2="public/"
@@ -49,6 +65,8 @@ echo --- creating zips for $TARGET, using mozilla distribution in $MOZ_DIST
 # Create the directories
 [ ! -d $TARGET_DIR/$TARGET/runtime ] && mkdir -p $TARGET_DIR/$TARGET/runtime
 [ ! -d $TARGET_DIR/$TARGET/runtime/components ] && mkdir -p $TARGET_DIR/$TARGET/runtime/components
+[ ! -d $TARGET_DIR/$TARGET/runtime/defaults ] && mkdir -p $TARGET_DIR/$TARGET/runtime/defaults
+[ ! -d $TARGET_DIR/$TARGET/runtime/defaults/pref ] && mkdir -p $TARGET_DIR/$TARGET/runtime/defaults/pref
 [ ! -d $TARGET_DIR/$TARGET/lib ] && mkdir -p $TARGET_DIR/$TARGET/lib
 [ ! -d $TARGET_DIR/$TARGET/inc ] && mkdir -p $TARGET_DIR/$TARGET/inc
 [ ! -d $TARGET_DIR/$TARGET/inc/nspr ] && mkdir -p $TARGET_DIR/$TARGET/inc/nspr
@@ -65,6 +83,8 @@ for i in $RUNTIME_FILES; do
 	else
 		if [ `echo $i | grep component` ]; then
 			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/components/
+		elif [ `echo $i | grep defaults` ]; then
+			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/defaults/pref/
 		else
 			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/
 		fi
diff --git a/editors/openoffice/Makefile b/editors/openoffice/Makefile
index 783772d184b6..f05c1a88119b 100644
--- a/editors/openoffice/Makefile
+++ b/editors/openoffice/Makefile
@@ -7,25 +7,30 @@
 
 PORTNAME=	openoffice
 PORTVERSION=	1.0.1
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES+=	editors
 MASTER_SITES+=	http://ny1.mirror.openoffice.org/%SUBDIR%/ \
 		http://ftp.gwdg.de/pub/misc/openoffice/%SUBDIR%/ \
 		${MASTER_SITE_RINGSERVER:S,%SUBDIR%,misc/openoffice/&,} \
 		ftp://ftp.cs.man.ac.uk/pub/toby/gpc/:gpc \
-		http://ny1.mirror.openoffice.org/miscellaneous/helpcontent/:help
+		http://ny1.mirror.openoffice.org/miscellaneous/helpcontent/:help \
+		http://people.freebsd.org/~mbr/patches/:moz
 MASTER_SITE_SUBDIR=	${PORTVERSION}
 DISTFILES+=	OOo_${PORTVERSION}_source.tar.bz2 \
-		gpc231.tar.Z:gpc
+		gpc231.tar.Z:gpc patch-openoffice-mozilla101-2002-10-14:moz
 .if defined(L10NHELP)
 DISTFILES+=	${L10NHELP:S/$/:help/}
 .endif
 
 SORT?=	/usr/bin/sort
+FIND?=	/usr/bin/find
 CUT?=	/usr/bin/cut
 AWK?=	/usr/bin/awk
 GREP?=	/usr/bin/grep
 MOUNT?=	/sbin/mount
+ZIP?=	${PREFIX}/bin/zip
+UNZIP?=	${PREFIX}/bin/unzip
+TCSH?=	/bin/tcsh
 
 .include <bsd.port.pre.mk>
 
@@ -354,6 +359,8 @@ extract-mozilla:
 	@cd ${WRKDIR}/mozilla && ${MAKE} extract WRKDIRPREFIX=""
 
 patch-mozilla:
+	@${CP} ${DISTDIR}/${DIST_SUBDIR}/patch-openoffice-mozilla101-2002-10-14 \
+		${WRKDIR}/mozilla/files/
 	@cd ${WRKDIR}/mozilla && ${MAKE} patch WRKDIRPREFIX=""
 
 build-mozilla:
@@ -387,11 +394,29 @@ install-mozilla:
 	@${CP} ${WRKDIR}/FREEBSDGCCIruntime.zip ${WRKSRC}/../moz/zipped/
 .endif
 
+register-mozilla:
+.if exists(${WRKDIR}/mozilla-runtime)
+	@${RM} -rf ${WRKDIR}/mozilla-runtime
+.endif
+	@${MKDIR} ${WRKDIR}/mozilla-runtime
+	@cd ${WRKDIR}/mozilla-runtime && ${UNZIP} -o ${WRKDIR}/FREEBSDGCCIruntime.zip
+	@cd ${WRKDIR}/mozilla-runtime && ${UNZIP} -o ${WRKDIR}/FREEBSDGCCIlib.zip
+	@${CP} ${WRKDIR}/mozilla/work/mozilla/dist/bin/regxpcom ${WRKDIR}/mozilla-runtime/
+	@${RM} ${WRKDIR}/mozilla-runtime/components/component.reg
+	@cd ${WRKDIR}/mozilla-runtime && export MOZILLA_FIVE_HOME=. \
+		&& export LD_LIBRARY_PATH=.:./lib && ./regxpcom 
+	@${CP} ${WRKDIR}/mozilla-runtime/components/xpti.dat \
+		${WRKDIR}/mozilla-runtime/components/xptitemp.dat
+	@${RM} ${WRKDIR}/FREEBSDGCCIruntime.zip ${WRKDIR}/mozilla-runtime/regxpcom
+	@cd ${WRKDIR}/mozilla-runtime && ${FIND} . -type f \
+		| ${ZIP} ${WRKDIR}/FREEBSDGCCIruntime.zip -@
+
 mozilla:
 	@${MAKE} extract-mozilla
 	@${MAKE} patch-mozilla
 	@${MAKE} build-mozilla
 	@${MAKE} install-mozilla
+	@${MAKE} register-mozilla
 
 do-build:
 	@${MAKE} mozilla
@@ -413,16 +438,16 @@ do-build:
 .endif
 .if !defined(DISPLAY)
 	@cd ${WRKSRC}/.. && DISPLAY=${DISPLAYHACK} PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
 	@-${CAT} ${WRKDIR}/.Xvfb.pid | xargs kill
 	@${RM} -f ${WRKDIR}/.Xvfb.pid
 .else
 	@cd ${WRKSRC}/.. && DISPLAY=${DISPLAY} PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && ${BUILD}'
 .endif
 .if defined(LANG_PKGNAME)
 	@cd ${WRKSRC}/.. && PATH="${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin" && \
-		tcsh -c 'source FreeBSDEnv.Set && unsetenv TOP && cd instsetoo/util && ${BUILD} LANGEXT=${LANGEXT}'
+		${TCSH} -c 'source FreeBSDEnv.Set && unsetenv TOP && cd instsetoo/util && ${BUILD} LANGEXT=${LANGEXT}'
 .endif
 
 pre-install:
diff --git a/editors/openoffice/distinfo b/editors/openoffice/distinfo
index 92575f99c367..2ed3b84d0aa0 100644
--- a/editors/openoffice/distinfo
+++ b/editors/openoffice/distinfo
@@ -1,5 +1,6 @@
 MD5 (openoffice/OOo_1.0.1_source.tar.bz2) = 34f2ca644b7d70573148c82d64eb6064
 MD5 (openoffice/gpc231.tar.Z) = fdb06fdb5a4670b172f9fb738b717be9
+MD5 (openoffice/patch-openoffice-mozilla101-2002-10-14) = 463058a33377a9226f919d00e39dc28a
 MD5 (openoffice/helpcontent) = 832193e5f8954fea10392b73e8dab8c5
 MD5 (openoffice/helpcontent_33_unix.tgz) = 20dcbf3211c20afb27fc5677ab8f69e5
 MD5 (openoffice/helpcontent_34_unix.tgz) = ba6adc71dc5cb766dd75f5b13a7c6bc8
diff --git a/editors/openoffice/files/zipmoz.sh b/editors/openoffice/files/zipmoz.sh
index 6b6b199d0bd0..43a4591f3430 100644
--- a/editors/openoffice/files/zipmoz.sh
+++ b/editors/openoffice/files/zipmoz.sh
@@ -1,14 +1,30 @@
 #!/bin/sh -f
 
-RUNTIME_FILES="components/libabsyncsvc.so components/libaddrbook.so components/libmork.so components/libmozldap.so \
-		components/libnecko.so components/libprofile.so components/librdf.so components/libstrres.so \
-		components/libunicharutil.so components/libuconv.so components/libucvcn.so components/libucvibm.so \
+RUNTIME_FILES=" components/libabsyncsvc.so components/libaddrbook.so \
+		components/libmork.so components/libmozldap.so \
+		components/libnecko.so components/libprofile.so \
+		components/librdf.so components/libstrres.so \
+		components/libunicharutil.so components/libuconv.so \
+		components/libucvcn.so components/libucvibm.so \
 		components/libucvja.so components/libucvko.so \
-		components/libucvlatin.so components/libucvtw.so components/libucvtw2.so components/liburiloader.so \
-		components/libvcard.so components/libxpconnect.so components/libpref.so libmozjs.so libmsgbaseutil.so \
-		libldap50.so libnspr4.so libplc4.so libplds4.so libxpcom.so libmozz.so component.reg"
-
-LIB_FILES="lib/libembed_base_s.a lib/libmozreg_s.a lib/libnspr4.so lib/libxpcom.so"
+		components/libucvlatin.so components/libucvtw.so \
+		components/libucvtw2.so components/liburiloader.so \
+		components/libvcard.so components/libxpconnect.so \
+		components/libpref.so components/libchrome.so libmozjs.so \
+		libmsgbaseutil.so libldap50.so libnspr4.so libplc4.so \
+		libplds4.so libxpcom.so libmozz.so component.reg \
+		components/necko_dns.xpt components/xpcom_xpti.xpt \
+		components/xpcom_threads.xpt components/xpcom_io.xpt \
+		components/xpcom_ds.xpt components/xpcom_components.xpt \
+		components/xpcom_base.xpt components/xpti.dat \
+		defaults/pref/all.js defaults/pref/config.js \
+		defaults/pref/editor.js defaults/pref/initpref.js \
+		defaults/pref/inspector.js defaults/pref/mailnews.js \
+		defaults/pref/security-prefs.js defaults/pref/unix.js \
+		defaults/pref/xpinstall.js"
+
+LIB_FILES="	lib/libembed_base_s.a lib/libmozreg_s.a \
+		lib/libnspr4.so lib/libxpcom.so lib/libprldap50.so"
 
 INC_FILES="include/"
 INC_FILES2="public/"
@@ -49,6 +65,8 @@ echo --- creating zips for $TARGET, using mozilla distribution in $MOZ_DIST
 # Create the directories
 [ ! -d $TARGET_DIR/$TARGET/runtime ] && mkdir -p $TARGET_DIR/$TARGET/runtime
 [ ! -d $TARGET_DIR/$TARGET/runtime/components ] && mkdir -p $TARGET_DIR/$TARGET/runtime/components
+[ ! -d $TARGET_DIR/$TARGET/runtime/defaults ] && mkdir -p $TARGET_DIR/$TARGET/runtime/defaults
+[ ! -d $TARGET_DIR/$TARGET/runtime/defaults/pref ] && mkdir -p $TARGET_DIR/$TARGET/runtime/defaults/pref
 [ ! -d $TARGET_DIR/$TARGET/lib ] && mkdir -p $TARGET_DIR/$TARGET/lib
 [ ! -d $TARGET_DIR/$TARGET/inc ] && mkdir -p $TARGET_DIR/$TARGET/inc
 [ ! -d $TARGET_DIR/$TARGET/inc/nspr ] && mkdir -p $TARGET_DIR/$TARGET/inc/nspr
@@ -65,6 +83,8 @@ for i in $RUNTIME_FILES; do
 	else
 		if [ `echo $i | grep component` ]; then
 			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/components/
+		elif [ `echo $i | grep defaults` ]; then
+			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/defaults/pref/
 		else
 			cp $MOZ_DIST/bin/$i $TARGET_DIR/$TARGET/runtime/
 		fi
-- 
cgit v1.2.3