Mac installer & screensaver: Allow building on newer versions of Xcode while preserving compatibility back to OS 10.6.

Problem: OS 10.6 and OS 10.7 require screensavers to be built with Garbage Collection (GC) enabled, but Xcode versions after 5.0.2 do not support GC.

Solution: save a compressed copy of the screensaver executable built with GC on GIT as BOINCSaver_MacOS10_6_7.zip, and update the Xcode project to build the screensaver with Automatic Reference Counting (ARC). Modify the Mac installer build script to add a copy of BOINCSaver_MacOS10_6_7 to the BOINCSaver bundle, so the installer installs the screen saver with both versions of the executable. Modify PostInstall.app to select the appropriate executable for the version of OS X at install time, rename it if necessary and delete the other one.
This commit is contained in:
Charlie Fenton 2017-06-05 02:16:06 -07:00
parent d98533241c
commit 030a55796e
5 changed files with 42 additions and 17 deletions

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2017 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -36,12 +36,8 @@
NSString *mDefaultPeriodString;
NSString *mSciencePeriodString;
NSString *mChangePeriodString;
NSArray *NIBTopLevel;
}
@property (strong) NSArray *NIBTopLevel;
- (IBAction)closeSheetSave:(id) sender;
- (IBAction)closeSheetCancel:(id) sender;

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2017 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -99,8 +99,6 @@ int signof(float x) {
@implementation BOINC_Saver_ModuleView
@synthesize NIBTopLevel;
- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview {
self = [ super initWithFrame:frame isPreview:isPreview ];
return self;
@ -523,10 +521,11 @@ int signof(float x) {
// if we haven't loaded our configure sheet, load the nib named MyScreenSaver.nib
if (!mConfigureSheet) {
if ([[ NSBundle bundleForClass:[ self class ]] respondsToSelector: @selector(loadNibNamed: owner: topLevelObjects:)]) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-method-access"
// [NSBundle loadNibNamed: owner: topLevelObjects:] is not available before OS 10.8
[ [ NSBundle bundleForClass:[ self class ]] loadNibNamed:@"BOINCSaver" owner:self topLevelObjects:&NIBTopLevel ];
[ [ NSBundle bundleForClass:[ self class ]] loadNibNamed:@"BOINCSaver" owner:self topLevelObjects:NULL ];
#pragma clang diagnostic pop
}
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1080

View File

@ -3796,8 +3796,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ENABLE_OBJC_ARC = NO;
GCC_ENABLE_OBJC_GC = supported;
CLANG_ENABLE_OBJC_ARC = YES;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "ScreenSaver-Info.plist";
OTHER_LDFLAGS = (
@ -3968,8 +3967,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CLANG_ENABLE_OBJC_ARC = NO;
GCC_ENABLE_OBJC_GC = supported;
CLANG_ENABLE_OBJC_ARC = YES;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "ScreenSaver-Info.plist";
OTHER_LDFLAGS = (

View File

@ -298,6 +298,29 @@ int main(int argc, char *argv[])
sleep (2);
// OS 10.6 and OS10.7 require screensavers built with Garbage Collection, but
// Xcode 5.0.2 was the last version of Xcode which supported building with
// Garbage Collection, so we have saved the screensaver executable with GC as
// a binary. The installer build script added it to the screen saver, which
// now contains both the code with Garbage Collection and the code with
// Automatic Reference Counting. Determine the correct one to use for this
// version of OS X and remove the other one.
if (compareOSVersionTo(10, 8) < 0) {
// "rm -rf \"/Library/Screen Savers/GridRepublic.saver/Contents/MacOS/BOINCSaver\""
sprintf(s, "rm -f \"/Library/Screen Savers/%s.saver/Contents/MacOS/%s\"", saverName[brandID], saverName[brandID]);
err = callPosixSpawn (s);
REPORT_ERROR(err);
sprintf(s, "mv -f \"/Library/Screen Savers/%s.saver/Contents/MacOS/BOINCSaver_MacOS10_6_7\" \"/Library/Screen Savers/%s.saver/Contents/MacOS/%s\"",
saverName[brandID], saverName[brandID], saverName[brandID]);
err = callPosixSpawn (s);
REPORT_ERROR(err);
} else {
// "rm -rf \"/Library/Screen Savers/GridRepublic.saver/Contents/MacOS/BOINCSaver_MacOS10_6_7\""
sprintf(s, "rm -f \"/Library/Screen Savers/%s.saver/Contents/MacOS/BOINCSaver_MacOS10_6_7\"", saverName[brandID]);
err = callPosixSpawn (s);
REPORT_ERROR(err);
}
// Install all_projects_list.xml file, but only if one doesn't
// already exist, since a pre-existing one is probably newer.
f = fopen("/Library/Application Support/BOINC Data/all_projects_list.xml", "r");

View File

@ -2,7 +2,7 @@
# This file is part of BOINC.
# http://boinc.berkeley.edu
# Copyright (C) 2015 University of California
# Copyright (C) 2017 University of California
#
# BOINC is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License
@ -44,6 +44,7 @@
## updated 12/17/14 by Charlie Fenton to fix typo in build of BOINC+VBox installer
## updated 4/7/15 by Charlie Fenton to comment on problem with BOINC+VBox installer
## updated 7/1/15 by Charlie Fenton for compatibility with OS 10.11
## updated 6/4/17 by Charlie Fenton for compatibility with Xcode versions > 5.0.2
##
## NOTE: This script requires Mac OS 10.6 or later, and uses XCode developer
## tools. So you must have installed XCode Developer Tools on the Mac
@ -54,7 +55,7 @@
## NOTE: To build the executables under Lion and XCode 4, select from XCode's
## menu: "Product/Buildfor/Build for Archiving", NOT "Product/Archive"
## Under Mavericks and Xcode 5, select "Product/Buildfor/Build for Profiling"
## Under Mavericks and Xcode 5, select "Product/Build For/Profiling"
## To have this script build the combined BOINC+VirtualBox installer:
## * Create a directory named "VirtualBox Installer" in the same
@ -222,7 +223,15 @@ cp -fpRL $BUILDPATH/boincscr ../BOINC_Installer/Pkg_Root/Library/Application\ Su
cp -fpRL $BUILDPATH/BOINCManager.app ../BOINC_Installer/Pkg_Root/Applications/
## OS 10.6 and OS10.7 require screensavers built with Garbage Collection, but Xcode 5.0.2
## was the last version of Xcode which supported building with Garbage Collection, so we
## have saved the screensaver executable with GC as a binary. Add it to the screen saver
## passed to the BOINC installer. At install time, he BOINC installer will select the
## correct binary for the version of OS X and delete the other one. This scripy assumes
## that $BUILDPATH/BOINCSaver.saver was built to use Automatic Reference Counting (ARC)
## and not built to use GC.
cp -fpRL $BUILDPATH/BOINCSaver.saver ../BOINC_Installer/Pkg_Root/Library/Screen\ Savers/
ditto -xk ./clientscr/BOINCSaver_MacOS10_6_7.zip ../BOINC_Installer/Pkg_Root/Library/Screen\ Savers/BOINCSaver.saver/Contents/MacOS
## Copy the localization files into the installer tree
## Old way copies CVS and *.po files which are not needed