changeset 4767:a800e350d88b

use .bat file for octave.exe/octave-version.exe (Bug #53938) * binary-dist-rules.mk: in windows, remove octave.exe and octave-version.exe and replace with octave.bat, copied to bin dir * installer-files/octave.bat: update path finding with .bat file in /bin instead of /, stub beginning of file to recall with cmd.exe if run from bash * tools/makeinst-script.sh.in: remove octave.bat from toplevel of installer, look for octave-cli.exe not octave.exe in prev installed check
author John Donoghue
date Mon, 09 Jul 2018 14:38:21 -0400
parents 7f203bae655e
children 0bee767e21ed
files binary-dist-rules.mk installer-files/octave.bat tools/makeinst-script.sh.in
diffstat 3 files changed, 21 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/binary-dist-rules.mk	Fri Jul 06 14:16:31 2018 -0400
+++ b/binary-dist-rules.mk	Mon Jul 09 14:38:21 2018 -0400
@@ -89,11 +89,16 @@
       cp $(TOP_DIR)/installer-files/README.html $(OCTAVE_DIST_DIR)/
       echo "  refblas..."
       cp $(OCTAVE_DIST_DIR)/bin/libblas.dll $(OCTAVE_DIST_DIR)/bin/librefblas.dll
-      echo "  octave.bat..."
-      cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/
+      echo "  octave.vbs..."
       cp $(TOP_DIR)/installer-files/octave.vbs $(OCTAVE_DIST_DIR)/
       cp $(TOP_DIR)/installer-files/octave-firsttime.vbs $(OCTAVE_DIST_DIR)/
+      cp $(TOP_DIR)/installer-files/fc_update.bat $(OCTAVE_DIST_DIR)/
       cp $(TOP_BUILD_DIR)/HG-ID $(OCTAVE_DIST_DIR)/
+      echo "  updating octave .exe to script files..."
+      rm -f $(OCTAVE_DIST_DIR)/bin/octave.exe
+      rm -f $(OCTAVE_DIST_DIR)/bin/octave-$($(OCTAVE_TARGET)_VERSION).exe
+      cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/bin/octave.bat
+      cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/bin/octave-$($(OCTAVE_TARGET)_VERSION).bat
       echo "  updating libtool references..."
       find '$(OCTAVE_DIST_DIR)/' -type f -name "*.la" \
         -exec $(SED) -i 's|$(HOST_PREFIX)|/usr|g;s|$(BUILD_TOOLS_PREFIX)|/usr|g' {} \; ;
@@ -106,7 +111,6 @@
       echo "  updating script config tool references..."
       find '$(OCTAVE_DIST_DIR)/bin' -type f -name "*-config" \
         -exec $(SED) -i 's|$(HOST_PREFIX)|/usr|g;s|$(BUILD_TOOLS_PREFIX)|/usr|g' {} \; ;
-      cp $(TOP_DIR)/installer-files/fc_update.bat $(OCTAVE_DIST_DIR)/
     endef
   else
     define copy-windows-dist-files
@@ -116,9 +120,15 @@
       cp $(TOP_DIR)/installer-files/README.html $(OCTAVE_DIST_DIR)/
       echo "  refblas..."
       cp $(OCTAVE_DIST_DIR)/bin/libblas.dll $(OCTAVE_DIST_DIR)/bin/librefblas.dll
-      echo "  octave.bat..."
-      cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/
+      echo "  octave.vbs..."
+      cp $(TOP_DIR)/installer-files/octave.vbs $(OCTAVE_DIST_DIR)/
+      cp $(TOP_DIR)/installer-files/octave-firsttime.vbs $(OCTAVE_DIST_DIR)/
       cp $(TOP_DIR)/installer-files/fc_update.bat $(OCTAVE_DIST_DIR)/
+      echo "  updating octave .exe to script files..."
+      rm -f $(OCTAVE_DIST_DIR)/bin/octave.exe
+      rm -f $(OCTAVE_DIST_DIR)/bin/octave-$($(OCTAVE_TARGET)_VERSION).exe
+      cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/bin/octave.bat
+      cp $(TOP_DIR)/installer-files/octave.bat $(OCTAVE_DIST_DIR)/bin/octave-$($(OCTAVE_TARGET)_VERSION).bat
     endef
   endif
 endif
--- a/installer-files/octave.bat	Fri Jul 06 14:16:31 2018 -0400
+++ b/installer-files/octave.bat	Mon Jul 09 14:38:21 2018 -0400
@@ -1,10 +1,12 @@
+:; # if running from bash, recall using cmd.exe
+:; cmd.exe //c "$0" "$@"; exit $?
 @echo off
 Rem   Find Octave's install directory through cmd.exe variables.
-Rem   This batch file should reside in Octaves installation subdir!
+Rem   This batch file should reside in Octaves installation bin dir!
 Rem
 Rem   This trick finds the location where the batch file resides.
 Rem   Note: the result ends with a backslash.
-set OCT_HOME=%~dp0
+set OCT_HOME=%~dp0\.\..\
 Rem Convert to 8.3 format so we don't have to worry about spaces.
 for %%I in ("%OCT_HOME%") do set OCT_HOME=%%~sI
 
--- a/tools/makeinst-script.sh.in	Fri Jul 06 14:16:31 2018 -0400
+++ b/tools/makeinst-script.sh.in	Mon Jul 09 14:38:21 2018 -0400
@@ -229,12 +229,10 @@
   SetOutPath "\$INSTDIR" 
   File "$OCTAVE_SOURCE/README.html"
 
-  ; include the octave.bat file
+  ; include octave.vbs and other scripts
   SetOutPath "\$INSTDIR" 
-  File "$OCTAVE_SOURCE/octave.bat"
   File "$OCTAVE_SOURCE/octave.vbs"
   File "$OCTAVE_SOURCE/octave-firsttime.vbs"
-
   File "$OCTAVE_SOURCE/fc_update.bat"
 
   File "$OCTAVE_SOURCE/HG-ID"
@@ -614,7 +612,7 @@
 
 ; Check whether prev install is here and no spaces in dest name
 Function CheckPrevInstallAndDest
-  IfFileExists "\$INSTDIR\\bin\\octave.exe" inst_exists  inst_none
+  IfFileExists "\$INSTDIR\\bin\\octave-cli.exe" inst_exists  inst_none
 inst_exists:
   MessageBox MB_YESNO|MB_ICONEXCLAMATION "Another Octave installation has been detected at that destination. It is recommended to uninstall it if you intend to use the same installation directory. Do you want to proceed with the installation anyway?" /SD IDYES IDYES inst_none IDNO 0
   Abort