[easytag/wip/mingw: 8/10] Generate NSIS installer script



commit 5c8129cd0b4c02317b753454ea2014bee520e001
Author: David King <amigadave amigadave com>
Date:   Tue Jan 15 23:22:34 2013 +0000

    Generate NSIS installer script
    
    Still a work in progress, as the DLL paths are hardcoded.

 Makefile.am                                    |   19 +-
 configure.ac                                   |    1 +
 {src/win32 => data}/nsis/easytag-header.bmp    |  Bin 25818 -> 25818 bytes
 {src/win32 => data}/nsis/easytag-install.bmp   |  Bin 154542 -> 154542 bytes
 {src/win32 => data}/nsis/easytag-install.ico   |  Bin 16958 -> 16958 bytes
 {src/win32 => data}/nsis/easytag-uninstall.bmp |  Bin 154542 -> 154542 bytes
 easytag-win32-installer.nsi                    |  351 --------------------
 easytag-win32-installer.nsi.in                 |  405 ++++++++++++++++++++++++
 8 files changed, 420 insertions(+), 356 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index bcf65a6..ce65695 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -116,6 +116,14 @@ easytag_LDADD = \
 	$(EASYTAG_LIBS) \
 	$(ID3LIB_LIBS)
 
+# NSIS installer script.
+# TODO: Run script from dist dir.
+easytag-win32-installer.nsi: easytag-win32-installer.nsi.in Makefile
+	$(AM_V_GEN)$(SED) -e "s|\ PACKAGE_NAME\@|$(PACKAGE_NAME)|" \
+		-e "s|\ PACKAGE_TARNAME\@|$(PACKAGE_TARNAME)|" \
+		-e "s|\ PACKAGE_URL\@|$(PACKAGE_URL)|" \
+		-e "s|\ PACKAGE_VERSION\@|$(PACKAGE_VERSION)|" $< > $@
+
 @INTLTOOL_DESKTOP_RULE@
 desktopdir = $(datadir)/applications
 desktop_in_files = easytag.desktop.in
@@ -204,10 +212,10 @@ dist_noinst_DATA = \
 	src/win32/win32dep.c \
 	src/win32/win32dep.h \
 	src/win32/win_easytag.c \
-	src/win32/nsis/easytag-header.bmp \
-	src/win32/nsis/easytag-install.bmp \
-	src/win32/nsis/easytag-install.ico \
-	src/win32/nsis/easytag-uninstall.bmp \
+	data/nsis/easytag-header.bmp \
+	data/nsis/easytag-install.bmp \
+	data/nsis/easytag-install.ico \
+	data/nsis/easytag-uninstall.bmp \
 	$(pixmaps) \
 	\
 	easytag.spec \
@@ -296,7 +304,8 @@ dist_noinst_SCRIPTS = \
 	autogen.sh
 
 CLEANFILES = \
-	$(desktop_DATA)
+	$(desktop_DATA) \
+	easytag-win32-installer.nsi
 
 DISTCLEANFILES = \
 	$(man_MANS) \
diff --git a/configure.ac b/configure.ac
index 571e90e..3b5bceb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
 AC_PROG_CXXCPP
+AC_PROG_SED
 PKG_PROG_PKG_CONFIG([0.24])
 
 dnl -------------------------------
diff --git a/src/win32/nsis/easytag-header.bmp b/data/nsis/easytag-header.bmp
similarity index 100%
rename from src/win32/nsis/easytag-header.bmp
rename to data/nsis/easytag-header.bmp
diff --git a/src/win32/nsis/easytag-install.bmp b/data/nsis/easytag-install.bmp
similarity index 100%
rename from src/win32/nsis/easytag-install.bmp
rename to data/nsis/easytag-install.bmp
diff --git a/src/win32/nsis/easytag-install.ico b/data/nsis/easytag-install.ico
similarity index 100%
rename from src/win32/nsis/easytag-install.ico
rename to data/nsis/easytag-install.ico
diff --git a/src/win32/nsis/easytag-uninstall.bmp b/data/nsis/easytag-uninstall.bmp
similarity index 100%
rename from src/win32/nsis/easytag-uninstall.bmp
rename to data/nsis/easytag-uninstall.bmp
diff --git a/easytag-win32-installer.nsi.in b/easytag-win32-installer.nsi.in
new file mode 100644
index 0000000..36fb41c
--- /dev/null
+++ b/easytag-win32-installer.nsi.in
@@ -0,0 +1,405 @@
+; NSIS script for EasyTAG mingw
+;
+; TODO: Test on a real Windows system.
+; TODO: Write better introductory text (do not _need_ to agree to the GPL, not
+;       necessary to quit other applications before installing.
+; TODO: Calculate installed size of files for Add/Remove Programs.
+
+!define PRODUCT_NAME @PACKAGE_NAME@
+!define PRODUCT_EXE_NAME @PACKAGE_TARNAME  exe
+!define PRODUCT_VERSION @PACKAGE_VERSION@
+!define PRODUCT_PUBLISHER "EasyTAG project"
+!define PRODUCT_WEB_SITE @PACKAGE_URL@
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_EXE_NAME}"
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"
+!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
+
+SetCompressor /SOLID lzma
+ShowInstDetails show
+ShowUninstDetails show
+
+; Modern UI
+!include "MUI.nsh"
+!include "Sections.nsh"
+
+; MUI Settings
+!define MUI_ABORTWARNING
+!define MUI_COMPONENTSPAGE_SMALLDESC
+!define MUI_ICON "data/nsis/easytag-install.ico"
+;!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" ;".\pixmaps\EasyTAG.ico"
+
+; Modern UI Configuration
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
+!define MUI_HEADERIMAGE_BITMAP "data/nsis/easytag-header.bmp"
+!define MUI_WELCOMEFINISHPAGE_BITMAP "data/nsis/easytag-install.bmp"
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP "data/nsis/easytag-uninstall.bmp"
+
+; Language Selection Dialog Settings
+!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
+!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
+!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"
+
+; Version resource
+VIProductVersion "0.0.0.0"
+VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
+VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
+VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
+VIAddVersionKey "LegalCopyright" ""
+VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer"
+
+; Welcome page
+!insertmacro MUI_PAGE_WELCOME
+
+; License page
+!insertmacro MUI_PAGE_LICENSE "./COPYING"
+
+; Components page
+!insertmacro MUI_PAGE_COMPONENTS
+
+; Directory page
+!insertmacro MUI_PAGE_DIRECTORY
+
+; Start menu page
+var ICONS_GROUP
+!define MUI_STARTMENUPAGE_NODISABLE
+!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${PRODUCT_NAME}"
+!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
+!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
+!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
+!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
+
+; Instfiles page
+!insertmacro MUI_PAGE_INSTFILES
+
+; Finish page
+!define MUI_FINISHPAGE_RUN "$INSTDIR\${PRODUCT_EXE_NAME}"
+!define MUI_FINISHPAGE_RUN_NOTCHECKED
+!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
+!define MUI_FINISHPAGE_LINK "${PRODUCT_NAME} Web site"
+!define MUI_FINISHPAGE_LINK_LOCATION ${PRODUCT_WEB_SITE}
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_WELCOME
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
+
+; Language files
+!insertmacro MUI_LANGUAGE "Afrikaans"
+!insertmacro MUI_LANGUAGE "Albanian"
+!insertmacro MUI_LANGUAGE "Arabic"
+!insertmacro MUI_LANGUAGE "Basque"
+!insertmacro MUI_LANGUAGE "Belarusian"
+!insertmacro MUI_LANGUAGE "Bosnian"
+!insertmacro MUI_LANGUAGE "Breton"
+!insertmacro MUI_LANGUAGE "Bulgarian"
+!insertmacro MUI_LANGUAGE "Catalan"
+!insertmacro MUI_LANGUAGE "Croatian"
+!insertmacro MUI_LANGUAGE "Czech"
+!insertmacro MUI_LANGUAGE "Danish"
+!insertmacro MUI_LANGUAGE "Dutch"
+!insertmacro MUI_LANGUAGE "English"
+!insertmacro MUI_LANGUAGE "Estonian"
+!insertmacro MUI_LANGUAGE "Farsi"
+!insertmacro MUI_LANGUAGE "Finnish"
+!insertmacro MUI_LANGUAGE "French"
+!insertmacro MUI_LANGUAGE "Galician"
+!insertmacro MUI_LANGUAGE "German"
+!insertmacro MUI_LANGUAGE "Greek"
+!insertmacro MUI_LANGUAGE "Hebrew"
+!insertmacro MUI_LANGUAGE "Hungarian"
+!insertmacro MUI_LANGUAGE "Icelandic"
+!insertmacro MUI_LANGUAGE "Indonesian"
+!insertmacro MUI_LANGUAGE "Irish"
+!insertmacro MUI_LANGUAGE "Italian"
+!insertmacro MUI_LANGUAGE "Japanese"
+!insertmacro MUI_LANGUAGE "Korean"
+!insertmacro MUI_LANGUAGE "Kurdish"
+!insertmacro MUI_LANGUAGE "Latvian"
+!insertmacro MUI_LANGUAGE "Lithuanian"
+!insertmacro MUI_LANGUAGE "Luxembourgish"
+!insertmacro MUI_LANGUAGE "Macedonian"
+!insertmacro MUI_LANGUAGE "Malay"
+!insertmacro MUI_LANGUAGE "Mongolian"
+!insertmacro MUI_LANGUAGE "Norwegian"
+!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
+!insertmacro MUI_LANGUAGE "Polish"
+!insertmacro MUI_LANGUAGE "Portuguese"
+!insertmacro MUI_LANGUAGE "PortugueseBR"
+!insertmacro MUI_LANGUAGE "Romanian"
+!insertmacro MUI_LANGUAGE "Russian"
+!insertmacro MUI_LANGUAGE "Serbian"
+!insertmacro MUI_LANGUAGE "SerbianLatin"
+!insertmacro MUI_LANGUAGE "SimpChinese"
+!insertmacro MUI_LANGUAGE "Slovak"
+!insertmacro MUI_LANGUAGE "Slovenian"
+!insertmacro MUI_LANGUAGE "Spanish"
+!insertmacro MUI_LANGUAGE "SpanishInternational"
+!insertmacro MUI_LANGUAGE "Swedish"
+!insertmacro MUI_LANGUAGE "Thai"
+!insertmacro MUI_LANGUAGE "TradChinese"
+!insertmacro MUI_LANGUAGE "Turkish"
+!insertmacro MUI_LANGUAGE "Ukrainian"
+!insertmacro MUI_LANGUAGE "Uzbek"
+!insertmacro MUI_LANGUAGE "Welsh"
+
+; MUI end ------
+
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+OutFile "easytag-${PRODUCT_VERSION}-setup.exe"
+InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
+ShowInstDetails show
+ShowUnInstDetails show
+
+Function .onInit
+  !insertmacro MUI_LANGDLL_DISPLAY ; Open the language selection window
+FunctionEnd
+
+
+;------------------------------------
+; EasyTAG executable install Section
+;------------------------------------
+Section "Core ${PRODUCT_NAME} Files" SecProgram
+  SectionIn 1 RO ; User cannot unselect it!
+
+  ; Fedora mingw paths. FIXME: Find these automatically.
+  SetOutPath "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/iconv.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libatk-1.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libcairo-2.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libffi-6.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgdk-win32-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgdk_pixbuf-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgio-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libglib-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgmodule-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgobject-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libgtk-win32-2.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libintl-8.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libogg-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libpango-1.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libpangocairo-1.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libpangowin32-1.0-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libpixman-1-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libpng15-15.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libvorbis-0.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/libvorbisfile-3.dll"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/pango-querymodules.exe"
+  File "/usr/i686-w64-mingw32/sys-root/mingw/bin/zlib1.dll"
+
+  SetOutPath "$INSTDIR\etc"
+  File /r "/usr/i686-w64-mingw32/sys-root/mingw/etc/fonts"
+  File /r "/usr/i686-w64-mingw32/sys-root/mingw/etc/gtk-2.0"
+  CreateDirectory "$INSTDIR\etc\pango"
+
+  SetOutPath "$INSTDIR\lib"
+  File /r "/usr/i686-w64-mingw32/sys-root/mingw/lib/gdk-pixbuf-2.0"
+  File /r "/usr/i686-w64-mingw32/sys-root/mingw/lib/gtk-2.0"
+  File /r "/usr/i686-w64-mingw32/sys-root/mingw/lib/pango"
+
+  SetOutPath "$INSTDIR"
+  File "${PRODUCT_EXE_NAME}"
+
+  ReadEnvStr $0 COMSPEC
+  SetOutPath "$INSTDIR"
+  nsExec::ExecToLog '$0 /C \usr\i686-w64-mingw32\sys-root\mingw\bin\pango-querymodules.exe > etc\pango\pango.modules'
+
+  ; FIXME: ChangeLog should come from the dist dir, otherwise it does not
+  ; contain the generated changelog.
+  File /oname=ChangeLog.txt ChangeLog
+  File /oname=COPYING.txt COPYING
+  File /oname=README.txt README
+
+  ; Shortcuts
+  ;!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  ;CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
+  ;CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\EasyTAG ${PRODUCT_VERSION}.lnk" "$INSTDIR\easytag.exe"
+  ;!insertmacro MUI_STARTMENU_WRITE_END
+SectionEnd
+
+;------------------------------------
+; EasyTAG shortcut install Section
+;------------------------------------
+SectionGroup /e "Shortcuts" SecShortcuts
+  Section /o "Desktop" SecDesktopShortcut
+    SetOverwrite on
+    CreateShortCut "$DESKTOP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\${PRODUCT_EXE_NAME}"
+    SetOverwrite off
+  SectionEnd
+
+  Section "Start Menu" SecStartMenuShortcut
+    SetOverwrite on
+    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+    CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
+    CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\${PRODUCT_EXE_NAME}"
+    !insertmacro MUI_STARTMENU_WRITE_END
+    SetOverwrite off
+  SectionEnd
+
+  Section "Context Menu" SecContextMenuShortcut
+    SetOverwrite on
+    WriteRegStr HKCR "Directory\shell\${PRODUCT_NAME}" "" "Browse with EasyTAG"
+    WriteRegStr HKCR "Directory\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\${PRODUCT_EXE_NAME}" "%1"'
+    SetOverwrite off
+  SectionEnd
+SectionGroupEnd
+
+
+;------------------------------------
+; Documentation install Section
+;------------------------------------
+Section "Documentation" SecDocumentation
+  SetOutPath "$INSTDIR\documentation"
+  SetOverwrite on
+  File "doc\EasyTAG_Documentation*.html"
+  File /r "doc\users_guide_*"
+
+  ; Shortcuts
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
+  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} Documentation.lnk" "$INSTDIR\documentation\EasyTAG_Documentation.html"
+  !insertmacro MUI_STARTMENU_WRITE_END
+SectionEnd
+
+;------------------------------------
+; Translation install Section
+;------------------------------------
+Section "Translations" SecTranslations
+  SetOutPath "$INSTDIR\locale"
+  SetOverwrite on
+;  FIXME: Install translations, probably from dist dir.
+;  File /r "win32-install-dir\locale\"
+
+  ; Shortcuts
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
+  !insertmacro MUI_STARTMENU_WRITE_END
+SectionEnd
+
+Section -AdditionalIcons
+  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
+  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
+  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
+  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall ${PRODUCT_NAME}.exe"
+  !insertmacro MUI_STARTMENU_WRITE_END
+SectionEnd
+
+Section -Post
+  WriteUninstaller "$INSTDIR\Uninstall ${PRODUCT_NAME}.exe"
+  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\${PRODUCT_EXE_NAME}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Uninstall ${PRODUCT_NAME}.exe"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\Uninstall ${PRODUCT_NAME}.exe$\" /S"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXE_NAME}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
+  WriteRegDword ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" "$1"
+  WriteRegDword ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" "$1"
+SectionEnd
+
+; Section descriptions
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecProgram} "The ${PRODUCT_NAME} program and associated core files"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecDocumentation} "Some documentation on how to use the program"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecTranslations} "Translation catalogs. You can skip installing these if you only want to see the UI in US English"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Application shortcuts"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} "Create a shortcut to the program on the desktop"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcut} "Create shortcuts in the start menu"
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenuShortcut} "Launch ${PRODUCT_NAME} from the Explorer context menu"
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+
+;------------------------------------
+; Uninstall Section
+;------------------------------------
+Section Uninstall
+  !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
+  Delete /rebootok "$DESKTOP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"
+  Delete /rebootok "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"
+  Delete /rebootok "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk"
+  RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
+
+  Delete /rebootok "$INSTDIR\${PRODUCT_EXE_NAME}"
+
+  RMDir /r "$INSTDIR\lib\pango"
+  RMDir /r "$INSTDIR\lib\gtk-2.0"
+  RMDir /r "$INSTDIR\lib\gdk-pixbuf-2.0"
+  RMDir /r "$INSTDIR\etc\pango"
+  RMDir /r "$INSTDIR\etc\gtk-2.0"
+  RMDir /r "$INSTDIR\etc\fonts"
+
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\zlib1.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\pango-querymodules.exe"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libvorbisfile-3.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libvorbis-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libpng15-15.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libpixman-1-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libpangowin32-1.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libpangocairo-1.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libpango-1.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libogg-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libintl-8.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgtk-win32-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgobject-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgmodule-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libglib-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgio-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgdk_pixbuf-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgdk-win32-2.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libgcc_s_sjlj-1.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libffi-6.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libcairo-2.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\libatk-1.0-0.dll"
+  Delete /rebootok "$INSTDIR\usr\i686-w64-mingw32\sys-root\mingw\bin\iconv.dll"
+  RMDir /r "$INSTDIR\usr"
+  RMDir /r "$INSTDIR\lib"
+  RMDir /r "$INSTDIR\etc"
+  Delete "$INSTDIR\${PRODUCT_NAME}.url"
+  Delete "$INSTDIR\Uninstall ${PRODUCT_NAME}.exe"
+  Delete "$INSTDIR\ChangeLog.txt"
+  Delete "$INSTDIR\COPYING.txt"
+  Delete "$INSTDIR\${PRODUCT_EXE_NAME}"
+  Delete "$INSTDIR\README.txt"
+  RMDir /r "$INSTDIR\Documentation\"
+  RMDir /r "$INSTDIR\locale\"
+
+  Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall ${PRODUCT_NAME}.lnk"
+  Delete "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} Website.lnk"
+  Delete "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"
+  Delete "$SMPROGRAMS\$ICONS_GROUP\${PRODUCT_NAME} Documentation.lnk"
+
+  Delete "$DESKTOP\${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"
+
+  RMDir "$SMPROGRAMS\$ICONS_GROUP"
+  RMDir "$INSTDIR"
+
+  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
+  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
+  ; Delete "Browse with EasyTAG" context menu
+  DeleteRegKey HKCR "Directory\shell\${PRODUCT_NAME}"
+
+  ; Delete personal settings?
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
+             "Do you want to remove your personal settings?" IDYES deletesettings IDNO dontdeletesettings
+  deletesettings:
+    ; Get 'Application Data' user's directory
+    ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "AppData"
+    RMDir /r "$R0\  PACKAGE_TARNAME@"
+  dontdeletesettings:
+
+  SetAutoClose true
+SectionEnd
+
+
+Function un.onInit
+!insertmacro MUI_UNGETLANGUAGE
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
+  Abort
+FunctionEnd



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]