wkhtmltox.nsi 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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\wkhtmltoimage.exe"
  40. Delete "$INSTDIR\bin\wkhtmltopdf.exe"
  41. Delete "$INSTDIR\bin\wkhtmltox.dll"
  42. Delete "$INSTDIR\lib\wkhtmltox.lib"
  43. Delete "$INSTDIR\include\wkhtmltox\dllbegin.inc"
  44. Delete "$INSTDIR\include\wkhtmltox\dllend.inc"
  45. Delete "$INSTDIR\include\wkhtmltox\pdf.h"
  46. Delete "$INSTDIR\include\wkhtmltox\image.h"
  47. Delete "$INSTDIR\uninstall.exe"
  48. RMDir "$INSTDIR\bin"
  49. RMDir "$INSTDIR\include\wkhtmltox"
  50. RMDir "$INSTDIR\include"
  51. RMDir "$INSTDIR\lib"
  52. RMDir "$INSTDIR"
  53. FunctionEnd
  54. !macroend
  55. !macro CheckVCRedist
  56. !ifdef MSVC
  57. InitPluginsDir
  58. ClearErrors
  59. ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\DevDiv\vc\Servicing\12.0\RuntimeMinimum" "Install"
  60. IfErrors need_vcruntime
  61. IntCmp $R0 1 skip_vcruntime need_vcruntime need_vcruntime
  62. need_vcruntime:
  63. File /oname=$PLUGINSDIR\vcredist.exe static-build\${TARGET}\vcredist.exe
  64. skip_vcruntime:
  65. !endif
  66. !macroend
  67. !insertmacro DeleteFiles ""
  68. !insertmacro DeleteFiles "un."
  69. Section "Install"
  70. !ifdef MSVC
  71. IfFileExists "$PLUGINSDIR\vcredist.exe" 0 skip_vcruntime
  72. ExecWait '"$PLUGINSDIR\vcredist.exe" /install /quiet /norestart' $R9
  73. skip_vcruntime:
  74. !endif
  75. Call DeleteFiles
  76. SetOutPath "$INSTDIR"
  77. SetOutPath "$INSTDIR\bin"
  78. File static-build\${TARGET}\app\bin\wkhtmltoimage.exe
  79. File static-build\${TARGET}\app\bin\wkhtmltopdf.exe
  80. File static-build\${TARGET}\app\bin\wkhtmltox.dll
  81. !ifdef MINGW
  82. File static-build\${TARGET}\app\bin\lib*.dll
  83. !endif
  84. SetOutPath "$INSTDIR\lib"
  85. File static-build\${TARGET}\app\bin\wkhtmltox.lib
  86. SetOutPath "$INSTDIR\include\wkhtmltox"
  87. File include\wkhtmltox\dllbegin.inc
  88. File include\wkhtmltox\dllend.inc
  89. File include\wkhtmltox\pdf.h
  90. File include\wkhtmltox\image.h
  91. WriteRegStr HKLM "Software\wkhtmltopdf" "InstallPath" "$INSTDIR"
  92. WriteRegStr HKLM "Software\wkhtmltopdf" "Version" "${VERSION}"
  93. WriteRegStr HKLM "Software\wkhtmltopdf" "DllPath" "$INSTDIR\bin\wkhtmltox.dll"
  94. WriteRegStr HKLM "Software\wkhtmltopdf" "PdfPath" "$INSTDIR\bin\wkhtmltopdf.exe"
  95. WriteRegStr HKLM "Software\wkhtmltopdf" "ImagePath" "$INSTDIR\bin\wkhtmltoimage.exe"
  96. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
  97. "DisplayName" "wkhtmltox ${VERSION}"
  98. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
  99. "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
  100. WriteUninstaller "$INSTDIR\uninstall.exe"
  101. SectionEnd
  102. Section "Uninstall"
  103. ${If} ${RunningX64}
  104. SetRegView 64
  105. ${EndIf}
  106. Call un.DeleteFiles
  107. DeleteRegKey HKLM "Software\wkhtmltopdf"
  108. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf"
  109. SectionEnd
  110. Function .onInit
  111. !if "${ARCH}" == "win32"
  112. !insertmacro CheckVCRedist
  113. ${If} ${RunningX64}
  114. SetRegView 64
  115. ${EndIf}
  116. !endif
  117. !if "${ARCH}" == "win64"
  118. ${If} ${RunningX64}
  119. SetRegView 64
  120. !insertmacro CheckVCRedist
  121. ${Else}
  122. Abort "Cannot install 64-bit binaries on a 32-bit OS"
  123. ${EndIf}
  124. !endif
  125. FunctionEnd