Skip to content

Instantly share code, notes, and snippets.

@bellbind
Created June 12, 2011 06:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bellbind/1021305 to your computer and use it in GitHub Desktop.
Save bellbind/1021305 to your computer and use it in GitHub Desktop.
[scala][msys]patch for support to launch scala command on msys

Patch for support to launch scala command on MSYS/Windows

Put MSYS awake PATH translation into each command bash scripts

Requirements

patch Install

wget http://www.scala-lang.org/downloads/distrib/files/scala-2.9.0.1.zip
wget --no-check-certificate https://raw.github.com/gist/1021305/scala-2.9.0.1-msys-support.patch
unzip scala-2.9.0.1.zip
cd scala-2.9.0.1
cat ../scala-2.9.0.1-msys-support.patch | patch -p1
diff --git a/bin/fsc b/bin/fsc
index 3c1a05b..d5294af 100644
--- a/bin/fsc
+++ b/bin/fsc
@@ -43,8 +43,10 @@ if [[ -n $SCALA_RUNNER_DEBUG ]]; then
fi
cygwin=false;
+msys=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
+ MINGW*) msys=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -100,6 +102,22 @@ if $cygwin; then
;;
esac
fi
+if $msys; then
+ SCALA_MSYS=$SCALA_HOME
+ SCALA_HOME=`cd "$SCALA_MSYS" ; pwd -W`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|:|;|g"`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|$SCALA_MSYS|$SCALA_HOME|g"`
+ case "$TERM" in
+ rxvt* | xterm*)
+ stty -icanon min 1 -echo
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnixTerminal"
+ ;;
+ *)
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnsupportedTerminal"
+ ;;
+ esac
+fi
+
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
diff --git a/bin/sbaz b/bin/sbaz
index b340338..7eb4290 100644
--- a/bin/sbaz
+++ b/bin/sbaz
@@ -9,8 +9,10 @@
##############################################################################
cygwin=false;
+msys=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
+ MINGW*) msys=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -75,6 +77,28 @@ if $cygwin; then
mv ${SCALA_HOME}/misc/sbaz/scala-library.jar.tmp ${SCALA_HOME}/misc/sbaz/scala-library.jar
fi
fi
+if $msys; then
+ SCALA_MSYS=$SCALA_HOME
+ SCALA_HOME=`cd "$SCALA_MSYS" ; pwd -W`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|:|;|g"`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|$SCALA_MSYS|$SCALA_HOME|g"`
+ # SBAZ SPECIFIC LOGIC
+ # On Windows, finsish install of sbaz dependencies now that JVM doesn't have a write lock on them
+ if [ -a "${SCALA_MSYS}/misc/sbaz/scala-bazaars.jar.staged" ] ; then
+ mv ${SCALA_MSYS}/misc/sbaz/scala-bazaars.jar.staged ${SCALA_MSYS}/misc/sbaz/scala-bazaars.jar
+ fi
+ if [ -a "${SCALA_MSYS}/misc/sbaz/sbaz.jar.staged" ] ; then
+ mv ${SCALA_MSYS}/misc/sbaz/sbaz.jar.staged ${SCALA_MSYS}/misc/sbaz/sbaz.jar
+ fi
+ if [ -a "${SCALA_MSYS}/misc/sbaz/scala-library.jar.staged" ] ; then
+ mv ${SCALA_MSYS}/misc/sbaz/scala-library.jar.staged ${SCALA_MSYS}/misc/sbaz/scala-library.jar
+ fi
+ # Transitional support for pre sbaz 2.0
+ if [ -a "${SCALA_MSYS}/misc/sbaz/scala-library.jar.tmp" ] ; then
+ mv ${SCALA_MSYS}/misc/sbaz/scala-library.jar.tmp ${SCALA_MSYS}/misc/sbaz/scala-library.jar
+ fi
+fi
+
# Reminder: substitution ${JAVA_OPTS:=-Xmx256M -Xms16M} DO NOT work on Solaris
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms16M"
diff --git a/bin/scala b/bin/scala
index efebd55..add78da 100644
--- a/bin/scala
+++ b/bin/scala
@@ -43,8 +43,10 @@ if [[ -n $SCALA_RUNNER_DEBUG ]]; then
fi
cygwin=false;
+msys=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
+ MINGW*) msys=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -100,6 +102,21 @@ if $cygwin; then
;;
esac
fi
+if $msys; then
+ SCALA_MSYS=$SCALA_HOME
+ SCALA_HOME=`cd "$SCALA_MSYS" ; pwd -W`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|:|;|g"`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|$SCALA_MSYS|$SCALA_HOME|g"`
+ case "$TERM" in
+ rxvt* | xterm*)
+ stty -icanon min 1 -echo
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnixTerminal"
+ ;;
+ *)
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnsupportedTerminal"
+ ;;
+ esac
+fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
diff --git a/bin/scalac b/bin/scalac
index 17cb787..1915ea9 100644
--- a/bin/scalac
+++ b/bin/scalac
@@ -43,8 +43,10 @@ if [[ -n $SCALA_RUNNER_DEBUG ]]; then
fi
cygwin=false;
+msys=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
+ MINGW*) msys=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -100,6 +102,21 @@ if $cygwin; then
;;
esac
fi
+if $msys; then
+ SCALA_MSYS=$SCALA_HOME
+ SCALA_HOME=`cd "$SCALA_MSYS" ; pwd -W`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|:|;|g"`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|$SCALA_MSYS|$SCALA_HOME|g"`
+ case "$TERM" in
+ rxvt* | xterm*)
+ stty -icanon min 1 -echo
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnixTerminal"
+ ;;
+ *)
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnsupportedTerminal"
+ ;;
+ esac
+fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
diff --git a/bin/scaladoc b/bin/scaladoc
index 0d08222..af23dbd 100644
--- a/bin/scaladoc
+++ b/bin/scaladoc
@@ -43,8 +43,10 @@ if [[ -n $SCALA_RUNNER_DEBUG ]]; then
fi
cygwin=false;
+msys=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
+ MSYS*) msys=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -100,6 +102,21 @@ if $cygwin; then
;;
esac
fi
+if $msys; then
+ SCALA_MSYS=$SCALA_HOME
+ SCALA_HOME=`cd "$SCALA_MSYS" ; pwd -W`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|:|;|g"`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|$SCALA_MSYS|$SCALA_HOME|g"`
+ case "$TERM" in
+ rxvt* | xterm*)
+ stty -icanon min 1 -echo
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnixTerminal"
+ ;;
+ *)
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnsupportedTerminal"
+ ;;
+ esac
+fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
diff --git a/bin/scalap b/bin/scalap
index b3ece9b..4c9b4b0 100644
--- a/bin/scalap
+++ b/bin/scalap
@@ -43,8 +43,10 @@ if [[ -n $SCALA_RUNNER_DEBUG ]]; then
fi
cygwin=false;
+msys=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
+ MINGW*) msys=true ;;
esac
# Finding the root folder for this Scala distribution
@@ -100,6 +102,21 @@ if $cygwin; then
;;
esac
fi
+if $msys; then
+ SCALA_MSYS=$SCALA_HOME
+ SCALA_HOME=`cd "$SCALA_MSYS" ; pwd -W`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|:|;|g"`
+ TOOL_CLASSPATH=`echo $TOOL_CLASSPATH | sed -e "s|$SCALA_MSYS|$SCALA_HOME|g"`
+ case "$TERM" in
+ rxvt* | xterm*)
+ stty -icanon min 1 -echo
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnixTerminal"
+ ;;
+ *)
+ CYGWIN_JLINE_TERMINAL="-Djline.terminal=scala.tools.jline.UnsupportedTerminal"
+ ;;
+ esac
+fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment