Ticket #48363: patch-osxapp.diff

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

Patch file referred to by Portfile. Required for OS X app stub. (revised)

  • 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  
    15821582                cd $(srcdir)/packaging/macosx ; \
    15831583                ./osx-app.sh @OSX_APP_FLAGS@ \
    15841584                        --create-bundle \
     1585                        -l ${prefix} \
    15851586                        --binary-path ../staging/$(PACKAGE).inst$(bindir) ; \
    15861587        else \
    15871588                echo "Error: OS X packaging tools not found." ; \
     
    16021603osx-install: osx-app
    16031604        @if test x$(HAVE_OSX_PACKAGING) = xyes ; then \
    16041605                echo "Copying Wireshark.app to /Applications" ; \
    1605                 cp -pr $(srcdir)/packaging/macosx/Wireshark.app /Applications ; \
     1606                cp -pPR $(srcdir)/packaging/macosx/Wireshark.app $(DESTDIR)/Applications/MacPorts ; \
    16061607        fi
    16071608
    16081609test-programs:
  • Makefile.in

    diff -uNrw Makefile.in.orig Makefile.in
    old new  
    42904290                cd $(srcdir)/packaging/macosx ; \
    42914291                ./osx-app.sh @OSX_APP_FLAGS@ \
    42924292                        --create-bundle \
     4293                        -l ${prefix} \
    42934294                        --binary-path ../staging/$(PACKAGE).inst$(bindir) ; \
    42944295        else \
    42954296                echo "Error: OS X packaging tools not found." ; \
     
    43104311osx-install: osx-app
    43114312        @if test x$(HAVE_OSX_PACKAGING) = xyes ; then \
    43124313                echo "Copying Wireshark.app to /Applications" ; \
    4313                 cp -pr $(srcdir)/packaging/macosx/Wireshark.app /Applications ; \
     4314                cp -pPR $(srcdir)/packaging/macosx/Wireshark.app $(DESTDIR)/Applications/MacPorts ; \
    43144315        fi
    43154316
    43164317test-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  
    5252binary_list="
    5353        androiddump
    5454        capinfos
     55        captype
    5556        dftest
    5657        dumpcap
    5758        editcap
    5859        mergecap
    5960        randpkt
    6061        rawshark
     62        reordercap
    6163        text2pcap
    6264        tshark
    6365"
     
    207209                EXTRALIBS=""
    208210        fi
    209211
     212        # Force building in 32-bit.
     213        XCODEFLAGS="$XCODEFLAGS -arch i386"
     214
    210215        # Set the SDK root, if an SDK was specified.
    211216        # (-sdk is only supported by the xcodebuild in the version of the
    212217        # developer tools that came with Snow Leopard and later versions)
     
    245250        mkdir -p "$pkgplugin"
    246251
    247252        if [ "$ui_toolkit" = "qt" ] ; then
    248                 cp -v "$binary_path/$wireshark_bin_name" "$pkgexec/Wireshark"
     253                ln -sv "$LIBPREFIX/bin/$wireshark_bin_name" "$pkgexec/Wireshark"
    249254        else
    250255        # Build and add the launcher
    251256        #----------------------------------------------------------
     
    270275                for binary in $binary_list wireshark ; do
    271276                        # Copy the binary to its destination
    272277                        dest_path="$pkgbin/$binary-bin"
    273                         cs_binary_list="$cs_binary_list $dest_path"
    274                         cp -v "$binary_path/$binary" "$dest_path"
    275                         # 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"
    276282
    277283                        if [ "$binary" != "wireshark" ] ; then
    278284                                ln -sv ./wireshark "$pkgbin/$binary"
     
    280286                done
    281287        elif [ "$ui_toolkit" = "qt" ] ; then
    282288                for binary in $binary_list ; do
    283                         # Copy the binary to its destination
    284                         cp -v "$binary_path/$binary" "$pkgexec"
    285                         cs_binary_list="$cs_binary_list $pkgexec/$binary"
     289                        ln -sv "$LIBPREFIX/bin/$binary" "$pkgexec/"
    286290                done
    287291        fi
    288292
    289         # The rest of the Wireshark installation (we handled bin above)
    290         rsync -av \
    291                 --exclude bin/ \
    292                 --exclude lib/ \
    293                 "$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
    294298
    295         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"
    296301
    297         # Copy the plugins from the "make install" location for them
    298         # to the plugin directory, removing the version number
    299         find "$binary_path/../lib/wireshark/plugins" \
    300                 -type f \
    301                 \( -name "*.so" -o -name "*.dylib" \) \
    302                 -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
    303307
    304308        cp "$plist" "$bundle/Contents/Info.plist"
    305309
     
    313317                res_list="
    314318                        $res_list
    315319                        bin
    316                         etc
    317320                        openDoc
    318321                        script
    319322                        MenuBar.nib
    320323                        ProgressWindow.nib
    321                         themes
    322324                "
    323325        fi
    324326
    325327        for rl_entry in $res_list ; do
    326                 rsync -av "$resdir"/Resources/$rl_entry "$bundle"/Contents/Resources/
     328                rsync -av "$resdir"/Resources/$rl_entry "$pkgres/"
    327329        done
    328330
     331        # Make sure that GTK launcher scripts are executable.
     332        [ "$ui_toolkit" = "gtk" ] && chmod a+x "$pkgres/"{script,openDoc} "$pkgbin/wireshark"
     333
    329334        # PkgInfo must match bundle type and creator code from Info.plist
    330335        echo "APPLWshk" > $bundle/Contents/PkgInfo
    331336
     337        # Stop execution here. This build is not meant to be relocated.
     338        return 0
     339
    332340        if [ "$ui_toolkit" = "gtk" ] ; then
    333341                echo -e "\nPulling in GTK+ libraries and resources...\n"
    334342
     
    404412        create_bundle
    405413fi
    406414
     415# Do not execute the rest of the script as the app is not meant to be relocated.
     416exit 0
     417
    407418echo -e "\nFixing up $bundle...\n"
    408419
    409420# 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