source: wkhtmltox/trunk/fuentes/wkhtmltox.nsi @ 51

Last change on this file since 51 was 51, checked in by mabarracus, 4 years ago

wip

File size: 4.4 KB
Line 
1!include "MUI2.nsh"
2!include "x64.nsh"
3
4Name             "wkhtmltox ${VERSION}"
5OutFile          "static-build\wkhtmltox-${VERSION}_${TARGET}.exe"
6!if "${ARCH}" == "win64"
7InstallDir       "$PROGRAMFILES64\wkhtmltopdf"
8!else
9InstallDir       "$PROGRAMFILES\wkhtmltopdf"
10!endif
11VIProductVersion "${SIMPLE_VERSION}"
12VIAddVersionKey  "ProductName"     "wkhtmltox"
13VIAddVersionKey  "FileDescription" "wkhtmltox ${VERSION}"
14VIAddVersionKey  "LegalCopyright"  "wkhtmltopdf authors"
15VIAddVersionKey  "FileVersion"     "${VERSION}"
16
17CRCCheck             force
18SetCompressor /SOLID lzma
19SetCompressorDictSize 64
20RequestExecutionLevel admin
21
22!insertmacro MUI_PAGE_LICENSE "LICENSE"
23!insertmacro MUI_PAGE_DIRECTORY
24!insertmacro MUI_PAGE_INSTFILES
25!insertmacro MUI_UNPAGE_CONFIRM
26!insertmacro MUI_UNPAGE_INSTFILES
27
28!insertmacro MUI_LANGUAGE "English"
29
30!macro DeleteFiles un
31Function ${un}DeleteFiles
32; remove as per old installer layout
33  Delete "$INSTDIR\libgcc_s_dw2-1.dll"
34  Delete "$INSTDIR\mingwm10.dll"
35  Delete "$INSTDIR\ssleay32.dll"
36  Delete "$INSTDIR\libeay32.dll"
37  Delete "$INSTDIR\wkhtmltopdf.exe"
38  Delete "$INSTDIR\wkhtmltoimage.exe"
39; remove as per current installer layout
40  Delete "$INSTDIR\bin\libgcc_s_sjlj-1.dll"
41  Delete "$INSTDIR\bin\libgcc_s_seh-1.dll"
42  Delete "$INSTDIR\bin\libstdc++-6.dll"
43  Delete "$INSTDIR\bin\libwinpthread-1.dll"
44  Delete "$INSTDIR\bin\wkhtmltoimage.exe"
45  Delete "$INSTDIR\bin\wkhtmltopdf.exe"
46  Delete "$INSTDIR\bin\wkhtmltox.dll"
47  Delete "$INSTDIR\lib\wkhtmltox.lib"
48  Delete "$INSTDIR\include\wkhtmltox\dllbegin.inc"
49  Delete "$INSTDIR\include\wkhtmltox\dllend.inc"
50  Delete "$INSTDIR\include\wkhtmltox\pdf.h"
51  Delete "$INSTDIR\include\wkhtmltox\image.h"
52  Delete "$INSTDIR\uninstall.exe"
53  RMDir  "$INSTDIR\bin"
54  RMDir  "$INSTDIR\include\wkhtmltox"
55  RMDir  "$INSTDIR\include"
56  RMDir  "$INSTDIR\lib"
57  RMDir  "$INSTDIR"
58FunctionEnd
59!macroend
60
61!macro CheckVCRedist
62!ifdef MSVC
63  InitPluginsDir
64  ClearErrors
65  ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" "Install"
66  IfErrors need_vcruntime
67  IntCmp $R0 1 skip_vcruntime need_vcruntime need_vcruntime
68need_vcruntime:
69    File /oname=$PLUGINSDIR\vcredist.exe static-build\${TARGET}\vcredist.exe
70skip_vcruntime:
71!endif
72!macroend
73
74!insertmacro DeleteFiles ""
75!insertmacro DeleteFiles "un."
76
77Section "Install"
78!ifdef MSVC
79  IfFileExists "$PLUGINSDIR\vcredist.exe" 0 skip_vcruntime
80  ExecWait '"$PLUGINSDIR\vcredist.exe" /install /quiet /norestart' $R9
81skip_vcruntime:
82!endif
83  Call DeleteFiles
84
85  SetOutPath "$INSTDIR"
86  SetOutPath "$INSTDIR\bin"
87  File static-build\${TARGET}\app\bin\wkhtmltoimage.exe
88  File static-build\${TARGET}\app\bin\wkhtmltopdf.exe
89  File static-build\${TARGET}\app\bin\wkhtmltox.dll
90!ifdef MINGW
91  File static-build\${TARGET}\app\bin\lib*.dll
92!endif
93
94  SetOutPath "$INSTDIR\lib"
95  File static-build\${TARGET}\app\bin\wkhtmltox.lib
96
97  SetOutPath "$INSTDIR\include\wkhtmltox"
98  File include\wkhtmltox\dllbegin.inc
99  File include\wkhtmltox\dllend.inc
100  File include\wkhtmltox\pdf.h
101  File include\wkhtmltox\image.h
102
103  WriteRegStr HKLM "Software\wkhtmltopdf" "InstallPath" "$INSTDIR"
104  WriteRegStr HKLM "Software\wkhtmltopdf" "Version"     "${VERSION}"
105  WriteRegStr HKLM "Software\wkhtmltopdf" "DllPath"     "$INSTDIR\bin\wkhtmltox.dll"
106  WriteRegStr HKLM "Software\wkhtmltopdf" "PdfPath"     "$INSTDIR\bin\wkhtmltopdf.exe"
107  WriteRegStr HKLM "Software\wkhtmltopdf" "ImagePath"   "$INSTDIR\bin\wkhtmltoimage.exe"
108  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
109                   "DisplayName" "wkhtmltox ${VERSION}"
110  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
111                   "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
112
113  WriteUninstaller "$INSTDIR\uninstall.exe"
114SectionEnd
115
116Section "Uninstall"
117  ${If} ${RunningX64}
118    SetRegView 64
119  ${EndIf}
120  Call un.DeleteFiles
121  DeleteRegKey HKLM "Software\wkhtmltopdf"
122  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf"
123SectionEnd
124
125Function .onInit
126!if "${ARCH}" == "win32"
127    !insertmacro CheckVCRedist
128  ${If} ${RunningX64}
129    SetRegView 64
130  ${EndIf}
131!endif
132!if "${ARCH}" == "win64"
133  ${If} ${RunningX64}
134    SetRegView 64
135    !insertmacro CheckVCRedist
136  ${Else}
137    Abort "Cannot install 64-bit binaries on a 32-bit OS"
138  ${EndIf}
139!endif
140FunctionEnd
Note: See TracBrowser for help on using the repository browser.