1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
|
#
# NSI script for octave windows
# $Id: octave-install-win32.nsi,v 1.3 2003/07/28 21:10:10 pkienzle Exp $
#
# http://nsis.sourceforge.net/Docs
# Sort out command line parameters
!ifndef VERSION
!error "Start MakeNSIS with /DVERSION=2.1.xx [/DMINOR=-yyyymmdd] [/DROOT=C:\cygwin] octave.nsi"
!endif
!ifndef MINOR
!define MINOR ""
!endif
!ifndef ROOT
!define ROOT "C:\cygwin"
!endif
# Product and version
!define MUI_PRODUCT "GNU Octave ${VERSION}"
!define MUI_VERSION "${VERSION}${MINOR}"
!define STARTMENU
!include "${NSISDIR}\Contrib\Modern UI\System.nsh"
!define MUI_LICENSEPAGE
!define MUI_COMPONENTSPAGE
!define MUI_DIRECTORYPAGE
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Spanish"
CrcCheck On
OutFile "octave-${MUI_VERSION}-inst.exe"
#Icon "octave.ico"
#UninstallIcon "octave.ico"
# ****************** Localization ***********************
LicenseData /LANG=${LANG_ENGLISH} "..\..\COPYING.GPL"
LicenseData /LANG=${LANG_SPANISH} "..\..\COPYING.GPL-spanish"
; The default caption is a language dependent string saying
; ${MUI_PRODUCT} ${VERSION} Setup
; Since our ${MUI_PRODUCT} includes ${VERSION}, we need to
; set the caption by hand for each of our languages.
Caption /LANG=${LANG_ENGLISH} "${MUI_PRODUCT} Setup"
Caption /LANG=${LANG_SPANISH} "Instalacin de ${MUI_PRODUCT}"
UninstallCaption /LANG=${LANG_ENGLISH} "Uninstall ${MUI_PRODUCT}"
UninstallCaption /LANG=${LANG_SPANISH} "Desinstalar ${MUI_PRODUCT}"
LangString TITLE_Section1 ${LANG_ENGLISH} "${MUI_PRODUCT}"
LangString TITLE_Section1 ${LANG_SPANISH} "${MUI_PRODUCT}"
LangString TITLE_Section2 ${LANG_ENGLISH} "Start Menu Icons"
LangString TITLE_Section2 ${LANG_SPANISH} "Iconos de Men de Inicio"
LangString TITLE_Section3 ${LANG_ENGLISH} "Desktop Icons"
LangString TITLE_Section3 ${LANG_SPANISH} "Iconos de Escritorio"
LangString DESC_Section1 ${LANG_ENGLISH} "Install the ${MUI_PRODUCT} for Windows binary distribution including gnuplot, epstk and the octave-forge extensions."
LangString DESC_Section1 ${LANG_SPANISH} "Instalar la version ejecutable the ${MUI_PRODUCT} para Windows la cual incluye gnuplot, epstk y las extensiones de octave-forge."
LangString DESC_Section2 ${LANG_ENGLISH} "Add a ${MUI_PRODUCT} folder to the Start Menu."
LangString DESC_Section2 ${LANG_SPANISH} "Agregar una carpeta de ${MUI_PRODUCT} al Men de Inicio."
LangString DESC_Section3 ${LANG_ENGLISH} "Add a ${MUI_PRODUCT} icon to the Desktop."
LangString DESC_Section3 ${LANG_SPANISH} "Agregar un icono de ${MUI_PRODUCT} al Escritorio."
LangString UninstallLink ${LANG_ENGLISH} "$SMPROGRAMS\${MUI_PRODUCT}\Uninstall ${MUI_PRODUCT}.lnk"
LangString UninstallLink ${LANG_SPANISH} "$SMPROGRAMS\${MUI_PRODUCT}\Desinstalar ${MUI_PRODUCT}.lnk"
LangString ManualLink ${LANG_ENGLISH} "$SMPROGRAMS\${MUI_PRODUCT}\${MUI_PRODUCT} Manual (HTML).lnk"
LangString ManualLink ${LANG_SPANISH} "$SMPROGRAMS\${MUI_PRODUCT}\Manual de ${MUI_PRODUCT} (HTML).lnk"
LangString FunctionLink ${LANG_ENGLISH} "$SMPROGRAMS\${MUI_PRODUCT}\OctaveForge Quick Reference (HTML).url"
LangString FunctionLink ${LANG_SPANISH} "$SMPROGRAMS\${MUI_PRODUCT}\Refencia Rpida de OctaveForge (HTML).url"
LangString EpstkLink ${LANG_ENGLISH} "$SMPROGRAMS\${MUI_PRODUCT}\Epstk Manual (HTML).url"
LangString EpstkLink ${LANG_SPANISH} "$SMPROGRAMS\${MUI_PRODUCT}\Manual de Epstk (HTML).url"
LangString RefcardLink ${LANG_ENGLISH} "$SMPROGRAMS\${MUI_PRODUCT}\${MUI_PRODUCT} Quick Reference (PDF).lnk"
LangString RefcardLink ${LANG_SPANISH} "$SMPROGRAMS\${MUI_PRODUCT}\Refencia Rpida de ${MUI_PRODUCT} (PDF).lnk"
; The following strings are used by "Function .onInit". If you are
; adding a new language, be sure to add new tests therein, otherwise
; the English language messages will be used.
!define PreviousCygwinEnglish "A previous installation of cygwin was detected. This package is not to be used from within a cygwin enviroment. Click OK if you want to continue anyway or CANCEL if you want to abort the installation process."
!define PreviousCygwinSpanish "Se detect una versin de cygwin instalada. Este paquete no fue diseado para funcionar dentro de un ambiente de cygwin. Presione Aceptar si desea continuar o Cancelar si desea detener el preceso de instalacin."
!define PreviousOctaveEnglish "A previous version of Octave for Windows was detected. Please uninstall any previous version before running this installer. Click OK if you want to continue anyway or CANCEL if you want to abort the installation process."
!define PreviousOctaveSpanish "Se detect una versin anterior de Octave para Windows. Por favor desinstale cualquier versin anterior antes de ejecutar este instalador. Presione Aceptar si desea continuar o Cancelar si desea detener el proceso de instalacin."
!define GenuineIntelEnglish "This version of Octave for Windows is optimized for Intel x86 processors and is known to cause troubles with other architectures. Click OK if you want to continue anyway or CANCEL if you want to abort the installation process."
!define GenuineIntelSpanish "Esta versin de Octave para Windows ha sido optimizada para procesadores Intel x86 y puede no funcionar correctamente sobre otros procesadores. Presione Aceptar si desea continuar o Cancelar si desea detener el proceso de instalacin."
# ****************** End Localization ***********************
# This is the command to start octave.
!define OctaveStart "rxvt.exe --keysym.0xFF50 '^a' --keysym.0xFF57 '^e' --keysym.0xFFFF '^f^h' -fn 'Lucida Console-12' -tn linux -title '${MUI_PRODUCT}' -geometry 80x25 -sl 400 -sr -e /bin/start_octave.sh"
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"
; Files and registry keys
Section $(TITLE_Section1) Section1
CreateDirectory $INSTDIR\tmp
CreateDirectory $INSTDIR\octave_files
SetOutPath $INSTDIR\bin
File "${ROOT}\opt\octave-support\*.*"
File install_octave.sh start_octave.sh
File octave.ico
File "${ROOT}\opt\octave\bin\*.*"
SetOutPath $INSTDIR\opt\octave\share
File /r "${ROOT}\opt\octave\share\*.*"
SetOutPath $INSTDIR\opt\octave\libexec
File /r "${ROOT}\opt\octave\libexec\*.*"
SetOutPath $INSTDIR\opt\octave\doc
File /r "${ROOT}\opt\octave\doc\*.*"
WriteUninstaller "$INSTDIR\uninstall.exe"
;Write language to the registry (for the uninstaller)
WriteRegStr HKCU "Software\GNU Octave" "Installer Language" $LANGUAGE
;File associations --- don't conflict with matlab's entries
ClearErrors
ReadRegStr $1 HKCR "" ".m"
StrCmp $1 "matfile" Matlab NoMatlab
NoMatlab:
WriteRegStr HKCR ".m" "" "octfile"
Matlab:
WriteRegStr HKCR "octfile" "" "Octave Script File"
WriteRegStr HKCR "octfile\DefaultIcon" "" "$INSTDIR\bin\octave.ico"
WriteRegStr HKCR "octfile\Shell\open\command" "" '"$WINDIR\notepad.exe" "%1"'
DetailPrint ";Cygwin's registry entries"
WriteRegStr HKLM \
"SOFTWARE\GNU Octave\Cygwin\mounts v2\/" "native" "$INSTDIR"
WriteRegDWORD HKLM \
"SOFTWARE\GNU Octave\Cygwin\mounts v2\/" "flags" "a"
WriteRegStr HKLM \
"SOFTWARE\GNU Octave\Cygwin\mounts v2\/usr/bin" "native" "$INSTDIR/bin"
WriteRegDWORD HKLM \
"SOFTWARE\GNU Octave\Cygwin\mounts v2\/usr/bin" "flags" "a"
WriteRegStr HKLM \
"SOFTWARE\GNU Octave\Cygwin\mounts v2\/usr/lib" "native" "$INSTDIR/lib"
WriteRegDWORD HKLM \
"SOFTWARE\GNU Octave\Cygwin\mounts v2\/usr/lib" "flags" "a"
WriteRegStr HKLM \
"SOFTWARE\GNU Octave\Cygwin\Program Options" "temp" "temp"
DeleteRegValue HKLM \
"SOFTWARE\GNU Octave\Cygwin\Program Options" "temp"
WriteRegStr HKU \
".DEFAULT\Software\GNU Octave\Cygwin\mounts v2\/" "native" "$INSTDIR"
WriteRegDWORD HKU \
".DEFAULT\Software\GNU Octave\Cygwin\mounts v2\/" "flags" "a"
WriteRegStr HKU \
".DEFAULT\Software\GNU Octave\Cygwin\mounts v2\/usr/bin" \
"native" "$INSTDIR/bin"
WriteRegDWORD HKU \
".DEFAULT\Software\GNU Octave\Cygwin\mounts v2\/usr/bin" "flags" "a"
WriteRegStr HKU \
".DEFAULT\Software\GNU Octave\Cygwin\mounts v2\/usr/lib" \
"native" "$INSTDIR/lib"
WriteRegDWORD HKU \
".DEFAULT\Software\GNU Octave\Cygwin\mounts v2\/usr/lib" "flags" "a"
WriteRegStr HKU \
".DEFAULT\Software\GNU Octave\Cygwin\Program Options" "temp" "temp"
DeleteRegValue HKU \
".DEFAULT\Software\GNU Octave\Cygwin\Program Options" "temp"
WriteRegStr HKCU \
"Software\GNU Octave\Cygwin\mounts v2\/" "cygdrive prefix" "/cygdrive"
WriteRegDWORD HKCU \
"Software\GNU Octave\Cygwin\mounts v2\/" "cygdrive flags" "22"
WriteRegStr HKCU \
"Software\GNU Octave\Cygwin\Program Options" "temp" "temp"
DeleteRegValue HKCU \
"Software\GNU Octave\Cygwin\Program Options" "temp"
;Uninstaller registry entries
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\GNU Octave" \
"DisplayName" "${MUI_PRODUCT}"
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\GNU Octave" \
"DisplayIcon" "$INSTDIR\bin\octave.ico"
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\GNU Octave" \
"UninstallString" "$INSTDIR\uninstall.exe"
SectionEnd
; Start menu shortcuts
Section "$(TITLE_Section2)" Section2
CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT}"
CreateShortCut $(UninstallLink) \
"$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT}\${MUI_PRODUCT}.lnk" \
"$INSTDIR\bin\run.exe" "${OctaveStart}" "$INSTDIR\bin\octave.ico" 0
CreateShortCut $(ManualLink) \
"$INSTDIR\opt\octave\doc\octave_toc.html"
CreateShortCut $(RefcardLink) \
"$INSTDIR\opt\octave\doc\refcard-letter.pdf"
WriteINIStr $(FunctionLink) "InternetShortcut" "URL" \
"http://octave.sourceforge.net/index/index.html"
WriteINIStr $(EpstkLink) "InternetShortcut" "URL" \
"http://epstk.sourceforge.net/epstk/quickref/index.html"
SectionEnd
; Desktop shortcuts
Section "$(TITLE_Section3)" Section3
CreateShortCut "$DESKTOP\${MUI_PRODUCT}.lnk" \
"$INSTDIR\bin\run.exe" "${OctaveStart}" "$INSTDIR\bin\octave.ico" 0
SectionEnd
; Make links to drives
!include "DetectDrives.nsi"
Function MakeDriveLink
StrCpy $R2 $R0 1
# FileOpen $R1 "$INSTDIR/drive.link" a
# FileSeek $R1 0 END
# FileWrite $R1 "ln -sf /cygdrive/$R2 /$R2"
# FileClose $R1
DetailPrint "ln -sf /cygdrive/$R2 /$R2"
# Shouldn't need PATH=/bin here, but if I don't then cygwin
# complains. I don't know why it doesn't complain below
# in section -Local Config
Exec `$INSTDIR\bin\sh.exe -c "PATH=/bin ln -sf /cygdrive/$R2 /$R2"`
FunctionEnd
Section "-Make drive links"
# Delete "$INSTDIR/drive.link"
Push "All Local Drives"
Push $0
GetFunctionAddress $0 "MakeDriveLink"
Exch $0
Call DetectDrives
# Add commands to install_octave.sh to detect and evaluate drive.link
SectionEnd
; Post-installation configuration
Section "-Local Config"
Exec "$INSTDIR\bin\sh.exe -e /bin/install_octave.sh"
SectionEnd
!insertmacro MUI_SECTIONS_FINISHHEADER
Function .onInit
Push Tahoma
Push 8
; Ask for language before doing anything else
!insertmacro MUI_LANGDLL_DISPLAY
Push 2F
LangDLL::LangDialog "Installer Language" "Please select a language."
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
; We may be Intel-specific, especially if compiled against ATLAS.
ClearErrors
ReadRegStr $1 HKLM "HARDWARE\DESCRIPTION\System\CentralProcessor\0\" "VendorIdentifier"
StrCmp $1 "GenuineIntel" Continue0 Error0
Error0:
; Language specific strings don't work in .onInit, so simulate the effect.
StrCpy $0 "${GenuineIntelEnglish}"
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +2
StrCpy $0 "${GenuineIntelSpanish}"
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION $0 IDOK Continue0
Abort
Continue0:
; Detect an existing Octave installation
ClearErrors
ReadRegDWORD $1 HKLM "SOFTWARE\GNU Octave\Cygwin\mounts v2\/" flags
IfErrors Continue1 Error1
Error1:
; Language specific strings don't work in .onInit, so simulate the effect.
StrCpy $0 "${PreviousOctaveEnglish}"
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +2
StrCpy $0 "${PreviousOctaveSpanish}"
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION $0 IDOK Continue1
Abort
Continue1:
; Detect an existing Cygwin installation
ClearErrors
ReadRegDWORD $1 HKLM "SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/" flags
IfErrors Continue2 Error2
Error2:
; Language specific strings don't work in .onInit, so simulate the effect.
StrCpy $0 "${PreviousCygwinEnglish}"
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +2
StrCpy $0 "${PreviousCygwinSpanish}"
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION $0 IDOK Continue2
Abort
Continue2:
FunctionEnd
!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
!insertmacro MUI_FUNCTIONS_DESCRIPTION_END
Section "Uninstall"
ClearErrors
; Clear file associations
ReadRegStr $1 HKCR "" ".m"
StrCmp $1 "octfile" NoMatlab Matlab
NoMatlab:
DeleteRegKey HKCR ".m"
Matlab:
DeleteRegKey HKCR "octfile\DefaultIcon"
DeleteRegKey HKCR "octfile\Shell\open\command"
DeleteRegKey HKCR "octfile"
; Clean up registry
DeleteRegKey HKLM "SOFTWARE\GNU Octave"
DeleteRegKey HKU ".DEFAULT\Software\GNU Octave"
DeleteRegKey HKCU "Software\GNU Octave"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GNU Octave"
;; The following used value is now stored in GNU Octave, which is cleaned above.
; DeleteRegKey HKCU "Software\${MUI_PRODUCT}" "Installer Language"
; Clean up start menu
Delete "$DESKTOP\${MUI_PRODUCT}.lnk"
Delete "$SMPROGRAMS\${MUI_PRODUCT}\*.*"
Delete "$INSTDIR\*.*"
RMDir "$SMPROGRAMS\${MUI_PRODUCT}"
; Clean up files
RMDir /r "$INSTDIR"
;Display the Finish header
!insertmacro MUI_UNFINISHHEADER
SectionEnd
Function un.onInit
;Get language from registry
ReadRegStr $LANGUAGE HKCU "Software\GNU Octave" "Installer Language"
FunctionEnd
|