pluginInstaller.nsi (3784B)
1 !include LogicLib.nsh 2 3 !define NAME Osirus 4 !define VENDOR "The Usual Suspects" 5 6 !define DIR_PLUGINS "..\..\bin\plugins\Release" 7 !define DIR_SKINS "..\..\source\osirusJucePlugin\skins\" 8 !define DIR_DATA "$DOCUMENTS\${VENDOR}\${NAME}" 9 10 Name ${NAME} 11 12 #!include ${NAME}.nsh 13 14 !define REGKEYBASE "Software\${VENDOR}\${NAME}" 15 16 OutFile ${NAME}Installer.exe 17 18 InstallColors /windows 19 XPStyle on 20 21 InstallDir "$PROGRAMFILES64\${VENDOR}\${NAME}" 22 InstallDirRegKey HKLM "${REGKEYBASE}" "InstallDir" 23 24 RequestExecutionLevel admin 25 26 # ____________________________ 27 # 28 29 Var DirVst2 30 Var DirVst3 31 Var DirClap 32 Var DirLv2 33 34 Function .onInit 35 SetShellVarContext current 36 SetRegView 64 37 FunctionEnd 38 39 Function un.onInit 40 SetShellVarContext current 41 SetRegView 64 42 FunctionEnd 43 44 # ____________________________ 45 # SECTIONS 46 # 47 48 !ifdef DIR_SKINS 49 Section "Default Skins (required)" 50 SectionIn RO 51 SetOutPath "${DIR_DATA}\skins" 52 File /r "${DIR_SKINS}" 53 SectionEnd 54 !endif 55 56 /* 57 SectionGroup /e "Variants" 58 Section "Instrument" Sec_Instruments 59 SectionEnd 60 61 Section "FX" Sec_FX 62 SectionEnd 63 SectionGroupEnd 64 */ 65 !macro SectionPlugin Format SectionVarName DirVarName FileExtension 66 Section "${Format}" ${SectionVarName} 67 SetOutPath $${DirVarName} 68 # ${If} ${SectionIsSelected} ${Sec_Instruments} 69 File /r /x *.so /x *.pdb "${DIR_PLUGINS}\${Format}\${NAME}.${FileExtension}" 70 # ${EndIf} 71 # ${If} ${SectionIsSelected} ${Sec_FX} 72 File /r /x *.so /x *.pdb "${DIR_PLUGINS}\${Format}\${NAME}FX.${FileExtension}" 73 # ${EndIf} 74 WriteRegStr HKLM "${REGKEYBASE}" "InstallDir${Format}" $${DirVarName} 75 SectionEnd 76 !macroend 77 78 SectionGroup /e "Plugin Formats" 79 !insertmacro SectionPlugin "VST" Sec_Vst2 DirVst2 dll 80 !insertmacro SectionPlugin "VST3" Sec_Vst3 DirVst3 vst3 81 !insertmacro SectionPlugin "CLAP" Sec_Clap DirClap clap 82 !insertmacro SectionPlugin "LV2" Sec_Lv2 DirLv2 lv2 83 SectionGroupEnd 84 85 Section 86 SetOutPath "$INSTDIR" 87 WriteRegStr HKLM "${REGKEYBASE}" "InstallDir" "$INSTDIR" 88 WriteUninstaller "$INSTDIR\${NAME}Uninstaller.exe" 89 CreateShortcut "$SMPROGRAMS\Uninstall ${NAME}.lnk" "$INSTDIR\${NAME}Uninstaller.exe" 90 SectionEnd 91 92 # ____________________________ 93 # PAGES 94 # 95 96 Page components 97 98 Page directory 99 100 !macro PagePlugin Result Format SectionName DefaultPath 101 PageEx directory 102 Caption " - Select ${Format} directory" 103 DirVar $${Result} 104 PageCallbacks DirPluginPre${Format} "" "" 105 PageExEnd 106 107 Function DirPluginPre${Format} 108 ${If} ${SectionIsSelected} ${SectionName} 109 ReadRegStr $${Result} HKLM "${REGKEYBASE}" "InstallDir${Format}" 110 ${If} $${Result} == "" 111 StrCpy $${Result} "${DefaultPath}" 112 ${EndIf} 113 ${Else} 114 Abort 115 ${EndIf} 116 FunctionEnd 117 !macroend 118 119 !insertmacro PagePlugin DirVst2 VST ${Sec_Vst2} "$COMMONFILES64\VST2" 120 !insertmacro PagePlugin DirVst3 VST3 ${Sec_Vst3} "$COMMONFILES64\VST3" 121 !insertmacro PagePlugin DirClap CLAP ${Sec_Clap} "$COMMONFILES64\CLAP" 122 !insertmacro PagePlugin DirLv2 LV2 ${Sec_Lv2} "$COMMONFILES64\LV2" 123 124 Page instfiles 125 126 # ____________________________ 127 # UNINSTALLER 128 # 129 130 Section "un.Remove Skins" 131 RMDir /r "${DIR_DATA}\skins" 132 SectionEnd 133 134 Section "un.Remove Firmware ROMs" 135 RMDir /r "${DIR_DATA}\roms" 136 SectionEnd 137 138 !macro RemovePlugin Format 139 ReadRegStr $0 HKLM "${REGKEYBASE}" "InstallDir${Format}" 140 ${If} "$0" != "" 141 RMDir /r "$0\${NAME}.${Format}" 142 RMDir /r "$0\${NAME}FX.${Format}" 143 Delete "$0\${NAME}.dll" 144 Delete "$0\${NAME}FX.dll" 145 ${EndIf} 146 !macroend 147 148 Section "un.Base Files (always removed)" 149 !insertmacro RemovePlugin VST 150 !insertmacro RemovePlugin VST3 151 !insertmacro RemovePlugin CLAP 152 !insertmacro RemovePlugin LV2 153 Delete "$SMPROGRAMS\Uninstall ${NAME}.lnk" 154 Delete "$INSTDIR\${NAME}Uninstaller.exe" 155 RMDir "$INSTDIR" 156 RMDir "${DIR_DATA}" 157 DeleteRegKey HKLM "${REGKEYBASE}" 158 SectionEnd 159 160 UninstPage components 161 UninstPage instfiles