Removed use of fgets() to read files and gerb_file approved file operations.
[geda-gerbv/spe.git] / win32 / gerbv.nsi.in
blob29e2048011c0ba521da99376954b89581af54057
1 ;; $Id$
2 ;;
3 ;; Installer script file for gerbv for windows. See http://nsis.sourceforge.net
4 ;; for details on NSIS.
5 ;;
7 ; Started with:
9 ;NSIS Modern User Interface
10 ;Start Menu Folder Selection Example Script
11 ;Written by Joost Verburg
13 ; and modified for wcalc by Dan McMahill
15 ; Later copied for use by pcb by Dan McMahill
16 ; Finally copied for use by gerbv by Dan McMahill
18 ;--------------------------------
19 ;Include Modern UI
21 !include "MUI.nsh"
23 ;--------------------------------
24 ;Include macros for associating file
25 ;extensions
26 !include "registerExtension.nsh"
28 ;--------------------------------
29 ;General
31 ;Name and file
32 Name "gerbv-@prog_version@"
33 OutFile "gerbvinst-@prog_version@.exe"
35 ;See http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
36 ;for more details.
37 RequestExecutionLevel admin
39 ;Default installation folder
40 InstallDir "$PROGRAMFILES\gerbv-@prog_version@"
42 ;Get installation folder from registry if available
43 InstallDirRegKey HKCU "Software\gerbv-@prog_version@" ""
45 ;--------------------------------
46 ;Variables
48 Var MUI_TEMP
49 Var STARTMENU_FOLDER
51 ;--------------------------------
52 ;Interface Settings
54 !define MUI_ABORTWARNING
56 ;--------------------------------
57 ;Pages
59 !insertmacro MUI_PAGE_LICENSE "@prog_srcdir@\COPYING"
60 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-gpl2"
61 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-gpl3"
62 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-lgpl2"
63 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-lgpl2-1"
64 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-expat"
65 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-fontconfig"
66 ; !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-jpeg"
67 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-png"
68 ; !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-tiff"
69 ; !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-xpm"
70 !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-zlib"
71 ; !insertmacro MUI_PAGE_COMPONENTS
72 !insertmacro MUI_PAGE_DIRECTORY
74 ;Start Menu Folder Page Configuration
75 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
76 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\gerbv-@prog_version@"
77 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
79 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
81 !insertmacro MUI_PAGE_INSTFILES
83 !insertmacro MUI_UNPAGE_CONFIRM
84 !insertmacro MUI_UNPAGE_INSTFILES
86 ;--------------------------------
87 ;Languages
89 !insertmacro MUI_LANGUAGE "English"
91 ;--------------------------------
92 ;Installer Sections
94 Section "Dummy Section" SecDummy
95 SetShellVarContext all
97 SetOutPath "$INSTDIR"
99 ;ADD YOUR OWN FILES HERE...
100 File /a /r "@gtk_win32_runtime@\*.*"
101 File /a /r "@prog_prefix@\*.*"
103 ;Associate file types and icons
104 ${registerExtension} "$INSTDIR\bin\gerbv.exe" "" ".gbr" "RS274-X File"
105 ${registerExtension} "$INSTDIR\bin\gerbv.exe" "" ".gbx" "RS274-X File"
106 ${registerExtension} "$INSTDIR\bin\gerbv.exe" "" ".cnc" "Excellon Drill File"
107 ${registerExtension} "$INSTDIR\bin\gerbv.exe" "" ".ncd" "Excellon Drill File"
108 ${registerExtension} "$INSTDIR\bin\gerbv.exe" "" ".xy" "PCB Centroid File"
109 ${registerExtension} "$INSTDIR\bin\gerbv.exe" "-p" ".gvp" "Gerbv Project File"
111 ;Store installation folder
112 WriteRegStr HKCU "Software\gerbv-@prog_version@" "" $INSTDIR
114 ;Create uninstaller
115 WriteUninstaller "$INSTDIR\Uninstall.exe"
117 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
119 ;Create shortcuts
120 CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
121 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
122 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\BUGS.lnk" "$INSTDIR\share\gerbv\BUGS.txt"
123 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\COPYING.lnk" "$INSTDIR\share\gerbv\COPYING.txt"
124 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Readme.lnk" "$INSTDIR\share\gerbv\Readme.txt"
125 SetShellVarContext current
126 SetOutPath "$DOCUMENTS"
127 SetShellVarContext all
128 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\gerbv.lnk" "$INSTDIR\bin\gerbv.exe" "" "$INSTDIR\bin\gerbv.exe" 0 "" "" "gerbv RS274-X file viewer"
129 SetOutPath "$INSTDIR"
131 ;; CreateShortCut link.lnk target.file [parameters [icon.file [icon_index_number [start_options [keyboard_shortcut [description]]]]]]
133 !insertmacro MUI_STARTMENU_WRITE_END
135 SectionEnd
137 ;--------------------------------
138 ;Descriptions
140 ;Language strings
141 ; LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
143 ;Assign language strings to sections
144 ; !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
145 ; !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
146 ; !insertmacro MUI_FUNCTION_DESCRIPTION_END
148 ;--------------------------------
149 ;Uninstaller Section
151 Section "Uninstall"
152 SetShellVarContext all
154 ;ADD YOUR OWN FILES HERE...
156 ${unregisterExtension} ".gbr" "RS274-X File"
157 ${unregisterExtension} ".gbx" "RS274-X File"
158 ${unregisterExtension} ".cnc" "Excellon Drill File"
159 ${unregisterExtension} ".ncd" "Excellon Drill File"
160 ${unregisterExtension} ".xy" "PCB Centroid File"
161 ${unregisterExtension} ".gvp" "Gerbv Project File"
163 Delete "$INSTDIR\Uninstall.exe"
164 Delete "$INSTDIR\*.*"
166 RMDir /r "$INSTDIR\*.*"
167 RMDir "$INSTDIR"
169 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
171 Delete "$SMPROGRAMS\$MUI_TEMP\BUGS.lnk"
172 Delete "$SMPROGRAMS\$MUI_TEMP\COPYING.lnk"
173 Delete "$SMPROGRAMS\$MUI_TEMP\gerbv.lnk"
174 Delete "$SMPROGRAMS\$MUI_TEMP\Readme.lnk"
175 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
177 ;Delete empty start menu parent diretories
178 StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
180 startMenuDeleteLoop:
181 ClearErrors
182 RMDir $MUI_TEMP
183 GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
185 IfErrors startMenuDeleteLoopDone
187 StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
188 startMenuDeleteLoopDone:
190 DeleteRegKey /ifempty HKCU "Software\gerbv-@prog_version@"
192 SectionEnd