wkhtmltox.nsi 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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}.0"
  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 "COPYING"
  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\wkhtmltoimage.exe"
  39. Delete "$INSTDIR\bin\wkhtmltopdf.exe"
  40. Delete "$INSTDIR\bin\wkhtmltox.dll"
  41. Delete "$INSTDIR\lib\wkhtmltox.lib"
  42. Delete "$INSTDIR\include\wkhtmltox\dllbegin.inc"
  43. Delete "$INSTDIR\include\wkhtmltox\dllend.inc"
  44. Delete "$INSTDIR\include\wkhtmltox\pdf.h"
  45. Delete "$INSTDIR\include\wkhtmltox\image.h"
  46. Delete "$INSTDIR\uninstall.exe"
  47. RMDir "$INSTDIR\bin"
  48. RMDir "$INSTDIR\include\wkhtmltox"
  49. RMDir "$INSTDIR\include"
  50. RMDir "$INSTDIR\lib"
  51. RMDir "$INSTDIR"
  52. FunctionEnd
  53. !macroend
  54. !insertmacro DeleteFiles ""
  55. !insertmacro DeleteFiles "un."
  56. Section "Install"
  57. Call DeleteFiles
  58. SetOutPath "$INSTDIR"
  59. SetOutPath "$INSTDIR\bin"
  60. File static-build\${TARGET}\app\bin\wkhtmltoimage.exe
  61. File static-build\${TARGET}\app\bin\wkhtmltopdf.exe
  62. File static-build\${TARGET}\app\bin\wkhtmltox.dll
  63. !ifdef MINGW
  64. File static-build\${TARGET}\app\bin\lib*.dll
  65. !endif
  66. SetOutPath "$INSTDIR\lib"
  67. File static-build\${TARGET}\app\bin\wkhtmltox.lib
  68. SetOutPath "$INSTDIR\include\wkhtmltox"
  69. File include\wkhtmltox\dllbegin.inc
  70. File include\wkhtmltox\dllend.inc
  71. File include\wkhtmltox\pdf.h
  72. File include\wkhtmltox\image.h
  73. WriteRegStr HKLM "Software\wkhtmltopdf" "InstallPath" "$INSTDIR"
  74. WriteRegStr HKLM "Software\wkhtmltopdf" "Version" "${VERSION}"
  75. WriteRegStr HKLM "Software\wkhtmltopdf" "DllPath" "$INSTDIR\bin\wkhtmltox.dll"
  76. WriteRegStr HKLM "Software\wkhtmltopdf" "PdfPath" "$INSTDIR\bin\wkhtmltopdf.exe"
  77. WriteRegStr HKLM "Software\wkhtmltopdf" "ImagePath" "$INSTDIR\bin\wkhtmltoimage.exe"
  78. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
  79. "DisplayName" "wkhtmltox ${VERSION}"
  80. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \
  81. "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
  82. WriteUninstaller "$INSTDIR\uninstall.exe"
  83. SectionEnd
  84. Section "Uninstall"
  85. Call un.DeleteFiles
  86. DeleteRegKey HKLM "Software\wkhtmltopdf"
  87. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf"
  88. SectionEnd
  89. Function .onInit
  90. ${If} ${RunningX64}
  91. SetRegView 64
  92. !if "${ARCH}" == "win64"
  93. ${Else}
  94. Abort "Cannot install 64-bit binaries on a 32-bit OS"
  95. !endif
  96. ${EndIf}
  97. FunctionEnd