forked from wkhtmltopdf/wkhtmltopdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wkhtmltox.nsi
137 lines (122 loc) · 4.35 KB
/
wkhtmltox.nsi
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
!include "MUI2.nsh"
!include "x64.nsh"
Name "wkhtmltox ${VERSION}"
OutFile "static-build\wkhtmltox-${VERSION}_${TARGET}.exe"
!if "${ARCH}" == "win64"
InstallDir "$PROGRAMFILES64\wkhtmltopdf"
!else
InstallDir "$PROGRAMFILES\wkhtmltopdf"
!endif
VIProductVersion "${SIMPLE_VERSION}"
VIAddVersionKey "ProductName" "wkhtmltox"
VIAddVersionKey "FileDescription" "wkhtmltox ${VERSION}"
VIAddVersionKey "LegalCopyright" "wkhtmltopdf authors"
VIAddVersionKey "FileVersion" "${VERSION}"
CRCCheck force
SetCompressor /SOLID lzma
SetCompressorDictSize 64
RequestExecutionLevel admin
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
!macro DeleteFiles un
Function ${un}DeleteFiles
; remove as per old installer layout
Delete "$INSTDIR\libgcc_s_dw2-1.dll"
Delete "$INSTDIR\mingwm10.dll"
Delete "$INSTDIR\ssleay32.dll"
Delete "$INSTDIR\libeay32.dll"
Delete "$INSTDIR\wkhtmltopdf.exe"
Delete "$INSTDIR\wkhtmltoimage.exe"
Delete "$INSTDIR\bin\libgcc_s_sjlj-1.dll"
Delete "$INSTDIR\bin\libgcc_s_seh-1.dll"
Delete "$INSTDIR\bin\libstdc++-6.dll"
Delete "$INSTDIR\bin\libwinpthread-1.dll"
; remove as per current installer layout
Delete "$INSTDIR\bin\wkhtmltoimage.exe"
Delete "$INSTDIR\bin\wkhtmltopdf.exe"
Delete "$INSTDIR\bin\wkhtmltox.dll"
Delete "$INSTDIR\lib\wkhtmltox.lib"
Delete "$INSTDIR\include\wkhtmltox\dllbegin.inc"
Delete "$INSTDIR\include\wkhtmltox\dllend.inc"
Delete "$INSTDIR\include\wkhtmltox\pdf.h"
Delete "$INSTDIR\include\wkhtmltox\image.h"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR\include\wkhtmltox"
RMDir "$INSTDIR\include"
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR"
FunctionEnd
!macroend
!macro CheckVCRedist
!ifdef MSVC
InitPluginsDir
ClearErrors
ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\DevDiv\vc\Servicing\${MSVC}\RuntimeMinimum" "Install"
IfErrors need_vcruntime
IntCmp $R0 1 skip_vcruntime need_vcruntime need_vcruntime
need_vcruntime:
File /oname=$PLUGINSDIR\vcredist.exe static-build\${TARGET}\vcredist.exe
skip_vcruntime:
!endif
!macroend
!insertmacro DeleteFiles ""
!insertmacro DeleteFiles "un."
Section "Install"
!ifdef MSVC
IfFileExists "$PLUGINSDIR\vcredist.exe" 0 skip_vcruntime
ExecWait '"$PLUGINSDIR\vcredist.exe" /install /quiet /norestart' $R9
skip_vcruntime:
!endif
Call DeleteFiles
SetOutPath "$INSTDIR"
SetOutPath "$INSTDIR\bin"
File static-build\${TARGET}\app\bin\wkhtmltoimage.exe
File static-build\${TARGET}\app\bin\wkhtmltopdf.exe
File static-build\${TARGET}\app\bin\wkhtmltox.dll
SetOutPath "$INSTDIR\lib"
File static-build\${TARGET}\app\bin\wkhtmltox.lib
SetOutPath "$INSTDIR\include\wkhtmltox"
File include\wkhtmltox\dllbegin.inc
File include\wkhtmltox\dllend.inc
File include\wkhtmltox\pdf.h
File include\wkhtmltox\image.h
WriteRegStr HKLM "Software\wkhtmltopdf" "InstallPath" "$INSTDIR"
WriteRegStr HKLM "Software\wkhtmltopdf" "Version" "${VERSION}"
WriteRegStr HKLM "Software\wkhtmltopdf" "DllPath" "$INSTDIR\bin\wkhtmltox.dll"
WriteRegStr HKLM "Software\wkhtmltopdf" "PdfPath" "$INSTDIR\bin\wkhtmltopdf.exe"
WriteRegStr HKLM "Software\wkhtmltopdf" "ImagePath" "$INSTDIR\bin\wkhtmltoimage.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
"DisplayName" "wkhtmltox ${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section "Uninstall"
${If} ${RunningX64}
SetRegView 64
${EndIf}
Call un.DeleteFiles
DeleteRegKey HKLM "Software\wkhtmltopdf"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf"
SectionEnd
Function .onInit
!if "${ARCH}" == "win32"
!insertmacro CheckVCRedist
${If} ${RunningX64}
SetRegView 64
${EndIf}
!endif
!if "${ARCH}" == "win64"
${If} ${RunningX64}
SetRegView 64
!insertmacro CheckVCRedist
${Else}
Abort "Cannot install 64-bit binaries on a 32-bit OS"
${EndIf}
!endif
FunctionEnd