aboutsummaryrefslogtreecommitdiffhomepage
path: root/dev/nsis/coq.nsi
blob: 1f598a88d3bb19c9fcaa8b5c2883728ed8144dba (plain)
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
; This script is used to build the Windows install program for Coq.

;NSIS Modern User Interface
;Written by Joost Verburg
;Modified by Julien Narboux and Pierre Letouzey

;SetCompress off
SetCompressor lzma
; Comment out after debuging.

; The VERSION should be passed as an argument at compile time using :
;

!define MY_PRODUCT "Coq" ;Define your own software name here
!define COQ_SRC_PATH "..\.."
!define OUTFILE "coq-installer-${VERSION}.exe"

!include "MUI2.nsh"
!include "FileAssociation.nsh"

;--------------------------------
;Configuration

  Name "Coq"

  ;General
  OutFile "${OUTFILE}"

  ;Folder selection page
  InstallDir "C:\${MY_PRODUCT}"
  
  ;Remember install folder
  InstallDirRegKey HKCU "Software\${MY_PRODUCT}" ""

;--------------------------------
;Modern UI Configuration

  !insertmacro MUI_PAGE_WELCOME
  !insertmacro MUI_PAGE_LICENSE "${COQ_SRC_PATH}/LICENSE"
  !insertmacro MUI_PAGE_COMPONENTS
  !define MUI_DIRECTORYPAGE_TEXT_TOP "Select where to install Coq.  The path MUST not include spaces."
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  !insertmacro MUI_PAGE_FINISH
  
  !insertmacro MUI_UNPAGE_WELCOME
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES
  !insertmacro MUI_UNPAGE_FINISH  

;--------------------------------
;Languages
 
  !insertmacro MUI_LANGUAGE "English"
  
;--------------------------------
;Language Strings

  ;Description
  LangString DESC_1 ${LANG_ENGLISH} "This package contains Coq and CoqIDE."
  LangString DESC_2 ${LANG_ENGLISH} "This package contains the development files (*.cmi, *.cmo, *.cmx, ...) needed in order to build a plugin for Coq."

;--------------------------------
; Check for white spaces
Function .onVerifyInstDir
  StrLen $0 "$INSTDIR"
  StrCpy $1 0
  ${While} $1 < $0
    StrCpy $3 $INSTDIR 1 $1
    StrCmp $3 " " SpacesInPath
    IntOp $1 $1 + 1
  ${EndWhile}
  Goto done
  SpacesInPath:
  Abort
  done:
FunctionEnd

;--------------------------------
;Installer Sections


Section "Coq" Sec1

  SetOutPath "$INSTDIR\"

  SetOutPath "$INSTDIR\bin"
  File ${COQ_SRC_PATH}\bin\*.exe
  ; make.exe and its dll
  File ${COQ_SRC_PATH}\bin\make.exe
  File ${COQ_SRC_PATH}\bin\libiconv2.dll
  File ${COQ_SRC_PATH}\bin\libintl3.dll

  SetOutPath "$INSTDIR\lib\theories"
  File /r ${COQ_SRC_PATH}\theories\*.vo
  SetOutPath "$INSTDIR\lib\plugins"
  File /r ${COQ_SRC_PATH}\plugins\*.vo
  File /r ${COQ_SRC_PATH}\plugins\*.cmxs
  SetOutPath "$INSTDIR\lib\tools\coqdoc"
  File ${COQ_SRC_PATH}\tools\coqdoc\coqdoc.sty
  File ${COQ_SRC_PATH}\tools\coqdoc\coqdoc.css
  SetOutPath "$INSTDIR\emacs"
  File ${COQ_SRC_PATH}\tools\*.el
  SetOutPath "$INSTDIR\man"
  File ${COQ_SRC_PATH}\man\*.1
  SetOutPath "$INSTDIR\lib\toploop"
  File ${COQ_SRC_PATH}\stm\stmworkertop.cmxs
  File ${COQ_SRC_PATH}\stm\tacworkertop.cmxs
  File ${COQ_SRC_PATH}\ide\coqidetop.cmxs

  ; CoqIDE
  SetOutPath "$INSTDIR\ide\"
  File ${COQ_SRC_PATH}\ide\*.png
  SetOutPath "$INSTDIR\share\gtksourceview-2.0\language-specs\"
  File ${COQ_SRC_PATH}\ide\*.lang
  File ${COQ_SRC_PATH}\ide\*.xml

  ; Start Menu Entries
  SetOutPath "$INSTDIR"
  CreateShortCut "$SMPROGRAMS\Coq\CoqIde.lnk" "$INSTDIR\bin\coqide.exe"

  ${registerExtension} "$INSTDIR\bin\coqide.exe" ".v" "Coq Script File"

  SetOutPath "$INSTDIR"
  File /r ${GTK_RUNTIME}\etc\gtk-2.0
  SetOutPath "$INSTDIR\bin"
  File ${GTK_RUNTIME}\bin\*.dll
  SetOutPath "$INSTDIR\lib"
  File /r ${GTK_RUNTIME}\lib\gtk-2.0 ${GTK_RUNTIME}\lib\glib-2.0
  SetOutPath "$INSTDIR\share"
  File /r ${GTK_RUNTIME}\share\themes
  File /r ${GTK_RUNTIME}\share\gtksourceview-2.0

  ;Store install folder
  WriteRegStr HKCU "Software\${MY_PRODUCT}" "" $INSTDIR
  
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"
  WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \
	  "DisplayName" "Coq Version ${VERSION}"
  WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \
	  "UninstallString" '"$INSTDIR\Uninstall.exe"'

  WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \
          "DisplayVersion" "${VERSION}"

  WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \
          "NoModify" "1"
  WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \
          "NoRepair" "1"

  WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \
          "URLInfoAbout" "http://coq.inria.fr"

; Start Menu Entries

; for the path in the .lnk
  SetOutPath "$INSTDIR" 

  CreateDirectory "$SMPROGRAMS\Coq"
  CreateShortCut "$SMPROGRAMS\Coq\Coq.lnk" "$INSTDIR\bin\coqtop.exe"
  WriteINIStr "$SMPROGRAMS\Coq\The Coq HomePage.url" "InternetShortcut" "URL" "http://coq.inria.fr"
  WriteINIStr "$SMPROGRAMS\Coq\The Coq Standard Library.url" "InternetShortcut" "URL" "http://coq.inria.fr/library"
  CreateShortCut "$SMPROGRAMS\Coq\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0

SectionEnd

Section "Coq files for plugin developers" Sec2

  SetOutPath "$INSTDIR\lib\"
  File /r ${COQ_SRC_PATH}\*.cmxa
  File /r ${COQ_SRC_PATH}\*.cmi
  File /r ${COQ_SRC_PATH}\*.cma
  File /r ${COQ_SRC_PATH}\*.cmo
  File /r ${COQ_SRC_PATH}\*.a
  File /r ${COQ_SRC_PATH}\*.o

SectionEnd

;--------------------------------
;Descriptions

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${Sec1} $(DESC_1)
  !insertmacro MUI_DESCRIPTION_TEXT ${Sec2} $(DESC_2)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
 
;--------------------------------
;Uninstaller Section

Section "Uninstall"

;; We keep the settings 
;; Delete "$INSTDIR\config\coqide-gtk2rc"
 
  RMDir /r "$INSTDIR\bin"
  RMDir /r "$INSTDIR\dev"
  RMDir /r "$INSTDIR\etc"
  RMDir /r "$INSTDIR\lib"
  RMDir /r "$INSTDIR\share"

  Delete "$INSTDIR\man\*.1"
  RMDir "$INSTDIR\man"

  Delete "$INSTDIR\emacs\*.el"
  RMDir "$INSTDIR\emacs"

;; Start Menu
  Delete "$SMPROGRAMS\Coq\Coq.lnk"
  Delete "$SMPROGRAMS\Coq\CoqIde.lnk"
  Delete "$SMPROGRAMS\Coq\Uninstall.lnk"
  Delete "$SMPROGRAMS\Coq\The Coq HomePage.url"
  Delete "$SMPROGRAMS\Coq\The Coq Standard Library.url"
  Delete "$INSTDIR\Uninstall.exe"
  
  DeleteRegKey /ifempty HKCU "Software\${MY_PRODUCT}"

  DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Coq"
  DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Coq"
  RMDir "$INSTDIR"
  RMDir "$SMPROGRAMS\Coq"

  ${unregisterExtension} ".v" "Coq Script File"

SectionEnd