diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 17:38:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-24 17:38:33 +0000 |
commit | f702b50b6ac6cb2e1e0e848a629a623f323c9de2 (patch) | |
tree | 67d787608695391e5edc2eb245b3943302ba1734 /packaging | |
parent | Releasing debian version 2.1.1-5. (diff) | |
download | deluge-f702b50b6ac6cb2e1e0e848a629a623f323c9de2.tar.xz deluge-f702b50b6ac6cb2e1e0e848a629a623f323c9de2.zip |
Merging upstream version 2.1.2~dev0+20230529.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging')
25 files changed, 1377 insertions, 0 deletions
diff --git a/packaging/osx/Info.plist.in b/packaging/osx/Info.plist.in new file mode 100644 index 0000000..7021497 --- /dev/null +++ b/packaging/osx/Info.plist.in @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleIdentifier</key> + <string>org.deluge</string> + <key>CFBundleName</key> + <string>Deluge</string> + <key>CFBundleIconFile</key> + <string>deluge.icns</string> + <key>CFBundleExecutable</key> + <string>Deluge</string> + <key>CFBundleShortVersionString</key> + <string>%VERSION%</string> + <key>CFBundleVersion</key> + <string>%VERSION%</string> + <key>CFBundleGetInfoString</key> + <string>%VERSION% (c) 2008-%YEAR% Deluge Team http://deluge-torrent.org/</string> + <key>NSHumanReadableCopyright</key> + <string>Copyright 2008-%YEAR% Deluge Team</string> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>DL##</string> + <key>LSMinimumSystemVersion</key> + <string>10.6</string> + <key>LSUIElement</key> + <string>0</string> + <key>NSHighResolutionCapable</key> + <true/> + <key>CFBundleDisplayName</key> + <string>Deluge</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>torrent</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>torrent</string> + <key>CFBundleTypeName</key> + <string>BitTorrent Document</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>LSHandlerRank</key> + <string>Owner</string> + <key>LSItemContentTypes</key> + <array> + <string>org.bittorrent.torrent</string> + </array> + </dict> + </array> +</dict> +</plist> diff --git a/packaging/osx/Instructions.md b/packaging/osx/Instructions.md new file mode 100644 index 0000000..985052c --- /dev/null +++ b/packaging/osx/Instructions.md @@ -0,0 +1,48 @@ +# Packaging setup with jhbuild + +These are the manual step based upon https://wiki.gnome.org/Projects/Jhbuild/Mac_OS + +If you encounter curl stalling on FTP URLs try disabling `epsv` for curl: +`echo no-epsv >> ~/.curlrc` + +1. Install XCode command line developer tools: + + xcode-select --install + +1. Install jhbuild: + + curl -LO https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/gtk-osx-build-setup.sh + sh gtk-osx-build-setup.sh + jhbuild bootstrap + +1. GTK-OSX Build + + 1. Bootstrap GTK and install PyGTK + + jhbuild build python meta-gtk-osx-bootstrap meta-gtk-osx-python + + 1. GTK OSX Themes: + + jhbuild build meta-gtk-osx-themes gtk-quartz-engine + + Note: [Quartz patch] if build error; `'height' is uninitialized`. + +1. Install [MacOS bundler] script + + This script is to help package GTK for Deluge. + + curl -OL http://ftp.gnome.org/pub/gnome/sources/gtk-mac-bundler/0.7/gtk-mac-bundler-0.7.4.tar.xz + tar xf gtk-mac-bundler-0.7.4.tar.xz + cd gtk-mac-bundler-0.7.4 + make install + +1. Build libtorrent and deps using libtorrent.modules: + + curl -O http://git.deluge-torrent.org/deluge/plain/osx/libtorrent.modules?h=develop + jhbuild -m libtorrent.modules build meta_libtorrent + + - OpenSSL requires "Skip Module (2)" when install stage fails as unable to use DESTDIR path. See patch. + - Note on a potential OpenSSL Error: 'libcrypto is a fat file' is due to mixing arch types (i386, x64) in build process. + +[quartz patch]: https://www.xpra.org/trac/attachment/ticket/533/quartz-style-fix.patch +[macos bundler]: https://wiki.gnome.org/Projects/GTK%2B/OSX/Bundling diff --git a/packaging/osx/README.rst b/packaging/osx/README.rst new file mode 100644 index 0000000..781b14b --- /dev/null +++ b/packaging/osx/README.rst @@ -0,0 +1,127 @@ +==================================== +Instructions for building Deluge.app +==================================== + +1. Compiler +----------- + +- To build deluge and the gtk osx modules, you must use `gcc` +- This has been successfully working with : + - gcc 4.2.1 - Xcode 4.1 - Mac OSX Lion (10.7.2) + - llvm-gcc 4.2.1 - Xcode 4.3.1 (With Command line utilities) - Mac OSX Lion (10.7.3) +- Check your version of gcc using `gcc -v` + +2. GTK-OSX jhbuild environment +------------------------------ + +Quick how-to *(from the full GTK-OSX building instructions)* [1]_, [2]_ + +a. Create a dedicated user account and use it for all the next steps:: + + sudo su - gtk + cat << EOF > ~/.profile + export PATH=~/.local/bin:~/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/git/bin + EOF + . ~/.profile + + *Note*: I'm using `gtk` login with `/opt/gtk` as home an jhbuild prefix. + +b. Download and run the gtk-osx-build-setup [3]_ script to install jhbuild:: + + curl -O https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh + sh gtk-osx-build-setup.sh + +c. Link or copy deluge osx jhbuildrc-custom:: + + ln -sf deluge/osx/jhbuildrc-custom ~/.jhbuildrc-custom + + *Note*: This setup builds only for `x86_64` arch to `/opt/gtk` prefix, feel free to edit. + +d. Build jhbuild and its modulesets: *(takes a while...)*:: + + jhbuild bootstrap && jhbuild + + *Note*: If you encounter an error while building `glib` like:: + + gconvert.c:65:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv + + Start a shell from jhbuild, edit the file `vim glib/gconvert.c +65` to delete the + section raising error, which is irrelevant. *(Lion iconv.h looks like gnu one, but it is not)* + Then exit the shell and resume build. + +5. Build the deluge moduleset: *(takes a while...)*:: + + jhbuild -m deluge/osx/deluge.modules build deluge + + *Note*: This jhbuild moduleset *should* build and install all deluge dependencies not available in gtk-osx. + +3. Build Deluge.app +------------------- + +a. Always do your custom build operations under a jhbuild shell:: + + jhbuild shell + +b. Cleanup:: + + python setup.py clean -a + +c. Build and install:: + + python setup.py py2app + python setup.py install + +d. Build app to `deluge/osx/app/Deluge.app`:: + + cd osx + ./make-app + +You *should* now have a working Deluge.app + +i386 Notes +---------- + +- Uncomment the relevant sections of : + - jhbuildrc-custom + - deluge.modules + - setup.cfg +- deluge egg has to be named without the -macosx-10.6-intel suffix +- To build for i386 under a x64 arch libtorrent python bindings have to be + patched manually to set correct arch see macports package patch + +Issues +------ + +If Deluge.app doesn't work or crash the first thing to do is to check OSX +Console for logs and/or crash reports. + +You can enable logging by passing the usual log command switches via console:: + + /Applications/Deluge.app/Contents/MacOS/Deluge -L debug -l debug.log + +Recent jhbuild issues: + +- Some jhbuild modules fails to build, freetype and gtk-mac-integration, + strangely configure is not called before build/install. +- If that happens, just force rebuild with something like: + + jhbuild build -cf gtk-mac-integration-python + +- Interrupt while building with Ctrl+C and wipe to start over if configure missing + +Known issues +------------ + +- **i386**: libtorrent crash +- **i18n**: English only for now +- **Magnet URLs**: Not currently supported by GTK-OSX + +Reference +--------- + +.. [1] http://live.gnome.org/Jhbuild +.. [2] http://live.gnome.org/GTK%2B/OSX/Building +.. [3] http://github.com/jralls/gtk-osx-build +.. [4] http://winswitch.org/dev/macosx.html +.. [5] http://mail.python.org/pipermail/pythonmac-sig/ +.. [6] https://github.com/jralls/gtk-mac-integration diff --git a/packaging/osx/deluge b/packaging/osx/deluge new file mode 100755 index 0000000..023977f --- /dev/null +++ b/packaging/osx/deluge @@ -0,0 +1,79 @@ +#!/bin/bash + +EXEC="exec" + +name="`basename $0`" +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then + full_path="$0" +else + full_path="`pwd`/$0" +fi +tmp=`dirname "$full_path"` +tmp=`dirname "$tmp"` +bundle=`dirname "$tmp"` +bundle_contents=${bundle%"/Contents"}"/Contents" +bundle_macos="$bundle_contents"/MacOS +bundle_res="$bundle_contents"/Resources +bundle_lib="$bundle_res"/lib +bundle_data="$bundle_res"/share +bundle_etc="$bundle_res"/etc + +export DYLD_FALLBACK_LIBRARY_PATH="$bundle_lib" +export XDG_CONFIG_DIRS="$bundle_etc"/xdg +export XDG_DATA_DIRS="$bundle_data" +export GTK_DATA_PREFIX="$bundle_res" +export GTK_EXE_PREFIX="$bundle_res" +export GTK_PATH="$bundle_res" +export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc" +export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules" +export GDK_PIXBUF_MODULE_FILE="$bundle_lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" +export PANGO_RC_FILE="$bundle_etc/pango/pangorc" +export PANGO_LIBDIR="$bundle_lib" +export PANGO_SYSCONFDIR="$bundle_etc" + +#Set $PYTHON to point inside the bundle +export PYTHON="$bundle_macos/python" +export PYTHONHOME="$bundle_res" +#Add the bundle's python modules +PYTHONPATH="$bundle_lib:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/lib-dynload/:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/:$PYTHONPATH" +PYTHONPATH="$bundle_lib/pygtk/2.0:$PYTHONPATH" +export PYTHONPATH + +# Ensure deluged is available by adding macos dir to path. +PATH=$bundle_macos:$PATH + +# We need a UTF-8 locale. +lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null` +if test "$?" != "0"; then + lang=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null | sed 's/_.*//'` +fi +LANG="" +if test "$lang" != ""; then + LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | \ + tail -n1 | sed 's/\./ /' | awk '{print $2}'`" +fi +if test "$LANG" == ""; then + export LANG="C" +else + export LANG="$LANG.utf8" +fi + +if test -f "$bundle_lib/charset.alias"; then + export CHARSETALIASDIR="$bundle_lib" +fi + +# Extra arguments can be added in environment.sh. +EXTRA_ARGS= +if test -f "$bundle_res/environment.sh"; then + source "$bundle_res/environment.sh" +fi + +# Strip out the argument added by the OS. +if [ "x`echo "x$1" | sed -e "s/^x-psn_.*//"`" == "x" ]; then + shift 1 +fi + +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_macos/Deluge-bin" "$@" diff --git a/packaging/osx/deluge-console b/packaging/osx/deluge-console new file mode 100755 index 0000000..e1e20e8 --- /dev/null +++ b/packaging/osx/deluge-console @@ -0,0 +1,69 @@ +#!/bin/bash + +EXEC="exec" + +name="`basename $0`" +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then + full_path="$0" +else + full_path="`pwd`/$0" +fi +tmp=`dirname "$full_path"` +tmp=`dirname "$tmp"` +bundle=`dirname "$tmp"` +bundle_contents=${bundle%"/Contents"}"/Contents" +bundle_macos="$bundle_contents"/MacOS +bundle_res="$bundle_contents"/Resources +bundle_lib="$bundle_res"/lib +bundle_data="$bundle_res"/share +bundle_etc="$bundle_res"/etc + +export DYLD_FALLBACK_LIBRARY_PATH="$bundle_lib" +export XDG_CONFIG_DIRS="$bundle_etc"/xdg +export XDG_DATA_DIRS="$bundle_data" + +#Set $PYTHON to point inside the bundle +export PYTHON="$bundle_macos/python" +export PYTHONHOME="$bundle_res" +#Add the bundle's python modules +PYTHONPATH="$bundle_lib:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/lib-dynload/:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/:$PYTHONPATH" +export PYTHONPATH + +# Ensure deluged is available by adding macos dir to path. +PATH=$bundle_macos:$PATH + +# We need a UTF-8 locale. +lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null` +if test "$?" != "0"; then + lang=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null | sed 's/_.*//'` +fi +LANG="" +if test "$lang" != ""; then + LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | \ + tail -n1 | sed 's/\./ /' | awk '{print $2}'`" +fi +if test "$LANG" == ""; then + export LANG="C" +else + export LANG="$LANG.utf8" +fi + +if test -f "$bundle_lib/charset.alias"; then + export CHARSETALIASDIR="$bundle_lib" +fi + +# Extra arguments can be added in environment.sh. +EXTRA_ARGS= +if test -f "$bundle_res/environment.sh"; then + source "$bundle_res/environment.sh" +fi + +# Strip out the argument added by the OS. +if [ "x`echo "x$1" | sed -e "s/^x-psn_.*//"`" == "x" ]; then + shift 1 +fi + +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_macos/deluge-console-bin" "$@" diff --git a/packaging/osx/deluge-web b/packaging/osx/deluge-web new file mode 100755 index 0000000..e66f550 --- /dev/null +++ b/packaging/osx/deluge-web @@ -0,0 +1,69 @@ +#!/bin/bash + +EXEC="exec" + +name="`basename $0`" +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then + full_path="$0" +else + full_path="`pwd`/$0" +fi +tmp=`dirname "$full_path"` +tmp=`dirname "$tmp"` +bundle=`dirname "$tmp"` +bundle_contents=${bundle%"/Contents"}"/Contents" +bundle_macos="$bundle_contents"/MacOS +bundle_res="$bundle_contents"/Resources +bundle_lib="$bundle_res"/lib +bundle_data="$bundle_res"/share +bundle_etc="$bundle_res"/etc + +export DYLD_FALLBACK_LIBRARY_PATH="$bundle_lib" +export XDG_CONFIG_DIRS="$bundle_etc"/xdg +export XDG_DATA_DIRS="$bundle_data" + +#Set $PYTHON to point inside the bundle +export PYTHON="$bundle_macos/python" +export PYTHONHOME="$bundle_res" +#Add the bundle's python modules +PYTHONPATH="$bundle_lib:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/lib-dynload/:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/:$PYTHONPATH" +export PYTHONPATH + +# Ensure deluged is available by adding macos dir to path. +PATH=$bundle_macos:$PATH + +# We need a UTF-8 locale. +lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null` +if test "$?" != "0"; then + lang=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null | sed 's/_.*//'` +fi +LANG="" +if test "$lang" != ""; then + LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | \ + tail -n1 | sed 's/\./ /' | awk '{print $2}'`" +fi +if test "$LANG" == ""; then + export LANG="C" +else + export LANG="$LANG.utf8" +fi + +if test -f "$bundle_lib/charset.alias"; then + export CHARSETALIASDIR="$bundle_lib" +fi + +# Extra arguments can be added in environment.sh. +EXTRA_ARGS= +if test -f "$bundle_res/environment.sh"; then + source "$bundle_res/environment.sh" +fi + +# Strip out the argument added by the OS. +if [ "x`echo "x$1" | sed -e "s/^x-psn_.*//"`" == "x" ]; then + shift 1 +fi + +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_macos/deluge-web-bin" "$@" diff --git a/packaging/osx/deluge.bundle b/packaging/osx/deluge.bundle new file mode 100644 index 0000000..c4abdfc --- /dev/null +++ b/packaging/osx/deluge.bundle @@ -0,0 +1,43 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<app-bundle> + <meta> + <prefix name="default">${env:JHBUILD_PREFIX}</prefix> + <destination overwrite="yes">app</destination> + <run-install-name-tool/> + <launcher-script>${project}/deluge</launcher-script> + </meta> + <plist>${project}/Info.plist</plist> + <main-binary>${prefix}/bin/deluge-gtk</main-binary> + <binary dest="${bundle}/Contents/MacOS/deluged-bin">${prefix}/bin/deluged</binary> + <binary dest="${bundle}/Contents/MacOS/deluge-web-bin">${prefix}/bin/deluge-web</binary> + <binary dest="${bundle}/Contents/MacOS/deluge-console-bin">${prefix}/bin/deluge-console</binary> + <binary dest="${bundle}/Contents/MacOS">${prefix}/bin/python</binary> + + <!-- not used: binary>${prefix}/lib/${gtkdir}/modules/*.so</binary--> + <binary>${prefix}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so</binary> + <binary>${prefix}/lib/libpyglib-2.0-python.0.dylib</binary> + <binary>${prefix}/lib/libgtk-quartz-2.0.0.dylib</binary> + <binary>${prefix}/lib/libglade-2.0.0.dylib</binary> + <binary>${prefix}/lib/libgtkmacintegration-gtk2.2.dylib</binary> + <binary>${prefix}/lib/librsvg-2.2.dylib</binary> + <binary>${prefix}/lib/pango/1.8.0/modules/pango*.so</binary> + <binary>${prefix}/lib/libboost_system.dylib</binary> + <binary>${prefix}/lib/libboost_python.dylib</binary> + <binary>${prefix}/lib/libtorrent-rasterbar.9.dylib</binary> + <binary>${prefix}/lib/libssl.1.0.0.dylib</binary> + <binary>${prefix}/lib/libz.1.2.8.dylib</binary> + + <data dest="${bundle}/Contents/Resources/">${project}/../../dist/deluge.app/Contents/Resources/</data> + <data>${prefix}/lib/pygtk/2.0/</data> + <!-- gtk theme --> + <binary>${prefix}/lib/${gtkdir}/${pkg:${gtk}:gtk_binary_version}/engines/libclearlooks.so</binary> + <data>${prefix}/share/themes/Clearlooks</data> + <data>${prefix}/share/themes/Mac</data><!-- required for stock accelerators cmd-X etc... --> + <data dest="${bundle}/Contents/Resources/etc/gtk-2.0/gtkrc">${project}/gtkrc</data> + <data dest="${bundle}/Contents/Resources">${project}/deluge.icns</data> + <data dest="${bundle}/Contents/Resources">${project}/torrent.icns</data> + + <data dest="${bundle}/Contents/MacOS/deluged">${project}/deluged</data> + <data dest="${bundle}/Contents/MacOS/deluge-web">${project}/deluge-web</data> + <data dest="${bundle}/Contents/MacOS/deluge-console">${project}/deluge-console</data> +</app-bundle> diff --git a/packaging/osx/deluge.icns b/packaging/osx/deluge.icns Binary files differnew file mode 100644 index 0000000..125a23d --- /dev/null +++ b/packaging/osx/deluge.icns diff --git a/packaging/osx/deluge.modules b/packaging/osx/deluge.modules new file mode 100644 index 0000000..c08180a --- /dev/null +++ b/packaging/osx/deluge.modules @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<!DOCTYPE moduleset SYSTEM "moduleset.dtd"> +<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> +<moduleset> + <repository type="git" name="git.gnome" + href="git://git.gnome.org"/> + <repository type="tarball" name="pypi" + href="http://pypi.python.org/packages/source/"/> + + <metamodule id="deluge"> + <dependencies> + <dep package="libtorrent"/> + <dep package="gtk-mac-bundler"/> + <dep package="deluge-python-deps"/> + </dependencies> + </metamodule> + + <autotools id="gtk-mac-bundler" autogen-template="echo no configure"> + <branch repo="git.gnome" module="gtk-mac-bundler"/> + </autotools> + + <metamodule id="deluge-python-deps"> + <dependencies> + <dep package="setuptools"/> + <dep package="chardet"/> + <dep package="pyopenssl"/> + <dep package="pyxdg"/> + <dep package="py2app"/> + <dep package="mako"/> + <dep package="twisted"/> + </dependencies> + </metamodule> + + <distutils id="setuptools"> + <branch repo="pypi" version="0.6c11" + module="s/setuptools/setuptools-0.6c11.tar.gz"/> + </distutils> + <distutils id="chardet"> + <branch repo="pypi" version="2.1.1" + module="c/chardet/chardet-2.1.1.tar.gz"/> + </distutils> + <distutils id="pyopenssl"> + <branch repo="pypi" version="0.13" + module="p/pyOpenSSL/pyOpenSSL-0.13.tar.gz"/> + </distutils> + <distutils id="pyxdg"> + <branch repo="pypi" version="0.25" + module="p/pyxdg/pyxdg-0.25.tar.gz"/> + </distutils> + <distutils id="py2app"> + <branch repo="pypi" version="0.7.3" + module="p/py2app/py2app-0.7.3.tar.gz"/> + </distutils> + <distutils id="mako"> + <branch repo="pypi" version="0.7.3" + module="M/Mako/Mako-0.7.3.tar.gz"/> + </distutils> + <distutils id="twisted"> + <branch repo="pypi" version="12.3.0" + module="T/Twisted/Twisted-12.3.0.tar.bz2"/> + </distutils> +</moduleset> diff --git a/packaging/osx/deluged b/packaging/osx/deluged new file mode 100755 index 0000000..28cebc0 --- /dev/null +++ b/packaging/osx/deluged @@ -0,0 +1,69 @@ +#!/bin/bash + +EXEC="exec" + +name="`basename $0`" +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then + full_path="$0" +else + full_path="`pwd`/$0" +fi +tmp=`dirname "$full_path"` +tmp=`dirname "$tmp"` +bundle=`dirname "$tmp"` +bundle_contents=${bundle%"/Contents"}"/Contents" +bundle_macos="$bundle_contents"/MacOS +bundle_res="$bundle_contents"/Resources +bundle_lib="$bundle_res"/lib +bundle_data="$bundle_res"/share +bundle_etc="$bundle_res"/etc + +export DYLD_FALLBACK_LIBRARY_PATH="$bundle_lib" +export XDG_CONFIG_DIRS="$bundle_etc"/xdg +export XDG_DATA_DIRS="$bundle_data" + +#Set $PYTHON to point inside the bundle +export PYTHON="$bundle_macos/python" +export PYTHONHOME="$bundle_res" +#Add the bundle's python modules +PYTHONPATH="$bundle_lib:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/lib-dynload/:$PYTHONPATH" +PYTHONPATH="$bundle_lib/python/:$PYTHONPATH" +export PYTHONPATH + +# Ensure deluged is available by adding macos dir to path. +PATH=$bundle_macos:$PATH + +# We need a UTF-8 locale. +lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null` +if test "$?" != "0"; then + lang=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null | sed 's/_.*//'` +fi +LANG="" +if test "$lang" != ""; then + LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | \ + tail -n1 | sed 's/\./ /' | awk '{print $2}'`" +fi +if test "$LANG" == ""; then + export LANG="C" +else + export LANG="$LANG.utf8" +fi + +if test -f "$bundle_lib/charset.alias"; then + export CHARSETALIASDIR="$bundle_lib" +fi + +# Extra arguments can be added in environment.sh. +EXTRA_ARGS= +if test -f "$bundle_res/environment.sh"; then + source "$bundle_res/environment.sh" +fi + +# Strip out the argument added by the OS. +if [ "x`echo "x$1" | sed -e "s/^x-psn_.*//"`" == "x" ]; then + shift 1 +fi + +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_macos/deluged-bin" "$@" diff --git a/packaging/osx/gtkrc b/packaging/osx/gtkrc new file mode 100644 index 0000000..a77430b --- /dev/null +++ b/packaging/osx/gtkrc @@ -0,0 +1,10 @@ +gtk-theme-name = "Clearlooks" +gtk-enable-mnemonics = 0 + +# Workaround for non-ascii display issue details +# here: http://bugs.gramps-project.org/view.php?id=5474 +style "user-font" +{ + font_name="Arial Unicode MS" +} +widget_class "*" style "user-font" diff --git a/packaging/osx/jhbuildrc-custom b/packaging/osx/jhbuildrc-custom new file mode 100644 index 0000000..6899bc5 --- /dev/null +++ b/packaging/osx/jhbuildrc-custom @@ -0,0 +1,32 @@ +# -*- mode: python -*- + +_gtk_osx_use_jhbuild_python = True + +#skip.append("libiconv") # Lion issues +branches["python"] = "http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz" + +modules = [ + "python", + "meta-gtk-osx-bootstrap", + "libglade", + "meta-gtk-osx-python", + "meta-gtk-osx-themes", + "gtk-quartz-engine", +] + +build_policy = "updated-deps" + +# For default operation, set architecture and SDK for the native machine: +_target = None; +if _osx_version >= 7.0: + _target = "10.7" +elif _osx_version >= 6.0: + _target = "10.6" +elif _osx_version >= 5.0: + _target = "10.5" +elif _osx_version >= 4.0: + _target = "10.4" + +setup_sdk(target=_target, sdk_version="native", architectures=[_default_arch]) +#setup_sdk(target="10.6", sdk_version="10.6", architectures=["x86_64"]) +#setup_sdk(target="10.6", sdk_version="10.6", architectures=["i386"]) diff --git a/packaging/osx/launchd/org.deluge-torrent.deluge-web.plist b/packaging/osx/launchd/org.deluge-torrent.deluge-web.plist new file mode 100644 index 0000000..b91fb61 --- /dev/null +++ b/packaging/osx/launchd/org.deluge-torrent.deluge-web.plist @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Label</key> + <string>org.deluge-torrent.deluge-web</string> + <key>ProgramArguments</key> + <array> + <string>/usr/local/bin/deluge-web</string> + <string>-d</string> + <string>-L</string> + <string>error</string> + <string>-l</string> + <string>/var/log/deluge-web.log</string> + </array> + <key>StandardOutPath</key> + <string>/tmp/deluge-web.stdout</string> + <key>StandardErrorPath</key> + <string>/tmp/deluge-web.stderr</string> + <!-- To enable running as 'deluge' user remove comments. + <key>UserName</key> + <string>deluge</string> + --> + <key>RunAtLoad</key> + <true/> + <key>KeepAlive</key> + <true/> +</dict> +</plist> diff --git a/packaging/osx/launchd/org.deluge-torrent.deluged.plist b/packaging/osx/launchd/org.deluge-torrent.deluged.plist new file mode 100644 index 0000000..424399b --- /dev/null +++ b/packaging/osx/launchd/org.deluge-torrent.deluged.plist @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Label</key> + <string>org.deluge-torrent.deluged</string> + <key>ProgramArguments</key> + <array> + <string>/usr/local/bin/deluged</string> + <string>-d</string> + <string>-L</string> + <string>error</string> + <string>-l</string> + <string>/var/log/deluged.log</string> + </array> + <key>StandardOutPath</key> + <string>/tmp/deluged.stdout</string> + <key>StandardErrorPath</key> + <string>/tmp/deluged.stderr</string> + <!-- To enable running as 'deluge' user remove comments. + <key>UserName</key> + <string>deluge</string> + --> + <key>RunAtLoad</key> + <true/> + <key>KeepAlive</key> + <true/> +</dict> +</plist> diff --git a/packaging/osx/libtorrent.modules b/packaging/osx/libtorrent.modules new file mode 100644 index 0000000..66d63f0 --- /dev/null +++ b/packaging/osx/libtorrent.modules @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<!DOCTYPE moduleset SYSTEM "moduleset.dtd"> +<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?> +<moduleset> + <repository type="tarball" name="sourceforge" + href="http://downloads.sourceforge.net/sourceforge/"/> + <repository type="tarball" name="libtorrent" + href="https://github.com/arvidn/libtorrent/archive/"/> + <repository type="tarball" name="openssl" + href="http://www.openssl.org/source/"/> + + <metamodule id="libtorrent"> + <dependencies> + <dep package="openssl"/> + <dep package="boost"/> + <dep package="libtorrent"/> + </dependencies> + </metamodule> + + <autotools id="libtorrent" autogen-sh="autotools.sh" + autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s --with-boost-libdir=%(libdir)s --with-openssl=%(prefix)s --with-libiconv-prefix=%(libdir)s %(autogenargs)s " + autogenargs="--enable-python-binding "> + <branch repo="libtorrent" version="1.0.6" module="RC_1_0.zip"/> + </autotools> + + <!-- openssl libdir is a relative path to prefix! --> + <autotools id="openssl" autogen-sh="Configure" + autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s --libdir=lib darwin64-x86_64-cc shared" + makeinstallargs="install_sw"> + <!--%(autogenargs)s" + autogenargs="darwin-i386-cc shared"> + <!--autogenargs="darwin64-x86_64-cc shared"> + Look into problem with autogenargs introducing extra darwin64-x86_64-cc --> + + <branch repo="openssl" version="1.0.2d" module="openssl-1.0.2d.tar.gz"/> + </autotools> + + <autotools id="boost" autogen-sh="bootstrap.sh" + autogen-template="%(srcdir)s/%(autogen-sh)s --prefix=%(prefix)s --libdir=%(libdir)s --with-python=%(prefix)s/bin/python --with-icu=%(prefix)s --with-libraries=system,python" + supports-non-srcdir-builds="false" + makeargs="|| ./b2" + makeinstallargs="|| ./b2 install"> + <branch repo="sourceforge" version="1.59.0" module="boost/boost_1_59_0.tar.bz2"/> + </autotools> +</moduleset> diff --git a/packaging/osx/make-app b/packaging/osx/make-app new file mode 100644 index 0000000..9489f6c --- /dev/null +++ b/packaging/osx/make-app @@ -0,0 +1,49 @@ +#!/bin/bash + +APPDIR="./app/Deluge.app" +RSCDIR="${APPDIR}/Contents/Resources" +LIBDIR="${RSCDIR}/lib" +VERSION=$(cat ../../RELEASE-VERSION) +YEAR=$(date +'%Y') + +function msg() { echo "==> $1"; } + +echo "*** Packaging Deluge.app to $APPDIR..." + +msg "Clearing app dir" +rm -fr $APPDIR + +msg "Fixing permissions on file we will need to relocate" +if [ ! -z "${JHBUILD_PREFIX}" ]; then + chmod 755 "${JHBUILD_PREFIX}/lib/"libpython*.dylib + chmod 755 "${JHBUILD_PREFIX}/lib/"libssl*.dylib + chmod 755 "${JHBUILD_PREFIX}/lib/"libcrypto*.dylib +fi + +chmod 755 deluge deluge-web deluge-console deluged + +msg "Create Info.plist for Deluge $version" +sed -e s/%VERSION%/$VERSION/ -e s/%YEAR%/$YEAR/ Info.plist.in > Info.plist + +msg "Calling gtk-mac-bundler" +gtk-mac-bundler deluge.bundle + +msg "Unzip site-packages and make python softlink without version number" +pushd ${LIBDIR} || exit 1 +ln -sf python* python +cd python +unzip -nq site-packages.zip +rm site-packages.zip +popd + +msg "Replacing deluge by its egg..." +rm -fr ${LIBDIR}/python/deluge +rsync -rpl $JHBUILD_PREFIX/lib/python2.7/site-packages/deluge-*.egg "${LIBDIR}/python/" + +msg "Clean unnecessary files" +find $APPDIR -name "*.la" -exec rm -f {} \; # Should not be packaged +find $APPDIR -name "*.pyo" -exec rm -f {} \; # Just duplicates +find $LIBDIR/python/deluge-*.egg -name "*.py" -exec rm -f {} \; # Remove source files, leaving compiled only. +rm -fr $LIBDIR/pygtk/2.0/*demo* + +echo "*** Packaging done:`du -hs $APPDIR | cut -f 1`" diff --git a/packaging/osx/torrent.icns b/packaging/osx/torrent.icns Binary files differnew file mode 100644 index 0000000..a6f9040 --- /dev/null +++ b/packaging/osx/torrent.icns diff --git a/packaging/source/make_release.py b/packaging/source/make_release.py new file mode 100755 index 0000000..277d1ce --- /dev/null +++ b/packaging/source/make_release.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# +# Copyright 2014 Calum Lind <calumlind@gmail.com> +# +# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with +# the additional special exception to link portions of this program with the OpenSSL library. +# See LICENSE for more details. +# +import os.path +from hashlib import sha256 +from subprocess import call, check_output + +sdist_formats = 'xztar' + +version = check_output(['python', 'version.py']).strip().decode() + +# Create release archive +release_dir = 'dist/release-%s' % version +print('Creating release archive for ' + version) + +call( + 'python setup.py --quiet egg_info --egg-base /tmp sdist --formats=%s --dist-dir=%s' + % (sdist_formats, release_dir), + shell=True, +) + + +if sdist_formats == 'xztar': + tarxz_path = os.path.join(release_dir, 'deluge-%s.tar.xz' % version) +else: + # Compress release archive with xz + tar_path = os.path.join(release_dir, 'deluge-%s.tar' % version) + tarxz_path = tar_path + '.xz' + print('Compressing tar (%s) with xz' % tar_path) + try: + from backports import lzma + except ImportError: + print('backports.lzma not installed, falling back to xz shell command') + call(['xz', '-e9zkf', tar_path]) + else: + with open(tar_path, 'rb') as tar_file, open(tarxz_path, 'wb') as xz_file: + xz_file.write( + lzma.compress(bytes(tar_file.read()), preset=9 | lzma.PRESET_EXTREME) + ) + +# Calculate shasum and add to sha256sums.txt +with open(tarxz_path, 'rb') as _file: + sha256sum = '{} {}'.format( + sha256(_file.read()).hexdigest(), + os.path.basename(tarxz_path), + ) +with open(os.path.join(release_dir, 'sha256sums.txt'), 'w') as _file: + _file.write(sha256sum + '\n') + +print('Complete: %s' % release_dir) diff --git a/packaging/win/README.md b/packaging/win/README.md new file mode 100644 index 0000000..272792c --- /dev/null +++ b/packaging/win/README.md @@ -0,0 +1,34 @@ += Deluge Installer for Windows = + +Instructions for building the Deluge NSIS Installer for Windows Vista/7/8/8.1/10/11. + +== Dependencies == + +- Deluge build: https://deluge.readthedocs.io/en/latest/depends.html +- PyInstaller: https://pypi.org/project/pyinstaller/ +- NSIS: http://nsis.sourceforge.net/Download + +== Build Steps == + +1. Build and Install Deluge on Windows. +2. Run pyinstaller from the deluge\packaging\win directory: + + `pyinstaller --clean delugewin.spec --distpath freeze` + + The result is a PyInstaller version of Deluge in `packaging\win\freeze`. + +3. Run the NSIS scripts: + + `python setup_nsis.py` + + 64-bit python: + + `makensis /Darch=x64 deluge-win-installer.nsi` + + 32-bit python: + + `makensis /Darch=x86 deluge-win-installer.nsi` + + Note: If you don't specify arch defaults to trying x64 + +The result is a standalone installer in the `packaging\win` directory. diff --git a/packaging/win/deluge-win-installer.nsi b/packaging/win/deluge-win-installer.nsi new file mode 100644 index 0000000..1f9c2e2 --- /dev/null +++ b/packaging/win/deluge-win-installer.nsi @@ -0,0 +1,234 @@ +# Deluge Windows installer script +# +# Copyright (C) 2009 Jesper Lund <mail@jesperlund.com> +# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com> +# Copyright (C) 2009 John Garland <johnnybg@gmail.com> +# +# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later. +# See LICENSE for more details. +# + +# Script version; displayed when running the installer +!define DELUGE_INSTALLER_VERSION "2.0" + +# Deluge program information +!define PROGRAM_NAME "Deluge" +# Detect version from file +!searchparse /file VERSION.tmp `build_version = "` PROGRAM_VERSION `"` +!ifndef PROGRAM_VERSION + !error "Program Version Undefined" +!endif +!define PROGRAM_WEB_SITE "http://deluge-torrent.org" +!define LICENSE_FILEPATH "..\..\LICENSE" + +!include FileFunc.nsh + +!ifndef arch +!define INSTALLER_FILENAME "deluge-${PROGRAM_VERSION}-win64-setup.exe" +!endif +!If "${arch}" == "x64" +!define INSTALLER_FILENAME "deluge-${PROGRAM_VERSION}-win64-setup.exe" +!EndIf +!If "${arch}" == "x86" +!define INSTALLER_FILENAME "deluge-${PROGRAM_VERSION}-win32-setup.exe" +!EndIf + +# Set default compressor +SetCompressor /FINAL /SOLID lzma +SetCompressorDictSize 64 + +# --- Interface settings --- +# Modern User Interface 2 +!include MUI2.nsh +# Installer +!define MUI_ICON "..\..\deluge\ui\data\pixmaps\deluge.ico" +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_RIGHT +!define MUI_HEADERIMAGE_BITMAP "installer-top.bmp" +!define MUI_WELCOMEFINISHPAGE_BITMAP "installer-side.bmp" +!define MUI_COMPONENTSPAGE_SMALLDESC +!define MUI_FINISHPAGE_NOAUTOCLOSE +!define MUI_ABORTWARNING +# Start Menu Folder Page Configuration +!define MUI_STARTMENUPAGE_DEFAULTFOLDER ${PROGRAM_NAME} +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCR" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Deluge" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" +# Uninstaller +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" +!define MUI_HEADERIMAGE_UNBITMAP "installer-top.bmp" +!define MUI_WELCOMEFINISHPAGE_UNBITMAP "installer-side.bmp" +!define MUI_UNFINISHPAGE_NOAUTOCLOSE + +!define MUI_FINISHPAGE_SHOWREADME "" +!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED +!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" +!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction + +# --- Start of Modern User Interface --- +Var StartMenuFolder +# Welcome, License & Components pages +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE ${LICENSE_FILEPATH} +!insertmacro MUI_PAGE_COMPONENTS +# Let the user select the installation directory +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder +# Run installation +!insertmacro MUI_PAGE_INSTFILES +# Display 'finished' page +!insertmacro MUI_PAGE_FINISH +# Uninstaller pages +!insertmacro MUI_UNPAGE_INSTFILES +# Language files +!insertmacro MUI_LANGUAGE "English" + + +# --- Functions --- + +# Check for running Deluge instance. +Function .onInit + System::Call 'kernel32::OpenMutex(i 0x100000, b 0, t "deluge") i .R0' + IntCmp $R0 0 notRunning + System::Call 'kernel32::CloseHandle(i $R0)' + MessageBox MB_OK|MB_ICONEXCLAMATION "Deluge is running. Please close it first" /SD IDOK + Abort + notRunning: +FunctionEnd + +Function un.onUninstSuccess + HideWindow + MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." /SD IDOK +FunctionEnd + +Function un.onInit + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to completely remove $(^Name)?" /SD IDYES IDYES +2 + Abort +FunctionEnd + +Function finishpageaction + CreateShortCut "$DESKTOP\Deluge.lnk" "$INSTDIR\deluge.exe" +FunctionEnd + +# --- Installation sections --- +!define PROGRAM_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROGRAM_NAME}" +!define PROGRAM_UNINST_ROOT_KEY "HKLM" +!define PROGRAM_UNINST_FILENAME "$INSTDIR\deluge-uninst.exe" + +BrandingText "${PROGRAM_NAME} Windows Installer v${DELUGE_INSTALLER_VERSION}" +Name "${PROGRAM_NAME} ${PROGRAM_VERSION}" +OutFile "${INSTALLER_FILENAME}" + +!ifndef arch +InstallDir "$PROGRAMFILES64\Deluge" +!endif +!If "${arch}" == "x64" +InstallDir "$PROGRAMFILES64\Deluge" +!endIf +!If "${arch}" == "x86" +InstallDir "$PROGRAMFILES32\Deluge" +!endIf + +ShowInstDetails show +ShowUnInstDetails show + +# Install main application +Section "Deluge Bittorrent Client" Section1 + SectionIn RO + !include "install_files.nsh" + + SetOverwrite ifnewer + SetOutPath "$INSTDIR" + File ${LICENSE_FILEPATH} + WriteIniStr "$INSTDIR\homepage.url" "InternetShortcut" "URL" "${PROGRAM_WEB_SITE}" + + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + SetShellVarContext all + CreateDirectory "$SMPROGRAMS\$StartMenuFolder" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Deluge.lnk" "$INSTDIR\deluge.exe" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Website.lnk" "$INSTDIR\homepage.url" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall Deluge.lnk" ${PROGRAM_UNINST_FILENAME} + !insertmacro MUI_STARTMENU_WRITE_END +SectionEnd + +# Create .torrent file association. +Section "Associate .torrent files with Deluge" Section2 + DeleteRegKey HKCR ".torrent" + WriteRegStr HKCR ".torrent" "" "Deluge" + WriteRegStr HKCR ".torrent" "Content Type" "application/x-bittorrent" + + DeleteRegKey HKCR "Deluge" + WriteRegStr HKCR "Deluge" "" "Deluge" + WriteRegStr HKCR "Deluge\Content Type" "" "application/x-bittorrent" + WriteRegStr HKCR "Deluge\DefaultIcon" "" "$INSTDIR\deluge.exe,0" + WriteRegStr HKCR "Deluge\shell" "" "open" + WriteRegStr HKCR "Deluge\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"' +SectionEnd + +# Create magnet uri association. +Section "Associate Magnet URI links with Deluge" Section3 + DeleteRegKey HKCR "Magnet" + WriteRegStr HKCR "Magnet" "" "URL:Magnet Protocol" + WriteRegStr HKCR "Magnet" "URL Protocol" "" + WriteRegStr HKCR "Magnet\shell\open\command" "" '"$INSTDIR\deluge.exe" "%1"' +SectionEnd + +LangString DESC_Section1 ${LANG_ENGLISH} "Install Deluge Bittorrent client." +LangString DESC_Section2 ${LANG_ENGLISH} "Select this option to let Deluge handle the opening of .torrent files." +LangString DESC_Section3 ${LANG_ENGLISH} "Select this option to let Deluge handle Magnet URI links from the web-browser." + +!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_FUNCTION_DESCRIPTION_END + +# Create uninstaller. +Section -Uninstaller + WriteUninstaller ${PROGRAM_UNINST_FILENAME} + WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayName" "$(^Name)" + WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "DisplayVersion" ${PROGRAM_VERSION} + WriteRegStr ${PROGRAM_UNINST_ROOT_KEY} "${PROGRAM_UNINST_KEY}" "UninstallString" ${PROGRAM_UNINST_FILENAME} +SectionEnd + +# --- Uninstallation section --- +Section Uninstall + # Delete Deluge files. + Delete "$INSTDIR\LICENSE" + Delete "$INSTDIR\homepage.url" + Delete ${PROGRAM_UNINST_FILENAME} + !include "uninstall_files.nsh" + + # Delete Start Menu items. + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + SetShellVarContext all + Delete "$SMPROGRAMS\$StartMenuFolder\Deluge.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Website.lnk" + Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall Deluge.lnk" + RmDir "$SMPROGRAMS\$StartMenuFolder" + DeleteRegKey /ifempty HKCR "Software\Deluge" + + Delete "$DESKTOP\Deluge.lnk" + + # Delete registry keys. + 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 + +# Add version info to installer properties. +VIProductVersion "${DELUGE_INSTALLER_VERSION}.0.0" +VIAddVersionKey ProductName ${PROGRAM_NAME} +VIAddVersionKey Comments "Deluge Bittorrent Client" +VIAddVersionKey CompanyName "Deluge Team" +VIAddVersionKey LegalCopyright "Deluge Team" +VIAddVersionKey FileDescription "${PROGRAM_NAME} Application Installer" +VIAddVersionKey FileVersion "${DELUGE_INSTALLER_VERSION}.0.0" +VIAddVersionKey ProductVersion "${PROGRAM_VERSION}.0" +VIAddVersionKey OriginalFilename ${INSTALLER_FILENAME} diff --git a/packaging/win/delugewin.spec b/packaging/win/delugewin.spec new file mode 100644 index 0000000..b6b5573 --- /dev/null +++ b/packaging/win/delugewin.spec @@ -0,0 +1,183 @@ +# -*- mode: python -*- +import os + +from PyInstaller.utils.hooks import ( + collect_data_files, + collect_submodules, + copy_metadata, +) + +datas = [] +binaries = [] +hiddenimports = ['pygame', 'ifaddr'] + +# Collect Meta Data +datas += copy_metadata('deluge', recursive=True) +datas += copy_metadata('service-identity', recursive=True) + +# Add Deluge Hidden Imports +hiddenimports += collect_submodules('deluge') + +# Add stdlib as Hidden Imports. +# This is filtered list that excludes some common examples or stuff not useful in +# plugins (such as tty, mailbox, turtledemo etc.). +# It is safe to assume that 90% of that list would already be included anyway. +stdlib = [ + 'string', + 're', + 'unicodedata', + 'struct', + 'codecs', + 'datetime', + 'zoneinfo', + 'calendar', + 'collections', + 'array', + 'weakref', + 'types', + 'copy', + 'enum', + 'numbers', + 'math', + 'cmath', + 'decimal', + 'fractions', + 'random', + 'statistics', + 'itertools', + 'functools', + 'operator', + 'pathlib', + 'fileinput', + 'stat', + 'tempfile', + 'glob', + 'fnmatch', + 'shutil', + 'pickle', + 'copyreg', + 'shelve', + 'marshal', + 'dom', + 'sqlite3', + 'zlib', + 'gzip', + 'bz2', + 'lzma', + 'csv', + 'hashlib', + 'hmac', + 'secrets', + 'os', + 'io', + 'time', + 'logging', + 'platform', + 'errno', + 'queue', + 'socket', + 'ssl', + 'email', + 'json', + 'mimetypes', + 'base64', + 'binhex', + 'binascii', + 'quopri', + 'uu', + 'html', + 'xml', + 'urllib', + 'http', + 'ftplib', + 'smtplib', + 'uuid', + 'xmlrpc.client', + 'ipaddress', + 'locale', + 'sys', +] +for module in stdlib: + hiddenimports += collect_submodules(module, filter=lambda name: 'test' not in name) + +# Add Hidden Imports for Plugins +hiddenimports += collect_submodules('twisted', filter=lambda name: 'test' not in name) +datas += copy_metadata('twisted', recursive=True) + +# Copy UI/Plugin and translation files to where pyinstaller expects +package_data = collect_data_files('deluge') +datas += package_data + +icon = [src for src, dest in package_data if src.endswith('deluge.ico')][0] + +# List of executables to produce +executables = { + 'deluge-script.pyw': {'name': 'deluge', 'console': False, 'gtk': True}, + 'deluge-gtk-script.pyw': {'name': 'deluge-gtk', 'console': False, 'gtk': True}, + 'deluge-debug-script.py': {'name': 'deluge-debug', 'console': True, 'gtk': True}, + 'deluge-console-script.py': { + 'name': 'deluge-console', + 'console': True, + 'gtk': False, + }, + 'deluged-script.pyw': {'name': 'deluged', 'console': False, 'gtk': False}, + 'deluged-debug-script.py': {'name': 'deluged-debug', 'console': True, 'gtk': False}, + 'deluge-web-debug-script.py': { + 'name': 'deluge-web-debug', + 'console': True, + 'gtk': False, + }, + 'deluge-web-script.pyw': {'name': 'deluge-web', 'console': False, 'gtk': False}, +} + +analysis = {} +exe = {} +coll = [] + +# Perform analysis +for e, d in executables.items(): + runtime_hooks = [] + if d['gtk']: + runtime_hooks += [os.path.join(SPECPATH, 'pyi_rth_gtk_csd.py')] + + analysis[e] = Analysis( + [os.path.abspath(os.path.join(HOMEPATH, os.pardir, os.pardir, 'Scripts', e))], + pathex=[], + binaries=binaries, + datas=datas, + hiddenimports=hiddenimports, + hookspath=[], + hooksconfig={}, + runtime_hooks=runtime_hooks, + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=None, + noarchive=False, + ) + +# Executable +for e, d in executables.items(): + exe[e] = EXE( + PYZ(analysis[e].pure, analysis[e].zipped_data, cipher=None), + analysis[e].scripts, + [], + exclude_binaries=True, + name=d['name'], + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + icon=icon, + console=d['console'], + disable_windowed_traceback=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, + ) + +# Collect +for e, d in executables.items(): + coll += exe[e], analysis[e].binaries, analysis[e].zipfiles, analysis[e].datas + +COLLECT(*coll, strip=False, upx=True, upx_exclude=[], name='Deluge') diff --git a/packaging/win/installer-side.bmp b/packaging/win/installer-side.bmp Binary files differnew file mode 100644 index 0000000..58c2bed --- /dev/null +++ b/packaging/win/installer-side.bmp diff --git a/packaging/win/installer-top.bmp b/packaging/win/installer-top.bmp Binary files differnew file mode 100644 index 0000000..1e1a94c --- /dev/null +++ b/packaging/win/installer-top.bmp diff --git a/packaging/win/pyi_rth_gtk_csd.py b/packaging/win/pyi_rth_gtk_csd.py new file mode 100644 index 0000000..345122d --- /dev/null +++ b/packaging/win/pyi_rth_gtk_csd.py @@ -0,0 +1,3 @@ +import os + +os.environ['GTK_CSD'] = os.getenv('GTK_CSD', '0') diff --git a/packaging/win/setup_nsis.py b/packaging/win/setup_nsis.py new file mode 100644 index 0000000..f34a941 --- /dev/null +++ b/packaging/win/setup_nsis.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# +# Copyright (C) 2012-2015 Calum Lind <calumlind@gmail.com> +# Copyright (C) 2010 Damien Churchill <damoxc@gmail.com> +# Copyright (C) 2009-2010 Andrew Resch <andrewresch@gmail.com> +# Copyright (C) 2009 Jesper Lund <mail@jesperlund.com> +# +# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with +# the additional special exception to link portions of this program with the OpenSSL library. +# See LICENSE for more details. +# + +import os + +import deluge.common + +# Get build_version from installed deluge. +build_version = deluge.common.get_version() +build_dir = os.path.join('freeze', 'Deluge') + +# Copy version info to file for nsis script. +with open('VERSION.tmp', 'w') as ver_file: + ver_file.write('build_version = "%s"' % build_version) + +# Create the install and uninstall file list for NSIS. +filedir_list = [] +for root, dirnames, filenames in os.walk(build_dir): + dirnames.sort() + filenames.sort() + filedir_list.append((root[len(build_dir) :], filenames)) + +with open('install_files.nsh', 'w') as f: + f.write('; Files to install\n') + for dirname, files in filedir_list: + if not dirname: + dirname = os.sep + f.write('\nSetOutPath "$INSTDIR%s"\n' % dirname) + for filename in files: + f.write('File ' + build_dir + os.path.join(dirname, filename) + '\n') + +with open('uninstall_files.nsh', 'w') as f: + f.write('; Files to uninstall\n') + for dirname, files in reversed(filedir_list): + f.write('\n') + if not dirname: + dirname = os.sep + for filename in files: + f.write('Delete "$INSTDIR%s"\n' % os.path.join(dirname, filename)) + f.write('RMDir "$INSTDIR%s"\n' % dirname) |