From fff75b51ce98a37794f25379da1f120a12a2344f Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 19 Feb 2014 17:13:04 +0000 Subject: [PATCH] [#2373] [OSX] Fix laucher scripts for single leading slash path On Mavericks the application path passed to scripts only has single leading slash compared to previous double slash. Renamed and changed shebang to bash to prevent any issues. Updated README to rst format for display in trac wiki. --- osx/README.md | 119 -------------------- osx/README.rst | 127 ++++++++++++++++++++++ osx/{deluge.sh => deluge} | 10 +- osx/{deluge-console.sh => deluge-console} | 11 +- osx/{deluge-web.sh => deluge-web} | 11 +- osx/deluge.bundle | 8 +- osx/{deluged.sh => deluged} | 11 +- osx/{make-app.sh => make-app} | 4 +- 8 files changed, 149 insertions(+), 152 deletions(-) delete mode 100644 osx/README.md create mode 100644 osx/README.rst rename osx/{deluge.sh => deluge} (88%) rename osx/{deluge-console.sh => deluge-console} (86%) rename osx/{deluge-web.sh => deluge-web} (83%) rename osx/{deluged.sh => deluged} (83%) rename osx/{make-app.sh => make-app} (94%) diff --git a/osx/README.md b/osx/README.md deleted file mode 100644 index 1f00d3898..000000000 --- a/osx/README.md +++ /dev/null @@ -1,119 +0,0 @@ -# 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][1] environment - -Quick how-to *(from the full [GTK-OSX building][2] instructions)* - -1. Create a dedicated user account and use it for all the next steps: - - *Note*: I'm using `gtk` login with `/opt/gtk` as home an jhbuild prefix - - sudo su - gtk - cat << EOF > ~/.profile - export PATH=~/.local/bin:~/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/git/bin - EOF - . ~/.profile - -2. 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 - -3. Link or copy deluge osx jhbuildrc-custom: - - *Note*: This setup builds only for `x86_64` arch to `/opt/gtk` - prefix, feel free to edit - - ln -sf deluge/osx/jhbuildrc-custom ~/.jhbuildrc-custom - -4. 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 (#4), 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 (#1) - -5. Build the deluge moduleset: *(takes a while...)* - - *Note*: This jhbuild moduleset *should* build and install all deluge - dependencies not available in gtk-osx - - jhbuild -m deluge/osx/deluge.modules build deluge - -## 3. Build Deluge.app - -1. Always do your custom build operations under a jhbuild shell: - - jhbuild shell - -2. Cleanup: - - python setup.py clean -a - -3. Build and install: - - python setup.py py2app - python setup.py install - -4. Build app to `deluge/osx/app/Deluge.app`: - - cd osx - ./make-app.sh - -You *should* have now 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. Alternatively, you can enable python -log by uncommenting the end of script `Deluge.app/Contents/MacOS/Deluge` - -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/osx/README.rst b/osx/README.rst new file mode 100644 index 000000000..781b14b58 --- /dev/null +++ b/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/osx/deluge.sh b/osx/deluge similarity index 88% rename from osx/deluge.sh rename to osx/deluge index 33b7e6fb8..adac78f75 100755 --- a/osx/deluge.sh +++ b/osx/deluge @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash EXEC="exec" name="`basename $0`" -if [[ "$0" == `pwd`* ]] || [[ "$0" == "//"* ]]; then +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then full_path="$0" else full_path="`pwd`/$0" @@ -15,7 +15,6 @@ bundle_contents="$bundle"/Contents bundle_macos="$bundle_contents"/MacOS bundle_res="$bundle_contents"/Resources bundle_lib="$bundle_res"/lib -bundle_bin="$bundle_res"/bin bundle_data="$bundle_res"/share bundle_etc="$bundle_res"/etc @@ -74,6 +73,5 @@ 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 in -#pygtk-demo's shebang. -$EXEC "$PYTHON" "$bundle_contents/MacOS/Deluge-bin" "$@" #-l ~/.config/deluge/app.log -L debug +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_contents/MacOS/Deluge-bin" "$@" diff --git a/osx/deluge-console.sh b/osx/deluge-console similarity index 86% rename from osx/deluge-console.sh rename to osx/deluge-console index 9c07e4c10..05d020f09 100755 --- a/osx/deluge-console.sh +++ b/osx/deluge-console @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash EXEC="exec" name="`basename $0`" -if [[ "$0" == `pwd`* ]] || [[ "$0" == "//"* ]]; then +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then full_path="$0" else full_path="`pwd`/$0" @@ -15,7 +15,6 @@ bundle_contents="$bundle"/Contents bundle_macos="$bundle_contents"/MacOS bundle_res="$bundle_contents"/Resources bundle_lib="$bundle_res"/lib -bundle_bin="$bundle_res"/bin bundle_data="$bundle_res"/share bundle_etc="$bundle_res"/etc @@ -30,7 +29,6 @@ export PYTHONHOME="$bundle_res" 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 # We need a UTF-8 locale. @@ -64,6 +62,5 @@ 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 in -#pygtk-demo's shebang. -$EXEC "$PYTHON" "$bundle_contents/MacOS/deluge-console-bin" "$@" #-l ~/.config/deluge/console.log -L debug +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_contents/MacOS/deluge-console-bin" "$@" diff --git a/osx/deluge-web.sh b/osx/deluge-web similarity index 83% rename from osx/deluge-web.sh rename to osx/deluge-web index d71603098..510069ca2 100755 --- a/osx/deluge-web.sh +++ b/osx/deluge-web @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash EXEC="exec" name="`basename $0`" -if [[ "$0" == `pwd`* ]] || [[ "$0" == "//"* ]]; then +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then full_path="$0" else full_path="`pwd`/$0" @@ -15,7 +15,6 @@ bundle_contents="$bundle"/Contents bundle_macos="$bundle_contents"/MacOS bundle_res="$bundle_contents"/Resources bundle_lib="$bundle_res"/lib -bundle_bin="$bundle_res"/bin bundle_data="$bundle_res"/share bundle_etc="$bundle_res"/etc @@ -30,7 +29,6 @@ export PYTHONHOME="$bundle_res" 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 # We need a UTF-8 locale. @@ -64,6 +62,5 @@ 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 in -#pygtk-demo's shebang. -$EXEC "$PYTHON" "$bundle_contents/MacOS/deluge-web-bin" "$@" #-l ~/.config/deluge/web.log -L debug +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_contents/MacOS/deluge-web-bin" "$@" diff --git a/osx/deluge.bundle b/osx/deluge.bundle index 324c9db78..e13d8c8b0 100644 --- a/osx/deluge.bundle +++ b/osx/deluge.bundle @@ -4,7 +4,7 @@ ${env:JHBUILD_PREFIX} app - ${project}/deluge.sh + ${project}/deluge ${project}/Info.plist ${prefix}/bin/deluge-gtk @@ -38,7 +38,7 @@ ${project}/deluge.icns ${project}/torrent.icns - ${project}/deluged.sh - ${project}/deluge-web.sh - ${project}/deluge-console.sh + ${project}/deluged + ${project}/deluge-web + ${project}/deluge-console diff --git a/osx/deluged.sh b/osx/deluged similarity index 83% rename from osx/deluged.sh rename to osx/deluged index e916b7387..011dbb745 100755 --- a/osx/deluged.sh +++ b/osx/deluged @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash EXEC="exec" name="`basename $0`" -if [[ "$0" == `pwd`* ]] || [[ "$0" == "//"* ]]; then +if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then full_path="$0" else full_path="`pwd`/$0" @@ -15,7 +15,6 @@ bundle_contents="$bundle"/Contents bundle_macos="$bundle_contents"/MacOS bundle_res="$bundle_contents"/Resources bundle_lib="$bundle_res"/lib -bundle_bin="$bundle_res"/bin bundle_data="$bundle_res"/share bundle_etc="$bundle_res"/etc @@ -30,7 +29,6 @@ export PYTHONHOME="$bundle_res" 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 # We need a UTF-8 locale. @@ -64,6 +62,5 @@ 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 in -#pygtk-demo's shebang. -$EXEC "$PYTHON" "$bundle_contents/MacOS/deluged-bin" "$@" #-l ~/.config/deluge/deluged.log -L debug +# Note that we're calling $PYTHON here to override the version used. +$EXEC "$PYTHON" "$bundle_contents/MacOS/deluged-bin" "$@" diff --git a/osx/make-app.sh b/osx/make-app similarity index 94% rename from osx/make-app.sh rename to osx/make-app index 297842b5c..19062ce45 100755 --- a/osx/make-app.sh +++ b/osx/make-app @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash APPDIR="./app/Deluge.app" RSCDIR="${APPDIR}/Contents/Resources" @@ -18,7 +18,7 @@ if [ ! -z "${JHBUILD_PREFIX}" ]; then chmod 755 "${JHBUILD_PREFIX}/lib/"libcrypto*.dylib fi -chmod 755 deluge*.sh +chmod 755 deluge deluge-web deluge-console deluged msg "Calling gtk-mac-bundler" gtk-mac-bundler deluge.bundle