Ticket #9286: sparkle.patch

File sparkle.patch, 9.8 KB (added by fingolfin, 13 years ago)

Slightly revised patch against master branch

  • base/main.cpp

    diff --git a/base/main.cpp b/base/main.cpp
    index 65aa0ab..c8a1feb 100644
    a b  
    3535#include "engines/metaengine.h"
    3636#include "base/commandLine.h"
    3737#include "base/plugins.h"
     38#if defined(USE_SPARKLE)
     39        #include "base/sparkle_osx.h"
     40#endif
    3841#include "base/version.h"
    3942
    4043#include "common/archive.h"
    extern "C" int scummvm_main(int argc, const char * const argv[]) {  
    404407        // Now as the event manager is created, setup the keymapper
    405408        setupKeymapper(system);
    406409
     410        // Setup the "Check for Updates..." menu on Mac-OSX when built with Sparkle support
     411        #if defined(USE_SPARKLE)
     412                SparkleMenu::addUpdateMenuItem();
     413        #endif
     414
    407415        // Unless a game was specified, show the launcher dialog
    408416        if (0 == ConfMan.getActiveDomain())
    409417                launcherDialog();
  • base/module.mk

    diff --git a/base/module.mk b/base/module.mk
    index f12a710..1437f60 100644
    a b MODULE_OBJS := \  
    66        plugins.o \
    77        version.o
    88
     9ifdef USE_SPARKLE
     10MODULE_OBJS += \
     11        sparkle_osx.o
     12endif
     13
    914# Include common rules
    1015include $(srcdir)/rules.mk
  • new file ase/sparkle_osx.h

    diff --git a/base/sparkle_osx.h b/base/sparkle_osx.h
    new file mode 100644
    index 0000000..3b8009b
    - +  
     1/* ScummVM - Graphic Adventure Engine
     2 *
     3 * ScummVM is the legal property of its developers, whose names
     4 * are too numerous to list here. Please refer to the COPYRIGHT
     5 * file distributed with this source distribution.
     6 *
     7 * This program is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU General Public License
     9 * as published by the Free Software Foundation; either version 2
     10 * of the License, or (at your option) any later version.
     11
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     20 *
     21 * $URL$
     22 * $Id$
     23 *
     24 */
     25
     26#ifndef SPARKLE_OSX_H
     27#define SPARKLE_OSX_H
     28
     29namespace SparkleMenu {
     30
     31/**
     32 * This functions adda an "Check for updates..." menu item to the Application
     33 * menu on Mac OS X, based on the Sparkle framework.
     34 *
     35 * @see http://sparkle.andymatuschak.org/
     36 */
     37void addUpdateMenuItem();
     38
     39} // End of namespace SparkleMenu
     40
     41#endif
  • new file ase/sparkle_osx.mm

    diff --git a/base/sparkle_osx.mm b/base/sparkle_osx.mm
    new file mode 100644
    index 0000000..7beb4f7
    - +  
     1/* ScummVM - Graphic Adventure Engine
     2 *
     3 * ScummVM is the legal property of its developers, whose names
     4 * are too numerous to list here. Please refer to the COPYRIGHT
     5 * file distributed with this source distribution.
     6 *
     7 * This program is free software; you can redistribute it and/or
     8 * modify it under the terms of the GNU General Public License
     9 * as published by the Free Software Foundation; either version 2
     10 * of the License, or (at your option) any later version.
     11
     12 * This program is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16
     17 * You should have received a copy of the GNU General Public License
     18 * along with this program; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     20 *
     21 * $URL$
     22 * $Id$
     23 *
     24 */
     25
     26#include "base/sparkle_osx.h"
     27
     28#include <Cocoa/Cocoa.h>
     29#include <Sparkle/Sparkle.h>
     30
     31namespace SparkleMenu {
     32
     33void addUpdateMenuItem() {
     34    NSMenuItem *menuItem = [[NSApp mainMenu] itemAtIndex:0];
     35    NSMenu *applicationMenu = [menuItem submenu];
     36
     37        /* Add "Check for Updates..." menu item */
     38        SUUpdater *updater = [SUUpdater sharedUpdater];
     39        NSMenuItem *updateMenuItem = [applicationMenu insertItemWithTitle:@"Check for Updates..." action:@selector(checkForUpdates:) keyEquivalent:@"" atIndex:1];
     40        [updateMenuItem setTarget:updater];
     41        [updater checkForUpdatesInBackground];
     42}
     43
     44} // End of namespace SparkleMenu
  • configure

    diff --git a/configure b/configure
    index fb453d1..db0e0e0 100755
    a b _alsa=auto  
    127127_seq_midi=auto
    128128_timidity=auto
    129129_zlib=auto
     130_sparkle=auto
    130131_mpeg2=no
    131132_png=auto
    132133_theoradec=auto
    Optional Libraries:  
    757758                           installed (optional)
    758759  --disable-fluidsynth     disable fluidsynth MIDI driver [autodetect]
    759760
     761  --with-sparkle-prefix=DIR   Prefix where sparkle is installed (MacOSX only - optional)
     762  --disable-sparkle        disable sparkle automatic update support [MacOSX only - autodetect]
     763
    760764  --with-sdl-prefix=DIR    Prefix where the sdl-config script is
    761765                           installed (optional)
    762766
    for ac_option in $@; do  
    802806        --disable-mad)            _mad=no         ;;
    803807        --enable-zlib)            _zlib=yes       ;;
    804808        --disable-zlib)           _zlib=no        ;;
     809        --enable-sparkle)         _sparkle=yes    ;;
     810        --disable-sparkle)        _sparkle=no     ;;
    805811        --enable-nasm)            _nasm=yes       ;;
    806812        --disable-nasm)           _nasm=no        ;;
    807813        --enable-mpeg2)           _mpeg2=yes      ;;
    for ac_option in $@; do  
    884890                ZLIB_CFLAGS="-I$arg/include"
    885891                ZLIB_LIBS="-L$arg/lib"
    886892                ;;
     893        --with-sparkle-prefix=*)
     894                arg=`echo $ac_option | cut -d '=' -f 2`
     895                SPARKLE_CFLAGS="-F$arg"
     896                SPARKLE_LIBS="-F$arg"
     897                ;;
    887898        --with-readline-prefix=*)
    888899                arg=`echo $ac_option | cut -d '=' -f 2`
    889900                READLINE_CFLAGS="-I$arg/include"
    define_in_config_if_yes "$_zlib" 'USE_ZLIB'  
    26082619echo "$_zlib"
    26092620
    26102621#
     2622# Check for Sparkle
     2623#
     2624echocheck "Sparkle"
     2625if test "$_sparkle" = auto ; then
     2626        _sparkle=no
     2627        cat > $TMPC << EOF
     2628#include <Cocoa/Cocoa.h>
     2629#include <Sparkle/Sparkle.h>
     2630int main(void) { SUUpdater *updater = [SUUpdater sharedUpdater]; return 0; }
     2631EOF
     2632        cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -framework Sparkle -ObjC++ -lobjc && _sparkle=yes
     2633fi
     2634if test "$_sparkle" = yes ; then
     2635        LIBS="$LIBS $SPARKLE_LIBS -framework Sparkle"
     2636        INCLUDES="$INCLUDES $SPARKLE_CFLAGS"
     2637fi
     2638define_in_config_if_yes "$_sparkle" 'USE_SPARKLE'
     2639echo "$_sparkle"
     2640
     2641#
    26112642# Check for LibMPEG2
    26122643#
    26132644echocheck "libmpeg2 >= 0.3.2"
  • dists/macosx/Info.plist

    diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist
    index 9e19926..ffa96a8 100644
    a b  
    2828        <string>NSApplication</string>
    2929        <key>NSHumanReadableCopyright</key>
    3030        <string>Copyright 2001-2011 The ScummVM team</string>
     31        <key>SUFeedURL</key>
     32        <string>http://www.scummvm.org/scummvm_osx_appcast.xml</string>
     33        <key>SUPublicDSAKeyFile</key>
     34        <string>dsa_pub.pem</string>
    3135</dict>
    3236</plist>
  • dists/macosx/Info.plist.in

    diff --git a/dists/macosx/Info.plist.in b/dists/macosx/Info.plist.in
    index 3ba5a08..7d2e285 100644
    a b  
    2828        <string>NSApplication</string>
    2929        <key>NSHumanReadableCopyright</key>
    3030        <string>Copyright 2001-2011 The ScummVM team</string>
     31        <key>SUFeedURL</key>
     32        <string>http://www.scummvm.org/scummvm_osx_appcast.xml</string>
     33        <key>SUPublicDSAKeyFile</key>
     34        <string>dsa_pub.pem</string>
    3135</dict>
    3236</plist>
  • new file dists/macosx/scummvm_osx_appcast.xml

    diff --git a/dists/macosx/scummvm_osx_appcast.xml b/dists/macosx/scummvm_osx_appcast.xml
    new file mode 100644
    index 0000000..d9b2044
    - +  
     1<?xml version="1.0" encoding="utf-8"?>
     2<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
     3   <channel>
     4      <title>ScummVM Changelog</title>
     5      <link>http://scummvm.org/scummvm_appcast.xml</link>
     6      <description>Most recent changes with links to updates.</description>
     7      <language>en</language>
     8         <item>
     9            <title>Version 1.2.1 (3 bugs fixed; 2 new features)</title>
     10                                                <sparkle:releaseNotesLink>
     11                                                        http://sourceforge.net/projects/scummvm/files/scummvm/1.2.1/ReleaseNotes/view
     12                                                </sparkle:releaseNotesLink>
     13            <pubDate>Sun, 19 Dec 2010 12:20:11 +0000</pubDate>
     14            <enclosure url="http://scummvm.org/ScummVM 1.2.1-Test.zip" sparkle:version="1.2.1" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
     15         </item>
     16         <item>
     17            <title>Version 1.2.0</title>
     18                                                <sparkle:releaseNotesLink>
     19                                                        http://sourceforge.net/projects/scummvm/files/scummvm/1.2.0/ReleaseNotes/view
     20                                                </sparkle:releaseNotesLink>
     21            <pubDate>Fri, 15 Oct 2010 12:20:11 +0000</pubDate>
     22            <enclosure url="http://scummvm.org/ScummVM 1.2.0-Test.zip" sparkle:version="1.2.0" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
     23         </item>
     24   </channel>
     25</rss>
  • ports.mk

    diff --git a/ports.mk b/ports.mk
    index c56031e..b9b3072 100644
    a b bundle: scummvm-static  
    4141        mkdir -p $(bundle_name)/Contents/Resources
    4242        echo "APPL????" > $(bundle_name)/Contents/PkgInfo
    4343        cp $(srcdir)/dists/macosx/Info.plist $(bundle_name)/Contents/
     44ifdef USE_SPARKLE
     45        mkdir -p $(bundle_name)/Contents/Frameworks
     46        cp $(srcdir)/dists/macosx/dsa_pub.pem $(bundle_name)/Contents/Resources/
     47        cp -R $(STATICLIBPATH)/Sparkle.framework $(bundle_name)/Contents/Frameworks/
     48endif
    4449        cp $(srcdir)/icons/scummvm.icns $(bundle_name)/Contents/Resources/
    4550        cp $(DIST_FILES_DOCS) $(bundle_name)/
    4651        cp $(DIST_FILES_THEMES) $(bundle_name)/Contents/Resources/
    ifdef USE_ZLIB  
    110115OSX_ZLIB ?= -lz
    111116endif
    112117
     118ifdef USE_SPARKLE
     119OSX_STATIC_LIBS += -framework Sparkle -F$(STATICLIBPATH)
     120endif
     121
    113122ifdef USE_TERMCONV
    114123OSX_ICONV ?= -liconv
    115124endif