openbsd-ports/math/geogebra/patches/patch-geogebra-4_0_38_0_geogebra
ajacoutot 8ffa15a7d0 Import geogebra-4.0.38.0.
GeoGebra is free and multi-platform dynamic mathematics software for
learning and teaching.

based on an initial submission from Azwaw OUSADOU and reworked by myself
ok jasper@
2012-08-21 07:18:17 +00:00

100 lines
3.2 KiB
Plaintext

$OpenBSD: patch-geogebra-4_0_38_0_geogebra,v 1.1.1.1 2012/08/21 07:18:17 ajacoutot Exp $
--- geogebra.orig Sat Jul 14 10:33:41 2012
+++ geogebra Mon Aug 20 12:33:10 2012
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#---------------------------------------------
# Script to start GeoGebra
#---------------------------------------------
@@ -9,13 +9,13 @@
# GG_SCRIPTNAME=<name of originally called script to start GeoGebra> # If unset, name of this script will be used
#
# GG_PATH=<path of directory containing geogebra.jar> # If unset, path of this script will be used.
-# In this case if the path of script does not contain the geogebra.jar file, /usr/share/geogebra will be used.
+# In this case if the path of script does not contain the geogebra.jar file, ${TRUEPREFIX}/share/geogebra will be used.
#
# JAVACMD=<Java command> # If unset, java will be used
#
# GG_XMS=<initial Java heap size> # If unset, 32m will be used.
#
-# GG_XMX=<maximum Java heap size> # If unset, 512m will be used.
+# GG_XMX=<maximum Java heap size> # If unset, 256m will be used.
#
# GG_DJAVA_LIBRARY_PATH=<native library path>
@@ -34,24 +34,23 @@ if [ -z "$GG_XMS" ]; then
fi
#---------------------------------------------
-# If GG_XMX not set, set to 512m
+# If GG_XMX not set, set to 256m
if [ -z "$GG_XMX" ]; then
- GG_XMX='512m'
+ GG_XMX='256m'
fi
#---------------------------------------------
# Set Java default options
-JAVA_OPTS=("-Xms$GG_XMS" "-Xmx$GG_XMX")
if [ -n "$GG_DJAVA_LIBRARY_PATH" ]; then
- JAVA_OPTS[${#JAVA_OPTS[*]}]="-Djava.library.path=$GG_DJAVA_LIBRARY_PATH"
+ JAVA_OPTS="-Djava.library.path=$GG_DJAVA_LIBRARY_PATH"
fi
#---------------------------------------------
# Set GeoGebra default options
-GG_OPTS=()
+GG_OPTS=""
#---------------------------------------------
# Define usage function
@@ -93,7 +92,7 @@ _USAGE
# If JAVACMD not set, use java
if [ -z "$JAVACMD" ]; then
- JAVACMD='java'
+ JAVACMD=`javaPathHelper -c geogebra`
fi
#---------------------------------------------
@@ -104,10 +103,10 @@ for i in "$@"; do
--help | --hel | --he | --h )
func_usage; exit 0 ;;
esac
- if [ $(expr match "$i" '.*--') -ne 0 ]; then
+ if [ $(expr -- "$i" : '.*--') -ne 0 ]; then
GG_OPTS[${#GG_OPTS[*]}]="$i"
shift $((1))
- elif [ $(expr match "$i" '.*-Xms') -ne 0 -o $(expr match "$i" '.*-Xmx') -ne 0 -o $(expr match "$i" '.*-Djava.library.path') -ne 0 ]; then
+ elif [ $(expr -- "$i" : '.*-Xms') -ne 0 -o $(expr -- "$i" : '.*-Xmx') -ne 0 -o $(expr -- "$i" : '.*-Djava.library.path') -ne 0 ]; then
JAVA_OPTS[${#JAVA_OPTS[*]}]="$i"
shift $((1))
fi
@@ -117,20 +116,10 @@ done
# If GG_PATH not set, use path of this script
if [ -z "$GG_PATH" ]; then
- GG_PATH="${BASH_SOURCE[0]}"
- if [ -h "${GG_PATH}" ]; then
- while [ -h "${GG_PATH}" ]; do
- GG_PATH=`readlink "${GG_PATH}"`
- done
- fi
- pushd . > /dev/null
- cd `dirname ${GG_PATH}` > /dev/null
- GG_PATH=`pwd`
- popd > /dev/null
- test -r "${GG_PATH}/geogebra.jar" || GG_PATH='/usr/share/geogebra'
+ GG_PATH='${TRUEPREFIX}/share/geogebra'
fi
#---------------------------------------------
# Run
-exec "$JAVACMD" "${JAVA_OPTS[@]}" -jar "$GG_PATH/geogebra.jar" "${GG_OPTS[@]}" "$@"
+exec "$JAVACMD" "-Xms$GG_XMS" "-Xmx$GG_XMX" "${JAVA_OPTS[@]}" -jar "$GG_PATH/geogebra.jar" "${GG_OPTS[@]}" "$@"