From a86ced47fee59bbe11cb3cee520df1417417f64b Mon Sep 17 00:00:00 2001 From: Randy Date: Tue, 31 May 2011 11:02:54 -0700 Subject: [PATCH] modifications to support cygwin building and running. credit goes to gyokuro for his work in getting earlier pad versions to build with cygwin. --- INSTALL | 24 ++++++++++++++++++++++++ bin/build.sh | 2 ++ bin/exports.sh | 9 ++++++++- etherpad/bin/run-local.sh | 24 ++++++++++++++++++++---- infrastructure/ace/bin/classpath.sh | 22 ++++++++++++++++++++++ infrastructure/ace/bin/make | 10 +++++++++- infrastructure/bin/classpath.sh | 13 ++++++++++--- infrastructure/bin/comp.sh | 21 +++++++++++++++++---- infrastructure/bin/makejar.sh | 7 ++++++- 9 files changed, 118 insertions(+), 14 deletions(-) create mode 100644 infrastructure/ace/bin/classpath.sh diff --git a/INSTALL b/INSTALL index f1828192..9445bf3c 100644 --- a/INSTALL +++ b/INSTALL @@ -59,3 +59,27 @@ etherpad*.deb in the directory one level above your current directory. * To run it, do etc/init.d/etherpad start +OPTION #3. INSTALLING ON WINDOWS SYSTEMS WITH CYGWIN + +* Install the dependencies in paths that do not contain spaces: cygwin, Scala 2.7, Sun Java JDK 6 or OpenJDK 6, libmysql-java + +* Uninstall gcj if it's installed as it seems to interfere with the + Scala compiler. You can safely reinstall it after compiling Etherpad + if you want to. + +* Run bin/build.sh + +* Create a MySQL database "etherpad" and a database user "etherpad" + +* Copy etherpad/etc/etherpad.localdev-default.properties to etherpad/etc/etherpad.local.properties + +* Edit etherpad/etc/etherpad.local.properties and set + etherpad.SQL_JDBC_URL + Example etherpad.SQL_JDBC_URL = jdbc:mysql://localhost:3306/etherpad + etherpad.SQL_PASSWORD + etherpad.SQL_USERNAME = etherpad + etherpad.adminPass + topdomains + Example: topdomains = yourhostname.com,localhost + +* You can now run etherpad via bin/run.sh diff --git a/bin/build.sh b/bin/build.sh index efde103f..4a7cbf4a 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -31,6 +31,7 @@ cp "$ETHERPADDIR"/infrastructure/build/appjet.jar $ETHERPADDIR/etherpad/appjet-e rm -rf "$ETHERPADDIR"/infrastructure/{appjet,build,buildjs,buildcache} # Rebuild modules +if [[ $(uname -s) != CYGWIN* ]]; then ( cd "$ETHERPADDIR" ls etherpad/src/plugins/ | while read name; do @@ -42,3 +43,4 @@ rm -rf "$ETHERPADDIR"/infrastructure/{appjet,build,buildjs,buildcache} ) done ) +fi diff --git a/bin/exports.sh b/bin/exports.sh index 07d84225..e401c694 100755 --- a/bin/exports.sh +++ b/bin/exports.sh @@ -36,6 +36,14 @@ if [ `uname` == "FreeBSD" ]; then export SCALA_LIBRARY_JAR="/usr/local/share/scala-2.7.7/lib/scala-library.jar" export PATH="$JAVA_HOME/bin:$SCALA_HOME/bin:/usr/local/mysql/bin:$PATH" export MYSQL_CONNECTOR_JAR="/usr/local/share/java/classes/mysql-connector-java.jar" +elif [[ $(uname -s) == CYGWIN* ]]; then + export JAVA_HOME="C:\Etherpad\JDK1.6_23" + export SCALA_HOME="C:\Etherpad\scala-2.7.4.final" + export JAVA="$JAVA_HOME\bin\java" + export SCALA="$SCALA_HOME\bin\scala" + export SCALA_LIBRARY_JAR="$SCALA_HOME\lib\scala-library.jar" + export PATH="$JAVA_HOME\bin:$SCALA_HOME\bin:$PATH" + export MYSQL_CONNECTOR_JAR="C:\Etherpad\mysql-connector-java-5.1.16\mysql-connector-java-5.1.16-bin.jar" else [ -e "/usr/lib/jvm/java-6-openjdk" ] && export JAVA_HOME="/usr/lib/jvm/java-6-openjdk" [ -e "/usr/lib/jvm/java-6-sun" ] && export JAVA_HOME="/usr/lib/jvm/java-6-sun" @@ -67,4 +75,3 @@ if ! [ -e "$SCALA" ]; then echo "Scala cannot be found '$SCALA' not found - Download it here: http://www.scala-lang.org/" exit 1 fi - diff --git a/etherpad/bin/run-local.sh b/etherpad/bin/run-local.sh index be33fa50..bcddaa0a 100755 --- a/etherpad/bin/run-local.sh +++ b/etherpad/bin/run-local.sh @@ -65,15 +65,31 @@ if [ ! -z $1 ]; then fi fi -CP="appjet-eth-dev.jar:data" -for f in lib/*.jar; do - CP="$CP:$f" -done +CP="" +if [[ $(uname -s) == CYGWIN* ]]; then + _tmp=`readlink -f "appjet-eth-dev.jar"` + CP=`cygpath -wp "${_tmp}"` + _tmp=`readlink -f "data"` + CP="${CP}\;"`cygpath -wp "${tmp}"` + for f in `readlink -f "lib/*.jar"`; do + CP="$CP\;"`cygpath -wp "${f}"` + done +else + CP="appjet-eth-dev.jar:data" + for f in lib/*.jar; do + CP="$CP:$f" + done +fi + if [ -z "$JAVA" ]; then JAVA=java fi +if [[ $(uname -s) == CYGWIN* ]]; then + JAVA=java +fi + # etherpad properties file cfg_file=./etc/etherpad.local.properties if [ ! -f $cfg_file ]; then diff --git a/infrastructure/ace/bin/classpath.sh b/infrastructure/ace/bin/classpath.sh new file mode 100644 index 00000000..240d1aeb --- /dev/null +++ b/infrastructure/ace/bin/classpath.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Copyright 2009 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS-IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +CP="./" +for f in `readlink -f "lib/*.jar"`; do + CP="${CP}\;"`cygpath -wp "${f}"` +done +echo $CP + diff --git a/infrastructure/ace/bin/make b/infrastructure/ace/bin/make index 9c2a7f2f..db20445a 100755 --- a/infrastructure/ace/bin/make +++ b/infrastructure/ace/bin/make @@ -1,7 +1,15 @@ #!/bin/sh mkdir -p ../../etherpad/src/etherpad/collab/ace mkdir -p ../../etherpad/src/static/js -exec scala -nocompdaemon -classpath lib/yuicompressor-2.4-appjet.jar:lib/rhino-js-1.7r1.jar $0 $@ + +JARFILES="." +if [[ $(uname -s) == CYGWIN* ]]; then + CP=`bin/classpath.sh` + exec scala -classpath $CP $0 $@ +else + exec scala -nocompdaemon -classpath lib/yuicompressor-2.4-appjet.jar:lib/rhino-js-1.7r1.jar $0 $@ +fi + !# import java.io._; diff --git a/infrastructure/bin/classpath.sh b/infrastructure/bin/classpath.sh index b1d297ce..5384ed6f 100755 --- a/infrastructure/bin/classpath.sh +++ b/infrastructure/bin/classpath.sh @@ -15,7 +15,14 @@ # limitations under the License. CP="./" -for f in `ls lib/*.jar`; do - CP="${CP}:${f}" -done + +if [[ $(uname -s) == CYGWIN* ]]; then + for f in `readlink -f "lib/*.jar"`; do + CP="${CP}\;"`cygpath -wp "${f}"` + done +else + for f in `ls lib/*.jar`; do + CP="${CP}:${f}" + done +fi echo $CP diff --git a/infrastructure/bin/comp.sh b/infrastructure/bin/comp.sh index 283065db..970ffb91 100755 --- a/infrastructure/bin/comp.sh +++ b/infrastructure/bin/comp.sh @@ -32,7 +32,13 @@ fi echo compiling with \'$CC\'... CP=`bin/classpath.sh` -CP="build/:${CP}" + +if [[ $(uname -s) == CYGWIN* ]]; then + _tmp=`readlink -f build` + CP="${CP}\;"`cygpath -wp "${_tmp}"` +else + CP="build/:${CP}" +fi if [ -z "$OBFUSC" ]; then OBFUSC=0 @@ -183,17 +189,24 @@ echo "copying files..." cp net.appjet.ajstdlib/streaming-client.js build/net/appjet/ajstdlib/ if [ $OBFUSC ] ; then echo obfuscating... - scala -classpath $CP:. net.appjet.bodylock.compressor \ - build/net/appjet/ajstdlib/streaming-client.js + if [[ $(uname -s) == CYGWIN* ]]; then + scala -classpath $CP net.appjet.bodylock.compressor \ + build/net/appjet/ajstdlib/streaming-client.js + else + scala -classpath $CP:. net.appjet.bodylock.compressor \ + build/net/appjet/ajstdlib/streaming-client.js + fi fi cp net.appjet.ajstdlib/streaming-iframe.html build/net/appjet/ajstdlib/ mkdir -p build/net/appjet/ajstdlib/modules +JSFILES=`find framework-src -name '*.js'` + echo "building javascript classfiles..." scala -classpath $CP net.appjet.bodylock.Compiler \ -destination=build/net/appjet/ajstdlib/ \ -cutPrefix=framework-src \ - `find framework-src -name '*.js'` + $JSFILES echo "done." diff --git a/infrastructure/bin/makejar.sh b/infrastructure/bin/makejar.sh index 46b46091..171a351b 100755 --- a/infrastructure/bin/makejar.sh +++ b/infrastructure/bin/makejar.sh @@ -63,7 +63,12 @@ cp ../buildcache/JAR/appjet.jar ./ echo "making JAR..." mv appjet.jar /tmp/appjet.jar -$JAR -uf /tmp/appjet.jar . #META-INF com javax org net uk v scala dojox +if [[ $(uname -s) == CYGWIN* ]]; then + _tmp=`readlink -f "/tmp/appjet.jar"` + $JAR uf `cygpath -wp "${_tmp}"` . #META-INF com javax org net uk v scala dojox +else + $JAR -uf /tmp/appjet.jar . #META-INF com javax org net uk v scala dojox +fi mv /tmp/appjet.jar ./ echo "cleaning up..."