win32 build scripts updated from 1.3-stable

This commit is contained in:
Calum Lind 2012-04-18 13:15:52 +01:00
commit 2cdcae8d31
3 changed files with 249 additions and 338 deletions

View file

@ -13,39 +13,25 @@ The GTK+ runtime libraries are installed separately (anywhere, in the Windows PA
1) Build Deluge on Windows 1) Build Deluge on Windows
2) Use a slightly hacked bbfreeze to create a standalone "executable" which does not need the the Python libs 2) Use a slightly hacked bbfreeze to create a standalone "executable" which does not need the the Python libs
The modification is to add these lines to: The modification is to add these lines to:
C:\Python26\Lib\site-packages\bbfreeze-0.96.5-py2.6-win32.egg\bbfreeze\recipes.py C:\Python26\Lib\site-packages\bbfreeze-0.96.5-py2.6-win32.egg\bbfreeze\recipes.py
Right after the 'prefixes' part of the Python function 'recipe_gtk_and_friends': Right at the top of the Python function 'recipe_gtk_and_friends':
return True
# Exclude DLL files in the GTK+ runtime bin dir.
# The GTK+ runtime must be in the PATH or copied to the application dir,
# so there is no point in including these DLLs with the bbfreeze output.
#
prefixes2 = ["iconv", "intl", "zlib1", "libpng12", "libatk", "libcairo", "libfont", "libfree", "libtiff", "libgio"]
for p in prefixes2:
if x.identifier.startswith(p):
print "SKIPPING:", x
x.__class__ = ExcludedModule
retval = True
break
The purpose is to avoid that bbfreeze copies DLLs from the GTK+ runtime bin directory.
Bbfreeze only copies a subset of the necessary DLLs (for some reason?). The cleanest
solution is to have the GTK+ runtime in a separate dir.
We want to include all the gtk libraries in the installer so that users don't
require a separate GTK+ installation.
3) Edit the 'build_version' variable in the Python script: 3) Edit the 'build_version' variable in the Python script:
win32/build-bbfreeze.py win32/build-bbfreeze.py
and run the script from the win32 directory: and run the script from the win32 directory:
python build-bbfreeze.py python build-bbfreeze.py
The script places the bbfreeze'd version of deluge in The script places the bbfreeze'd version of deluge in
build-win32/deluge-bbfreeze-build_version build-win32/deluge-bbfreeze-build_version
@ -60,13 +46,13 @@ The GTK+ runtime libraries are installed separately (anywhere, in the Windows PA
and run the NSIS script. and run the NSIS script.
The result is a standalone installer. The only dependency for the installer is the GTK+ runtime, The result is a standalone installer. The only dependency for the installer is the GTK+ runtime,
which is downloaded by the Deluge installer if it isn't installed in the system. which is downloaded by the Deluge installer if it isn't installed in the system.
The GTK+ installer is downloaded from http://download.deluge-torrent.org/windows/deps/ The GTK+ installer is downloaded from http://download.deluge-torrent.org/windows/deps/
and placed in the user temp directory (not deleted after installation). and placed in the user temp directory (not deleted after installation).
The post install script creates the deluge.cmd file using startX.exe with the correct path The post install script creates the deluge.cmd file using startX.exe with the correct path
and sets up the file association for .torrent. and sets up the file association for .torrent.

View file

@ -1,20 +1,28 @@
build_version = "1.3.1" build_version = "1.4.0-dev"
python_path = "C:\\Python26\\" python_path = "C:\\Python26\\"
import os, glob
import shutil import shutil
shutil.copy(python_path + "Scripts\deluge-script.py", python_path + "Scripts\deluge.py") shutil.copy(python_path + "Scripts\deluge-script.pyw", python_path + "Scripts\deluge.py")
shutil.copy(python_path + "Scripts\deluge-script.pyw", python_path + "Scripts\deluge-debug.py")
shutil.copy(python_path + "Scripts\deluged-script.py", python_path + "Scripts\deluged.py") shutil.copy(python_path + "Scripts\deluged-script.py", python_path + "Scripts\deluged.py")
shutil.copy(python_path + "Scripts\deluge-web-script.py", python_path + "Scripts\deluge-web.py") shutil.copy(python_path + "Scripts\deluge-web-script.py", python_path + "Scripts\deluge-web.py")
shutil.copy(python_path + "Scripts\deluge-gtk-script.py", python_path + "Scripts\deluge-gtk.py") shutil.copy(python_path + "Scripts\deluge-gtk-script.pyw", python_path + "Scripts\deluge-gtk.py")
shutil.copy(python_path + "Scripts\deluge-console-script.py", python_path + "Scripts\deluge-console.py") shutil.copy(python_path + "Scripts\deluge-console-script.py", python_path + "Scripts\deluge-console.py")
includes=("libtorrent", "gzip", "zipfile", "re", "socket", "struct", "cairo", "pangocairo", "atk", "pango", "twisted.internet.utils", "gio", "gtk.glade", "email.mime")
excludes=("numpy", "OpenGL", "psyco", "win32ui")
dst = "..\\build-win32\\deluge-bbfreeze-" + build_version + "\\"
from bbfreeze import Freezer from bbfreeze import Freezer
f = Freezer("..\\build-win32\\deluge-bbfreeze-" + build_version, includes=("libtorrent", "gzip", "zipfile", "re", "socket", "struct", "cairo", "pangocairo", "atk", "pango", "twisted.internet.utils", "gio", "gtk.glade")) f = Freezer(dst, includes=includes, excludes=excludes)
f.addScript(python_path + "Scripts\deluge.py", gui_only=False) f.include_py = False
f.addScript(python_path + "Scripts\deluge.py", gui_only=True)
f.addScript(python_path + "Scripts\deluge-debug.py", gui_only=False)
f.addScript(python_path + "Scripts\deluged.py", gui_only=False) f.addScript(python_path + "Scripts\deluged.py", gui_only=False)
f.addScript(python_path + "Scripts\deluge-web.py", gui_only=False) f.addScript(python_path + "Scripts\deluge-web.py", gui_only=False)
f.addScript(python_path + "Scripts\deluge-gtk.py", gui_only=False) f.addScript(python_path + "Scripts\deluge-gtk.py", gui_only=True)
f.addScript(python_path + "Scripts\deluge-console.py", gui_only=False) f.addScript(python_path + "Scripts\deluge-console.py", gui_only=False)
f() # starts the freezing process f() # starts the freezing process
@ -24,13 +32,13 @@ import icon
icon_path = os.path.join(os.path.dirname(__file__), "deluge.ico") icon_path = os.path.join(os.path.dirname(__file__), "deluge.ico")
icon.CopyIcons(dst+"deluge.exe", icon_path) icon.CopyIcons(dst+"deluge.exe", icon_path)
icon.CopyIcons(dst+"deluge-debug.exe", icon_path) icon.CopyIcons(dst+"deluge-debug.exe", icon_path)
icon.CopyIcons(dst+"deluged.exe", icon_path) icon.CopyIcons(dst+"deluged.exe", icon_path)
icon.CopyIcons(dst+"deluge-web.exe", icon_path) icon.CopyIcons(dst+"deluge-web.exe", icon_path)
icon.CopyIcons(dst+"deluge-gtk.exe", icon_path) icon.CopyIcons(dst+"deluge-gtk.exe", icon_path)
icon.CopyIcons(dst+"deluge-console.exe", icon_path) icon.CopyIcons(dst+"deluge-console.exe", icon_path)
# exclude files which are already included in GTK or Windows # exclude files which are already included in GTK or Windows
excludeFiles = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "POWRPROF.dll", "freetype*.dll", "iconv.dll", "intl.dll", "libatk*.dll", "libcairo*.dll", "libexpat*.dll", "libfontconfig*.dll", "libfreetype*.dll", "libgio*.dll", "libpng*.dll", "libtiff*.dll", "zlib1.dll") excludeFiles = ("MSIMG32.dll", "MSVCR90.dll", "MSVCP90.dll", "POWRPROF.dll", "DNSAPI.dll", "USP10.dll")
for file in excludeFiles: for file in excludeFiles:
for filename in glob.glob(dst + file): for filename in glob.glob(dst + file):
print "removing file:", filename print "removing file:", filename

View file

@ -1,303 +1,220 @@
# Deluge Windows installer script # Deluge Windows installer script
# Version 0.4 28-Apr-2009 # Version 0.4 28-Apr-2009
# Copyright (C) 2009 by # Copyright (C) 2009 by
# Jesper Lund <mail@jesperlund.com> # Jesper Lund <mail@jesperlund.com>
# Andrew Resch <andrewresch@gmail.com> # Andrew Resch <andrewresch@gmail.com>
# John Garland <johnnybg@gmail.com> # John Garland <johnnybg@gmail.com>
# Deluge is free software. # Deluge is free software.
# #
# You may redistribute it and/or modify it under the terms of the # You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software # GNU General Public License, as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) # Foundation; either version 3 of the License, or (at your option)
# any later version. # any later version.
# #
# Deluge is distributed in the hope that it will be useful, # Deluge is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. # See the GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with deluge. If not, write to: # along with deluge. If not, write to:
# The Free Software Foundation, Inc., # The Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor # 51 Franklin Street, Fifth Floor
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
# #
# Set default compressor # Set default compressor
SetCompressor lzma SetCompressor lzma
### ###
### --- The PROGRAM_VERSION !define need to be updated with new Deluge versions --- ### --- The PROGRAM_VERSION !define need to be updated with new Deluge versions ---
### ###
# Script version; displayed when running the installer # Script version; displayed when running the installer
!define DELUGE_INSTALLER_VERSION "0.4" !define DELUGE_INSTALLER_VERSION "0.5"
# Deluge program information # Deluge program information
!define PROGRAM_NAME "Deluge" !define PROGRAM_NAME "Deluge"
!define PROGRAM_VERSION "1.2.2" !define PROGRAM_VERSION "1.4.0-dev"
!define PROGRAM_WEB_SITE "http://deluge-torrent.org" !define PROGRAM_WEB_SITE "http://deluge-torrent.org"
# Python files generated with bbfreeze (without DLLs from GTK+ runtime) # Python files generated with bbfreeze (without DLLs from GTK+ runtime)
!define DELUGE_PYTHON_BBFREEZE_OUTPUT_DIR "..\build-win32\deluge-bbfreeze-${PROGRAM_VERSION}" !define DELUGE_PYTHON_BBFREEZE_OUTPUT_DIR "..\build-win32\deluge-bbfreeze-${PROGRAM_VERSION}"
# Installer for GTK+ 2.12 runtime; will be downloaded from deluge-torrent.org # --- Interface settings ---
!define DELUGE_GTK_DEPENDENCY "gtk2-runtime-2.16.6-2010-02-24-ash.exe"
# Modern User Interface 2
!include MUI2.nsh
# --- Interface settings ---
# Installer
# Modern User Interface 2 !define MUI_ICON "deluge.ico"
!include MUI2.nsh !define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
# Installer !define MUI_HEADERIMAGE_BITMAP "installer-top.bmp"
!define MUI_ICON "deluge.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "installer-side.bmp"
!define MUI_HEADERIMAGE !define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_HEADERIMAGE_RIGHT !define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_HEADERIMAGE_BITMAP "installer-top.bmp" !define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP "installer-side.bmp"
!define MUI_COMPONENTSPAGE_SMALLDESC # Uninstaller
!define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define MUI_ABORTWARNING !define MUI_HEADERIMAGE_UNBITMAP "installer-top.bmp"
!define MUI_WELCOMEFINISHPAGE_UNBITMAP "installer-side.bmp"
# Uninstaller !define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define MUI_HEADERIMAGE_UNBITMAP "installer-top.bmp" # --- Start of Modern User Interface ---
!define MUI_WELCOMEFINISHPAGE_UNBITMAP "installer-side.bmp"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE # Welcome page
!insertmacro MUI_PAGE_WELCOME
# --- Start of Modern User Interface ---
# License page
# Welcome page !insertmacro MUI_PAGE_LICENSE "..\LICENSE"
!insertmacro MUI_PAGE_WELCOME
# Components page
# License page !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_LICENSE "..\LICENSE"
# Let the user select the installation directory
# Components page !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
# Run installation
# Let the user select the installation directory !insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_DIRECTORY
# Display 'finished' page
# Run installation !insertmacro MUI_PAGE_FINISH
!insertmacro MUI_PAGE_INSTFILES
# Uninstaller pages
# Display 'finished' page !insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
# Language files
# Uninstaller pages !insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_UNPAGE_INSTFILES
# Language files # --- Functions ---
!insertmacro MUI_LANGUAGE "English"
Function un.onUninstSuccess
HideWindow
# --- Functions --- MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onUninstSuccess
HideWindow Function un.onInit
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to completely remove $(^Name) and all of its components?" IDYES +2
FunctionEnd Abort
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort # --- Installation sections ---
FunctionEnd
# Compare versions
!include "WordFunc.nsh"
# --- Installation sections ---
!define PROGRAM_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}"
# Compare versions !define PROGRAM_UNINST_ROOT_KEY "HKLM"
!include "WordFunc.nsh"
# Branding text
!define PROGRAM_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" BrandingText "Deluge Windows Installer v${DELUGE_INSTALLER_VERSION}"
!define PROGRAM_UNINST_ROOT_KEY "HKLM"
Name "${PROGRAM_NAME} ${PROGRAM_VERSION}"
# Branding text OutFile "..\build-win32\deluge-${PROGRAM_VERSION}-win32-setup.exe"
BrandingText "Deluge Windows Installer v${DELUGE_INSTALLER_VERSION}"
InstallDir "$PROGRAMFILES\Deluge"
Name "${PROGRAM_NAME} ${PROGRAM_VERSION}"
OutFile "..\build-win32\deluge-${PROGRAM_VERSION}-win32-setup.exe" ShowInstDetails show
ShowUnInstDetails show
# The Python bbfreeze files will be placed here
!define DELUGE_PYTHON_SUBDIR "$INSTDIR\Deluge-Python" # Install main application
Section "Deluge Bittorrent Client" Section1
InstallDir "$PROGRAMFILES\Deluge" SectionIn RO
ShowInstDetails show SetOutPath $INSTDIR
ShowUnInstDetails show File /r "${DELUGE_PYTHON_BBFREEZE_OUTPUT_DIR}\*.*"
# Install main application SetOverwrite ifnewer
Section "Deluge Bittorrent Client" Section1 File "..\LICENSE"
SectionIn RO SectionEnd
Rmdir /r "${DELUGE_PYTHON_SUBDIR}" Section -StartMenu_Desktop_Links
SetOutPath "${DELUGE_PYTHON_SUBDIR}" WriteIniStr "$INSTDIR\homepage.url" "InternetShortcut" "URL" "${PROGRAM_WEB_SITE}"
File /r "${DELUGE_PYTHON_BBFREEZE_OUTPUT_DIR}\*.*" # create shortcuts for all users
SetShellVarContext all
# Clean up previous confusion between Deluge.ico and deluge.ico (seems to matter on Vista registry settings?) CreateDirectory "$SMPROGRAMS\Deluge"
Delete "$INSTDIR\Deluge.ico" CreateShortCut "$SMPROGRAMS\Deluge\Deluge.lnk" "$INSTDIR\deluge.exe"
CreateShortCut "$SMPROGRAMS\Deluge\Deluge daemon.lnk" "$INSTDIR\deluged.exe"
SetOverwrite ifnewer CreateShortCut "$SMPROGRAMS\Deluge\Deluge webUI.lnk" "$INSTDIR\deluge-web.exe"
SetOutPath $INSTDIR CreateShortCut "$SMPROGRAMS\Deluge\Project homepage.lnk" "$INSTDIR\Homepage.url"
File "..\LICENSE" CreateShortCut "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk" "$INSTDIR\Deluge-uninst.exe"
File "StartX.exe" CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.exe"
File "deluge.ico" SectionEnd
# Create deluge.cmd file Section -Uninstaller
fileOpen $0 "$INSTDIR\deluge.cmd" w WriteUninstaller "$INSTDIR\Deluge-uninst.exe"
fileWrite $0 '@ECHO OFF$\r$\n' WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayName" "$(^Name)"
fileWrite $0 'SET DELUGEFOLDER="$INSTDIR"$\r$\n' WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "UninstallString" "$INSTDIR\Deluge-uninst.exe"
fileWrite $0 'SET STARTX_APP="$INSTDIR\StartX.exe"$\r$\n' SectionEnd
fileWrite $0 '$\r$\n'
fileWrite $0 'IF ""%1"" == """" ( $\r$\n' # Create file association for .torrent
fileWrite $0 ' %STARTX_APP% /B /D%DELUGEFOLDER% "$INSTDIR\Deluge-Python\deluge.exe"$\r$\n' Section "Create .torrent file association for Deluge" Section2
fileWrite $0 ') ELSE ( $\r$\n' # Set up file association for .torrent files
fileWrite $0 ' %STARTX_APP% /B /D%DELUGEFOLDER% "$INSTDIR\Deluge-Python\deluge.exe "%1" "%2" "%3" "%4""$\r$\n' DeleteRegKey HKCR ".torrent"
fileWrite $0 ')$\r$\n' WriteRegStr HKCR ".torrent" "" "Deluge"
fileClose $0 WriteRegStr HKCR ".torrent" "Content Type" "application/x-bittorrent"
# Create deluged.cmd file DeleteRegKey HKCR "Deluge"
fileOpen $0 "$INSTDIR\deluged.cmd" w WriteRegStr HKCR "Deluge" "" "Deluge"
fileWrite $0 '@ECHO OFF$\r$\n' WriteRegStr HKCR "Deluge\Content Type" "" "application/x-bittorrent"
fileWrite $0 'SET DELUGEFOLDER="$INSTDIR"$\r$\n' WriteRegStr HKCR "Deluge\DefaultIcon" "" "$INSTDIR\deluge.exe,0"
fileWrite $0 '"$INSTDIR\StartX.exe" /B /D%DELUGEFOLDER% "$INSTDIR\Deluge-Python\deluged.exe "%1" "%2" "%3" "%4""$\r$\n' WriteRegStr HKCR "Deluge\shell" "" "open"
fileClose $0 WriteRegStr HKCR "Deluge\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"'
SectionEnd
# Create deluge-webui.cmd file
fileOpen $0 "$INSTDIR\deluge-webui.cmd" w
fileWrite $0 '@ECHO OFF$\r$\n' # Create magnet uri association
fileWrite $0 'SET DELUGEFOLDER="$INSTDIR"$\r$\n' Section "Create magnet uri link association for Deluge" Section3
fileWrite $0 '"$INSTDIR\StartX.exe" /B /D%DELUGEFOLDER% "$INSTDIR\Deluge-Python\deluge.exe --ui web"$\r$\n' DeleteRegKey HKCR "magnet"
fileWrite $0 "ECHO Deluge WebUI started and is running at http://localhost:8112 by default$\r$\n" WriteRegStr HKCR "magnet" "" "URL:magnet protocol"
fileWrite $0 "ECHO NOTE: The Deluge WebUI process can only be stopped in the Windows Task Manager$\r$\n" WriteRegStr HKCR "magnet" "URL Protocol" ""
fileWrite $0 "ECHO.$\r$\n"
fileWrite $0 PAUSE WriteRegStr HKCR "magnet\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"'
fileClose $0 SectionEnd
SectionEnd
Section -StartMenu_Desktop_Links LangString DESC_Section1 ${LANG_ENGLISH} "Install Deluge Bittorrent client."
WriteIniStr "$INSTDIR\homepage.url" "InternetShortcut" "URL" "${PROGRAM_WEB_SITE}" LangString DESC_Section2 ${LANG_ENGLISH} "Select this option unless you have another torrent client which you want to use for opening .torrent files."
LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to have Deluge handle magnet links."
CreateDirectory "$SMPROGRAMS\Deluge"
CreateShortCut "$SMPROGRAMS\Deluge\Deluge.lnk" "$INSTDIR\deluge.cmd" "" "$INSTDIR\deluge.ico" !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
CreateShortCut "$SMPROGRAMS\Deluge\Deluge daemon.lnk" "$INSTDIR\deluged.cmd" "" "$INSTDIR\deluge.ico" !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
CreateShortCut "$SMPROGRAMS\Deluge\Deluge webUI.lnk" "$INSTDIR\deluge-webui.cmd" "" "$INSTDIR\deluge.ico" !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
CreateShortCut "$SMPROGRAMS\Deluge\Project homepage.lnk" "$INSTDIR\Homepage.url" !insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
CreateShortCut "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk" "$INSTDIR\Deluge-uninst.exe" !insertmacro MUI_FUNCTION_DESCRIPTION_END
CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.cmd" "" "$INSTDIR\deluge.ico"
SectionEnd
# --- Uninstallation section(s) ---
Section -Uninstaller
WriteUninstaller "$INSTDIR\Deluge-uninst.exe" Section Uninstall
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayName" "$(^Name)" RmDir /r "$INSTDIR"
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "UninstallString" "$INSTDIR\Deluge-uninst.exe"
WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayIcon" "$INSTDIR\deluge.ico" SetShellVarContext all
SectionEnd Delete "$SMPROGRAMS\Deluge\Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Deluge daemon.lnk"
# Create file association for .torrent Delete "$SMPROGRAMS\Deluge\Deluge webUI.lnk"
Section "Create .torrent file association for Deluge" Section2 Delete "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk"
# Set up file association for .torrent files Delete "$SMPROGRAMS\Deluge\Project homepage.lnk"
DeleteRegKey HKCR ".torrent" Delete "$DESKTOP\Deluge.lnk"
WriteRegStr HKCR ".torrent" "" "Deluge"
WriteRegStr HKCR ".torrent" "Content Type" "application/x-bittorrent" RmDir "$SMPROGRAMS\Deluge"
DeleteRegKey HKCR "Deluge" DeleteRegKey ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}"
WriteRegStr HKCR "Deluge" "" "Deluge"
WriteRegStr HKCR "Deluge\Content Type" "" "application/x-bittorrent" # Only delete the .torrent association if Deluge owns it
WriteRegStr HKCR "Deluge\DefaultIcon" "" '"$INSTDIR\deluge.ico"' ReadRegStr $1 HKCR ".torrent" ""
WriteRegStr HKCR "Deluge\shell" "" "open" StrCmp $1 "Deluge" 0 DELUGE_skip_delete
WriteRegStr HKCR "Deluge\shell\open\command" "" '"$INSTDIR\deluge.cmd" "%1"'
SectionEnd # Delete the key since it is owned by Deluge; afterwards there is no .torrent association
DeleteRegKey HKCR ".torrent"
# Create magnet uri association DELUGE_skip_delete:
Section "Create magnet uri link association for Deluge" Section3 # This key is only used by Deluge, so we should always delete it
DeleteRegKey HKCR "magnet" DeleteRegKey HKCR "Deluge"
WriteRegStr HKCR "magnet" "" "URL:magnet protocol" SectionEnd
WriteRegStr HKCR "magnet" "URL Protocol" ""
WriteRegStr HKCR "magnet\shell\open\command" "" '"$INSTDIR\deluge.cmd" "%1"'
SectionEnd
# Install GTK+ 2.16
Section "GTK+ 2.16 runtime" Section4
GTK_install_start:
MessageBox MB_OK "You will now download and run the installer for the GTK+ 2.16 runtime. \
You must be connected to the internet before you press the OK button. \
The GTK+ runtime can be installed in any location, \
because the GTK+ installer adds the location to the global PATH variable. \
Please note that the GTK+ 2.16 runtime is not removed by the Deluge uninstaller. \
You must use the GTK+ 2.16 uninstaller if you want to remove it together with Deluge."
# Download GTK+ installer to TEMP dir
NSISdl::download http://download.deluge-torrent.org/windows/deps/${DELUGE_GTK_DEPENDENCY} "$TEMP\${DELUGE_GTK_DEPENDENCY}"
# Get return value (success, cancel, or string describing the network error)
Pop $2
StrCmp $2 "success" 0 GTK_download_error
ExecWait '"$TEMP\${DELUGE_GTK_DEPENDENCY}" /compatdlls=yes'
Goto GTK_install_exit
GTK_download_error:
MessageBox MB_ICONEXCLAMATION|MB_OK "Download of GTK+ 2.16 installer failed (return code: $2). \
You must install the GTK+ 2.16 runtime manually, or Deluge will fail to run on your system."
GTK_install_exit:
SectionEnd
LangString DESC_Section1 ${LANG_ENGLISH} "Install Deluge Bittorrent client."
LangString DESC_Section2 ${LANG_ENGLISH} "Select this option unless you have another torrent client which you want to use for opening .torrent files."
LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to have Deluge handle magnet links."
LangString DESC_Section4 ${LANG_ENGLISH} "Download and install the GTK+ 2.16 runtime. \
This is skipped automatically if GTK+ is already installed."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(DESC_Section3)
!insertmacro MUI_DESCRIPTION_TEXT ${Section4} $(DESC_Section4)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
# --- Uninstallation section(s) ---
Section Uninstall
Rmdir /r "${DELUGE_PYTHON_SUBDIR}"
Delete "$INSTDIR\Deluge-uninst.exe"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\deluge.cmd"
Delete "$INSTDIR\deluged.cmd"
Delete "$INSTDIR\deluge-webui.cmd"
Delete "$INSTDIR\StartX.exe"
Delete "$INSTDIR\Homepage.url"
Delete "$INSTDIR\deluge.ico"
Delete "$SMPROGRAMS\Deluge\Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Deluge daemon.lnk"
Delete "$SMPROGRAMS\Deluge\Deluge webUI.lnk"
Delete "$SMPROGRAMS\Deluge\Uninstall Deluge.lnk"
Delete "$SMPROGRAMS\Deluge\Project homepage.lnk"
Delete "$DESKTOP\Deluge.lnk"
RmDir "$SMPROGRAMS\Deluge"
RmDir "$INSTDIR"
DeleteRegKey ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}"
# Only delete the .torrent association if Deluge owns it
ReadRegStr $1 HKCR ".torrent" ""
StrCmp $1 "Deluge" 0 DELUGE_skip_delete
# Delete the key since it is owned by Deluge; afterwards there is no .torrent association
DeleteRegKey HKCR ".torrent"
DELUGE_skip_delete:
# This key is only used by Deluge, so we should always delete it
DeleteRegKey HKCR "Deluge"
SectionEnd