ports/96659: [PATCH] devel/maven: Improve launcher shell script

Herve Quiroz hq at FreeBSD.org
Tue May 2 13:30:19 UTC 2006


>Number:         96659
>Category:       ports
>Synopsis:       [PATCH] devel/maven: Improve launcher shell script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 02 13:30:16 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Herve Quiroz
>Release:        FreeBSD 6.1-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD arabica.esil.univ-mrs.fr 6.1-PRERELEASE FreeBSD 6.1-PRERELEASE #0: Wed Mar  1 10:26:16 CET
>Description:

With this patch, the launcher shell script will set JAVA_HOME if no value is
defined. The default value is the JDK that got chosen by the ports system at
install time. We will be able to improve the script further when ports/96050
gets commited.

To reduce the complexity of the launcher, it is now a plain new shell script,
configured via SUB_FILES.

While I was here, I also switched pkg-message to SUB_FILES (although its
content could now be altered given ${JAVA_HOME} is not mandatory to run Maven
anymore).

PORTREVISION bumped.

Added file(s):
- files/maven.sh.in
- files/pkg-message.in

Removed file(s):
- pkg-message
- files/patch-maven-home

Port maintainer (jbq at caraldi.com) is cc'd.

Generated with FreeBSD Port Tools 0.75
>How-To-Repeat:
>Fix:

--- maven-1.0.2_1.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/devel/maven/Makefile,v
retrieving revision 1.9
diff -u -u -r1.9 Makefile
--- Makefile	4 Apr 2006 08:08:47 -0000	1.9
+++ Makefile	2 May 2006 13:21:41 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	maven
 PORTVERSION=	1.0.2
+PORTREVISION=	1
 CATEGORIES=	devel java
 MASTER_SITES=	${MASTER_SITE_APACHE}
 MASTER_SITE_SUBDIR=	${PORTNAME}/binaries
@@ -19,21 +20,17 @@
 JAVA_VERSION=	1.3+
 NO_BUILD=	yes
 DATADIR=	${JAVASHAREDIR}/${PORTNAME}
-PKGMESSAGE=	${WRKDIR}/pkg-message
-SUBSTITUTIONS=	-e 's,%%DATADIR%%,${DATADIR},g'
-REINPLACE_FILES=	${WRKSRC}/bin/maven
 
-post-configure:
-	@${SED} ${SUBSTITUTIONS} pkg-message > ${PKGMESSAGE}
-	@${REINPLACE_CMD} ${SUBSTITUTIONS} ${REINPLACE_FILES}
+SUB_FILES=	maven.sh \
+		pkg-message
+SUB_LIST=	JAVA_HOME=${JAVA_HOME}
 
-BINFILES=	install_repo.sh maven
 DIRECTORIES=	lib lib/endorsed plugins
+
 do-install:
 	${MKDIR} ${DATADIR}/bin
-.for file in ${BINFILES}
-	${INSTALL_SCRIPT} ${WRKSRC}/bin/${file} ${DATADIR}/bin
-.endfor
+	${INSTALL_SCRIPT} ${WRKSRC}/bin/install_repo.sh ${DATADIR}/bin
+	${INSTALL_SCRIPT} ${WRKDIR}/maven.sh ${DATADIR}/bin/maven
 	${LN} -fs ${DATADIR}/bin/maven ${PREFIX}/bin
 	${INSTALL_DATA} ${WRKSRC}/bin/forehead.conf ${DATADIR}/bin
 	${INSTALL_DATA} ${WRKSRC}/*.xsd ${DATADIR}
Index: pkg-message
===================================================================
RCS file: pkg-message
diff -N pkg-message
--- pkg-message	4 Apr 2006 08:08:47 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-
-To work with Maven you need to set the following environment variable:
-  * JAVA_HOME
-    Set it to the base directory of your java installation.
-
-Then, you should initialize your repository with:
-  %%DATADIR%%/bin/install_repo.sh ~/.maven/repository
-
-If you are behind a proxy, create a ~/.mavenrc file with something like:
-  MAVEN_OPTS="$MAVEN_OPTS -Dmaven.proxy.host=YOUR_PROXY_HOSTNAME
-    -Dmaven.proxy.port=YOUR_PROXY_PORT"
Index: files/maven.sh.in
===================================================================
RCS file: files/maven.sh.in
diff -N files/maven.sh.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/maven.sh.in	2 May 2006 13:21:41 -0000
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+FOREHEAD_VERSION="1.0-beta-5"
+
+if [ -z "${MAVEN_OPTS}" ] ; then
+	MAVEN_OPTS="-Xmx256m"
+fi
+
+if [ -f /etc/mavenrc ] ; then
+	. /etc/mavenrc
+fi
+
+if [ -f "${HOME}/.mavenrc" ] ; then
+	. "${HOME}/.mavenrc"
+fi
+
+MAVEN_HOME="${MAVEN_HOME:-"%%DATADIR%%"}"
+JAVA_HOME="${JAVA_HOME:-"%%JAVA_HOME%%"}"
+MAVEN_ENDORSED="${JAVA_HOME}/lib/endorsed:${MAVEN_HOME}/lib/endorsed"
+TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
+MAIN_CLASS="com.werken.forehead.Forehead"
+
+if [ -n "${MAVEN_HOME_LOCAL}" ]; then
+	MAVEN_OPTS="${MAVEN_OPTS} -Dmaven.home.local=${MAVEN_HOME_LOCAL}" 
+fi
+  
+JAVA_HOME="${JAVA_HOME}" \
+	exec "%%LOCALBASE%%/bin/java" \
+	${MAVEN_OPTS} \
+	"-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl" \
+	"-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" \
+	"-Djava.endorsed.dirs=${MAVEN_ENDORSED}" \
+	-classpath "${MAVEN_HOME}/lib/forehead-${FOREHEAD_VERSION}.jar" \
+	"-Dforehead.conf.file=${MAVEN_HOME}/bin/forehead.conf"  \
+	"-Dtools.jar=${TOOLS_JAR}" \
+	"-Dmaven.home=${MAVEN_HOME}" \
+	"${MAIN_CLASS}" "$@"
Index: files/patch-maven-home
===================================================================
RCS file: files/patch-maven-home
diff -N files/patch-maven-home
--- files/patch-maven-home	4 Apr 2006 08:08:47 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,10 +0,0 @@
---- bin/maven.orig	Tue Dec  7 12:13:46 2004
-+++ bin/maven	Sat Apr  1 00:07:23 2006
-@@ -19,6 +19,7 @@
- #   reserved.
- 
- FOREHEAD_VERSION=1.0-beta-5
-+MAVEN_HOME=%%DATADIR%%
- 
- if [ -z "$MAVEN_OPTS" ] ; then
-   MAVEN_OPTS="-Xmx256m"
Index: files/pkg-message.in
===================================================================
RCS file: files/pkg-message.in
diff -N files/pkg-message.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message.in	2 May 2006 13:21:41 -0000
@@ -0,0 +1,11 @@
+
+To work with Maven you need to set the following environment variable:
+  * JAVA_HOME
+    Set it to the base directory of your java installation.
+
+Then, you should initialize your repository with:
+  %%DATADIR%%/bin/install_repo.sh ~/.maven/repository
+
+If you are behind a proxy, create a ~/.mavenrc file with something like:
+  MAVEN_OPTS="$MAVEN_OPTS -Dmaven.proxy.host=YOUR_PROXY_HOSTNAME
+    -Dmaven.proxy.port=YOUR_PROXY_PORT"
--- maven-1.0.2_1.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list