lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] allow install_msw.sh to work on drives other than C:


From: Vadim Zeitlin
Subject: [lmi] allow install_msw.sh to work on drives other than C:
Date: Mon, 22 Mar 2010 14:10:41 +0100

 Hello,

 I've finally managed to build LMI using install_msw.sh on my system which
doesn't have a C: drive. This actually required surprisingly few changes.
The first one was not even related to the drive letter problem but rather
to a change in mount command syntax in Cygwin 1.7. Let me just show the
patch:

----------------------------------------------------------------------------
commit f4e8a0c18296ad7362466e9dd9037d00b44af8a1
Author: Vadim Zeitlin <address@hidden>
Date:   Sat Mar 20 16:02:58 2010 +0100

    Use "-m" option with mount instead of --mount-commands.
    
    The long --mount-commands option was renamed to --mount-entries in Cygwin 
1.7
    so we'd need to test for Cygwin version to continue using the long option 
with
    both 1.5 and 1.7. It however looks easier to just use the short version of 
the
    option which didn't change in the new release and looks very unlikely to
    change in the future.

diff --git a/install_msw.sh b/install_msw.sh
index f5e87e1..f3152be 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -52,7 +52,7 @@ find /tmp/lmi_cache -type f |xargs md5sum
 # programs may want to use it. Furthermore, if it were removed, then
 # shell completion, e.g., '/op' [tab], wouldn't work.
 
-restore_opt_mount=`mount --mount-commands |grep '"/opt"'`
+restore_opt_mount=`mount -m |grep '"/opt"'`
 
 umount "/opt"
 umount "/opt/lmi"
@@ -94,7 +94,7 @@ touch ~/.cvspass
 
 export CVS_RSH="ssh"
 echo $CVSROOT
-ps -ef | grep --quiet ssh-agent \
+ps -ef |grep --quiet ssh-agent \
   || export CVSROOT=":pserver:address@hidden:/sources/lmi"
 
 echo $CVSROOT
@@ -113,7 +113,7 @@ cd /opt/lmi/src/lmi
 # It seems quite unlikely that anyone who's building lmi would have
 # any other need for a mount with that name.
 
-restore_MinGW_mount=`mount --mount-commands |grep '"/MinGW_"'`
+restore_MinGW_mount=`mount -m |grep '"/MinGW_"'`
 [ -z "$restore_MinGW_mount" ] \
   || echo $restore_MinGW_mount |grep --silent '"C:/opt/lmi/MinGW-20090203"' \
   || echo -e "Replacing former MinGW_ mount:\n  $restore_MinGW_mount" >/dev/tty
----------------------------------------------------------------------------

I think this change should be applied anyhow as you will also upgrade to
1.7 sooner or later and it shouldn't have any bad effect on Cygwin 1.5.


 The second change allows to specify a different drive for building:
----------------------------------------------------------------------------
commit 315976ed69451cee3ef77b55d51e895e6ef24c81
Author: Vadim Zeitlin <address@hidden>
Date:   Sat Mar 20 16:30:53 2010 +0100

    Allow specifying a non-default drive for /opt directory.
    
    Honour the setting of LMI_OPT_DRIVE environment variable if it is defined
    instead of hardcoding "C:" drive (it is still used by default however).
    
    This allows to use the script on systems where C: drive can't be used for 
LMI
    build (e.g. because there is not enough space on it).

diff --git a/install_msw.sh b/install_msw.sh
index f3152be..5df46a3 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -54,14 +54,23 @@ find /tmp/lmi_cache -type f |xargs md5sum
 
 restore_opt_mount=`mount -m |grep '"/opt"'`
 
+# Allow specifying a different drive for the LMI opt directory.
+#
+# This is especially useful for the setups where the C: disk is too small to
+# be used for LMI build. Notice that opt directory must always be in the root
+# of this drive for the paths to be compatible between Cygwin and MinGW32 so
+# we don't allow customizing the path.
+lmi_opt_drive=${LMI_OPT_DRIVE-C}
+lmi_opt_path="$lmi_opt_drive/opt"
+
 umount "/opt"
 umount "/opt/lmi"
 mkdir /opt
-mount --force "C:/opt" "/opt"
+mount --force "$lmi_opt_path" "/opt"
 mkdir --parents /opt/lmi/src/lmi
 mkdir --parents /opt/lmi/share/doc/lmi
 umount "/opt"
-mount --force "C:/opt/lmi" "/opt/lmi"
+mount --force "$lmi_opt_path/lmi" "/opt/lmi"
 
 [ -z "$restore_opt_mount" ] || sh -c $restore_opt_mount
 
@@ -115,9 +124,9 @@ cd /opt/lmi/src/lmi
 
 restore_MinGW_mount=`mount -m |grep '"/MinGW_"'`
 [ -z "$restore_MinGW_mount" ] \
-  || echo $restore_MinGW_mount |grep --silent '"C:/opt/lmi/MinGW-20090203"' \
+  || echo $restore_MinGW_mount |grep --silent 
'"$lmi_opt_path/lmi/MinGW-20090203"' \
   || echo -e "Replacing former MinGW_ mount:\n  $restore_MinGW_mount" >/dev/tty
-mount --force "C:/opt/lmi/MinGW-20090203" "/MinGW_"
+mount --force "$lmi_opt_path/lmi/MinGW-20090203" "/MinGW_"
 rm --force --recursive scratch
 rm --force --recursive /MinGW_
 make prefix=/MinGW_ cache_dir=/tmp/lmi_cache -f install_mingw.make
----------------------------------------------------------------------------

AFAICS this also shouldn't have any bad effects and so I hope this could be
applied as well to make my life slightly simpler. OTOH I don't often use
install_msw.sh and LMI makefiles so it's not a huge problem if you decide
to keep this out of LMI svn, I can always maintain this patch locally, it
just would be nice to not have to.


 Finally, I have another patch but this one is much bigger and not really
ready for submission yet. It allows to build LMI in a different directory,
e.g. I normally have its sources in w:/src/tt/lmi and not in w:/opt/lmi and
so for me it would be much more convenient to be able to use them directly
from there. But this requires using /src/tt/lmi instead of /opt in quite a
few places so I'm not sure if you'd consider a patch adding support for
LMI_PREFIX variable similar to LMI_OPT_DRIVE in the patch above, i.e. such
that its contents would be used instead of /opt if it's defined. Please let
me know if you would be interested in a patch adding it and I'll polish my
patch and submit it then.

 Thanks,
VZ

reply via email to

[Prev in Thread] Current Thread [Next in Thread]