diff --git a/CMakeLists.txt b/CMakeLists.txt index d68280b8fb..be741bd942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1245,7 +1245,7 @@ if(BUILD_wireshark OR BUILD_logwolf) endif() set(QT_FOUND ON) if(APPLE) - ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE 1) + ws_find_package(Sparkle ENABLE_SPARKLE HAVE_SOFTWARE_UPDATE 2) endif() if(Qt${qtver}Multimedia_FOUND) set(QT_MULTIMEDIA_LIB 1) diff --git a/cmake/modules/FindSparkle.cmake b/cmake/modules/FindSparkle.cmake index e552c33e31..1969c02d15 100644 --- a/cmake/modules/FindSparkle.cmake +++ b/cmake/modules/FindSparkle.cmake @@ -9,8 +9,8 @@ include(FindPackageHandleStandardArgs) -file(GLOB USR_LOCAL_HINT "/usr/local/Sparkle-[1-9]*/") -file(GLOB HOMEBREW_HINT "/usr/local/Caskroom/sparkle/[1-9]*/") +file(GLOB USR_LOCAL_HINT "/usr/local/Sparkle-[2-9]*/") +file(GLOB HOMEBREW_HINT "/usr/local/Caskroom/sparkle/[2-9]*/") find_path(SPARKLE_INCLUDE_DIR Sparkle.h HINTS ${USR_LOCAL_HINT} ${HOMEBREW_HINT} @@ -33,6 +33,8 @@ if(_spustandardupdatercontroller_h) set(SPARKLE_VERSION 2) endif() +unset(_spustandardupdatercontroller_h CACHE) + find_package_handle_standard_args(Sparkle REQUIRED_VARS SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY VERSION_VAR SPARKLE_VERSION diff --git a/ui/macosx/sparkle_bridge.m b/ui/macosx/sparkle_bridge.m index f922b1b932..a596fcb0bc 100644 --- a/ui/macosx/sparkle_bridge.m +++ b/ui/macosx/sparkle_bridge.m @@ -15,16 +15,10 @@ #import -// XXX Is there a more reliable way to do this? -#ifdef SPUUserUpdateState_h -#define HAVE_SPARKLE_2 -#endif - // https://sparkle-project.org/documentation/customization/ // Sparkle stores its state in ~/Library/Preferences/org.wireshark.Wireshark.plist. // You can check its log output via `log stream | grep -i sparkle`. -#ifdef HAVE_SPARKLE_2 // The Sparkle 1 UI provided a sharedUpdater singleton, which is deprecated // in Sparkle 2: // https://sparkle-project.org/documentation/upgrading/ @@ -47,28 +41,17 @@ } @end -#endif void sparkle_software_update_init(const char *url, bool enabled, int interval) { -#ifdef HAVE_SPARKLE_2 [[[SparkleBridge sharedStandardUpdaterController] updater] setAutomaticallyChecksForUpdates: enabled]; [[[SparkleBridge sharedStandardUpdaterController] updater] setUpdateCheckInterval: interval]; [[[SparkleBridge sharedStandardUpdaterController] updater] setFeedURL: [NSURL URLWithString: [[NSString alloc] initWithUTF8String: url] ]]; -#else - [[SUUpdater sharedUpdater] setAutomaticallyChecksForUpdates: enabled]; - [[SUUpdater sharedUpdater] setUpdateCheckInterval: interval]; - [[SUUpdater sharedUpdater] setFeedURL: [NSURL URLWithString: [[NSString alloc] initWithUTF8String: url] ]]; -#endif } void sparkle_software_update_check(void) { -#ifdef HAVE_SPARKLE_2 [[SparkleBridge sharedStandardUpdaterController] checkForUpdates: [[NSApplication sharedApplication] delegate]]; -#else - [[SUUpdater sharedUpdater] checkForUpdates: [[NSApplication sharedApplication] delegate]]; -#endif } // Sparkle requires NSApplicationWillTerminateNotification in order to