freebsd-ports/www/apache-forrest/files/patch-src-resources-forrest_shbat-bin-forrest
Thierry Thomas 119e262ec8 Add apache-forrest 0.5.1, a tool for rapid development of small
sites.

PR:		58015
Submitted by:	Nicola Vitale
2004-05-23 19:24:22 +00:00

65 lines
1.5 KiB
Text

--- src/resources/forrest-shbat/bin/forrest Sun Oct 5 16:48:21 2003
+++ src/resources/forrest-shbat/bin/forrest.port Tue Oct 14 15:50:00 2003
@@ -4,6 +4,8 @@
cygwin=false;
darwin=false;
+freebsd=false;
+
case "`uname`" in
CYGWIN*) cygwin=true ;;
Darwin*) darwin=true
@@ -11,7 +13,13 @@
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
fi
;;
+ FreeBSD*) freebsd=true
+ if [ -z "$JAVA_HOME" ] ; then
+ JAVA_HOME=%%JAVA_HOME%%
+ fi
+ ;;
esac
+export JAVA_HOME
if [ "$cygwin" = "true" ] ; then
PROJECT_HOME=`cygpath -w "$PWD"`
@@ -19,9 +27,37 @@
PROJECT_HOME=`pwd`
fi
-# use the location of this script to infer $FORREST_HOME
-FORREST_HOME=`dirname "$0"`/..
+# Try to determine the FORREST_HOME
+if [ -z "$FORREST_HOME" ] ; then
+ # Note: this piece of code is based on ant's shell script
+
+ ## resolve links - $0 may be a link to ant's home
+ PRG=$0
+ progname=`basename $0`
+ saveddir=`pwd`
+
+ # need this for relative symlinks
+ cd `dirname $PRG`
+
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname $PRG`/$link"
+ fi
+ done
+ FORREST_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ FORREST_HOME=`cd "$FORREST_HOME" && pwd`
+
+ cd $saveddir
+fi
+export FORREST_HOME
+
# Save old ANT_HOME
OLD_ANT_HOME="$ANT_HOME"
unset ANT_HOME