!define APP_NAME "evince"
!define APP_VERSION "2.27.3"
!define APP_PUBLISHER "Windows port by Hib Eris"
!define APP_LINK "http://bugzilla.gnome.org/show_bug.cgi?id=339172"

!define UN_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
!define UN_EXE "uninstall.exe"

Name "${APP_NAME} v${APP_VERSION}"
OutFile "..\${APP_NAME} v${APP_VERSION}.exe"
InstallDir "$PROGRAMFILES\${APP_NAME}"
ShowInstDetails show
ShowUnInstDetails show
XPStyle on
SetOverwrite on
SetCompressor /SOLID lzma
SetCompressorDictSize 64

#Icon evince.ico
#UninstallIcon uninstall.ico

Section "Main" S01
   # Copy program files
   SetOutPath "$INSTDIR"
   File *.exe
   File *.dll
   File /r etc
   File /r lib
   File /r share
   WriteUninstaller "$INSTDIR\${UN_EXE}"
SectionEnd

Section "Main2" S02
   # Insert uninstall reg keys
   WriteRegStr HKLM '${UN_KEY}' "DisplayName" "$(^Name)"
   WriteRegStr HKLM '${UN_KEY}' "UninstallString" "$INSTDIR\${UN_EXE}"
   WriteRegStr HKLM '${UN_KEY}' "DisplayVersion" "v${APP_VERSION}"
   WriteRegStr HKLM '${UN_KEY}' "Publisher" "${APP_PUBLISHER}"
   WriteRegStr HKLM '${UN_KEY}' "URLInfoAbout" "${APP_LINK}"
SectionEnd

Section "Main3" S03
   # Shortcuts
   CreateDirectory "$SMPROGRAMS\${APP_NAME}"
   CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\${UN_EXE}"
   CreateShortCut "$SMPROGRAMS\${APP_NAME}\${APP_NAME}.lnk" "$INSTDIR\${APP_NAME}.exe"
SectionEnd

# Custom uninstaller
Section Uninstall
   DeleteRegKey HKLM '${UN_KEY}'
   RMDir /r "$SMPROGRAMS\${APP_NAME}"
   RMDir /r "$INSTDIR"
SectionEnd
