diff --git a/Configurations/ConfigBinaryDelta.xcconfig b/Configurations/ConfigBinaryDelta.xcconfig index 88da9839..9a538d71 100644 --- a/Configurations/ConfigBinaryDelta.xcconfig +++ b/Configurations/ConfigBinaryDelta.xcconfig @@ -1,5 +1,4 @@ // BinaryDelta tool only PRODUCT_NAME = BinaryDelta -GCC_PREFIX_HEADER = LD_RUNPATH_SEARCH_PATHS = @executable_path/ diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index a5c5fbfc..4b3b5332 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -1,6 +1,7 @@ // Common -FINISH_INSTALL_TOOL_NAME = Autoupdate +SPARKLE_BUNDLE_IDENTIFIER = org.andymatuschak.Sparkle +SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate SPARKLE_VERSION_MAJOR = 1 SPARKLE_VERSION_MINOR = 8 @@ -10,11 +11,11 @@ SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VE CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION) ALWAYS_SEARCH_USER_PATHS = NO GCC_PRECOMPILE_PREFIX_HEADER = YES -GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h +GCC_PREFIX_HEADER = Sparkle/Sparkle.pch ARCHS = $(ARCHS_STANDARD) MACOSX_DEPLOYMENT_TARGET = 10.7 -GCC_PREPROCESSOR_DEFINITIONS = FINISH_INSTALL_TOOL_NAME=$(FINISH_INSTALL_TOOL_NAME) +GCC_PREPROCESSOR_DEFINITIONS = SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" CLANG_ENABLE_OBJC_ARC = YES // Enable warnings diff --git a/Configurations/ConfigFramework.xcconfig b/Configurations/ConfigFramework.xcconfig index 9ac5dd14..d45bcdbb 100644 --- a/Configurations/ConfigFramework.xcconfig +++ b/Configurations/ConfigFramework.xcconfig @@ -7,5 +7,4 @@ PRODUCT_NAME = Sparkle WRAPPER_EXTENSION = framework FRAMEWORK_VERSION = A INFOPLIST_FILE = Sparkle/Sparkle-Info.plist -GCC_PREFIX_HEADER = Sparkle/Sparkle.pch OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey diff --git a/Configurations/ConfigRelaunch.xcconfig b/Configurations/ConfigRelaunch.xcconfig index ee339f01..1537a724 100644 --- a/Configurations/ConfigRelaunch.xcconfig +++ b/Configurations/ConfigRelaunch.xcconfig @@ -1,8 +1,7 @@ // Relaunch Tool only INFOPLIST_FILE = Sparkle/Autoupdate/Autoupdate-Info.plist -PRODUCT_NAME = $(FINISH_INSTALL_TOOL_NAME) +PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME) SKIP_INSTALL = YES -GCC_PREFIX_HEADER = Sparkle/Autoupdate/Autoupdate.pch ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index f99d1c0c..68767214 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -54,7 +54,6 @@ 55C14F08136EF6DB00649790 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; 55C14F0C136EF6EA00649790 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; 55C14F0D136EF6F200649790 /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; }; - 55C14F0F136EF73600649790 /* Autoupdate.pch in Headers */ = {isa = PBXBuildFile; fileRef = 55C14F0E136EF73600649790 /* Autoupdate.pch */; }; 55C14F20136EF84300649790 /* SUStatusController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6196CFE409C71ADE000DC222 /* SUStatusController.m */; }; 55C14F21136EF84D00649790 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; }; 55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; }; @@ -383,7 +382,6 @@ 55C14C18136EF2C700649790 /* zh_TW */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = zh_TW; path = zh_TW.lproj/SUUpdatePermissionPrompt.xib; sourceTree = ""; }; 55C14F04136EF6DB00649790 /* SULog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULog.h; sourceTree = ""; }; 55C14F05136EF6DB00649790 /* SULog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SULog.m; sourceTree = ""; }; - 55C14F0E136EF73600649790 /* Autoupdate.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Autoupdate.pch; sourceTree = ""; }; 55C14F31136EFC2400649790 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 5AEF45D9189D1CC90030D7DC /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Sparkle.strings; sourceTree = ""; }; 5AF9DC3B1981DBEE001EA135 /* SUDSAVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUDSAVerifierTest.m; path = Tests/SUDSAVerifierTest.m; sourceTree = ""; }; @@ -744,7 +742,6 @@ children = ( 55C14BB9136EEF1500649790 /* Autoupdate-Info.plist */, 55C14BD3136EEFCE00649790 /* Autoupdate.m */, - 55C14F0E136EF73600649790 /* Autoupdate.pch */, ); path = Autoupdate; sourceTree = ""; @@ -946,7 +943,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 55C14F0F136EF73600649790 /* Autoupdate.pch in Headers */, 611142E910FB1BE5009810AA /* bspatch.h in Headers */, 6160E7E10D3B4A8800E9CD71 /* NTSynchronousTask.h in Headers */, 61299B3609CB04E000B7442F /* Sparkle.h in Headers */, diff --git a/Sparkle/Autoupdate/Autoupdate.pch b/Sparkle/Autoupdate/Autoupdate.pch deleted file mode 100644 index f29230f1..00000000 --- a/Sparkle/Autoupdate/Autoupdate.pch +++ /dev/null @@ -1,16 +0,0 @@ -// -// Sparkle.pch -// Sparkle -// -// Created by Andy Matuschak on 7/23/08. -// Copyright 2008 Andy Matuschak. All rights reserved. -// - -#define SPARKLE_BUNDLE [NSBundle mainBundle] -#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", SPARKLE_BUNDLE, comment) -#define SUAbstractFail() NSAssert2(nil, @"Can't call %@ on an instance of %@; this is an abstract method!", __PRETTY_FUNCTION__, [self class]); - -#ifdef __OBJC__ -#import -#import "SUConstants.h" -#endif diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 06727ee7..14632648 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -21,15 +21,6 @@ #import "SUCodeSigningVerifier.h" #import "SUUpdater_Private.h" -#ifdef FINISH_INSTALL_TOOL_NAME -// FINISH_INSTALL_TOOL_NAME expands to unquoted Autoupdate -#define QUOTE_NS_STRING2(str) @"" #str -#define QUOTE_NS_STRING1(str) QUOTE_NS_STRING2(str) -#define FINISH_INSTALL_TOOL_NAME_STRING QUOTE_NS_STRING1(FINISH_INSTALL_TOOL_NAME) -#else -#error FINISH_INSTALL_TOOL_NAME not defined -#endif - @interface SUBasicUpdateDriver () @property (strong) SUAppcastItem *updateItem; @@ -360,11 +351,12 @@ [updaterDelegate updater:self.updater willInstallUpdate:self.updateItem]; } - NSString *const finishInstallToolName = FINISH_INSTALL_TOOL_NAME_STRING; + NSBundle *sparkleBundle = [NSBundle bundleWithIdentifier:SUBundleIdentifier]; + NSString *const finishInstallToolName = [[sparkleBundle infoDictionary] objectForKey:SURelaunchToolNameKey]; // Copy the relauncher into a temporary directory so we can get to it after the new version's installed. // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems. - NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:finishInstallToolName ofType:@"app"]; + NSString *relaunchPathToCopy = [sparkleBundle pathForResource:finishInstallToolName ofType:@"app"]; if (relaunchPathToCopy != nil) { NSString *targetPath = [[self.host appSupportPath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]]; diff --git a/Sparkle/SUConstants.h b/Sparkle/SUConstants.h index c07d9f40..2876bb86 100644 --- a/Sparkle/SUConstants.h +++ b/Sparkle/SUConstants.h @@ -26,6 +26,12 @@ #define TRY_TO_APPEND_VERSION_NUMBER 1 +// ----------------------------------------------------------------------------- +// Misc: +// ----------------------------------------------------------------------------- + +extern NSString *const SUBundleIdentifier; + // ----------------------------------------------------------------------------- // Notifications: // ----------------------------------------------------------------------------- @@ -55,6 +61,7 @@ extern NSString *const SULastProfileSubmitDateKey; extern NSString *const SUPromptUserOnFirstLaunchKey; extern NSString *const SUKeepDownloadOnFailedInstallKey; extern NSString *const SUDefaultsDomainKey; +extern NSString *const SURelaunchToolNameKey; extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect."))); // ----------------------------------------------------------------------------- diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index 832391ef..d01ee680 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -13,6 +13,8 @@ #import "SUVersionComparisonProtocol.h" #import "SUConstants.h" +NSString *const SUBundleIdentifier = @SPARKLE_BUNDLE_IDENTIFIER; + NSString *const SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation"; NSString *const SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore"; @@ -35,6 +37,7 @@ NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch"; NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize"; NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall"; NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain"; +NSString *const SURelaunchToolNameKey = @"SURelaunchToolName"; NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain"; OSStatus SUAppcastParseError = 1000; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 0eb7e613..2ca4093b 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -106,7 +106,7 @@ - (void)displayReleaseNotes { // Set the default font - [self.releaseNotesView setPreferencesIdentifier:[SPARKLE_BUNDLE bundleIdentifier]]; + [self.releaseNotesView setPreferencesIdentifier:SUBundleIdentifier]; WebPreferences *prefs = [self.releaseNotesView preferences]; NSString *familyName = [[NSFont systemFontOfSize:8] familyName]; if ([familyName hasPrefix:@"."]) { // 10.9 returns ".Lucida Grande UI", which isn't a valid name for the WebView diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index f8fcfc8b..3117fea5 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -476,7 +476,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults return customUserAgentString; } - NSString *version = [SPARKLE_BUNDLE objectForInfoDictionaryKey:@"CFBundleVersion"]; + NSString *version = [[NSBundle bundleWithIdentifier:SUBundleIdentifier] objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]; NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [self.host name], [self.host displayVersion], version ? version : @"?"]; NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; return [[NSString alloc] initWithData:cleanedAgent encoding:NSASCIIStringEncoding]; diff --git a/Sparkle/Sparkle-Info.plist b/Sparkle/Sparkle-Info.plist index eeba5131..70f339ef 100644 --- a/Sparkle/Sparkle-Info.plist +++ b/Sparkle/Sparkle-Info.plist @@ -9,7 +9,7 @@ CFBundleIconFile CFBundleIdentifier - org.andymatuschak.Sparkle + ${SPARKLE_BUNDLE_IDENTIFIER} CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,5 +24,7 @@ ${CURRENT_PROJECT_VERSION} NSPrincipalClass + SURelaunchToolName + ${SPARKLE_RELAUNCH_TOOL_NAME} diff --git a/Sparkle/Sparkle.pch b/Sparkle/Sparkle.pch index 62f19dfa..e726bc38 100644 --- a/Sparkle/Sparkle.pch +++ b/Sparkle/Sparkle.pch @@ -8,9 +8,7 @@ #ifdef __OBJC__ -#define SPARKLE_BUNDLE [NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"] -#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", SPARKLE_BUNDLE, comment) -#define SUAbstractFail() NSAssert2(nil, @"Can't call %@ on an instance of %@; this is an abstract method!", __PRETTY_FUNCTION__, [self class]); +#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", [NSBundle bundleWithIdentifier:SUBundleIdentifier], comment) #import #import "SUConstants.h"