aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/win32/msys_tools/win2msys_path.sh
diff options
context:
space:
mode:
authorunknown <[email protected]>2011-02-22 17:29:46 +0100
committerPatrik Nyblom <[email protected]>2011-12-02 15:21:10 +0100
commit7b3596ba1521f201c9416fc7a0385cb7e6c6f495 (patch)
treed3c0f1152ec3ee094e3fb142c091d89786b5ac46 /erts/etc/win32/msys_tools/win2msys_path.sh
parentdef5331a201ab811150599b969abf751a4954ceb (diff)
downloadotp-7b3596ba1521f201c9416fc7a0385cb7e6c6f495.tar.gz
otp-7b3596ba1521f201c9416fc7a0385cb7e6c6f495.tar.bz2
otp-7b3596ba1521f201c9416fc7a0385cb7e6c6f495.zip
Build Win64 Erlang emulator using MSYS
Still does not run, just compiles.
Diffstat (limited to 'erts/etc/win32/msys_tools/win2msys_path.sh')
-rw-r--r--erts/etc/win32/msys_tools/win2msys_path.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/erts/etc/win32/msys_tools/win2msys_path.sh b/erts/etc/win32/msys_tools/win2msys_path.sh
new file mode 100644
index 0000000000..6558a15ecd
--- /dev/null
+++ b/erts/etc/win32/msys_tools/win2msys_path.sh
@@ -0,0 +1,38 @@
+#! /bin/bash
+if [ -z "$1" ]; then
+ echo "Usage: $0 <path>" >&2
+ exit 1;
+fi
+
+MSYS_PATH=`echo "$1" | sed 's,^\([a-zA-Z]\):\\\\,/\L\1/,;s,\\\\,/,g'`
+if [ -z "$MSYS_PATH" ]; then
+ echo "$0: Could not translate $1 to msys format" >&2
+ exit 2;
+fi
+
+DELBLANK=`echo "$MSYS_PATH" | sed 's, ,,g'`
+
+if [ "X$DELBLANK" != "X$MSYS_PATH" ]; then
+ if [ -d "$MSYS_PATH" ]; then
+ C1=`(cd "$MSYS_PATH" && cmd //C "for %i in (".") do @echo %~fsi")`
+ MSYS_PATH=`echo "$C1" | sed 's,^\([a-zA-Z]\):\\\\,/\L\1/,;s,\\\\,/,g'`
+ else
+ MSYS_DIR=`dirname "$MSYS_PATH"`
+ MSYS_FILE=`basename "$MSYS_PATH"`
+ if [ -d "$MSYS_DIR" ]; then
+ C1=`(cd "$MSYS_DIR" && cmd //C "for %i in (".") do @echo %~fsi")`
+ BAT_FILE=/tmp/w$$.bat
+ # I simply cannot get the quoting right for this,
+ # need an intermediate bat file
+ cat > $BAT_FILE <<EOF
+@echo off
+for %%i in ("$MSYS_FILE") do @echo %%~snxi
+EOF
+ C2=`(cd "$MSYS_DIR" && cmd //C $BAT_FILE)`
+ rm -f $BAT_FILE
+ MSYS_PATH=`echo "$C1/$C2" | sed 's,^\([a-zA-Z]\):\\\\,/\L\1/,;s,\\\\,/,g;s," ", ,g'`
+ fi
+ fi
+fi
+echo $MSYS_PATH
+exit 0 \ No newline at end of file