Browse Source

Handle path conversion using cygpath utility on Cygwin system

Pierre Muller 2 years ago
parent
commit
816079a7cc
1 changed files with 31 additions and 16 deletions
  1. 31 16
      rtl/regenmakefiles.sh

+ 31 - 16
rtl/regenmakefiles.sh

@@ -2,6 +2,13 @@
 #
 #
 # Check directory
 # Check directory
 #
 #
+
+if [ "${PATH/cygdrive/}" != "$PATH" ] ; then
+  inCygwin=1
+else
+  inCygwin=0
+fi
+
 if [ -z "$1" ]; then
 if [ -z "$1" ]; then
   RTLDIR=$(pwd)
   RTLDIR=$(pwd)
 else
 else
@@ -9,32 +16,40 @@ else
   if [ ! -d $RTLDIR ]; then
   if [ ! -d $RTLDIR ]; then
     echo "The directory $RTLDIR does not exist"
     echo "The directory $RTLDIR does not exist"
     exit 1
     exit 1
-  fi  
-fi 
+  fi
+fi
+if [ $inCygwin -eq 1 ] ; then
+  echo "Cygwin system detected"
+  NEWRTLDIR=`cygpath -da $RTLDIR`
+  echo "RTLDIR=$NEWRTLDIR"
+  if [ -n "$NEWRTLDIR" ] ; then
+    RTLDIR="$NEWRTLDIR"
+  fi
+fi
 #
 #
 # Check rtl dir ?
 # Check rtl dir ?
 #
 #
-if [ ! -d $RTLDIR/ucmaps ]; then
+if [ ! -d "$RTLDIR/ucmaps" ]; then
   echo "This script must be executed in the rtl directory or have an argument tto specify the RTL directory"
   echo "This script must be executed in the rtl directory or have an argument tto specify the RTL directory"
   exit 1
   exit 1
 fi
 fi
 #
 #
 # fpcmake to use
 # fpcmake to use
 #
 #
-if [ -e $RTLDIR/../utils/fpcm/fpcmake ]; then
-  FPCMAKE=$RTLDIR/../utils/fpcm/fpcmake
+if [ -e "$RTLDIR/../utils/fpcm/fpcmake" ]; then
+  FPCMAKE="$RTLDIR/../utils/fpcm/fpcmake"
 else
 else
   FPCMAKE=fpcmake
   FPCMAKE=fpcmake
-fi  
+fi
 #
 #
 # Go
 # Go
 #
 #
-echo "Using fpcmake: $FPCMAKE"
+echo "Using fpcmake: \"$FPCMAKE\""
 #
 #
 # Main
 # Main
 #
 #
-echo "Doing RTL toplevel dir: $RTLDIR"
-pushd $RTLDIR >/dev/null 2>&1
+echo "Doing RTL toplevel dir: \"$RTLDIR\""
+pushd "$RTLDIR" >/dev/null 2>&1
 $FPCMAKE -q -Tall
 $FPCMAKE -q -Tall
 popd >/dev/null 2>&1
 popd >/dev/null 2>&1
 #
 #
@@ -42,20 +57,20 @@ popd >/dev/null 2>&1
 #
 #
 for d in *
 for d in *
 do
 do
-  if [ -f $d/Makefile.fpc ]; then
+  if [ -f "$d/Makefile.fpc" ]; then
     echo "Doing directory $d"
     echo "Doing directory $d"
-    pushd $RTLDIR/$d >/dev/null 2>&1
+    pushd "$RTLDIR/$d" >/dev/null 2>&1
     case $d in
     case $d in
-      darwin) 
+      darwin)
         TARGETS="darwin,ios,iphonesim" ;;
         TARGETS="darwin,ios,iphonesim" ;;
       macos)
       macos)
         TARGETS="macosclassic" ;;
         TARGETS="macosclassic" ;;
       *)
       *)
-        TARGETS=$d  
-    esac  
+        TARGETS="$d" ;;
+    esac
     CMD="$FPCMAKE -T$TARGETS -q -x $RTLDIR/inc/Makefile.rtl"
     CMD="$FPCMAKE -T$TARGETS -q -x $RTLDIR/inc/Makefile.rtl"
-    # echo "Command: $CMD"
-    $CMD 
+    echo "Command: $CMD"
+    $CMD
     popd >/dev/null 2>&1
     popd >/dev/null 2>&1
   fi
   fi
 done
 done