diff --git a/.gitignore b/.gitignore index 941c9a5..180efb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ +misc/segments4 +misc/customprofiles target/ *.BAK .classpath .project *.class .idea/ -*.iml \ No newline at end of file +*.iml diff --git a/README.md b/README.md index 769f001..290c09f 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,29 @@ For more infos see http://brouter.de/brouter Get it on Google Play + +## Build and Install + Compile with (Java 6!): > mvn clean install -Dandroid.sdk.path= +To skip building for Android, add ``-pl '!brouter-routing-app'``. + +Next, download one or more [data file(s)](http://brouter.de/brouter/segments4/) (rd5) into the ``misc/segments4`` directory. + +## Run + +On Linux: +> ./misc/scripts/standalone/server.sh + +On Windows (using Bash): +> ./misc/scripts/standalone/server.sh + +On Windows (using CMD): +> misc\scripts\standalone\server.cmd + + Related Projects ================ diff --git a/misc/scripts/standalone/local.sh b/misc/scripts/standalone/local.sh index 972b038..8211acf 100755 --- a/misc/scripts/standalone/local.sh +++ b/misc/scripts/standalone/local.sh @@ -1,10 +1,3 @@ #!/bin/sh -# BRouter standalone server -# java -cp brouter.jar btools.brouter.RouteServer [bindaddress] - -# maxRunningTime is the request timeout in seconds, set to 0 to disable timeout -JAVA_OPTS="-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300" -CLASSPATH=../brouter.jar - -java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer ../segments4 ../profiles2 ../customprofiles 17777 1 localhost +BINDADDRESS="localhost" "$(dirname "$0")/server.sh" diff --git a/misc/scripts/standalone/server.cmd b/misc/scripts/standalone/server.cmd index d26c2c3..dc35e9c 100644 --- a/misc/scripts/standalone/server.cmd +++ b/misc/scripts/standalone/server.cmd @@ -3,8 +3,35 @@ REM BRouter standalone server REM java -cp brouter.jar btools.brouter.RouteServer +pushd %~dp0 + REM maxRunningTime is the request timeout in seconds, set to 0 to disable timeout set JAVA_OPTS=-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300 -set CLASSPATH=../brouter.jar -java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer ..\segments4 ..\profiles2 ..\customprofiles 17777 1 +REM First search in locations matching the directory structure as found in the official BRouter zip archive +set CLASSPATH=../brouter.jar +set SEGMENTSPATH=..\segments4 +set PROFILESPATH=..\profiles2 +set CUSTOMPROFILESPATH=..\customprofiles + +REM Otherwise try to locate files inside the source checkout +if not exist "%CLASSPATH%" ( + for /f "tokens=*" %%w in ( + 'where /R ..\..\..\brouter-server\target brouter-server*-jar-with-dependencies.jar' + ) do ( + set CLASSPATH=%%w + ) +) +if not exist "%SEGMENTSPATH%" ( + set SEGMENTSPATH=..\..\segments4 +) +if not exist "%PROFILESPATH%" ( + set PROFILESPATH=..\..\profiles2 +) +if not exist "%CUSTOMPROFILESPATH%" ( + set CUSTOMPROFILESPATH=..\..\customprofiles +) + +java %JAVA_OPTS% -cp %CLASSPATH% btools.server.RouteServer "%SEGMENTSPATH%" "%PROFILESPATH%" "%CUSTOMPROFILESPATH%" 17777 1 + +popd diff --git a/misc/scripts/standalone/server.sh b/misc/scripts/standalone/server.sh index f37b0d8..9a439ed 100755 --- a/misc/scripts/standalone/server.sh +++ b/misc/scripts/standalone/server.sh @@ -2,10 +2,30 @@ cd "$(dirname "$0")" # BRouter standalone server -# java -cp brouter.jar btools.brouter.RouteServer +# java -cp brouter.jar btools.brouter.RouteServer [bindaddress] # maxRunningTime is the request timeout in seconds, set to 0 to disable timeout JAVA_OPTS="-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300" -CLASSPATH=../brouter.jar -java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer ../segments4 ../profiles2 ../customprofiles 17777 1 +# If paths are unset, first search in locations matching the directory structure +# as found in the official BRouter zip archive +CLASSPATH=${CLASSPATH:-"../brouter.jar"} +SEGMENTSPATH=${SEGMENTSPATH:-"../segments4"} +PROFILESPATH=${PROFILESPATH:-"../profiles2"} +CUSTOMPROFILESPATH=${CUSTOMPROFILESPATH:-"../customprofiles"} + +# Otherwise try to locate files inside the source checkout +if [ ! -e "$CLASSPATH" ]; then + CLASSPATH="$(ls ../../../brouter-server/target/brouter-server-*jar-with-dependencies.jar | sort --reverse --version-sort | head --lines 1)" +fi +if [ ! -e "$SEGMENTSPATH" ]; then + SEGMENTSPATH="../../segments4" +fi +if [ ! -e "$PROFILESPATH" ]; then + PROFILESPATH="../../profiles2" +fi +if [ ! -e "$CUSTOMPROFILESPATH" ]; then + CUSTOMPROFILESPATH="../../customprofiles" +fi + +java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer "$SEGMENTSPATH" "$PROFILESPATH" "$CUSTOMPROFILESPATH" 17777 1 $BINDADDRESS