Ticket #48363: patch-osxapp.3.diff

File patch-osxapp.3.diff, 11.9 KB (added by mdeaudelin (Mathieu Deaudelin-Lemay), 9 years ago)

Updated offsets so the patch continues to apply cleanly.

  • Makefile.am

    # Changed Makefile to install app bundle in the proper location
    # and to provide the install prefix to the osx-app.sh script.
    
    diff -uNrw Makefile.am.orig Makefile.am
    old new  
    15841584                cd $(srcdir)/packaging/macosx ; \
    15851585                ./osx-app.sh @OSX_APP_FLAGS@ \
    15861586                        --create-bundle \
     1587                        -l ${prefix} \
    15871588                        --binary-path ../staging/$(PACKAGE).inst$(bindir) ; \
    15881589        else \
    15891590                echo "Error: OS X packaging tools not found." ; \
     
    16031604
    16041605osx-install: osx-app
    16051606        @if test x$(HAVE_OSX_PACKAGING) = xyes ; then \
    1606                 echo "Copying Wireshark.app to /Applications" ; \
    1607                 cp -pr $(srcdir)/packaging/macosx/Wireshark.app /Applications ; \
     1607                echo "Copying Wireshark.app to $(APPLICATIONS_DIR)" ; \
     1608                cp -pPR $(srcdir)/packaging/macosx/Wireshark.app $(DESTDIR)$(APPLICATIONS_DIR) ; \
    16081609        fi
    16091610
    16101611test-programs:
  • Makefile.in

    diff -uNrw Makefile.in.orig Makefile.in
    old new  
    42944294                cd $(srcdir)/packaging/macosx ; \
    42954295                ./osx-app.sh @OSX_APP_FLAGS@ \
    42964296                        --create-bundle \
     4297                        -l ${prefix} \
    42974298                        --binary-path ../staging/$(PACKAGE).inst$(bindir) ; \
    42984299        else \
    42994300                echo "Error: OS X packaging tools not found." ; \
     
    43134314
    43144315osx-install: osx-app
    43154316        @if test x$(HAVE_OSX_PACKAGING) = xyes ; then \
    4316                 echo "Copying Wireshark.app to /Applications" ; \
    4317                 cp -pr $(srcdir)/packaging/macosx/Wireshark.app /Applications ; \
     4317                echo "Copying Wireshark.app to $(APPLICATIONS_DIR)" ; \
     4318                cp -pPR $(srcdir)/packaging/macosx/Wireshark.app $(DESTDIR)$(APPLICATIONS_DIR) ; \
    43184319        fi
    43194320
    43204321test-programs:
  • packaging/macosx/osx-app.sh

    # Change the script to build an application bundle which contains only
    # symbolic links to the executables in their locations under $prefix.
    
    diff -uNrw packaging/macosx/osx-app.sh.orig packaging/macosx/osx-app.sh
    old new  
    227209                EXTRALIBS=""
    228210        fi
    229211
     212        # Force building in 32-bit.
     213        XCODEFLAGS="$XCODEFLAGS -arch i386"
     214
    230215        # Set the SDK root, if an SDK was specified.
    231216        # (-sdk is only supported by the xcodebuild in the version of the
    232217        # developer tools that came with Snow Leopard and later versions)
     
    265250        mkdir -p "$pkgplugin"
    266251
    267252        if [ "$ui_toolkit" = "qt" ] ; then
    268                 cp -v "$binary_path/$wireshark_bin_name" "$pkgexec/Wireshark"
     253                ln -sv "$LIBPREFIX/bin/$wireshark_bin_name" "$pkgexec/Wireshark"
    269254        else
    270255        # Build and add the launcher
    271256        #----------------------------------------------------------
     
    290275                for binary in $binary_list wireshark ; do
    291276                        # Copy the binary to its destination
    292277                        dest_path="$pkgbin/$binary-bin"
    293                         cs_binary_list="$cs_binary_list $dest_path"
    294                         cp -v "$binary_path/$binary" "$dest_path"
    295                         # TODO Add a "$verbose" variable and command line switch, which sets wether these commands are verbose or not
     278                        # wireshark-bin is wireshark-gtk
     279                        [ "$binary" = "wireshark" ] && binary=$wireshark_bin_name
     280
     281                        ln -sv "$LIBPREFIX/bin/$binary" "$dest_path"
    296282
    297283                        if [ "$binary" != "wireshark" ] ; then
    298284                                ln -sv ./wireshark "$pkgbin/$binary"
     
    300286                done
    301287        elif [ "$ui_toolkit" = "qt" ] ; then
    302288                for binary in $binary_list ; do
    303                         # Copy the binary to its destination
    304                         cp -v "$binary_path/$binary" "$pkgexec"
    305                         cs_binary_list="$cs_binary_list $pkgexec/$binary"
     289                        ln -sv "$LIBPREFIX/bin/$binary" "$pkgexec/"
    306290                done
    307291        fi
    308292
    309         # The rest of the Wireshark installation (we handled bin above)
    310         rsync -av \
    311                 --exclude bin/ \
    312                 --exclude lib/ \
    313                 "$binary_path/.."/* "$pkgres"
     293        # Symlink each item that would have been copied to the Resources folder.
     294        mkdir -p "$pkgres/"
     295        for rsrcdir in "$(find "$binary_path/../" -depth 1 \! -name bin \! -name lib)"; do
     296                ln -sv "$LIBPREFIX/$(basename "$rsrcdir")" "$pkgres/"
     297        done
    314298
    315         rsync -av $binary_path/../lib/*.dylib "$pkglib/"
     299        # Don't copy libraries, symlink Frameworks (or Resources/lib) to $LIBPREFIX/lib.
     300        ln -sfv "$LIBPREFIX/lib" "$pkglib"
    316301
    317         # Copy the plugins from the "make install" location for them
    318         # to the plugin directory, removing the version number
    319         find "$binary_path/../lib/wireshark/plugins" \
    320                 -type f \
    321                 \( -name "*.so" -o -name "*.dylib" \) \
    322                 -exec cp -fv "{}" "$pkgplugin/" \;
     302        # Symlink ${bundle}/Contents/PlugIns to ${prefix}/lib/wireshark/plugins/${version}
     303        rm -rf "$pkgplugin"
     304        for plvers in "$(find "$binary_path/../lib/wireshark/plugins" -depth 1 -type d -name ?.*.*)"; do
     305                ln -sfv "$LIBPREFIX/lib/wireshark/plugins/$(basename "$plvers")" "$pkgplugin"
     306        done
    323307
    324308        cp "$plist" "$bundle/Contents/Info.plist"
    325309
     
    333317                res_list="
    334318                        $res_list
    335319                        bin
    336                         etc
    337320                        openDoc
    338321                        script
    339322                        MenuBar.nib
    340323                        ProgressWindow.nib
    341                         themes
    342324                "
    343325        fi
    344326
    345327        for rl_entry in $res_list ; do
    346                 rsync -av "$resdir"/Resources/$rl_entry "$bundle"/Contents/Resources/
     328                rsync -av "$resdir"/Resources/$rl_entry "$pkgres/"
    347329        done
    348330
     331        # Make sure that GTK launcher scripts are executable.
     332        [ "$ui_toolkit" = "gtk" ] && chmod a+x "$pkgres/"{script,openDoc} "$pkgbin/wireshark"
     333
    349334        # PkgInfo must match bundle type and creator code from Info.plist
    350335        echo "APPLWshk" > $bundle/Contents/PkgInfo
    351336
     337        # Stop execution here. This build is not meant to be relocated.
     338        return 0
     339
    352340        if [ "$ui_toolkit" = "gtk" ] ; then
    353341                echo -e "\nPulling in GTK+ libraries and resources...\n"
    354342
     
    424412        create_bundle
    425413fi
    426414
     415# Do not execute the rest of the script as the app is not meant to be relocated.
     416exit 0
     417
    427418echo -e "\nFixing up $bundle...\n"
    428419
    429420# Find out libs we need from Fink, MacPorts, or from a custom install
  • packaging/macosx/Resources/bin/wireshark

    # Change the launcher script to remove all parts where environment variables
    # are set to accomodate relocatable application bundles since ours isn't.
    
    diff -uNrw packaging/macosx/Resources/bin/wireshark.orig packaging/macosx/Resources/bin/wireshark
    old new  
    2121#       http://developer.apple.com/qa/qa2001/qa1067.html
    2222# but since no one does, we correct this by making the 'classic' PATH additions here:
    2323#       /usr/local/bin which, though standard, doesn't seem to be in the PATH
    24 #       newer python as recommended by MacPython http://www.python.org/download/mac/
    2524#       Fink
    2625#       MacPorts (former DarwinPorts)
    27 export PATH="/opt/local/bin:/sw/bin/:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin:$CWD:$PATH"
     26export PATH="/opt/local/bin:/sw/bin:/usr/local/bin:$CWD:$PATH"
    2827
    2928if [ "$APPNAME" == "wireshark" ] ; then # Apply GUI settings
    30         # For Panther and Tiger, override the default fontconfig configuration
    31         # XXX - This apparently isn't needed?
    32         #if [[ $VERSION -le 4 ]]; then
    33                 export FONTCONFIG_PATH="$TOP/etc/fonts"
    34         #fi
    35         export PANGO_RC_FILE="$HOME/.wireshark-etc/pangorc"
    36         export GTK_IM_MODULE_FILE="$HOME/.wireshark-etc/gtk.immodules"
    37         export GDK_PIXBUF_MODULE_FILE="$HOME/.wireshark-etc/gdk-pixbuf.loaders"
    38         export GTK_DATA_PREFIX="$TOP"
    39         export GTK_EXE_PREFIX="$TOP"
    40         export GNOME_VFS_MODULE_CONFIG_PATH="$TOP/etc/gnome-vfs-2.0/modules"
    41         export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules"
    42 
    43         # Set GTK theme (only if there is no .gtkrc-2.0 in the user's home)
    44         if [[ ! -e "$HOME/.gtkrc-2.0" ]]; then
    45                 # prepare the theme depending on OS X appearance settings
    46                 (
    47                         cd "$TOP/themes/Clearlooks-Quicksilver-OSX/gtk-2.0/"
    48                         ./sync_osx_look.sh
    49                         # TODO: make this more robust, probably by integrating this script directly inline here
    50                 )
    51                 export GTK2_RC_FILES="$TOP/themes/Clearlooks-Quicksilver-OSX/gtk-2.0/gtkrc"
    52         fi
    5329
    5430        # TODO: Have to add ".UTF-8" to the LANG since ommiting causes Wireshark
    5531        #       to crash on startup in locale_from_utf8().
     
    5733                2>&1\`_\" /usr/share/locale/locale.alias | tail -n1 | sed 's/\./ /' | \
    5834                awk '{print $2}'`.UTF-8"
    5935
    60         # Handle the case where the directory storing Wireshark has a '#' in the name.
    61         # This '#' needs to be escaped in pango.modules for Pango to work properly.
    62         ESCAPEDTOP=`echo $TOP | sed 's/#/\\\\\\\\#/'`
    63 
    64         mkdir -p "${HOME}/.wireshark-etc"
    65         sed 's|${HOME}|'"$HOME|g" "$TOP/etc/pango/pangorc" > "${HOME}/.wireshark-etc/pangorc"
    66         sed 's|${CWD}|'"$ESCAPEDTOP|g" "$TOP/etc/pango/pango.modules" \
    67                 > "${HOME}/.wireshark-etc/pango.modules"
    68         cp -f "$TOP/etc/pango/pangox.aliases" "${HOME}/.wireshark-etc/"
    69         sed 's|${CWD}|'"$TOP|g" "$TOP/etc/gtk-2.0/gtk.immodules" \
    70                 > "${HOME}/.wireshark-etc/gtk.immodules"
    71         sed 's|${CWD}|'"$TOP|g" "$TOP/etc/gtk-2.0/gdk-pixbuf.loaders" \
    72                 > "${HOME}/.wireshark-etc/gdk-pixbuf.loaders"
    7336fi
    7437
    7538exec "$CWD/$APPNAME-bin" "$@"
  • packaging/macosx/Resources/bin/getdisplay.sh

    # Remove all parts of launcher scripts that are specific to Mac OS X 10.4 and earlier
    # since this version of wireshark doesn't run on it anyway.
    
    diff -uNrw packaging/macosx/Resources/bin/getdisplay.sh.orig packaging/macosx/Resources/bin/getdisplay.sh
    old new  
    1 #!/bin/sh
    2 #
    3 # Author: Aaron Voisine <aaron@voisine.org>
    4 
    5 if [ "$DISPLAY"x == "x" ]; then
    6     echo :0 > /tmp/display.$UID
    7 else
    8     echo $DISPLAY > /tmp/display.$UID
    9 fi
  • packaging/macosx/Resources/openDoc

    diff -uNrw packaging/macosx/Resources/openDoc.orig packaging/macosx/Resources/openDoc
    old new  
    55
    66CWD="`dirname \"$0\"`"
    77
    8 # System version: 3 for Panther, 4 for Tiger, 5 for Leopard
    9 export VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
    10 
    11 if [[ $VERSION -le 4 ]]; then
    12         export "DISPLAY=`cat /tmp/display.$UID`"
    13 fi
    14 
    158BASE="`echo "$0" | sed -e 's/\/[A-Za-z]*.app\/Contents\/Resources\/openDoc/\//'`"
    169cd "$BASE"
    1710exec "$CWD/bin/wireshark" "$@"
    18 
  • packaging/macosx/Resources/script

    diff -uNrw packaging/macosx/Resources/script.orig packaging/macosx/Resources/script
    old new  
    55
    66CWD="`dirname \"$0\"`"
    77
    8 # System version: 3 for Panther, 4 for Tiger, 5 for Leopard
    9 export VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'`
    10 
    11 # On Leopard, X11.app is installed by default, and will be started
    12 # automatically via launchd.  On older systems, we need to start
    13 # X11 ourself.
    14 
    15 # For Panther and Tiger, start X11
    16 if [[ $VERSION -le 4 ]]; then
    17         # FIXME apparently this removes the xterm that starts with X
    18         # from xinitrc but when is it really used? Should we modify
    19         # the .xinitrc of the user without warning?
    20         ps -wx -ocommand | grep -e '[X]11' > /dev/null
    21         if [ "$?" != "0" -a ! -f "${HOME}/.xinitrc" ]; then
    22             echo "rm -f \"${HOME}/.xinitrc\"" > "${HOME}/.xinitrc"
    23             sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> "${HOME}/.xinitrc"
    24         fi
    25 
    26         # Start X11 and get DISPLAY
    27         cp -f "$CWD/bin/getdisplay.sh" /tmp/
    28         rm -f /tmp/display.$UID
    29         open-x11 /tmp/getdisplay.sh || \
    30         open -a XDarwin /tmp/getdisplay.sh || \
    31         echo ":0" > /tmp/display.$UID
    32 
    33         while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do
    34             sleep 1
    35         done
    36         export DISPLAY="`cat /tmp/display.$UID`"
    37 
    38         ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
    39 fi
    40 
    41 
    428# Warn the user about time-consuming generation of fontconfig caches.
    43 test -f "${HOME}/.wireshark/.fccache-new" || exit 12
    44 
     9# Check first if the user already has a cache, then check if we already warned.
     10test -d "${HOME}/.cache/fontconfig" || test -f "${HOME}/.wireshark/.fccache-new" || exit 12
    4511
    4612BASE="`echo "$0" | sed -e 's/\/Contents\/Resources\/script/\//'`"
    4713cd "$BASE"
    4814exec "$CWD/bin/wireshark" "$@"
    49 # TODO examine wether it would be wisest to move the code from wireshark shell
    50 # script and getdisplay.sh to here and only keep the real binary in bin. This
    51 # may make things easier on Leopard and may also help using Wireshark on the
    52 # command line
    53