Subject: Re: openoffice2-bin and java
To: Antoine Reilles <Antoine.Reilles@loria.fr>
From: Geert Hendrickx <ghen@telenet.be>
List: tech-pkg
Date: 10/21/2005 14:56:21
On Fri, Oct 21, 2005 at 02:00:44PM +0200, Antoine Reilles wrote:
> Why not include mk/java-vm.mk, and use ${PKG_JAVA_HOME} to let  
> openoffice ind it's java implementation/classes ?

Oh, sure.  It looks much better then: 

===>
Index: Makefile
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/misc/openoffice2-bin/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	20 Oct 2005 14:05:39 -0000	1.4
+++ Makefile	21 Oct 2005 12:52:50 -0000
@@ -86,14 +85,21 @@
 DISTNAME=	# Dummy to prevent error from missing DISTNAME
 .endif
 
+.include "options.mk"
+
 do-install:
 	${RM} -f ${WRKDIR}/PLIST.nouniq
 	${RPM2PKG} ${RPM2PKGARGS} ${WRKSRC}/*.rpm
 	uniq ${WRKDIR}/PLIST.nouniq >${WRKDIR}/PLIST
+.if !empty(PKG_JVM)
 	${RM} -f ${PREFIX}/bin/soffice
 	${SED}  -e "s|@@PREFIX@@|${PREFIX}|g" -e "s|@@OO_VER@@|${OO_VER}|g" \
+		-e "s|@@JAVA_HOME@@|${PKG_JAVA_HOME}|g" \
 		< ${FILESDIR}/soffice > ${PREFIX}/bin/soffice
 	${CHMOD} +x ${PREFIX}/bin/soffice
+.else
+	${LN} -sf ../openoffice.org${OO_VER}/program/soffice ${PREFIX}/bin/soffice
+.endif
 .for i in scalc sdraw simpress swriter
 	${LN} -sf ../openoffice.org${OO_VER}/program/${i} ${PREFIX}/bin/${i}
 .endfor
Index: files/soffice
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/misc/openoffice2-bin/files/soffice,v
retrieving revision 1.2
diff -u -r1.2 soffice
--- files/soffice	10 Oct 2005 20:08:49 -0000	1.2
+++ files/soffice	21 Oct 2005 12:52:50 -0000
@@ -7,16 +7,10 @@
 # make sure we can find `whoami` on solaris
 PATH=${PATH}:/usr/ucb
 
-# add an existing java directory to $PATH to allow OOo to
+# add the chosen java directory to $PATH to allow OOo to
 # automatically find it
-#
-if [ -d "@@PREFIX@@/java" ]; then
-  for i in @@PREFIX@@/java/*; do
-    if [ -f "$i/bin/java" ]; then
-	export PATH=$PATH:$i/bin
-    fi
-  done
-fi
+PATH=${PATH}:@@JAVA_HOME@@
+
 # default data seg size is too small for java
 ulimit -d `ulimit -H -d`
<===

with this options.mk: 

===>
# $NetBSD

PKG_OPTIONS_VAR=	PKG_OPTIONS.openoffice2-bin
PKG_SUPPORTED_OPTIONS=	java

.include "../../mk/bsd.options.mk"

.if !empty(PKG_OPTIONS:Mjava)
PKG_JVMS_ACCEPTED=	sun-jdk13 sun-jdk14 sun-jdk15
USE_JAVA=		run
.include "../../mk/java-vm.mk"
.endif
<===

Michael?  

	Geert