SCDoc: Use proper static string constants instead of comparing string literals.
[supercollider.git] / platform / windows / supercollider.nsi
bloba6f2942c4bb778e07458187a8e96435eec04edb6
1 !cd ${SC_SRC_DIR}
3 !include "Sections.nsh"
4 !include "FileFunc.nsh"
5 !include "WordFunc.nsh"
6 !include "MUI2.nsh"
7 !insertmacro MUI_LANGUAGE "English"
9 Name "SuperCollider ${SC_VERSION}"
10 OutFile ${SC_DST_DIR}\SuperCollider-${SC_VERSION}-win32.exe
11 InstallDir $PROGRAMFILES\SuperCollider-${SC_VERSION}
13 !ifdef SC_ED
14 Var GEDIT_DIR
15 !endif
17 ; --- PAGES ---
19 !define MUI_PAGE_HEADER_TEXT "License"
20 !define MUI_LICENSEPAGE_TEXT_TOP "Please review the license below."
21 !define MUI_LICENSEPAGE_TEXT_BOTTOM \
22 "By installing this software you implicitely agree with this license."
23 !insertmacro MUI_PAGE_LICENSE SuperCollider\LICENSE.txt
25 !define MUI_PAGE_HEADER_TEXT "Instructions"
26 !define MUI_PAGE_HEADER_SUBTEXT \
27 "Useful information regarding installation and usage"
28 !define MUI_LICENSEPAGE_TEXT_BOTTOM \
29 "These instructions will be available after installation \
30 in a README.txt file."
31 !define MUI_LICENSEPAGE_BUTTON "Next >"
32 ;!define MUI_LICENSEPAGE_TEXT_BOTTOM \
33 ;"By installing this software you implicitely agree with this license."
34 !insertmacro MUI_PAGE_LICENSE SuperCollider\README.txt
36 !define MUI_PAGE_HEADER_TEXT "Installation components"
37 !insertmacro MUI_PAGE_COMPONENTS
39 !define MUI_PAGE_HEADER_TEXT "Installation Folder"
40 !insertmacro MUI_PAGE_DIRECTORY
42 !ifdef SC_ED
43 !define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Gedit Folder"
44 !define MUI_DIRECTORYPAGE_VARIABLE $GEDIT_DIR
45 !define MUI_PAGE_HEADER_TEXT "Gedit Folder"
46 !define MUI_PAGE_CUSTOMFUNCTION_PRE skipIfNoSced
47 !define MUI_DIRECTORYPAGE_TEXT_TOP \
48 "Setup will install Sced - a plugin for gedit text editor \
49 that allows you to interact with SuperCollider from within the editor, \
50 and adds syntax highlighting for SuperCollider code.$\n$\n\
51 Please select a folder where gedit is installed:"
52 !insertmacro MUI_PAGE_DIRECTORY
53 !endif
55 !insertmacro MUI_PAGE_INSTFILES
57 !insertmacro MUI_UNPAGE_CONFIRM
59 !insertmacro MUI_UNPAGE_INSTFILES
61 ; --- SECTIONS ---
63 Section "Core" core_sect
64 SetOutPath $INSTDIR
65 File /r SuperCollider\*
67 ;Store installation folder
68 ;Does not work!
69 ;WriteRegStr HKLM "Software\SuperCollider\${SC_VERSION}" "intall-dir" $INSTDIR
71 ;Create uninstaller
72 WriteUninstaller "$INSTDIR\Uninstall.exe"
73 SectionEnd
75 !ifdef SC_ED
76 Section "Sced (gedit integration)" sced_sect
77 SetOutPath $GEDIT_DIR
79 File /r gedit\*
81 FileOpen $0 $APPDATA\sced.config.json w
82 IfErrors doneWriteConfig
83 ${WordReplace} $INSTDIR "\" "\\" "+" $1
84 FileWrite $0 "{$\"supercollider-dir$\": $\"$1$\"}"
85 FileClose $0
86 doneWriteConfig:
88 ;WriteRegStr HKLM "SOFTWARE\SuperCollider\${SC_VERSION}" "gedit-dir" "$GEDIT_DIR"
89 SectionEnd
90 !endif
92 Section "Uninstall"
94 RMDir /r "$INSTDIR"
96 ; !ifdef SC_ED
97 ; ReadRegStr $0 HKLM "Software\SuperCollider\${SC_VERSION}" "gedit-dir"
98 ; IfErrors doneDeleteSced
99 ; RMDir /r $0\lib\gedit-2\plugins\sced
100 ; Delete $0\lib\gedit-2\plugins\sced.gedit-plugin
101 ; Delete $0\share\gtksourceview-2.0\language-specs\supercollider.lang
102 ; doneDeleteSced:
103 ; !endif
105 ;DeleteRegKey HKLM "Software\SuperCollider\${SC_VERSION}"
107 SectionEnd
109 ; --- COMPONENT DESCRIPTIONS ---
111 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
112 !insertmacro MUI_DESCRIPTION_TEXT ${core_sect} \
113 "Language interpreter and sound synthesis server. Command-line only."
114 !ifdef SC_ED
115 !insertmacro MUI_DESCRIPTION_TEXT ${sced_sect} \
116 "Integration with gedit text editor.$\n$\n\
117 You need to have gedit installed."
118 !endif
119 !insertmacro MUI_FUNCTION_DESCRIPTION_END
121 ; --- FUNCTIONS ---
123 Function .onInit
124 IntOp $0 ${SF_SELECTED} | ${SF_RO}
125 SectionSetFlags ${core_sect} $0
126 FunctionEnd
128 !ifdef SC_ED
129 Function skipIfNoSced
130 SectionGetFlags ${sced_sect} $0
131 IntOp $0 $0 & ${SF_SELECTED}
132 IntCmp $0 0 is0 ok ok
133 is0:
134 Abort
136 ${Locate} $PROGRAMFILES32 "/G=0 /L=D /M=gedit*" geditFound
137 StrCmp $GEDIT_DIR "" 0 done
138 ${Locate} $PROGRAMFILES64 "/G=0 /L=D /M=gedit*" geditFound
139 done:
140 FunctionEnd
142 Function geditFound
143 StrCpy $GEDIT_DIR $R9
144 Push "StopLocate"
145 FunctionEnd
146 !endif