Add missing credit for Esperanto translation
[neverball.git] / scripts / neverball.nsi
blob988afa47ca7796b58eab214223df65bcb3e690dd
1 #------------------------------------------------------------------------------
3 !include "LogicLib.nsh"
5 #------------------------------------------------------------------------------
7 !ifndef VERSION
8 !define VERSION "unknown"
9 !endif
11 !ifndef OUTFILE
12 !define OUTFILE "../neverball-${VERSION}-setup.exe"
13 !endif
15 !define UNINSTALL_REG_ROOT \
16 "Software\Microsoft\Windows\CurrentVersion\Uninstall\Neverball"
18 #------------------------------------------------------------------------------
20 OutFile ${OUTFILE}
21 Name "Neverball ${VERSION}"
22 LicenseData "COPYING.txt"
23 InstallDir "$PROGRAMFILES\Neverball"
25 XPStyle on
26 SetCompressor /solid lzma
27 RequestExecutionLevel user
29 #------------------------------------------------------------------------------
31 Page license
32 Page components
33 Page directory
34 Page instfiles
36 Function .onInit
37 Call IsUserAdmin
38 Pop $R0
40 ${If} $R0 == "true"
41 SetShellVarContext all
42 ${EndIf}
43 FunctionEnd
45 Section "Neverball/Neverputt"
46 SectionIn RO
48 SetOutPath "$INSTDIR"
50 File *.txt doc\*.txt
51 File /r /x .svn /x *.map /x *.obj data
52 File /r locale
54 File neverball.exe neverputt.exe *.dll
56 File /oname=data\icon\neverball.ico dist\ico\neverball.ico
57 File /oname=data\icon\neverputt.ico dist\ico\neverputt.ico
59 CreateDirectory "$INSTDIR\bin"
61 SetOutPath "$INSTDIR\bin"
63 File scripts\neverball.bat
64 File scripts\neverputt.bat
65 File contrib\curve.exe
67 # http://nsis.sourceforge.net/\
68 # Add_uninstall_information_to_Add/Remove_Programs
70 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
71 "DisplayName" "Neverball ${VERSION}"
72 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
73 "DisplayVersion" "${VERSION}"
74 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
75 "DisplayIcon" "$INSTDIR\data\icon\neverball.ico"
76 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
77 "UninstallString" "$INSTDIR\uninstall.exe"
78 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
79 "URLInfoAbout" "http://www.neverball.org/"
80 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
81 "URLUpdateInfo" "http://www.neverball.org/"
82 WriteRegStr SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
83 "HelpLink" "http://www.nevercorner.net/"
84 WriteRegDWORD SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
85 "NoModify" 1
86 WriteRegDWORD SHELL_CONTEXT ${UNINSTALL_REG_ROOT} \
87 "NoRepair" 1
89 WriteUninstaller "$INSTDIR\uninstall.exe"
90 SectionEnd
92 Section "Mapping tools (compiler, maps, ...)"
93 SetOutPath "$INSTDIR"
95 File mapc.exe
96 File /oname=bin\mapc.bat scripts\mapc.bat
98 SetOutPath "$INSTDIR\data"
100 File /r /x ".svn" data\*.map
101 File /r /x ".svn" data\*.obj
102 SectionEnd
104 SectionGroup "Shortcuts"
105 Section "In Start menu"
106 # Reset to get a proper working directory
107 SetOutPath "$INSTDIR"
109 CreateDirectory "$SMPROGRAMS\Neverball"
111 CreateShortcut \
112 "$SMPROGRAMS\Neverball\Neverball.lnk" \
113 "$INSTDIR\neverball.exe" "" \
114 "$INSTDIR\data\icon\neverball.ico"
116 CreateShortcut \
117 "$SMPROGRAMS\Neverball\Neverputt.lnk" \
118 "$INSTDIR\neverputt.exe" "" \
119 "$INSTDIR\data\icon\neverputt.ico"
120 SectionEnd
122 Section "On desktop"
123 # Reset to get a proper working directory
124 SetOutPath "$INSTDIR"
126 CreateShortcut \
127 "$DESKTOP\Neverball.lnk" \
128 "$INSTDIR\neverball.exe" "" \
129 "$INSTDIR\data\icon\neverball.ico"
131 CreateShortcut \
132 "$DESKTOP\Neverputt.lnk" \
133 "$INSTDIR\neverputt.exe" "" \
134 "$INSTDIR\data\icon\neverputt.ico"
135 SectionEnd
136 SectionGroupEnd
138 #------------------------------------------------------------------------------
140 UninstPage uninstConfirm
141 UninstPage instfiles
143 Function un.onInit
144 Call un.IsUserAdmin
145 Pop $R0
147 ${If} $R0 == "true"
148 SetShellVarContext all
149 ${EndIf}
150 FunctionEnd
152 Section "Uninstall"
153 Delete "$SMPROGRAMS\Neverball\Neverball.lnk"
154 Delete "$SMPROGRAMS\Neverball\Neverputt.lnk"
155 RMDir "$SMPROGRAMS\Neverball"
156 Delete "$DESKTOP\Neverball.lnk"
157 Delete "$DESKTOP\Neverputt.lnk"
159 DeleteRegKey SHELL_CONTEXT ${UNINSTALL_REG_ROOT}
161 # FIXME: unsafe if the directory contains other-than-installed stuff
162 RMDir /r $INSTDIR
163 SectionEnd
165 #------------------------------------------------------------------------------
167 # URL: http://nsis.sourceforge.net/IsUserAdmin
168 # Author: Lilla (lilla@earthlink.net) 2003-06-13
170 !macro IsUserAdmin un
171 Function ${un}IsUserAdmin
172 Push $R0
173 Push $R1
174 Push $R2
176 ClearErrors
177 UserInfo::GetName
178 IfErrors Win9x
179 Pop $R1
180 UserInfo::GetAccountType
181 Pop $R2
183 StrCmp $R2 "Admin" 0 Continue
184 StrCpy $R0 "true"
185 Goto Done
187 Continue:
188 StrCmp $R2 "" Win9x
189 StrCpy $R0 "false"
190 Goto Done
192 Win9x:
193 StrCpy $R0 "true"
195 Done:
197 Pop $R2
198 Pop $R1
199 Exch $R0
200 FunctionEnd
201 !macroend
203 !insertmacro IsUserAdmin ""
204 !insertmacro IsUserAdmin "un."
206 #------------------------------------------------------------------------------
208 # vim:sts=4:sw=4:et: