Permalink
Browse files

Hopefully don't blast the PATH.

  • Loading branch information...
1 parent d80efd4 commit 19332f9aad4931c8a7659b5db79fa299f35a67f4 @protz committed Mar 23, 2012
Showing with 43 additions and 6 deletions.
  1. +25 −0 EnvVarUpdate.nsh
  2. +6 −3 Makefile
  3. +12 −3 install.nsi
View
@@ -144,6 +144,31 @@ Function ${UN}EnvVarUpdate
DetailPrint "ERROR: PathString is blank"
Goto EnvVarUpdate_Restore_Vars
${EndIf}
+
+ ;;khc - here check if length is going to be greater then max string length
+ ;; and abort if so - also abort if original path empty - may mean
+ ;; it was too long as well- write message to say set it by hand
+
+ Push $6
+ Push $7
+ Push $8
+ StrLen $7 $4
+ StrLen $6 $5
+ IntOp $8 $6 + $7
+ ${If} $5 == ""
+ ${OrIf} $8 >= ${NSIS_MAX_STRLEN}
+ SetErrors
+ DetailPrint "Current $1 length ($6) too long to modify in NSIS; set manually if needed"
+ Pop $8
+ Pop $7
+ Pop $6
+ Goto EnvVarUpdate_Restore_Vars
+ ${EndIf}
+ Pop $8
+ Pop $7
+ Pop $6
+
+ ;;khc
; Make sure we've got some work to do
${If} $5 == ""
View
@@ -1,6 +1,9 @@
-NSIS=/c/Program\ Files\ \(x86\)/NSIS/makensisw.exe
+NSIS=/cygdrive/c/Program\ Files\ \(x86\)/NSIS/makensisw.exe
SCRIPT=install.nsi
-OCAMLROOT=/c/ocamlmgw
+OCAMLROOT=/cygdrive/c/ocamlmgw/
+OCAMLROOTW=c:/ocamlmgw/
+
+.PHONY: version
all: util version
$(NSIS) $(SCRIPT)
@@ -10,7 +13,7 @@ all: util version
util: gen_files.ml $(OCAMLROOT)/bin/ocaml.exe
rm -f gen_files.byte
ocamlbuild gen_files.byte
- ./gen_files.byte $(OCAMLROOT)
+ ./gen_files.byte $(OCAMLROOTW)
version: $(OCAMLROOT)/bin/ocaml.exe
$(shell echo "!define MUI_VERSION \""`$(OCAMLROOT)/bin/ocaml.exe -version | sed 's/.*version \([^ ]\+\).*/\1/g'`"\"" > version.nsh)
View
@@ -31,15 +31,17 @@
!define EMACS_VER "23.3"
!define ROOT_DIR "c:\ocamlmgw" ; the directory where your binary dist of ocaml lives
+!define MULTIUSER_EXECUTIONLEVEL Highest
+
!include "version.nsh"
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "EnvVarUpdate.nsh"
+!include "MultiUser.nsh"
Name "OCaml"
-OutFile "ocaml-${MUI_VERSION}-mingw32.exe"
+OutFile "ocaml-${MUI_VERSION}-i686-mingw64.exe"
InstallDir "$PROGRAMFILES32\${MUI_PRODUCT}"
-RequestExecutionLevel admin
!define MUI_WELCOMEPAGE_TITLE "Welcome to the OCaml setup for windows."
!define MUI_WELCOMEPAGE_TEXT "This wizard will install OCaml ${MUI_VERSION}, as well as required tools and libraries for it to work properly."
@@ -82,6 +84,8 @@ Var STARTMENUFOLDER
Section "OCaml" SecOCaml
+ !insertmacro MULTIUSER_INIT
+
ReadRegStr $1 SHCTX "SOFTWARE\OCaml" ""
${If} $1 != ""
@@ -104,10 +108,13 @@ Section "OCaml" SecOCaml
File /r ${ROOT_DIR}\bin
File /r ${ROOT_DIR}\lib
File /r ${ROOT_DIR}\man
+
+ ; This is for the OCamlWin thing
+ WriteRegStr SHCTX "Software\Objective Caml" "InterpreterPath" "$INSTDIR\bin\ocaml.exe"
WriteRegStr SHCTX "Software\OCaml" "" $INSTDIR
; We want to overwrite that one anyway for the new setup to work properly.
- WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "OCAMLLIB" "$INSTDIR\lib"
+ WriteRegStr SHCTX "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "OCAMLLIB" "$INSTDIR\lib"
${EnvVarUpdate} $0 "PATH" "P" "HKLM" "$INSTDIR\bin"
; There's already a file like that in the original directory, so remove it,
@@ -217,6 +224,8 @@ LangString DESC_SecEmacs ${LANG_ENGLISH} "Emacs is a text editor with excellent
Section "Uninstall"
+ !insertmacro MULTIUSER_UNINIT
+
${If} ${FileExists} "$INSTDIR\emacs-${EMACS_VER}"
MessageBox MB_YESNO "Also uninstall Emacs ${EMACS_VER}?" IDNO next

0 comments on commit 19332f9

Please sign in to comment.