--- misc/trunk/win32_installer/linuxsampler_all.nsi 2009/05/11 19:50:03 1900 +++ misc/trunk/win32_installer/linuxsampler_all.nsi 2009/07/02 16:11:49 1926 @@ -21,7 +21,7 @@ !include "MUI.nsh" !include "EnvVarUpdate.nsh" -!define RELEASE_DATE "20090511" +!define RELEASE_DATE "20090623" ; The name of the installer Name "LinuxSampler (${RELEASE_DATE})" @@ -31,13 +31,16 @@ ; Java Runtime Environment, needed for JSampler !define JRE_VERSION "1.6" -!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=11292" +!define JRE_32_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=31621" +!define JRE_64_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=31623" ; The default installation directory -InstallDir $PROGRAMFILES\LinuxSampler +InstallDir "$PROGRAMFILES64\LinuxSampler" + +!define DEFAULT_VST_DIR "$PROGRAMFILES64\Steinberg\VstPlugins" ; Get installation folder from registry if available -InstallDirRegKey HKCU "Software\LinuxSampler" "" +InstallDirRegKey HKLM "Software\LinuxSampler" "Main Directory" ;-------------------------------- ;Interface Settings @@ -62,6 +65,8 @@ !define BIN_TYPE_686SSE "686 SSE" !define BIN_TYPE_686 "686" +Var /GLOBAL binType + ;-------------------------------- ; Pages @@ -90,20 +95,23 @@ StrCpy $installinggigedit "0" FunctionEnd -; detects CPU capabilities and determmines which native binary type to install -Function DetectSystemType - Var /GLOBAL binType - +; detects CPU capabilities, determmines which native binary type to install +; and selects the appropriate windows registry view (32 bit or 64 bit) +!macro DetectSystemType un +Function ${un}DetectSystemType ; check if this is a 64 bit windows System::Call "kernel32::GetCurrentProcess() i .s" System::Call "kernel32::IsWow64Process(i s, *i .r0)" IntCmp $0 0 not64bit StrCpy $binType BIN_TYPE_64BIT DetailPrint "64 bit Windows detected." + SetRegView 64 Goto DetectSystemDone not64bit: ; a 32 bit system + SetRegView 32 + ; check if CPU supports SSE cpudesc::tell Pop $0 ; full identification string in $0 @@ -118,6 +126,9 @@ DetectSystemDone: FunctionEnd +!macroend +!insertmacro DetectSystemType "" +!insertmacro DetectSystemType "un." ; Check for the presence of gtkmm, and if false, ask the user whether to ; download and install gtkmm now from the internet. @@ -153,17 +164,26 @@ ; Downloads and launches the JRE installer from the internet Function GetJRE - MessageBox MB_OK "JSampler requires Java ${JRE_VERSION}, it will now \ - be downloaded and installed" + Var /GLOBAL jreUri - StrCpy $2 "$TEMP\Java Runtime Environment.exe" - nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2 - Pop $R0 ;Get the return value - StrCmp $R0 "success" +3 - MessageBox MB_OK "Download failed: $R0" - Quit - ExecWait $2 - Delete $2 + StrCmp $binType BIN_TYPE_64BIT 0 +3 + StrCpy $jreUri ${JRE_64_URL} + Goto +2 + StrCpy $jreUri ${JRE_32_URL} + + DetailPrint "Downloading JRE from: $jreUri" + + MessageBox MB_OK "JSampler requires Java ${JRE_VERSION}, it will now \ + be downloaded and installed" + + StrCpy $2 "$TEMP\Java Runtime Environment.exe" + nsisdl::download /TIMEOUT=30000 "$jreUri" $2 + Pop $R0 ; Get the return value + StrCmp $R0 "success" +3 + MessageBox MB_OK "Download failed: $R0" + Quit + ExecWait $2 + Delete $2 FunctionEnd ; Checks if the JRE is already installed, if not it will download and install it from the internet @@ -172,6 +192,17 @@ "CurrentVersion" StrCmp $2 ${JRE_VERSION} done + StrCmp $binType BIN_TYPE_64BIT 0 downloadjre + + ; on 64 bit systems also check the 32 bit view of the registry, maybe + ; a 32 bit JRE was already installed + SetRegView 32 + ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \ + "CurrentVersion" + SetRegView 64 ; restore 64 bit view + StrCmp $3 ${JRE_VERSION} done + + downloadjre: Call GetJRE done: @@ -199,7 +230,7 @@ noRegistryKeyExists: ClearErrors DetailPrint "No VST plugin directory defined in registry." - StrCpy $vstPluginPath "$PROGRAMFILES\Steinberg\VstPlugins" + StrCpy $vstPluginPath "${DEFAULT_VST_DIR}" done: DetailPrint "Using the following as VST plugin directory: $vstPluginPath" @@ -207,7 +238,7 @@ ;-------------------------------- -; primer things to do +; primer things to do (before installing, not called on uninstall) Section "" Call DetectSystemType Call DetectVstPath @@ -232,6 +263,7 @@ linuxsampler64: File bin\64\linuxsampler.exe File bin\64\liblinuxsampler-1.dll + File bin\64\libsqlite3-0.dll SetOutPath $vstPluginPath File bin\64\LinuxSampler.dll Goto done @@ -239,6 +271,7 @@ linuxsampler686sse: File bin\686sse\linuxsampler.exe File bin\686sse\liblinuxsampler-1.dll + File bin\686\libsqlite3-0.dll SetOutPath $vstPluginPath File bin\686sse\LinuxSampler.dll Goto done @@ -246,6 +279,7 @@ linuxsampler686: File bin\686\linuxsampler.exe File bin\686\liblinuxsampler-1.dll + File bin\686\libsqlite3-0.dll SetOutPath $vstPluginPath File bin\686\LinuxSampler.dll Goto done @@ -253,7 +287,7 @@ done: SectionEnd -Section "JSampler 'Fantasia' 0.8a-cvs6" SecJSampler +Section "JSampler 'Fantasia' 0.8a-cvs8" SecJSampler DetailPrint "Installing JSampler binaries ..." ; make sure JRE is installed Call DetectJRE @@ -261,7 +295,7 @@ ; Set output path to the installation directory. SetOutPath $INSTDIR ; Files to install - File bin\Fantasia-0.8a-cvs6.jar + File bin\Fantasia-0.8a-cvs8.jar File jsampler.ico SectionEnd @@ -452,19 +486,25 @@ done: - ; As this is a mandatory component, we add the common binary directory - ; of LinuxSampler and friends to the system's PATH variable here ... + ; As this is a mandatory component, we misuse is for the following + ; common tasks as well ... + + ; Add LinuxSampler and friends to the system's PATH variable ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR" - ; As this is a mandatory component, we misuse it to install the uninstaller as well ... ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LinuxSampler" "DisplayName" "LinuxSampler ${RELEASE_DATE}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LinuxSampler" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LinuxSampler" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LinuxSampler" "NoRepair" 1 WriteUninstaller "uninstall.exe" - ;Store installation folder - WriteRegStr HKCU "Software\LinuxSampler" "" $INSTDIR + + ; Store installation folders + WriteRegStr HKLM "Software\LinuxSampler" "Main Directory" $INSTDIR + WriteRegStr HKLM "Software\LinuxSampler" "VST Directory" $vstPluginPath + + ; Just for info, store the release date as well + WriteRegStr HKLM "Software\LinuxSampler" "Release Date" ${RELEASE_DATE} SectionEnd Section "libsndfile 1.0.19" Seclibsndfile @@ -493,21 +533,37 @@ SectionEnd Section "Start Menu Shortcuts" SecShortcuts + Var /GLOBAL javawbin + + ; Switch system variables to 'all users', to ensure we create the start + ; menu shortcuts for all users and not just for the current user. + SetShellVarContext all + + ; try to resolve the full qualified path of the javaw binary + ClearErrors + SearchPath $javawbin javaw.exe + IfErrors 0 javawDetected + ClearErrors + ; if all fails, simply use SYSDIR (which should work almost always anyway) + DetailPrint "WRN: Could not resolve javaw.exe path, using SYSDIR." + StrCpy $javawbin "$SYSDIR\javaw.exe" + javawDetected: + CreateDirectory "$SMPROGRAMS\LinuxSampler" CreateShortCut "$SMPROGRAMS\LinuxSampler\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 StrCmp $installingLinuxSampler '1' 0 +2 - CreateShortCut "$SMPROGRAMS\LinuxSampler\LinuxSampler 0.5.1 (stand alone backend).lnk" "$INSTDIR\linuxsampler.exe" "" "$INSTDIR\linuxsampler.exe" 0 + CreateShortCut "$SMPROGRAMS\LinuxSampler\LinuxSampler 0.5.1.12cvs (stand alone backend).lnk" "$INSTDIR\linuxsampler.exe" "" "$INSTDIR\linuxsampler.exe" 0 StrCmp $installingJSampler '1' 0 +2 - CreateShortCut '$SMPROGRAMS\LinuxSampler\JSampler Fantasia 0.8a (frontend).lnk' 'javaw' '-jar "$INSTDIR\Fantasia-0.8a.jar"' '$INSTDIR\jsampler.ico' 0 + CreateShortCut '$SMPROGRAMS\LinuxSampler\JSampler Fantasia 0.8a-cvs8 (frontend).lnk' '$javawbin' '-jar "$INSTDIR\Fantasia-0.8a-cvs8.jar"' '$INSTDIR\jsampler.ico' 0 StrCmp $installingQSampler '1' 0 +2 - CreateShortCut "$SMPROGRAMS\LinuxSampler\QSampler 0.2.1 (frontend).lnk" "$INSTDIR\qsampler.exe" "" "$INSTDIR\qsampler.ico" 0 + CreateShortCut "$SMPROGRAMS\LinuxSampler\QSampler 0.2.1.26 (frontend).lnk" "$INSTDIR\qsampler.exe" "" "$INSTDIR\qsampler.ico" 0 StrCmp $installinggigedit '1' 0 +2 - CreateShortCut "$SMPROGRAMS\LinuxSampler\gigedit 0.1.1 (stand alone).lnk" "$INSTDIR\gigedit.exe" "" "$INSTDIR\gigedit.exe" 0 + CreateShortCut "$SMPROGRAMS\LinuxSampler\gigedit 0.1.1.x cvs2009-05-10 (stand alone).lnk" "$INSTDIR\gigedit.exe" "" "$INSTDIR\gigedit.exe" 0 SectionEnd ;-------------------------------- @@ -515,20 +571,43 @@ ; Uninstaller Section "Uninstall" + Var /GLOBAL vstdir + + Call un.DetectSystemType + DetailPrint "Removing LinuxSampler directory from PATH variable ..." ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR" + DetailPrint "Searching for VST plugin ..." + ClearErrors + ReadRegStr $0 HKLM "Software\LinuxSampler" "VST Directory" + IfErrors usedefaultvstdir 0 + StrCpy $vstdir $0 + DetailPrint "VST plugin location found in registry." + Goto vstdirDetected + usedefaultvstdir: + DetailPrint "WRN: No VST plugin location found in registry, trying default location." + ClearErrors + StrCpy $vstdir "${DEFAULT_VST_DIR}" + vstdirDetected: + DetailPrint "Removing registry keys ..." DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LinuxSampler" + DeleteRegKey HKLM "Software\LinuxSampler" - DetailPrint "Removing VST plugin ..." - Delete $vstPluginPath\LinuxSampler.dll + ; Workaround for Vista and younger: switch system variables to 'all users' + ; otherwise e.g. we couldn't delete start menu shortcuts below on those + ; systems, as those variables would point to the current user. + SetShellVarContext all - DetailPrint "Removing shortcuts (if any) ..." + DetailPrint "Removing shortcuts (if any) from: $SMPROGRAMS ..." Delete "$SMPROGRAMS\LinuxSampler\*.*" + DetailPrint "Removing VST plugin from: $vstdir ..." + Delete "$vstdir\LinuxSampler.dll" + DetailPrint "Removing directories used ..." - RMDir "$SMPROGRAMS\LinuxSampler" + RMDir /r "$SMPROGRAMS\LinuxSampler" RMDir /r "$INSTDIR" SectionEnd @@ -536,10 +615,10 @@ ;Descriptions ;Language strings -LangString DESC_SecLinuxSampler ${LANG_ENGLISH} "Sampler backend (stand-alone application and VST plugin), including sampler engine, MIDI and audio drivers, native C++ API as well as network (LSCP) API. Use a frontend application like JSampler or QSampler to control the sampler." +LangString DESC_SecLinuxSampler ${LANG_ENGLISH} "Sampler backend (stand-alone and VST), including sampler engine, MIDI and audio drivers, native C++ API as well as network (LSCP) API. Use a frontend application like JSampler or QSampler to control the sampler." LangString DESC_SecJSampler ${LANG_ENGLISH} "Graphical frontend (user interface) for LinuxSampler written in Java, supporting all current features of LinuxSampler. This is the 'Fantasia' distribution of JSampler, offering a modern skin based look." LangString DESC_SecQSampler ${LANG_ENGLISH} "Graphical light-weight frontend (user interface) for LinuxSampler written in C++, offering a fast native user interface. NOTE: QSampler doesn't support all LinuxSampler features yet!" -LangString DESC_Secgigedit ${LANG_ENGLISH} "Graphical instrument editor for Gigasampler format v2 and v3 files. Can be used stand-alone or in conjunction with LinuxSampler. NOTE: this is yet an early development version!" +LangString DESC_Secgigedit ${LANG_ENGLISH} "Graphical instrument editor for Gigasampler format v2 and v3 files. Can be used stand-alone or in conjunction with LinuxSampler." LangString DESC_Seclibgig ${LANG_ENGLISH} "C++ program library for accessing DLS (Level 1 and Level 2) and Gigasampler format (v2 and v3) files. This library is required by LinuxSampler, gigedit and QSampler." LangString DESC_Seclibsndfile ${LANG_ENGLISH} "C program library for reading and writing files containing sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format), used by gigedit to import samples." LangString DESC_SecShortcuts ${LANG_ENGLISH} "Installs start menu shortcuts for all applications."