wkhtmltox.nsi 4.8 KB

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