Commit be4dd35f authored by Jeremy Huddleston's avatar Jeremy Huddleston

XQuartz: Initial support for automatic updates through Sparkle

(cherry picked from commit c45f1be3)
parent 2415e2dc
......@@ -527,6 +527,10 @@ AC_ARG_WITH(apple-application-id,AS_HELP_STRING([--with-apple-application-id=VAL
[ APPLE_APPLICATION_ID="${withval}" ],
[ APPLE_APPLICATION_ID="org.x.X11" ])
AC_SUBST([APPLE_APPLICATION_ID])
AC_ARG_ENABLE(sparkle,AS_HELP_STRING([--enable-sparkle], [Enable updating of X11.app using the Sparkle Framework (default: disabled)]),
[ XQUARTZ_SPARKLE="${enableval}" ],
[ XQUARTZ_SPARKLE="no" ])
AC_SUBST([XQUARTZ_SPARKLE])
AC_ARG_ENABLE(builddocs, AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
[BUILDDOCS=$enableval],
[BUILDDOCS=no])
......@@ -1687,6 +1691,10 @@ if test "x$XQUARTZ" = xyes; then
PKG_CHECK_MODULES(XPBPROXY, [applewmproto >= 1.3] [applewm >= 1.3] xfixes fixesproto x11)
if test "x$XQUARTZ_SPARKLE" = xyes ; then
AC_DEFINE(XQUARTZ_SPARKLE,1,[Support application updating through sparkle.])
fi
if test "x$STANDALONE_XPBPROXY" = xyes ; then
AC_DEFINE(STANDALONE_XPBPROXY,1,[Build a standalone xpbproxy])
fi
......@@ -1703,9 +1711,8 @@ AC_SUBST([OBJCLINK])
AC_SUBST([OBJCFLAGS])
# internal, undocumented automake func follows :(
_AM_DEPENDENCIES([OBJC])
AM_CONDITIONAL(HAVE_XPLUGIN, [test "x$ac_cv_lib_Xplugin_xp_init" = xyes])
AM_CONDITIONAL(HAVE_AGL_FRAMEWORK, [test "x$xorg_cv_AGL_framework" = xyes])
AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes])
AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"])
AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes])
dnl DMX DDX
......
......@@ -47,6 +47,7 @@
- (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
- (float) prefs_get_float:(NSString *)key default:(float)def;
- (int) prefs_get_boolean:(NSString *)key default:(int)def;
- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def;
- (NSArray *) prefs_get_array:(NSString *)key;
- (void) prefs_set_integer:(NSString *)key value:(int)value;
- (void) prefs_set_float:(NSString *)key value:(float)value;
......@@ -95,6 +96,7 @@ extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
#define PREFS_TEST_EXTENSIONS "enable_test_extensions"
#define PREFS_XP_OPTIONS "xp_options"
#define PREFS_LOGIN_SHELL "login_shell"
#define PREFS_UPDATE_FEED "update_feed"
#define PREFS_CLICK_THROUGH "wm_click_through"
#define PREFS_FFM "wm_ffm"
#define PREFS_FOCUS_ON_NEW_WINDOW "wm_focus_on_new_window"
......
......@@ -50,6 +50,10 @@
#include <unistd.h>
#include <AvailabilityMacros.h>
#ifdef XQUARTZ_SPARKLE
#include <Sparkle/SUUpdater.h>
#endif
#include <Xplugin.h>
// pbproxy/pbproxy.h
......@@ -585,6 +589,23 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
return ret != NULL ? ret : def;
}
- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def {
CFPropertyListRef value;
NSURL *ret = NULL;
value = [self prefs_get:key];
if (value != NULL && CFGetTypeID (value) == CFStringGetTypeID ()) {
NSString *s = (NSString *) value;
ret = [NSURL URLWithString:s];
}
if (value != NULL) CFRelease (value);
return ret != NULL ? ret : def;
}
- (float) prefs_get_float:(NSString *)key default:(float)def {
CFPropertyListRef value;
float ret = def;
......@@ -746,6 +767,14 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
default:FALSE];
#if XQUARTZ_SPARKLE
NSURL *url = [self prefs_copy_url:@PREFS_UPDATE_FEED default:nil];
if(url) {
[[SUUpdater sharedUpdater] setFeedURL:url];
CFRelease(url);
}
#endif
}
/* This will end up at the end of the responder chain. */
......@@ -935,7 +964,12 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
if(!xpbproxy_init())
fprintf(stderr, "Error initializing xpbproxy\n");
#if XQUARTZ_SPARKLE
[[SUUpdater sharedUpdater] resetUpdateCycle];
// [[SUUpdater sharedUpdater] checkForUpdates:X11App];
#endif
[NSApp run];
/* not reached */
}
......
......@@ -26,6 +26,14 @@
<string>x11a</string>
<key>CSResourcesFileMapped</key>
<true/>
#ifdef XQUARTZ_SPARKLE
<key>SUEnableAutomaticChecks</key>
<true/>
<key>SUPublicDSAKeyFile</key>
<string>sparkle.pem</string>
<key>SUFeedURL</key>
<string>http://xquartz.macosforge.org/downloads/sparkle/release.xml</string>
#endif
<key>NSHumanReadableCopyright</key>
<string>© 2003-2009 Apple Inc.
© 2003 XFree86 Project, Inc.
......
......@@ -4,6 +4,10 @@ CPP_FILES_FLAGS = \
-DAPPLE_APPLICATION_ID="$(APPLE_APPLICATION_ID)" \
-DAPPLE_APPLICATION_NAME="$(APPLE_APPLICATION_NAME)"
if XQUARTZ_SPARKLE
CPP_FILES_FLAGS += -DXQUARTZ_SPARKLE
endif
install-data-hook:
$(srcdir)/mk_bundke.sh $(srcdir) $(builddir) $(DESTDIR)$(APPLE_APPLICATIONS_DIR)/$(APPLE_APPLICATION_NAME).app install
......
......@@ -39,6 +39,11 @@ X11_bin_LDFLAGS += \
-Wl,-framework,OpenGL
endif
if XQUARTZ_SPARKLE
X11_bin_LDFLAGS += \
-Wl,-framework,Sparkle
endif
if RECORD
X11_bin_LDADD += \
$(top_builddir)/record/librecord.la
......
......@@ -124,6 +124,9 @@
/* Have Quartz */
#undef XQUARTZ
/* Support application updating through sparkle. */
#undef XQUARTZ_SPARKLE
/* Build a standalone xpbproxy */
#undef STANDALONE_XPBPROXY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment