Ticket #9286: ScummVM_Sparkle.patch

File ScummVM_Sparkle.patch, 10.7 KB (added by CeRiAl, 13 years ago)

MACOSX: Add Sparkle support

  • base/main.cpp

    diff -rupN scummvm-1.2.1-orig/base/main.cpp scummvm-1.2.1-source/base/main.cpp
    old new  
    5252#include "gui/GuiManager.h"
    5353#include "gui/message.h"
    5454#include "gui/error.h"
     55#if defined(USE_SPARKLE)
     56        #include "gui/sparkle_osx.h"
     57#endif
    5558
    5659#include "sound/audiocd.h"
    5760#include "sound/mididrv.h"
    extern "C" int scummvm_main(int argc, co  
    377380        // Now as the event manager is created, setup the keymapper
    378381        setupKeymapper(system);
    379382
     383        // Setup the "Check for Updates..." menu on Mac-OSX when built with Sparkle support
     384        #if defined(USE_SPARKLE)
     385                GUI::SparkleMenu sparkleMenu;
     386                sparkleMenu.addUpdateMenuItem();
     387        #endif 
     388
    380389        // Unless a game was specified, show the launcher dialog
    381390        if (0 == ConfMan.getActiveDomain())
    382391                launcherDialog();
  • scummvm-1.2.

    diff -rupN scummvm-1.2.1-orig/configure scummvm-1.2.1-source/configure
    old new _mad=auto  
    123123_alsa=auto
    124124_seq_midi=auto
    125125_zlib=auto
     126_sparkle=auto
    126127_mpeg2=no
    127128_fluidsynth=auto
    128129_16bit=auto
    Optional Libraries:  
    730731                           installed (optional)
    731732  --disable-fluidsynth     disable fluidsynth MIDI driver [autodetect]
    732733
     734  --with-sparkle-prefix=DIR   Prefix where sparkle is installed (MacOSX only - optional)
     735  --disable-sparkle        disable sparkle automatic update support [MacOSX only - autodetect]
     736
    733737  --with-sdl-prefix=DIR    Prefix where the sdl-config script is
    734738                           installed (optional)
    735739
    for ac_option in $@; do  
    773777        --disable-mad)            _mad=no         ;;
    774778        --enable-zlib)            _zlib=yes       ;;
    775779        --disable-zlib)           _zlib=no        ;;
     780        --enable-sparkle)         _sparkle=yes    ;;
     781        --disable-sparkle)        _sparkle=no     ;;
    776782        --enable-nasm)            _nasm=yes       ;;
    777783        --disable-nasm)           _nasm=no        ;;
    778784        --enable-mpeg2)           _mpeg2=yes      ;;
    for ac_option in $@; do  
    839845                ZLIB_CFLAGS="-I$arg/include"
    840846                ZLIB_LIBS="-L$arg/lib"
    841847                ;;
     848        --with-sparkle-prefix=*)
     849                arg=`echo $ac_option | cut -d '=' -f 2`
     850                SPARKLE_CFLAGS="-F$arg"
     851                SPARKLE_LIBS="-framework Sparkle -F$arg"
     852                ;;
    842853        --with-readline-prefix=*)
    843854                arg=`echo $ac_option | cut -d '=' -f 2`
    844855                READLINE_CFLAGS="-I$arg/include"
    define_in_config_if_yes "$_zlib" 'USE_ZL  
    23622374echo "$_zlib"
    23632375
    23642376#
     2377# Check for Sparkle
     2378#
     2379echocheck "Sparkle"
     2380if test "$_sparkle" = auto ; then
     2381        _sparkle=no
     2382        cat > $TMPC << EOF
     2383#include <Cocoa/Cocoa.h>
     2384#include <Sparkle/Sparkle.h>
     2385int main(void) { SUUpdater *updater = [SUUpdater sharedUpdater]; return 0; }
     2386EOF
     2387        cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -ObjC++ -lobjc && _sparkle=yes
     2388fi
     2389if test "$_sparkle" = yes ; then
     2390        LIBS="$LIBS $SPARKLE_LIBS"
     2391        INCLUDES="$INCLUDES $SPARKLE_CFLAGS"
     2392fi
     2393define_in_config_if_yes "$_sparkle" 'USE_SPARKLE'
     2394echo "$_sparkle"
     2395
     2396#
    23652397# Check for LibMPEG2
    23662398#
    23672399echocheck "libmpeg2 >= 0.3.2"
  • dists/macosx/Info.plist

    diff -rupN scummvm-1.2.1-orig/dists/macosx/Info.plist scummvm-1.2.1-source/dists/macosx/Info.plist
    old new  
    2828        <string>NSApplication</string>
    2929        <key>NSHumanReadableCopyright</key>
    3030        <string>Copyright 2001-2010 The ScummVM team</string>
     31        <key>SUFeedURL</key>
     32        <string>http://scummvm.org/scummvm_appcast.xml</string>
     33        <key>SUPublicDSAKeyFile</key>
     34        <string>dsa_pub.pem</string>
    3135</dict>
    3236</plist>
  • dists/macosx/Info.plist.in

    diff -rupN scummvm-1.2.1-orig/dists/macosx/Info.plist.in scummvm-1.2.1-source/dists/macosx/Info.plist.in
    old new  
    2828        <string>NSApplication</string>
    2929        <key>NSHumanReadableCopyright</key>
    3030        <string>Copyright 2001-2010 The ScummVM team</string>
     31        <key>SUFeedURL</key>
     32        <string>http://scummvm.org/scummvm_appcast.xml</string>
     33        <key>SUPublicDSAKeyFile</key>
     34        <string>dsa_pub.pem</string>
    3135</dict>
    3236</plist>
  • dists/macosx/scummvm_appcast.xml

    diff -rupN scummvm-1.2.1-orig/dists/macosx/scummvm_appcast.xml scummvm-1.2.1-source/dists/macosx/scummvm_appcast.xml
    old new  
     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>
     26 No newline at end of file
  • gui/module.mk

    diff -rupN scummvm-1.2.1-orig/gui/module.mk scummvm-1.2.1-source/gui/module.mk
    old new MODULE_OBJS += \  
    3636        browser.o
    3737endif
    3838
     39ifdef USE_SPARKLE
     40MODULE_OBJS += \
     41        sparkle_osx.o
     42endif
     43
     44
    3945# Include common rules
    4046include $(srcdir)/rules.mk
  • gui/sparkle_osx.h

    diff -rupN scummvm-1.2.1-orig/gui/sparkle_osx.h scummvm-1.2.1-source/gui/sparkle_osx.h
    old new  
     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 GUI {
     30
     31class SparkleMenu {
     32public:
     33        SparkleMenu(void);
     34        virtual ~SparkleMenu();
     35        virtual void addUpdateMenuItem();
     36};
     37
     38} // End of namespace GUI
     39
     40#endif
  • gui/sparkle_osx.mm

    diff -rupN scummvm-1.2.1-orig/gui/sparkle_osx.mm scummvm-1.2.1-source/gui/sparkle_osx.mm
    old new  
     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 "gui/sparkle_osx.h"
     27
     28#include <Cocoa/Cocoa.h>
     29#include <Sparkle/Sparkle.h>
     30
     31namespace GUI {
     32
     33SparkleMenu::SparkleMenu(void) {}
     34SparkleMenu::~SparkleMenu() {}
     35
     36void SparkleMenu::addUpdateMenuItem() {
     37    NSMenuItem *menuItem = [[NSApp mainMenu] itemAtIndex:0];
     38    NSMenu *applicationMenu = [menuItem submenu];
     39
     40        /* Add "Check for Updates..." menu item */
     41        SUUpdater *updater = [SUUpdater sharedUpdater];
     42        NSMenuItem *updateMenuItem = [applicationMenu insertItemWithTitle:@"Check for Updates..." action:@selector(checkForUpdates:) keyEquivalent:@"" atIndex:1];
     43        [updateMenuItem setTarget:updater];
     44        [updater checkForUpdatesInBackground];
     45}
     46
     47} // End of namespace GUI
  • scummvm-1.2.

    diff -rupN scummvm-1.2.1-orig/ports.mk scummvm-1.2.1-source/ports.mk
    old new 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  
    101106OSX_ZLIB ?= -lz
    102107endif
    103108
     109ifdef USE_SPARKLE
     110OSX_STATIC_LIBS += -framework Sparkle -F$(STATICLIBPATH)
     111endif
     112
    104113ifdef USE_TERMCONV
    105114OSX_ICONV ?= -liconv
    106115endif