From 58096ce59725b29b6084d0b1e091a52397dfea7e Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 1 Aug 2020 23:41:58 -0700 Subject: [PATCH 1/7] Mac: Automatically build Universal x86_64 / arm64 binaries on Xcode versions that support building both architectures, x86_64-only binaries on Xcode versions that support only x86_64 and arm64-only binaries on Xcode versions that support only arm64. CAUTION #1: I don't have arm64 macintosh hardware so this has been tested only on an x86_64 system. CAUTION #2: This was developed on MacOS 11.0 beta 3 and Xcode 12.0 beta 2, not final release builds CAUTION #3: At this time OpenSSL does not yet provide a way to build for MacOS with arm64 architecture, so I implemented a temporary workaround, which may or may not work properly on arm64 Macs. --- client/cs_platforms.cpp | 2 + clientgui/mac/SetupSecurity.cpp | 45 ----- clientgui/mac/config.h | 2 + lib/mac/QBacktrace.c | 18 +- lib/mac/QCrashReport.c | 165 +---------------- lib/mac/QMachOImage.c | 6 +- lib/mac/mac_backtrace.cpp | 4 +- mac_build/boinc.xcodeproj/project.pbxproj | 108 ++++------- mac_build/buildFTGL.sh | 97 +++++++++- mac_build/buildWxMac.sh | 74 +++++--- mac_build/buildc-ares.sh | 145 +++++++++++---- mac_build/buildcurl.sh | 211 +++++++++++++++++----- mac_build/buildfreetype.sh | 90 +++++++-- mac_build/buildopenssl.sh | 129 +++++++++++-- mac_installer/release_boinc.sh | 79 ++++---- mac_installer/release_brand.sh | 77 ++++---- 16 files changed, 765 insertions(+), 487 deletions(-) diff --git a/client/cs_platforms.cpp b/client/cs_platforms.cpp index cd25e3e7c5a..5ea63fa5a4c 100644 --- a/client/cs_platforms.cpp +++ b/client/cs_platforms.cpp @@ -104,6 +104,8 @@ void CLIENT_STATE::detect_platforms() { if (compareOSVersionTo(10, 15) < 0) { add_platform("i686-apple-darwin"); } +#elif defined(__arm64__) + add_platform("arm64-apple-darwin"); #else #error Mac client now requires a 64-bit system #endif diff --git a/clientgui/mac/SetupSecurity.cpp b/clientgui/mac/SetupSecurity.cpp index b96995645cb..3a3cd69d0e1 100644 --- a/clientgui/mac/SetupSecurity.cpp +++ b/clientgui/mac/SetupSecurity.cpp @@ -40,9 +40,6 @@ static OSStatus UpdateNestedDirectories(char * basepath); static OSStatus MakeXMLFilesPrivate(char * basepath); static OSStatus DoSudoPosixSpawn(const char *pathToTool, char *arg1, char *arg2, char *arg3, char *arg4, char *arg5, char *arg6); -#ifndef __x86_64__ -static pascal Boolean ErrorDlgFilterProc(DialogPtr theDialog, EventRecord *theEvent, short *theItemHit); -#endif #ifdef _DEBUG static OSStatus SetFakeMasterNames(void); #endif @@ -1061,52 +1058,10 @@ static OSStatus DoSudoPosixSpawn(const char *pathToTool, char *arg1, char *arg2, void ShowSecurityError(const char *format, ...) { va_list args; -#ifdef __x86_64__ va_start(args, format); vfprintf(stderr, format, args); va_end(args); -#else - char s[1024]; - short itemHit; - AlertStdAlertParamRec alertParams; - ModalFilterUPP ErrorDlgFilterProcUPP; - - va_start(args, format); - s[0] = vsprintf(s+1, format, args); - va_end(args); - - ErrorDlgFilterProcUPP = NewModalFilterUPP(ErrorDlgFilterProc); - - alertParams.movable = true; - alertParams.helpButton = false; - alertParams.filterProc = ErrorDlgFilterProcUPP; - alertParams.defaultText = "\pOK"; - alertParams.cancelText = NULL; - alertParams.otherText = NULL; - alertParams.defaultButton = kAlertStdAlertOKButton; - alertParams.cancelButton = 0; - alertParams.position = kWindowDefaultPosition; - - BringAppToFront(); - - StandardAlert (kAlertStopAlert, (StringPtr)s, NULL, &alertParams, &itemHit); - - DisposeModalFilterUPP(ErrorDlgFilterProcUPP); -#endif -} - - -#ifndef __x86_64__ -static pascal Boolean ErrorDlgFilterProc(DialogPtr theDialog, EventRecord *theEvent, short *theItemHit) { - // We need this because this is a command-line application so it does not get normal events - if (GetCurrentEventButtonState()) { - *theItemHit = kStdOkItemIndex; - return true; - } - - return StdFilterProc(theDialog, theEvent, theItemHit); } -#endif // return time of day (seconds since 1970) as a double diff --git a/clientgui/mac/config.h b/clientgui/mac/config.h index 35e0d997d07..0274a0b5fe5 100644 --- a/clientgui/mac/config.h +++ b/clientgui/mac/config.h @@ -339,6 +339,8 @@ /* Host for this compilation */ #ifdef __x86_64__ #define HOSTTYPE "x86_64-apple-darwin" +#elif defined(__arm64__) +#define HOSTTYPE "arm64-apple-darwin" #endif /* "Define to 1 if largefile support causes missing symbols in C++" */ diff --git a/lib/mac/QBacktrace.c b/lib/mac/QBacktrace.c index b7f93f137a7..5dcf0b88301 100644 --- a/lib/mac/QBacktrace.c +++ b/lib/mac/QBacktrace.c @@ -154,8 +154,11 @@ First checked in. #if TARGET_CPU_PPC #include -#endif +#elif TARGET_CPU_X86_64 #include +#elif TARGET_CPU_ARM64 +#include +#endif #if defined(__cplusplus) } @@ -167,7 +170,7 @@ First checked in. // A new architecture will require substantial changes to this file. -#if ! (TARGET_CPU_PPC || TARGET_CPU_PPC64 || TARGET_CPU_X86 || TARGET_CPU_X86_64) +#if ! (TARGET_CPU_PPC || TARGET_CPU_PPC64 || TARGET_CPU_X86 || TARGET_CPU_X86_64 || TARGET_CPU_ARM64) #error QBacktrace: What architecture? #endif @@ -558,6 +561,7 @@ static int ReadAddr(QBTContext *context, QTMAddr addr, QTMAddr *valuePtr) return err; } +#if ! TARGET_CPU_ARM64 static void AddFrame(QBTContext *context, QTMAddr pc, QTMAddr fp, QBTFlags flags) // Adds a frame to the end of the output array with the // value specified by pc, fp, and flags. @@ -582,6 +586,7 @@ static void AddFrame(QBTContext *context, QTMAddr pc, QTMAddr fp, QBTFlags flags context->frameCountOut += 1; } +#endif static int BacktraceCore(QBTContext *context, size_t *frameCountPtr) // The core backtrace code. This routine is called by all of the various @@ -2512,6 +2517,15 @@ extern int QBTCreateThreadStateSelf( state->rbp = (uintptr_t) fp; #endif } + #elif TARGET_CPU_ARM64 + arm_thread_state64_t * state; + + flavor = ARM_THREAD_STATE64; + state = (arm_thread_state64_t *) calloc(1, sizeof(*state)); + if (state != NULL) { + state->pc = (uintptr_t) pc; + state->fp = (uintptr_t) fp; + } #else #error What architecture? #endif diff --git a/lib/mac/QCrashReport.c b/lib/mac/QCrashReport.c index 677bf8e2962..b501d3acf1c 100644 --- a/lib/mac/QCrashReport.c +++ b/lib/mac/QCrashReport.c @@ -145,10 +145,7 @@ First checked in. // By default, the system only gives us the one that's appropriate // for our machine. So we include both here. -#if TARGET_CPU_PPC -#include -#endif -#include +//#include #if defined(__cplusplus) } @@ -942,146 +939,6 @@ extern void QCRPrintBacktraces(QCrashReportRef crRef, FILE *f) } } -#if TARGET_CPU_PPC -static void PrintPowerPCThreadState( - QCrashReportRef crRef, - const char * threadID, - FILE * f -) - // Prints a PowerPC 32-bit thread state based on the thread state of the crashed - // thread. - // - // I'm really not happy with this. For a start, there's a whole bunch code - // that's shared between the various CPU architecture printing routines that - // could be factored out. However, doing that nicely would require me to - // strike a difficult balance between flexibility and complexity. - // - // Secondly, it would be nice if this routine was explicitly passed the - // thread state so that it could work on things other than the crashed - // thread. And that has implications for the API that wraps this up - // (QCRPrintThreadState). - // - // Hmmm, what to do. Nothing at the moment. Also spent way too much time - // on this code. -{ - const ppc_thread_state_t * state; - const unsigned int * regBase; - int reg; - char regName[32]; - - assert( QCRIsValid(crRef) ); - assert(crRef->crashedThreadIndex != kQCRNoThread); - assert( crRef->threads[crRef->crashedThreadIndex].state != NULL ); - assert( crRef->threads[crRef->crashedThreadIndex].stateFlavor == PPC_THREAD_STATE ); - - if (crRef->threads[crRef->crashedThreadIndex].stateSize == (PPC_THREAD_STATE_COUNT * sizeof(integer_t))) { - state = (const ppc_thread_state_t *) crRef->threads[crRef->crashedThreadIndex].state; -/* -Thread 0 crashed with PPC Thread State: - srr0: 0x01be8f98 srr1: 0x0200f030 vrsave: 0x00000000 - xer: 0x20000000 lr: 0x01be49bc ctr: 0x00000000 mq: 0x00000000 - r0: 0x01be49b4 r1: 0xbffff630 r2: 0x0188e250 r3: 0xffffffff - r4: 0x00000052 r5: 0x00000004 r6: 0x00000000 r7: 0xbffff7cf - r8: 0xbffffcc7 r9: 0x0000000b r10: 0xa0000d84 r11: 0xa00041f4 - r12: 0x0188e3a4 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000 - r16: 0x00000000 r17: 0x00000000 r18: 0x00000000 r19: 0x00000000 - r20: 0x00ca0275 r21: 0xbffffa00 r22: 0xbffffcce r23: 0xbffffccc - r24: 0xbffffcc4 r25: 0xbffffb20 r26: 0xbffffcc4 r27: 0xbffffcc4 - r28: 0x0188d650 r29: 0x01be92d8 r30: 0xbffff900 r31: 0x01be92e0 -*/ - fprintf(f, "%s crashed with PPC Thread State:\n", threadID); -#ifndef __LP64__ - fprintf(f, " srr0: 0x%08x srr1: 0x%08x vrsave: 0x%08x\n", state->srr0, state->srr1, state->vrsave); - fprintf(f, " xer: 0x%08x lr: 0x%08x ctr: 0x%08x mq: 0x%08x\n", state->xer, state->lr, state->ctr, state->mq); - - regBase = (const unsigned int *) &state->r0; -#else - fprintf(f, " srr0: 0x%08x srr1: 0x%08x vrsave: 0x%08x\n", state->srr0, state->srr1, state->vrsave); - fprintf(f, " xer: 0x%08x lr: 0x%08x ctr: 0x%08x mq: 0x%08x\n", state->xer, state->lr, state->ctr, state->mq); - - regBase = (const unsigned int *) &state->r0; -#endif - for (reg = 0; reg < 32; reg++) { - if ((reg % 4) == 0) { - fprintf(f, " "); - } - snprintf(regName, sizeof(regName), "r%d", reg); - fprintf(f, "%4s: 0x%08x", regName, regBase[reg]); - - if ((reg % 4) == 3) { - fprintf(f, "\n"); - } - } - fprintf(f, "\n"); - } - -} - -static void PrintPowerPC64ThreadState( - QCrashReportRef crRef, - const char * threadID, - FILE * f -) - // Prints a PowerPC 64-bit thread state based on the thread state of the - // crashed thread. - // - // See PrintPowerPCThreadState for comments about the overall approach. -{ - const ppc_thread_state64_t * state; - const unsigned long long * regBase; - int reg; - char regName[32]; - - assert( QCRIsValid(crRef) ); - assert(crRef->crashedThreadIndex != kQCRNoThread); - assert( crRef->threads[crRef->crashedThreadIndex].state != NULL ); - assert( crRef->threads[crRef->crashedThreadIndex].stateFlavor == PPC_THREAD_STATE64 ); - - if (crRef->threads[crRef->crashedThreadIndex].stateSize == (PPC_THREAD_STATE64_COUNT * sizeof(integer_t))) { - state = (const ppc_thread_state64_t *) crRef->threads[crRef->crashedThreadIndex].state; - -/* -Thread 0 crashed with PPC Thread State 64: - srr0: 0x0000000000000000 srr1: 0x000000004000d030 vrsave: 0x0000000000000000 - cr: 0x44022282 xer: 0x0000000020000004 lr: 0x000000009000b15c ctr: 0x000000009000b200 - r0: 0x00000000ffffffe1 r1: 0x00000000bfffeb10 r2: 0x00000000a073cdec r3: 0x0000000010004005 - r4: 0x0000000003000006 r5: 0x0000000000000000 r6: 0x0000000000000450 r7: 0x0000000000001203 - r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000003 r11: 0x00000000a0006a2c - r12: 0x000000009000b200 r13: 0x0000000000000000 r14: 0x0000000000000001 r15: 0x0000000000000001 - r16: 0x0000000000000000 r17: 0x0000000000000000 r18: 0x000000000000430f r19: 0x0000000000000000 - r20: 0x00000000101a6e8a r21: 0x00000000f8bd9d7f r22: 0x0000000000310808 r23: 0x00000000bfffebe0 - r24: 0x0000000000000450 r25: 0x0000000000001203 r26: 0x0000000000000000 r27: 0x0000000000000000 - r28: 0x0000000000000000 r29: 0x0000000003000006 r30: 0x0000000003000006 r31: 0x000000009075cdec -*/ - - fprintf(f, "%s crashed with PPC Thread State:\n", threadID); -#ifndef __LP64__ - fprintf(f, " srr0: 0x%016llx srr1: 0x%016llx vrsave: 0x%016x\n", state->srr0, state->srr1, state->vrsave); - fprintf(f, " cr: 0x%08x xer: 0x%016llx lr: 0x%016llx ctr: 0x%016llx\n", state->cr, state->xer, state->lr, state->ctr); - - regBase = (const unsigned long long *) &state->r0; -#else - fprintf(f, " srr0: 0x%016llx srr1: 0x%016llx vrsave: 0x%016x\n", state->srr0, state->srr1, state->vrsave); - fprintf(f, " cr: 0x%08x xer: 0x%016llx lr: 0x%016llx ctr: 0x%016llx\n", state->cr, state->xer, state->lr, state->ctr); - - regBase = (const unsigned long long *) &state->r0; -#endif - for (reg = 0; reg < 32; reg++) { - if ((reg % 4) == 0) { - fprintf(f, " "); - } - snprintf(regName, sizeof(regName), "r%d", reg); - fprintf(f, "%4s: 0x%016llx", regName, regBase[reg]); - - if ((reg % 4) == 3) { - fprintf(f, "\n"); - } - } - fprintf(f, "\n"); - } -} -#endif // TARGET_CPU_PPC - #if TARGET_CPU_X86 || TARGET_CPU_X86_64 static void PrintX86ThreadState( @@ -1215,26 +1072,6 @@ extern void QCRPrintThreadState(QCrashReportRef crRef, FILE *f) // Each CPU type has its own thread state flavor namespace, although it's // shared by the 32- and 64-bit variants. switch (crRef->actualCPUType) { -#if TARGET_CPU_PPC - case CPU_TYPE_POWERPC: -#if 0 // BOINC does not support 64-bit PowerPC - case CPU_TYPE_POWERPC64: -#endif - switch (crRef->threads[crRef->crashedThreadIndex].stateFlavor) { - case PPC_THREAD_STATE: - PrintPowerPCThreadState(crRef, threadID, f); - break; - case PPC_THREAD_STATE64: - PrintPowerPC64ThreadState(crRef, threadID, f); - break; - default: - assert(false); - break; - } - break; -#endif // TARGET_CPU_PPC - - #if TARGET_CPU_X86 || TARGET_CPU_X86_64 case CPU_TYPE_X86: case CPU_TYPE_X86_64: diff --git a/lib/mac/QMachOImage.c b/lib/mac/QMachOImage.c index c8aa478c96a..9528692d8c3 100644 --- a/lib/mac/QMachOImage.c +++ b/lib/mac/QMachOImage.c @@ -139,7 +139,7 @@ First checked in. #include #include -#if TARGET_CPU_X86 || TARGET_CPU_X86_64 +#if TARGET_CPU_X86 || TARGET_CPU_X86_64 || TARGET_CPU_ARM64 #include #endif @@ -2070,7 +2070,7 @@ static int FindTaskDyld(task_t task, cpu_type_t cputype, QTMAddr *dyldAddrPtr) int err; kern_return_t kr; QTMAddr localDyldAddr; -#if TARGET_CPU_X86 || TARGET_CPU_X86_64 +#if TARGET_CPU_X86 || TARGET_CPU_X86_64 || TARGET_CPU_ARM64 mach_vm_address_t thisRegion; #else vm_address_t thisRegion; @@ -2114,7 +2114,7 @@ static int FindTaskDyld(task_t task, cpu_type_t cputype, QTMAddr *dyldAddrPtr) mach_msg_type_number_t infoCount; -#if TARGET_CPU_X86 || TARGET_CPU_X86_64 +#if TARGET_CPU_X86 || TARGET_CPU_X86_64 || TARGET_CPU_ARM64 mach_vm_size_t thisRegionSize; vm_region_basic_info_data_64_t info; diff --git a/lib/mac/mac_backtrace.cpp b/lib/mac/mac_backtrace.cpp index 391a3cb54df..d9e3ea0a5ba 100644 --- a/lib/mac/mac_backtrace.cpp +++ b/lib/mac/mac_backtrace.cpp @@ -221,6 +221,8 @@ void PrintBacktrace(void) { snprintf(atosPipeBuf, sizeof(atosPipeBuf), "/usr/bin/atos -o \"%s\" -arch x86_64", pathToThisProcess); #elif defined (__i386__) snprintf(atosPipeBuf, sizeof(atosPipeBuf), "/usr/bin/atos -o \"%s\" -arch i386", pathToThisProcess); +#elif defined (__arm64__) + snprintf(atosPipeBuf, sizeof(atosPipeBuf), "/usr/bin/atos -o \"%s\" -arch arm", pathToThisProcess); #else snprintf(atosPipeBuf, sizeof(atosPipeBuf), "/usr/bin/atos -o \"%s\" -arch ppc", pathToThisProcess); #endif @@ -232,7 +234,7 @@ void PrintBacktrace(void) { } if (cppfiltExists) { - cppfiltPipe = popen("/usr/bin/c++filt -s gnu-v3 -n", "r+"); + cppfiltPipe = popen("/usr/bin/c++filt -s gnu -n", "r+"); if (cppfiltPipe) { setbuf(cppfiltPipe, 0); } diff --git a/mac_build/boinc.xcodeproj/project.pbxproj b/mac_build/boinc.xcodeproj/project.pbxproj index 8bd52312035..993df34d0f3 100644 --- a/mac_build/boinc.xcodeproj/project.pbxproj +++ b/mac_build/boinc.xcodeproj/project.pbxproj @@ -41,6 +41,11 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + DD000D6A24D0208E0083DE77 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */; }; + DD000D6B24D020940083DE77 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */; }; + DD000D7424D0244D0083DE77 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD000D7324D0244C0083DE77 /* SystemConfiguration.framework */; }; + DD000D7524D0244D0083DE77 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD000D7324D0244C0083DE77 /* SystemConfiguration.framework */; }; + DD000D7624D0244D0083DE77 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD000D7324D0244C0083DE77 /* SystemConfiguration.framework */; }; DD0052F910CA6F1D0067570C /* cs_proxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD0052F710CA6F1D0067570C /* cs_proxy.cpp */; }; DD00F554176C081500850424 /* MacInstaller.icns in Resources */ = {isa = PBXBuildFile; fileRef = DD531BC50C193D3800742E50 /* MacInstaller.icns */; }; DD01B6790C16723C0023A806 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20286C33FDCF999611CA2CEA /* Carbon.framework */; }; @@ -59,7 +64,6 @@ DD1AFEAF0A512D8700EE5B82 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20286C33FDCF999611CA2CEA /* Carbon.framework */; }; DD1AFEB00A512D8700EE5B82 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD1929D80918A2F100C31BCF /* Security.framework */; }; DD1AFEE80A51301C00EE5B82 /* Installer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD1AFEE70A51301C00EE5B82 /* Installer.cpp */; }; - DD1B4C3114FEFA0000ABB13F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */; }; DD1CB232154F5BF700BFF282 /* project.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD1CB22E154F5BF700BFF282 /* project.cpp */; }; DD1CB233154F5BF700BFF282 /* result.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD1CB230154F5BF700BFF282 /* result.cpp */; }; DD1E4B7B14DCA83F0093C711 /* async_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD1E4B7914DCA83F0093C711 /* async_file.cpp */; }; @@ -239,7 +243,6 @@ DD7748B50A356D6C0025D05E /* SetupSecurity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7748B40A356D6C0025D05E /* SetupSecurity.cpp */; }; DD7749680A3596380025D05E /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD1929D80918A2F100C31BCF /* Security.framework */; }; DD77A71812F2D1C9006B82E9 /* MacBitmapComboBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD77A71612F2D1C9006B82E9 /* MacBitmapComboBox.cpp */; }; - DD7811631851AC8D0050CF7B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */; }; DD7A5D8312EEBE5E0006268E /* sg_TaskCommandPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7A5D8212EEBE5E0006268E /* sg_TaskCommandPopup.cpp */; }; DD7A5D9F12EEBFC20006268E /* sg_ProjectWebSitesPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7A5D9E12EEBFC20006268E /* sg_ProjectWebSitesPopup.cpp */; }; DD7A5DAB12EEC37B0006268E /* sg_ProjectCommandPopup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD7A5DAA12EEC37B0006268E /* sg_ProjectCommandPopup.cpp */; }; @@ -541,7 +544,6 @@ DDE900271E643E3C003728F2 /* mac_util.mm in Sources */ = {isa = PBXBuildFile; fileRef = DDBAA9B41DF1902B004C48FD /* mac_util.mm */; }; DDEEAA991F73D3D70051E8C5 /* MultiGPUMig.defs in Sources */ = {isa = PBXBuildFile; fileRef = DD64D8001F6BE5BA00FEEAAA /* MultiGPUMig.defs */; settings = {ATTRIBUTES = (Client, Server, ); }; }; DDEEAA9A1F73E8630051E8C5 /* IOSurface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD0BB7A11F62B105000151B2 /* IOSurface.framework */; }; - DDEEAA9D1F73E9570051E8C5 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */; }; DDF07768236C4D410046EE44 /* proxy_info.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD344BEF07C5B1770043025C /* proxy_info.cpp */; }; DDF07769236C4D6A0046EE44 /* hostinfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD344BB607C5AEEE0043025C /* hostinfo.cpp */; }; DDF0776B236C4DD60046EE44 /* opencl_boinc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD76BF9117CB45870075936D /* opencl_boinc.cpp */; }; @@ -554,9 +556,6 @@ DDF5F85A10DD05DB006A50CD /* notice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDE1372D10DC5E8D00161D6B /* notice.cpp */; }; DDF5F85B10DD05E4006A50CD /* notice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDE1372D10DC5E8D00161D6B /* notice.cpp */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; DDF93511176B0D0C00A2793C /* translate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDF9350F176B0D0C00A2793C /* translate.cpp */; }; - DDF9B767245C3A8000587EBE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDF9B766245C3A7F00587EBE /* SystemConfiguration.framework */; }; - DDF9B768245C3A8000587EBE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDF9B766245C3A7F00587EBE /* SystemConfiguration.framework */; }; - DDF9B769245C3A8000587EBE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDF9B766245C3A7F00587EBE /* SystemConfiguration.framework */; }; DDF9B76A245C3C7900587EBE /* shmem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAA31C97042157A800A80164 /* shmem.cpp */; }; DDF9B76B245C3CC700587EBE /* shmem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAA31C97042157A800A80164 /* shmem.cpp */; }; DDF9EC0A144EB2BB005D6144 /* boinc_opencl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDF9EC08144EB2BB005D6144 /* boinc_opencl.cpp */; }; @@ -867,6 +866,7 @@ AA8B6B1C046C364400A80164 /* app_ipc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = app_ipc.h; path = ../lib/app_ipc.h; sourceTree = SOURCE_ROOT; }; AAA31C97042157A800A80164 /* shmem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = shmem.cpp; sourceTree = ""; }; AAA31C98042157A800A80164 /* shmem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = shmem.h; path = ../lib/shmem.h; sourceTree = SOURCE_ROOT; }; + DD000D7324D0244C0083DE77 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = ""; }; DD0052F710CA6F1D0067570C /* cs_proxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cs_proxy.cpp; path = ../client/cs_proxy.cpp; sourceTree = SOURCE_ROOT; }; DD0052F810CA6F1D0067570C /* cs_proxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cs_proxy.h; path = ../client/cs_proxy.h; sourceTree = SOURCE_ROOT; }; DD04BE1A0EDD836A006D5603 /* TermsOfUsePage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TermsOfUsePage.h; path = ../clientgui/TermsOfUsePage.h; sourceTree = SOURCE_ROOT; }; @@ -1278,7 +1278,6 @@ DDDC2054183B560B00CB5845 /* mac_address.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mac_address.h; sourceTree = ""; }; DDDD6D7E12E4611300C258A0 /* sg_ProjectPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sg_ProjectPanel.cpp; path = ../clientgui/sg_ProjectPanel.cpp; sourceTree = SOURCE_ROOT; }; DDDD6D7F12E4611300C258A0 /* sg_ProjectPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sg_ProjectPanel.h; path = ../clientgui/sg_ProjectPanel.h; sourceTree = SOURCE_ROOT; }; - DDDE391224600D05005FCEFA /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SystemConfiguration.framework; sourceTree = ""; }; DDDE43B00EC04C1800083520 /* DlgExitMessage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DlgExitMessage.cpp; path = ../clientgui/DlgExitMessage.cpp; sourceTree = SOURCE_ROOT; }; DDDE43B80EC04C3C00083520 /* DlgExitMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DlgExitMessage.h; path = ../clientgui/DlgExitMessage.h; sourceTree = SOURCE_ROOT; }; DDE1372810DC5E5300161D6B /* cs_notice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cs_notice.cpp; path = ../client/cs_notice.cpp; sourceTree = SOURCE_ROOT; }; @@ -1310,7 +1309,6 @@ DDF93510176B0D0C00A2793C /* translate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = translate.h; path = ../lib/translate.h; sourceTree = ""; }; DDF9385407E28906004DC076 /* checkin_notes */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = checkin_notes; path = ../checkin_notes; sourceTree = SOURCE_ROOT; }; DDF9B4D01F680006008BC9B7 /* x_opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = x_opengl.h; sourceTree = ""; }; - DDF9B766245C3A7F00587EBE /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = ../../../../../System/Library/Frameworks/SystemConfiguration.framework; sourceTree = ""; }; DDF9EC03144EB14B005D6144 /* libboinc_opencl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libboinc_opencl.a; sourceTree = BUILT_PRODUCTS_DIR; }; DDF9EC08144EB2BB005D6144 /* boinc_opencl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = boinc_opencl.cpp; sourceTree = ""; }; DDF9EC09144EB2BB005D6144 /* boinc_opencl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boinc_opencl.h; sourceTree = ""; }; @@ -1400,7 +1398,6 @@ DD3E15330A774397007E0084 /* Security.framework in Frameworks */, DD21B49D0D750FC600AFFEE5 /* AppKit.framework in Frameworks */, DD9E560F182D0D40002AF0F8 /* WebKit.framework in Frameworks */, - DD7811631851AC8D0050CF7B /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1432,8 +1429,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DD000D7624D0244D0083DE77 /* SystemConfiguration.framework in Frameworks */, DDA70B4223632223007097BD /* AppKit.framework in Frameworks */, - DDF9B769245C3A8000587EBE /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1476,12 +1473,12 @@ buildActionMask = 2147483647; files = ( DD130E740820C422001A0291 /* ScreenSaver.framework in Frameworks */, + DD000D7424D0244D0083DE77 /* SystemConfiguration.framework in Frameworks */, DDEEAA9A1F73E8630051E8C5 /* IOSurface.framework in Frameworks */, DDB6E3EF0D5B27AA00ED12B8 /* Carbon.framework in Frameworks */, - DDEEAA9D1F73E9570051E8C5 /* OpenGL.framework in Frameworks */, + DD000D6B24D020940083DE77 /* OpenGL.framework in Frameworks */, DDB74A6C0D74259E00E97A40 /* AppKit.framework in Frameworks */, DDD93E7313E017B600B92D0F /* IOKit.framework in Frameworks */, - DDF9B767245C3A8000587EBE /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1520,9 +1517,9 @@ buildActionMask = 2147483647; files = ( DD130F320820C47C001A0291 /* IOKit.framework in Frameworks */, + DD000D6A24D0208E0083DE77 /* OpenGL.framework in Frameworks */, DD431FAA0A41660D0060585A /* Carbon.framework in Frameworks */, DD85AE4B0F5D284D0031F7AC /* Security.framework in Frameworks */, - DD1B4C3114FEFA0000ABB13F /* OpenGL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1537,8 +1534,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DD000D7524D0244D0083DE77 /* SystemConfiguration.framework in Frameworks */, DD26B52C237445DD00206557 /* AppKit.framework in Frameworks */, - DDF9B768245C3A8000587EBE /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1594,7 +1591,6 @@ DD81C79E144D8F97000BE61A /* jpeg */, 20286C2CFDCF999611CA2CEA /* Resources */, 20286C32FDCF999611CA2CEA /* External Frameworks and Libraries */, - DDF9B766245C3A7F00587EBE /* SystemConfiguration.framework */, 195DF8C9FE9D4F0611CA2CBB /* Products */, DD96AFFA0811075100A06F22 /* ScreenSaver-Info.plist */, DD1277B5081F3D67007B5DE1 /* PostInstall-Info.plist */, @@ -1637,7 +1633,7 @@ DD89165D0F3B1BC200DE5B1C /* GLUT.framework */, DD89165E0F3B1BC200DE5B1C /* OpenGL.framework */, DD0BB7A11F62B105000151B2 /* IOSurface.framework */, - DDDE391224600D05005FCEFA /* SystemConfiguration.framework */, + DD000D7324D0244C0083DE77 /* SystemConfiguration.framework */, ); name = "External Frameworks and Libraries"; sourceTree = SOURCE_ROOT; @@ -4093,6 +4089,10 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); GCC_OPTIMIZATION_LEVEL = 0; MACOSX_DEPLOYMENT_TARGET = 10.13; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4104,6 +4104,10 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); MACOSX_DEPLOYMENT_TARGET = 10.13; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; @@ -4223,27 +4227,6 @@ DD9843D909920F220090855B /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { - OTHER_CFLAGS = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); - "OTHER_CFLAGS[arch=ppc]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); - "OTHER_CFLAGS[arch=x86_64]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); OTHER_LDFLAGS = ""; PRODUCT_NAME = boinc; }; @@ -4254,20 +4237,6 @@ buildSettings = { HEADER_SEARCH_PATHS = ../lib; LIBRARY_SEARCH_PATHS = ../lib; - "OTHER_CFLAGS[arch=ppc]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); - "OTHER_CFLAGS[arch=x86_64]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); PRODUCT_NAME = boinc_api; }; name = Deployment; @@ -4284,6 +4253,10 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = "ScreenSaver-Info.plist"; OTHER_LDFLAGS = ( "-framework", @@ -4314,13 +4287,6 @@ "../../c-ares-1.13.0/.libs", "../../openssl-1.1.0g/", ); - "OTHER_CFLAGS[arch=x86_64]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); OTHER_LDFLAGS = ( "-L.", "-lcurl", @@ -4452,6 +4418,10 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ENABLE_OBJC_ARC = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); INFOPLIST_FILE = "ScreenSaver-Info.plist"; OTHER_LDFLAGS = ( "-framework", @@ -4603,20 +4573,6 @@ isa = XCBuildConfiguration; buildSettings = { HEADER_SEARCH_PATHS = ../samples/jpeglib; - "OTHER_CFLAGS[arch=ppc]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); - "OTHER_CFLAGS[arch=x86_64]" = ( - "-D_THREAD_SAFE", - "-DNDEBUG", - "-DSANDBOX", - "-include", - ../clientgui/mac/config.h, - ); PRODUCT_NAME = boinc_graphics2; }; name = Deployment; @@ -4672,6 +4628,10 @@ DDFA60CE0CB337D40037B88C /* Development */ = { isa = XCBuildConfiguration; buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); HEADER_SEARCH_PATHS = ../lib/mac; OTHER_CFLAGS = ( "-D_THREAD_SAFE", @@ -4687,6 +4647,10 @@ DDFA60D20CB337D40037B88C /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); HEADER_SEARCH_PATHS = ../lib/mac; OTHER_CFLAGS = ( "-D_THREAD_SAFE", diff --git a/mac_build/buildFTGL.sh b/mac_build/buildFTGL.sh index e617ce25aa5..5b7850b74a8 100644 --- a/mac_build/buildFTGL.sh +++ b/mac_build/buildFTGL.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2019 University of California +# Copyright (C) 2020 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 @@ -27,6 +27,7 @@ # Updated 2/7/14 for OS 10.9 # Updated 2/8/18 to fix linker warning for Xcode 9.2 under OS 10.13 # Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility +# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.8 or later # @@ -88,6 +89,34 @@ if [ $? -ne 0 ]; then return 1 fi +if [ "${doclean}" != "yes" ]; then + if [ -f "${libPath}/libftgl.a" ]; then + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then $GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then $GCC_can_build_arm64="yes"; fi + if [ $GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPath}/libftgl.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then + lipo "${libPath}/libftgl.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ]; then + cwd=$(pwd) + dirname=${cwd##*/} + echo "${dirname} already built" + return 0 + fi + fi +fi + GPPPATH=`xcrun -find g++` if [ $? -ne 0 ]; then echo "ERROR: can't find g++ compiler" @@ -115,6 +144,7 @@ export PATH="${TOOLSPATH1}":"${TOOLSPATH2}":$PATH SDKPATH=`xcodebuild -version -sdk macosx Path` # Build for x86_64 architecture + export CC="${GCCPATH}";export CXX="${GPPPATH}" export CPPFLAGS="" export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" @@ -130,27 +160,76 @@ else fi if [ $? -ne 0 ]; then return 1; fi -if [ "${doclean}" = "yes" ]; then +if [ "${doclean}" == "yes" ]; then make clean 1>$stdout_target fi cd src || return 1 make 1>$stdout_target + +cd "${SRCDIR}" + +if [ $? -ne 0 ]; then return 1; fi + +# Try building for arm64 architecture + +export CC="${GCCPATH}";export CXX="${GPPPATH}" +export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" +export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export SDKROOT="${SDKPATH}" +export MACOSX_DEPLOYMENT_TARGET=10.7 + +if [ "x${lprefix}" != "x" ]; then + ./configure --prefix="${lprefix}" --enable-shared=NO --disable-freetypetest --with-ft-prefix="${libftpath}" --host=arm +else + ./configure --enable-shared=NO --disable-freetypetest --with-ft-prefix="${libftpath}" --host=arm +fi if [ $? -ne 0 ]; then + echo " ******" + echo "FTGL: x86_64 build succeeded but could not build for arm64." + echo " ******" +else ## Some versions of Xcode 12 don't support building for arm64 + + # save x86_64 lib for later use + cd src || return 1 + mv -f .libs/libftgl.a libftgl_x86_64.a cd "${SRCDIR}" || return 1 - return 1; -fi -if [ "x${lprefix}" != "x" ]; then - # this installs the modified library - make install 1>$stdout_target + make clean 1>$stdout_target + + cd src || return 1 + make 1>$stdout_target if [ $? -ne 0 ]; then + rm -f libftgl_x86_64.a cd "${SRCDIR}" || return 1 return 1; fi -fi -cd "${SRCDIR}" || return 1 + mv -f .libs/libftgl.a .libs/libftgl_arm64.a + # combine x86_64 and arm libraries + lipo -create libftgl_x86_64.a .libs/libftgl_arm64.a -output .libs/libftgl.a + if [ $? -ne 0 ]; then + rm -f libftgl_x86_64.a libs/libftgl_arm64.a + cd "${SRCDIR}" || return 1 + return 1; + fi + + rm -f libftgl_x86_64.a + rm -f .libs/libftgl_arm64.a + + if [ "x${lprefix}" != "x" ]; then + # this installs the modified library + make install 1>$stdout_target + if [ $? -ne 0 ]; then + cd "${SRCDIR}" || return 1 + return 1; + fi + fi + + cd "${SRCDIR}" || return 1 +fi lprefix="" export CC="";export CXX="" diff --git a/mac_build/buildWxMac.sh b/mac_build/buildWxMac.sh index a98944b57c1..f3282f7fc0d 100644 --- a/mac_build/buildWxMac.sh +++ b/mac_build/buildWxMac.sh @@ -39,6 +39,7 @@ # Fix wxWidgets 3.1.0 to not use backingScaleFactor API on OS 10.6 6/8/18 # Update for compatibility with Xcode 10 (this script for BOINC 7.15+ only) 10/14/18 # Add patches to build with Xcode 11 and OS 10.15 sdk 3/1/20 +# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.6 or later ## @@ -297,18 +298,27 @@ retval=0 alreadyBuilt=0 if [ "${doclean}" != "clean" ] && [ -f "${libPathRel}/libwx_osx_cocoa_static.a" ]; then - lipo "${libPathRel}/libwx_osx_cocoa_static.a" -verify_arch x86_64 - if [ $? -eq 0 ]; then - alreadyBuilt=1 - lipo "${libPathRel}/libwx_osx_cocoa_static.a" -verify_arch i386 - if [ $? -eq 0 ]; then - # already built for both 32 and 64 bit, rebuild for only 64 bit - alreadyBuilt=0 - doclean="clean" - fi - else - # already built but not for correct architecture - doclean="clean" + GCCPATH=`xcrun -find gcc` + if [ $? -ne 0 ]; then + echo "ERROR: can't find gcc compiler" + return 1 + fi + + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi + if [ $GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPathRel}/libwx_osx_cocoa_static.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then + lipo "${libPathRel}/libwx_osx_cocoa_static.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi fi fi @@ -321,7 +331,11 @@ else ## We must override some of the build settings in wxWindows.xcodeproj ## For wxWidgets 3.0.0 through 3.1.0 (at least) we must use legacy WebKit APIs ## for x86_64, so we must define WK_API_ENABLED=0 - xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Release $doclean build ARCHS="x86_64" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DNDEBUG -fvisibility=hidden" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=${PIPESTATUS[0]} + + ## "-include unistd.h" is a workaround for a problem under Xcode 12 Beta + ## $(ARCHS_STANDARD) builds Universal Binary (x86_64 & arm64) library under + ## Xcode versions that can, otherwise it builds only the X86_64 library. + xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Release $doclean build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=${PIPESTATUS[0]} if [ ${retval} -ne 0 ]; then return 1; fi if [ "x${lprefix}" != "x" ]; then # copy library and headers to $lprefix @@ -334,24 +348,27 @@ else fi fi -if [ "${nodebug}" = "yes" ]; then +if [ "${nodebug}" == "yes" ]; then return 0 fi alreadyBuilt=0 if [ "${doclean}" != "clean" ] && [ -f "${libPathDbg}/libwx_osx_cocoa_static.a" ]; then - lipo "${libPathDbg}/libwx_osx_cocoa_static.a" -verify_arch x86_64 - if [ $? -eq 0 ]; then - alreadyBuilt=1 - lipo "${libPathDbg}/libwx_osx_cocoa_static.a" -verify_arch i386 - if [ $? -eq 0 ]; then - # already built for both 32 and 64 bit, rebuild for only 64 bit - alreadyBuilt=0 - doclean="clean" ## Not acutally used; see comment below - fi - else - # already built but not for correct architectures - doclean="clean" ## Not acutally used; see comment below + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi + if [ GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPathDbg}/libwx_osx_cocoa_static.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ GCC_can_build_arm64 == "yes" ]; then + lipo "${libPathDbg}/libwx_osx_cocoa_static.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="clean"; fi fi fi @@ -370,7 +387,10 @@ else ## * If there is a previous build of wrong architecture, both Xcode 10 and ## earlier versions of Xcode correctly overwrite it with x86_64-only build. ## - xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="x86_64" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DDEBUG -fvisibility=hidden" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=${PIPESTATUS[0]} + ## "-include unistd.h" is a workaround for a problem under Xcode 12 Beta + ## $(ARCHS_STANDARD) builds Universal Binary (x86_64 & arm64) library under + ## Xcode versions that can, otherwise it builds only the X86_64 library. + xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=${PIPESTATUS[0]} if [ ${retval} -ne 0 ]; then return 1; fi if [ "x${lprefix}" != "x" ]; then # copy debug library to $PREFIX diff --git a/mac_build/buildc-ares.sh b/mac_build/buildc-ares.sh index f664825bd2c..a230fd027cf 100644 --- a/mac_build/buildc-ares.sh +++ b/mac_build/buildc-ares.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2019 University of California +# Copyright (C) 2020 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 @@ -31,6 +31,7 @@ # Updated 1/25/18 for bulding c-ares 1.13.0 (updated comemnts only) # Updated 2/22/18 to avoid APIs not available in earlier versions of OS X # Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility +# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.8 or later # @@ -49,6 +50,32 @@ ## use -q or --quiet to redirect build output to /dev/null instead of /dev/stdout ## +function patch_ares_config() { + # Patch ares_config.h to not use clock_gettime(), which is + # defined in OS 10.12 SDK but was not available before OS 10.12. + # If building with an older SDK, this patch will fail because + # config has already set our desired value. + rm -f ares_config.h.orig + rm -f /tmp/ares_config_h_diff + cat >> /tmp/ares_config_h_diff << ENDOFFILE +--- ares_config_orig.h 2018-01-25 04:15:37.000000000 -0800 ++++ ares_config.h 2018-02-22 01:30:57.000000000 -0800 +@@ -74,7 +74,7 @@ + #define HAVE_BOOL_T 1 + + /* Define to 1 if you have the clock_gettime function and monotonic timer. */ +-#define HAVE_CLOCK_GETTIME_MONOTONIC 1 ++/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ + + /* Define to 1 if you have the closesocket function. */ + /* #undef HAVE_CLOSESOCKET */ +ENDOFFILE + + patch -bfi /tmp/ares_config_h_diff ares_config.h +## rm -f /tmp/ares_config_h_diff +## rm -f ares_config.h.rej +} + doclean="" stdout_target="/dev/stdout" lprefix="/tmp/installed-c-ares" @@ -71,21 +98,40 @@ while [[ $# -gt 0 ]]; do shift # past argument or value done -if [ "${doclean}" != "yes" ]; then - if [ -f "${libPath}/libcares.a" ]; then - cwd=$(pwd) - dirname=${cwd##*/} - echo "${dirname} already built" - return 0 - fi -fi - GCCPATH=`xcrun -find gcc` if [ $? -ne 0 ]; then echo "ERROR: can't find gcc compiler" return 1 fi +if [ "${doclean}" != "yes" ]; then + if [ -f "${libPath}/libcares.a" ]; then + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi + if [ $GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPath}/libcares.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then + lipo "${libPath}/libcares.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ]; then + cwd=$(pwd) + dirname=${cwd##*/} + echo "${dirname} already built" + return 0 + fi + fi +fi + GPPPATH=`xcrun -find g++` if [ $? -ne 0 ]; then echo "ERROR: can't find g++ compiler" @@ -130,30 +176,9 @@ export MAC_OS_X_VERSION_MIN_REQUIRED=1070 ./configure --prefix=${lprefix} --enable-shared=NO --host=x86_64 if [ $? -ne 0 ]; then return 1; fi -# Patch ares_config.h to not use clock_gettime(), which is -# defined in OS 10.12 SDK but was not available before OS 10.12. -# If building with an older SDK, this patch will fail because -# config has already set our desired value. -rm -f ares_config.h.orig -cat >> /tmp/ares_config_h_diff << ENDOFFILE ---- ares_config_orig.h 2018-01-25 04:15:37.000000000 -0800 -+++ ares_config.h 2018-02-22 01:30:57.000000000 -0800 -@@ -74,7 +74,7 @@ - #define HAVE_BOOL_T 1 - - /* Define to 1 if you have the clock_gettime function and monotonic timer. */ --#define HAVE_CLOCK_GETTIME_MONOTONIC 1 -+/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ +patch_ares_config - /* Define to 1 if you have the closesocket function. */ - /* #undef HAVE_CLOSESOCKET */ -ENDOFFILE - -patch -bfi /tmp/ares_config_h_diff ares_config.h -rm -f /tmp/ares_config_h_diff -rm -f ares_config.h.rej - -if [ "${doclean}" = "yes" ]; then +if [ "${doclean}" == "yes" ]; then make clean fi @@ -162,6 +187,60 @@ if [ $? -ne 0 ]; then return 1; fi make install 1>$stdout_target if [ $? -ne 0 ]; then return 1; fi +export CC="${GCCPATH}";export CXX="${GPPPATH}" +export CPPFLAGS="" +export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" +export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++" +export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7" +export SDKROOT="${SDKPATH}" +export MACOSX_DEPLOYMENT_TARGET=10.7 +export MAC_OS_X_VERSION_MAX_ALLOWED=1070 +export MAC_OS_X_VERSION_MIN_REQUIRED=1070 + +./configure --prefix=${lprefix} --enable-shared=NO --host=arm +if [ $? -ne 0 ]; then + echo " ******" + echo "c-ares: x86_64 build succeeded but could not build for arm64." + echo " ******" +else ## Some versions of Xcode 12 don't support building for arm64 + +patch_ares_config + + # save x86_64 header and lib for later use + # c-ares configure creates a different ares_build.h file for each architecture + # for a sanity check on size of long and socklen_t. But these are identical + # for x86_64 and arm64, so this is not currently an issue. + ## cp -f ares_build.h ares_build_x86_64.h + mv -f .libs/libcares.a libcares_x86_64.a + + # Build for arm64 architecture + make clean 1>$stdout_target + + make 1>$stdout_target + if [ $? -ne 0 ]; then + rm -f libcares_x86_64.a + rm -f ares_build_x86_64.h + return 1 + fi + + # c-ares configure creates a different ares_build.h file for each architecture + # for a sanity check on size of long and socklen_t. But these are identical + # for x86_64 and arm64, so this is not currently an issue. + ## cp -f ares_build.h ares_build_arm64.h + mv -f .libs/libcares.a .libs/libcares_arm64.a + # combine x86_64 and arm libraries + lipo -create libcares_x86_64.a .libs/libcares_arm64.a -output .libs/libcares.a + if [ $? -ne 0 ]; then + rm -f libcares_x86_64.a .libs/libcares_arm64.a + return 1 + fi + + rm -f libcares_x86_64.a .libs/libcares_arm64.a + + make install 1>$stdout_target + if [ $? -ne 0 ]; then return 1; fi +fi + lprefix="" export CC="";export CXX="" export LDFLAGS="" diff --git a/mac_build/buildcurl.sh b/mac_build/buildcurl.sh index 88fbc4978eb..8e8aad94c98 100644 --- a/mac_build/buildcurl.sh +++ b/mac_build/buildcurl.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2019 University of California +# Copyright (C) 2020 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,6 +36,7 @@ # Updated 1/26/18 to get directory names of c-ares and OpenSSL from dependencyNames.sh # Updated 2/22/18 to avoid APIs not available in earlier versions of OS X # Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility +# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.8 or later # @@ -56,6 +57,45 @@ ## NOTE: cURL depends on OpenSLL and c-ares, so they must be built before cURL. # +function patch_curl_config { + # Patch curl_config.h to not use clock_gettime(), which is + # defined in OS 10.12 SDK but was not available before OS 10.12. + # If building with an older SDK or an older version of Xcode, these + # patches will fail because config has already set our desired values. + rm -f /tmp/curl_config_h_diff1 + cat >> /tmp/curl_config_h_diff1 << ENDOFFILE +--- lib/curl_config.h 2018-02-22 04:21:52.000000000 -0800 ++++ lib/curl_config1.h.in 2018-02-22 04:29:56.000000000 -0800 +@@ -141,5 +141,5 @@ + + /* Define to 1 if you have the __builtin_available function. */ +-#define HAVE_BUILTIN_AVAILABLE 1 ++/* #undef HAVE_BUILTIN_AVAILABLE */ + + /* Define to 1 if you have the clock_gettime function and monotonic timer. */ +ENDOFFILE + + patch -fi /tmp/curl_config_h_diff1 lib/curl_config.h + rm -f /tmp/curl_config_h_diff1 + rm -f lib/curl_config.h.rej + + cat >> /tmp/curl_config_h_diff2 << ENDOFFILE +--- lib/curl_config.h 2018-02-22 04:21:52.000000000 -0800 ++++ lib/curl_config2.h.in 2018-02-22 04:30:21.000000000 -0800 +@@ -144,5 +144,5 @@ + + /* Define to 1 if you have the clock_gettime function and monotonic timer. */ +-#define HAVE_CLOCK_GETTIME_MONOTONIC 1 ++/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ + + /* Define to 1 if you have the closesocket function. */ +ENDOFFILE + + patch -fi /tmp/curl_config_h_diff2 lib/curl_config.h + rm -f /tmp/curl_config_h_diff2 + rm -f lib/curl_config.h.rej +} + CURL_DIR=`pwd` doclean="" @@ -82,15 +122,6 @@ while [[ $# -gt 0 ]]; do shift # past argument or value done -if [ "${doclean}" != "yes" ]; then - if [ -f "${libPath}/libcurl.a" ]; then - cwd=$(pwd) - dirname=${cwd##*/} - echo "${dirname} already built" - return 0 - fi -fi - export PATH=/usr/local/bin:$PATH GCCPATH=`xcrun -find gcc` @@ -99,6 +130,34 @@ if [ $? -ne 0 ]; then return 1 fi +if [ "${doclean}" != "yes" ]; then + if [ -f "${libPath}/libcurl.a" ]; then + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi + if [ $GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPath}/libcurl.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then + lipo "${libPath}/libcurl.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ]; then + cwd=$(pwd) + dirname=${cwd##*/} + echo "${dirname} already built" + return 0 + fi + fi +fi + GPPPATH=`xcrun -find g++` if [ $? -ne 0 ]; then echo "ERROR: can't find g++ compiler" @@ -130,6 +189,11 @@ if [ -d "${libPath}" ]; then if [ $? -ne 0 ]; then return 1; fi fi +# c-ares configure creates a different ares_build.h file for each architecture +# for a sanity check on size of long and socklen_t. But these are identical for +# x86_64 and arm64, so this is not currently an issue. +## cp -f ../"${caresDirName}"/ares_build_x86_64.h /tmp/installed-c-ares/include/ares_build.h + export PATH=/usr/local/bin:$PATH export CC="${GCCPATH}";export CXX="${GPPPATH}" export SDKROOT="${SDKPATH}" @@ -171,48 +235,76 @@ else echo "" fi -# Patch curl_config.h to not use clock_gettime(), which is -# defined in OS 10.12 SDK but was not available before OS 10.12. -# If building with an older SDK or an older version of Xcode, these -# patches will fail because config has already set our desired values. -cat >> /tmp/curl_config_h_diff1 << ENDOFFILE ---- lib/curl_config.h 2018-02-22 04:21:52.000000000 -0800 -+++ lib/curl_config1.h.in 2018-02-22 04:29:56.000000000 -0800 -@@ -141,5 +141,5 @@ +patch_curl_config - /* Define to 1 if you have the __builtin_available function. */ --#define HAVE_BUILTIN_AVAILABLE 1 -+/* #undef HAVE_BUILTIN_AVAILABLE */ +if [ "${doclean}" == "yes" ]; then + make clean +fi - /* Define to 1 if you have the clock_gettime function and monotonic timer. */ -ENDOFFILE +make 1>$stdout_target +if [ $? -ne 0 ]; then return 1; fi -patch -fi /tmp/curl_config_h_diff1 lib/curl_config.h -rm -f /tmp/curl_config_h_diff1 -rm -f lib/curl_config.h.rej +if [ "x${lprefix}" != "x" ]; then + make install 1>$stdout_target + if [ $? -ne 0 ]; then return 1; fi +fi -cat >> /tmp/curl_config_h_diff2 << ENDOFFILE ---- lib/curl_config.h 2018-02-22 04:21:52.000000000 -0800 -+++ lib/curl_config2.h.in 2018-02-22 04:30:21.000000000 -0800 -@@ -144,5 +144,5 @@ +# Now see if we can build for arm64 - /* Define to 1 if you have the clock_gettime function and monotonic timer. */ --#define HAVE_CLOCK_GETTIME_MONOTONIC 1 -+/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ +# c-ares configure creates a different ares_build.h file for each architecture +# for a sanity check on size of long and socklen_t. But these are identical for +# x86_64 and arm64, so this is not currently an issue. +## cp -f ../"${caresDirName}"/ares_build_arm.h /tmp/installed-c-ares/include/ares_build.h - /* Define to 1 if you have the closesocket function. */ -ENDOFFILE +if [ "x${lprefix}" != "x" ]; then + export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" + export CPPFLAGS="" + export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++" + export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7" + PKG_CONFIG_PATH="${lprefix}/lib/pkgconfig" ./configure --prefix=${lprefix} --enable-ares --enable-shared=NO --without-libidn --without-libidn2 --without-nghttp2 --host=arm +else + export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64 -L${CURL_DIR}/../${opensslDirName} " + export CPPFLAGS="" + export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++ -I${CURL_DIR}/../${opensslDirName}/include" + export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -I${CURL_DIR}/../${opensslDirName}/include" + ./configure --enable-shared=NO --enable-ares="${libcares}" --without-libidn --without-libidn2 --without-nghttp2 --host=arm + echo "" +fi + +if [ $? -ne 0 ]; then + echo " ******" + echo "curl: x86_64 build succeeded but could not build for arm64." + echo " ******" +else ## Some versions of Xcode 12 don't support building for arm64 + + # save x86_64 header and lib for later use + # curl configure creates a different curlbuild.h file for each architecture + # for a sanity check on size of long and socklen_t. But these are identical + # for x86_64 and arm64, so this is not currently an issue. +## cp -f include/curl/curlbuild.h include/curl/curlbuild_x86_64.h + mv -f lib/.libs/libcurl.a lib/libcurl_x86_64.a -patch -fi /tmp/curl_config_h_diff2 lib/curl_config.h -rm -f /tmp/curl_config_h_diff2 -rm -f lib/curl_config.h.rej + patch_curl_config -if [ "${doclean}" = "yes" ]; then make clean + if [ $? -ne 0 ]; then return 1; fi + + make 1>$stdout_target + if [ $? -ne 0 ]; then return 1; fi + # curl configure creates a different curlbuild.h file for each architecture + # for a sanity check on size of long and socklen_t. But these are identical + # for x86_64 and arm64, so this is not currently an issue. +## mv -f include/curl/curlbuild.h include/curl/curlbuild_arm64.h + mv -f lib/.libs/libcurl.a lib/libcurl_arm64.a + + lipo -create lib/libcurl_x86_64.a lib/libcurl_arm64.a -output lib/.libs/libcurl.a + if [ $? -ne 0 ]; then + rm -f lib/libcurl_x86_64.a lib/libcurl_arm64.a + return 1 + fi fi -make 1>$stdout_target -if [ $? -ne 0 ]; then return 1; fi +rm -f lib/libcurl_x86_64.a lib/libcurl_arm64.a if [ "x${lprefix}" != "x" ]; then make install 1>$stdout_target @@ -222,6 +314,9 @@ else rm -Rf ${libcares} fi +# Delete temporarily installed c-ares. +rm -Rf ${libcares} + export lprefix="" export CC="";export CXX="" export LDFLAGS="" @@ -229,4 +324,38 @@ export CXXFLAGS="" export CFLAGS="" export SDKROOT="" +# curl configure creates a different curlbuild.h file for each architecture +# for a sanity check on size of long and socklen_t. But these are identical +# for x86_64 and arm64, so this is not currently an issue and so we return now. +return 0 + +# Create a custom curlbuild.h file which directs BOINC builds +# to the correct curlbuild_xxx.h file for each architecture. +cat >> include/curl/curlbuild.h << ENDOFFILE +/*************************************************************************** +* +* This file was created for BOINC by the buildcurl.sh script +* +* You should not need to modify it manually +* + ***************************************************************************/ + +#ifndef __BOINC_CURLBUILD_H +#define __BOINC_CURLBUILD_H + +#ifndef __APPLE__ +#error - this file is for Macintosh only +#endif + +#ifdef __x86_64__ +#include "curl/curlbuild_x86_64.h" +#elif defined(__arm64__) +#include "curl/curlbuild_arm64.h" +#else +#error - unknown architecture +#endif + +#endif /* __BOINC_CURLBUILD_H */ +ENDOFFILE + return 0 diff --git a/mac_build/buildfreetype.sh b/mac_build/buildfreetype.sh index b7a56185f05..3ab957ba47e 100644 --- a/mac_build/buildfreetype.sh +++ b/mac_build/buildfreetype.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2019 University of California +# Copyright (C) 2020 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 @@ -31,6 +31,7 @@ # Updated 1/5/16 for FreeType-2.6.2 # Updated 1/25/18 for any version of FreeType (changed only comments) # Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility +# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.8 or later # @@ -87,21 +88,40 @@ while [[ $# -gt 0 ]]; do shift # past argument or value done -if [ "${doclean}" != "yes" ]; then - if [ -f "${libPath}/libfreetype.a" ]; then - cwd=$(pwd) - dirname=${cwd##*/} - echo "${dirname} already built" - return 0 - fi -fi - GCCPATH=`xcrun -find gcc` if [ $? -ne 0 ]; then echo "ERROR: can't find gcc compiler" return 1 fi +if [ "${doclean}" != "yes" ]; then + if [ -f "${libPath}/libfreetype.a" ]; then + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi + if [ $GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPath}/libfreetype.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then + lipo "${libPath}/libfreetype.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ]; then + cwd=$(pwd) + dirname=${cwd##*/} + echo "${dirname} already built" + return 0 + fi + fi +fi + GPPPATH=`xcrun -find g++` if [ $? -ne 0 ]; then echo "ERROR: can't find g++ compiler" @@ -143,7 +163,7 @@ export MACOSX_DEPLOYMENT_TARGET=10.7 ./configure --enable-shared=NO --prefix=${lprefix} --without-png --host=x86_64 if [ $? -ne 0 ]; then return 1; fi -if [ "${doclean}" = "yes" ]; then +if [ "${doclean}" == "yes" ]; then make clean fi @@ -151,10 +171,54 @@ make 1>$stdout_target if [ $? -ne 0 ]; then return 1; fi # Building ftgl requires [install-path]/bin/freetype-config -# this installs the modified library +# this installs the x86_64 library in case we can't build for arm64 make install 1>$stdout_target if [ $? -ne 0 ]; then return 1; fi +export CC="${GCCPATH}";export CXX="${GPPPATH}" +export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" +export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export SDKROOT="${SDKPATH}" +export MACOSX_DEPLOYMENT_TARGET=10.7 + +./configure --enable-shared=NO --prefix=${lprefix} --without-png --host=arm +if [ $? -ne 0 ]; then + echo " ******" + echo "Freetype: x86_64 build succeeded but could not build for arm64." + echo " ******" +else ## Some versions of Xcode 12 don't support building for arm64 + + # save x86_64 lib for later use + mv -f objs/.libs/libfreetype.a objs/.libs/libfreetype_x86_64.a + + # Build for arm64 architecture + make clean 1>$stdout_target + + make 1>$stdout_target + if [ $? -ne 0 ]; then + rm -f objs/.libs/libfreetype_x86_64.a + return 1 + fi + + mv -f objs/.libs/libfreetype.a objs/.libs/libfreetype_arm64.a + # combine x86_64 and arm libraries + lipo -create objs/.libs/libfreetype_x86_64.a objs/.libs/libfreetype_arm64.a -output objs/.libs/libfreetype.a + if [ $? -ne 0 ]; then + rm -f objs/.libs/libfreetype_x86_64.a objs/.libs/libfreetype_arm64.a + return 1 + fi + + rm -f objs/.libs/libfreetype_x86_64.a + rm -f objs/.libs/libfreetype_arm64.a + + # Building ftgl requires [install-path]/bin/freetype-config + # this installs the modified library + make install 1>$stdout_target + if [ $? -ne 0 ]; then return 1; fi +fi + # remove installed items not needed by ftgl build # this directory is only used when no --prefix argument was given rm -fR "../freetype_install/share" @@ -163,7 +227,7 @@ rm -f ../freetype_install/lib/libfreetype.* lprefix="" export CC="";export CXX="" export LDFLAGS="" -export CXXFLAGS="" +export CPPFLAGS="" export CFLAGS="" export SDKROOT="" diff --git a/mac_build/buildopenssl.sh b/mac_build/buildopenssl.sh index 95af1c2239d..45ee7376a75 100644 --- a/mac_build/buildopenssl.sh +++ b/mac_build/buildopenssl.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2019 University of California +# Copyright (C) 2020 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 @@ -34,6 +34,7 @@ # Updated 9/10/16 for openssl-1.1.0 # Updated 1/25/18 for bulding openssl 1.1.0g (updated comemnts only) # Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility +# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.8 or later # @@ -74,15 +75,6 @@ while [[ $# -gt 0 ]]; do shift # past argument or value done -if [ "${doclean}" != "yes" ]; then - if [ -f ${libPath}/libssl.a ] && [ -f ${libPath}/libcrypto.a ]; then - cwd=$(pwd) - dirname=${cwd##*/} - echo "${dirname} already built" - return 0 - fi -fi - export PATH=/usr/local/bin:$PATH GCCPATH=`xcrun -find gcc` @@ -91,6 +83,38 @@ if [ $? -ne 0 ]; then return 1 fi +if [ "${doclean}" != "yes" ]; then + if [ -f ${libPath}/libssl.a ] && [ -f ${libPath}/libcrypto.a ]; then + alreadyBuilt=1 + GCC_can_build_x86_64="no" + GCC_can_build_arm64="no" + + GCC_archs=`lipo -archs "${GCCPATH}"` + if [[ "${GCC_archs}" == *"x86_64"* ]]; then GCC_can_build_x86_64="yes"; fi + if [[ "${GCC_archs}" == *"arm64"* ]]; then GCC_can_build_arm64="yes"; fi + if [ $GCC_can_build_x86_64 == "yes" ]; then + lipo "${libPath}/libssl.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + lipo "${libPath}/libcrypto.a" -verify_arch x86_64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ] && [ $GCC_can_build_arm64 == "yes" ]; then + lipo "${libPath}/libssl.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + lipo "${libPath}/libcrypto.a" -verify_arch arm64 + if [ $? -ne 0 ]; then alreadyBuilt=0; doclean="yes"; fi + fi + + if [ $alreadyBuilt -eq 1 ]; then + cwd=$(pwd) + dirname=${cwd##*/} + echo "${dirname} already built" + return 0 + fi + fi +fi + GPPPATH=`xcrun -find g++` if [ $? -ne 0 ]; then echo "ERROR: can't find g++ compiler" @@ -122,6 +146,8 @@ if [ -d "${libPath}" ]; then rm -f ${libPath}/libcrypto.a fi +# Build for x86_64 architecture + export CC="${GCCPATH}";export CXX="${GPPPATH}" export CPPFLAGS="" export LDFLAGS="-Wl,-sysroot,${SDKPATH},-syslibroot,${SDKPATH},-arch,x86_64" @@ -139,8 +165,8 @@ else if [ $? -ne 0 ]; then return 1; fi fi -if [ "${doclean}" = "yes" ]; then - make clean +if [ "${doclean}" == "yes" ]; then + make clean 1>$stdout_target fi make 1>$stdout_target @@ -151,6 +177,85 @@ if [ "x${lprefix}" != "x" ]; then if [ $? -ne 0 ]; then return 1; fi fi +# Try building for arm64 architecture +# Note: Some versions of Xcode 12 don't support building for arm64 + +export CC="${GCCPATH}";export CXX="${GPPPATH}" +export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" +export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export SDKROOT="${SDKPATH}" +export MACOSX_DEPLOYMENT_TARGET=10.7 + +## TEMPORARY WORKAROUNDS because OpenSSL 1.1.0g has no configure option for +## darwin arm64 +if [ "x${lprefix}" != "x" ]; then + ./configure --prefix=${lprefix} no-shared ios64-cross + if [ $? -ne 0 ]; then return 1; fi +else + ./configure no-shared ios64-cross + if [ $? -ne 0 ]; then return 1; fi +fi +## Patch the ios64-cross makefile to build for a Mac instead of iOS device +sed -i "" 's:-arch arm64:-target arm64-apple-macos10.7 -stdlib=libc++:g' Makefile +sed -i "" 's:-mios-version-min=7.0.0:-DMAC_OS_X_VERSION_MAX_ALLOWED=1070:g' Makefile +sed -i "" 's:-isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK):-isysroot ${SDKROOT}:g' Makefile +## END OF TEMPORARY WORKAROUNDS + +# save x86_64 lib for later use +mv -f libcrypto.a libcrypto_x86_64.a +mv -f libssl.a libssl_x86_64.a + +make clean 1>$stdout_target + +make 1>$stdout_target +if [ $? -ne 0 ]; then + echo " ******" + echo "OpenSSL: x86_64 build succeeded but could not build for arm64." + echo " ******" + rm -f libcrypto_x86_64.a + rm -f libssl_x86_64.a +fi + +mv -f libcrypto.a libcrypto_arm64.a +mv -f libssl.a libssl_arm64.a + +# combine x86_64 and arm libraries +lipo -create libcrypto_x86_64.a libcrypto_arm64.a -output libcrypto.a +if [ $? -eq 0 ]; then + lipo -create libssl_x86_64.a libssl_arm64.a -output libssl.a + if [ $? -ne 0 ]; then + rm -f libcrypto_x86_64.a libcrypto_arm64.a + rm -f libssl_x86_64.a libssl_arm64.a + return 1; + fi +fi + +rm -f libcrypto_x86_64.a libcrypto_arm64.a +rm -f libssl_x86_64.a libssl_arm64.a + +## openssl 1.1.0g does not have a configure option for darwin arm64, so we use +## the same configure as for ios64-cross with some patches and hope it works +## properly. +## NOTE: At the time of writing, I do not have an arm64 Mac to test with. +# Revisit this if a newer version of openssl becomes available. +# +# Get the names of the current versions of and openssl from the +# dependencyNames.sh file in the same directory as this script. +myScriptPath="${BASH_SOURCE[0]}" +myScriptDir="${myScriptPath%/*}" +source "${myScriptDir}/dependencyNames.sh" + +if [ "${opensslDirName}" != "openssl-1.1.0g" ]; then +echo "${opensslDirName}" + echo "************ NOTICE ****************" + echo "New version of openssl may have better arm64 darwin support" + echo "See comments in build script buildopenssl.sh for details." + echo "************************************" + return +fi + lprefix="" export CC="";export CXX="" export LDFLAGS="" diff --git a/mac_installer/release_boinc.sh b/mac_installer/release_boinc.sh index 67b51db8a39..2998ad30e88 100644 --- a/mac_installer/release_boinc.sh +++ b/mac_installer/release_boinc.sh @@ -50,10 +50,11 @@ ## updated 11/6/18 by Charlie Fenton to code sign for Apple "notarization" ## updated 11/4/19 by Charlie Fenton to code sign for new gfx_cleanup helper app ## updated 3/4/20 by Charlie Fenton to copy symbol tables directly from build +# Updated 7/29/20 TO build Apple Silicon / arm64 and x86_64 Universal binary ## -## NOTE: This script requires Mac OS 10.6 or later, and uses XCode developer +## NOTE: This script requires Mac OS 10.7 or later, and uses XCode developer ## tools. So you must have installed XCode Developer Tools on the Mac -## before running this script. You must code sign using OS 10.9 or later +## before running this script. You must code sign using OS 10.9 or later ## for compatibility with Gatekeeper on OS 10.10 or later. ## ## @@ -149,8 +150,16 @@ fi #pushd ./ BOINCPath=$PWD -DarwinVersion=`uname -r`; -DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; +if [ "$4" = "-dev" ]; then + exec 7<"mac_build/Build_Development_Dir" + read -u 7 BUILDPATH +else + exec 7<"mac_build/Build_Deployment_Dir" + read -u 7 BUILDPATH +fi + +##DarwinVersion=`uname -r`; +##DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; # DarwinMinorVersion=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `; # # echo "major = $DarwinMajorVersion" @@ -162,40 +171,42 @@ DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; # Darwin version 7.x.y corresponds to OS 10.3.x # Darwin version 6.x corresponds to OS 10.2.x -if [ "$DarwinMajorVersion" -gt 10 ]; then - # XCode 4.1 on OS 10.7 builds only Intel binaries - arch="x86_64" - - # XCode 3.x and 4.x use different paths for their build products. - # Our scripts in XCode's script build phase write those paths to - # files to help this release script find the build products. - if [ "$4" = "-dev" ]; then - exec 7<"mac_build/Build_Development_Dir" - read -u 7 BUILDPATH +arch="x86_64" + +Products_Have_x86_64="no" +Products_Have_arm64="no" +cd "${BUILDPATH}" +lipo "BOINCManager.app/Contents/MacOS/BOINCManager" -verify_arch x86_64 +if [ $? -eq 0 ]; then Products_Have_x86_64="yes"; fi +lipo "BOINCManager.app/Contents/MacOS/BOINCManager" -verify_arch arm64 +if [ $? -eq 0 ]; then Products_Have_arm64="yes"; fi +if [ $Products_Have_x86_64 == "no" ] && [ $Products_Have_arm64 == "no" ]; then + echo "ERROR: could not determine architecture of BOINC Manager" +fi +if [ $Products_Have_arm64 == "yes" ]; then + if [ $Products_Have_x86_64 == "yes" ]; then + arch="universal" else - exec 7<"mac_build/Build_Deployment_Dir" - read -u 7 BUILDPATH + arch="arm64" fi +fi -else - # XCode 3.2 on OS 10.6 does sbuild Intel and PowerPC Universal binaries - arch="universal" - - # XCode 3.x and 4.x use different paths for their build products. - if [ "$4" = "-dev" ]; then - if [ -d mac_build/build/Development/ ]; then - BUILDPATH="mac_build/build/Development" - else - BUILDPATH="mac_build/build" - fi - else - if [ -d mac_build/build/Deployment/ ]; then - BUILDPATH="mac_build/build/Deployment" - else - BUILDPATH="mac_build/build" - fi +for Executable in "boinc" "boinccmd" "switcher" "setprojectgrp" "boincscr" "BOINCSaver.saver/Contents/MacOS/BOINCSaver" "Uninstall BOINC.app/Contents/MacOS/Uninstall BOINC" "BOINC Installer.app/Contents/MacOS/BOINC Installer" "PostInstall.app/Contents/MacOS/PostInstall" +do + Have_x86_64="no" + Have_arm64="no" + lipo "${Executable}" -verify_arch x86_64 + if [ $? -eq 0 ]; then Have_x86_64="yes"; fi + lipo "${Executable}" -verify_arch arm64 + if [ $? -eq 0 ]; then Have_arm64="yes"; fi + + if [ $Have_x86_64 != $Products_Have_x86_64 ] || [ $Have_arm64 != $Products_Have_arm64 ]; then + echo "ERROR: Architecture mismatch: BOINC Manager and " "${Executable}" + return 1 fi -fi +done + +cd "${BOINCPath}" sudo rm -dfR ../BOINC_Installer/Installer\ Resources/ sudo rm -dfR ../BOINC_Installer/Installer\ Scripts/ diff --git a/mac_installer/release_brand.sh b/mac_installer/release_brand.sh index 7a00a7eae55..4fbfc627168 100755 --- a/mac_installer/release_brand.sh +++ b/mac_installer/release_brand.sh @@ -122,8 +122,8 @@ fi BOINCPath=$PWD -DarwinVersion=`uname -r`; -DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; +##DarwinVersion=`uname -r`; +##DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; # DarwinMinorVersion=`echo $version | sed 's/[0-9]*[.]\([0-9]*\).*/\1/' `; # # echo "major = $DarwinMajorVersion" @@ -135,41 +135,56 @@ DarwinMajorVersion=`echo $DarwinVersion | sed 's/\([0-9]*\)[.].*/\1/' `; # Darwin version 7.x.y corresponds to OS 10.3.x # Darwin version 6.x corresponds to OS 10.2.x -if [ "$DarwinMajorVersion" -gt 10 ]; then - # XCode 4.1 on OS 10.7 builds only Intel binaries - arch="x86_64" - - # XCode 3.x and 4.x use different paths for their build products. - # Our scripts in XCode's script build phase write those paths to - # files to help this release script find the build products. - if [ "$5" = "-dev" ]; then - exec 7<"mac_build/Build_Development_Dir" - read -u 7 BUILDPATH - else - exec 7<"mac_build/Build_Deployment_Dir" - read -u 7 BUILDPATH - fi +arch="x86_64" +# XCode 3.x and 4.x use different paths for their build products. +# Our scripts in XCode's script build phase write those paths to +# files to help this release script find the build products. +if [ "$5" = "-dev" ]; then + exec 7<"mac_build/Build_Development_Dir" + read -u 7 BUILDPATH else - # XCode 3.2 on OS 10.6 does build Intel and PowerPC Universal binaries - arch="universal" - - # XCode 3.x and 4.x use different paths for their build products. - if [ "$5" = "-dev" ]; then - if [ -d mac_build/build/Development/ ]; then - BUILDPATH="mac_build/build/Development" - else - BUILDPATH="mac_build/build" - fi + exec 7<"mac_build/Build_Deployment_Dir" + read -u 7 BUILDPATH +fi + +arch="x86_64" + +Products_Have_x86_64="no" +Products_Have_arm64="no" +cd "${BUILDPATH}" +lipo "BOINCManager.app/Contents/MacOS/BOINCManager" -verify_arch x86_64 +if [ $? -eq 0 ]; then Products_Have_x86_64="yes"; fi +lipo "BOINCManager.app/Contents/MacOS/BOINCManager" -verify_arch arm64 +if [ $? -eq 0 ]; then Products_Have_arm64="yes"; fi +if [ $Products_Have_x86_64 == "no" ] && [ $Products_Have_arm64 == "no" ]; then + echo "ERROR: could not determine architecture of BOINC Manager" +fi +if [ $Products_Have_arm64 == "yes" ]; then + if [ $Products_Have_x86_64 == "yes" ]; then + arch="universal" else - if [ -d mac_build/build/Deployment/ ]; then - BUILDPATH="mac_build/build/Deployment" - else - BUILDPATH="mac_build/build" - fi + arch="arm64" fi fi +for Executable in "boinc" "boinccmd" "switcher" "setprojectgrp" "boincscr" "BOINCSaver.saver/Contents/MacOS/BOINCSaver" "Uninstall BOINC.app/Contents/MacOS/Uninstall BOINC" "BOINC Installer.app/Contents/MacOS/BOINC Installer" "PostInstall.app/Contents/MacOS/PostInstall" +do + Have_x86_64="no" + Have_arm64="no" + lipo "${Executable}" -verify_arch x86_64 + if [ $? -eq 0 ]; then Have_x86_64="yes"; fi + lipo "${Executable}" -verify_arch arm64 + if [ $? -eq 0 ]; then Have_arm64="yes"; fi + + if [ $Have_x86_64 != $Products_Have_x86_64 ] || [ $Have_arm64 != $Products_Have_arm64 ]; then + echo "ERROR: Architecture mismatch: BOINC Manager and " "${Executable}" + return 1 + fi +done + +cd "${BOINCPath}" + sudo rm -dfR ../BOINC_Installer/Installer\ Resources/ sudo rm -dfR ../BOINC_Installer/Installer\ Scripts/ sudo rm -dfR ../BOINC_Installer/Pkg_Root From a3885168ec5fe4a6474f52f20fe86b593007de9c Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sun, 2 Aug 2020 06:07:36 -0700 Subject: [PATCH 2/7] Mac: Remove obsolete references to PowerPC architecture from BOINC Xcode project --- mac_build/boinc.xcodeproj/project.pbxproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mac_build/boinc.xcodeproj/project.pbxproj b/mac_build/boinc.xcodeproj/project.pbxproj index 993df34d0f3..0ac20449ad0 100644 --- a/mac_build/boinc.xcodeproj/project.pbxproj +++ b/mac_build/boinc.xcodeproj/project.pbxproj @@ -4366,8 +4366,6 @@ HEADER_SEARCH_PATHS = "../lib/**"; LIBRARY_STYLE = STATIC; MACOSX_DEPLOYMENT_TARGET = 10.7; - "MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.7; - "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.7; OTHER_CFLAGS = ( "-D_THREAD_SAFE", "-DNDEBUG", @@ -4538,8 +4536,6 @@ HEADER_SEARCH_PATHS = "../lib/**"; LIBRARY_STYLE = STATIC; MACOSX_DEPLOYMENT_TARGET = 10.7; - "MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.7; - "MACOSX_DEPLOYMENT_TARGET[arch=x86_64]" = 10.7; OTHER_CFLAGS = ( "-D_THREAD_SAFE", "-D_DEBUG", From 45875b20fa915539e33c808cc89f62022c8faca9 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 4 Aug 2020 05:17:45 -0700 Subject: [PATCH 3/7] Mac: Screensaver fixes for arm64 and MacOS 11 Big Sur --- clientscr/gfx_switcher.cpp | 26 +++++++++++++++++++++++--- clientscr/screensaver.cpp | 13 +++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/clientscr/gfx_switcher.cpp b/clientscr/gfx_switcher.cpp index 6f9343e0a07..2c34494f3b1 100644 --- a/clientscr/gfx_switcher.cpp +++ b/clientscr/gfx_switcher.cpp @@ -173,7 +173,7 @@ int main(int argc, char** argv) { return errno; } else { // if screensaverLoginUser #if VERBOSE // For debugging only - print_to_log_file("gfx_switcher using fork()");; + print_to_log_file("gfx_switcher using fork()"); #endif int pid = fork(); if (pid == 0) { @@ -182,10 +182,16 @@ int main(int argc, char** argv) { // full path twice in the argument list to execv. execv(resolved_path, argv+2); // If we got here execv failed +#if VERBOSE // For debugging only + print_to_log_file("gfx_switcher: Process creation (%s) failed: errno=%d\n", resolved_path, errno); +#endif fprintf(stderr, "Process creation (%s) failed: errno=%d\n", resolved_path, errno); return errno; } else { char shmem_name[MAXPATHLEN]; +#if VERBOSE // For debugging only + print_to_log_file("gfx_switcher: Child PID=%d", pid); +#endif snprintf(shmem_name, sizeof(shmem_name), "/tmp/boinc_ss_%s", screensaverLoginUser); retval = attach_shmem_mmap(shmem_name, (void**)&pid_for_shmem); if (pid_for_shmem != 0) { @@ -280,10 +286,24 @@ void * MonitorScreenSaverEngine(void* param) { while (true) { boinc_sleep(1.0); // Test every second ScreenSaverEngine_Pid = getPidIfRunning("com.apple.ScreenSaver.Engine"); +#if VERBOSE // For debugging only + print_to_log_file("MonitorScreenSaverEngine: ScreenSaverEngine_Pid=%d", ScreenSaverEngine_Pid); +#endif if (ScreenSaverEngine_Pid == 0) { - kill(graphics_Pid, SIGKILL); +#ifdef __x86_64__ + ScreenSaverEngine_Pid = getPidIfRunning("com.apple.ScreenSaver.Engine.legacyScreenSaver.x86_64"); +#elif defined(__arm64__) + ScreenSaverEngine_Pid = getPidIfRunning("com.apple.ScreenSaver.Engine.legacyScreenSaver.arm64"); +#endif +#if VERBOSE // For debugging only + print_to_log_file("MonitorScreenSaverEngine: ScreenSaverEngine_legacyScreenSaver_Pid=%d", ScreenSaverEngine_Pid); +#endif + } + + if (ScreenSaverEngine_Pid == 0) { + kill(graphics_Pid, SIGKILL); #if VERBOSE // For debugging only - print_to_log_file("MonitorScreenSaverEngine calling kill(%d, SIGKILL", graphics_Pid); + print_to_log_file("MonitorScreenSaverEngine calling kill(%d, SIGKILL", graphics_Pid); #endif return 0; } diff --git a/clientscr/screensaver.cpp b/clientscr/screensaver.cpp index 2a79f930495..aa3cff9fb58 100644 --- a/clientscr/screensaver.cpp +++ b/clientscr/screensaver.cpp @@ -26,6 +26,8 @@ #endif #ifdef __APPLE__ +#define VERBOSE 0 + #include #include #include @@ -49,6 +51,17 @@ extern pthread_mutex_t saver_mutex; #include "str_replace.h" #include "screensaver.h" +#ifdef __APPLE__ +#undef BOINCTRACE +#if VERBOSE +#define BOINCTRACE print_to_log_file +#else +#define BOINCTRACE(...) +#endif + +#define _T +#endif + // Platform specific application includes // #if defined(_WIN32) From 0ffa65a909e210c8f8cc727d30ece9b1b3fdd546 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 4 Aug 2020 05:25:48 -0700 Subject: [PATCH 4/7] Mac: fixes to client and Manager to support arm64, remove some obsolete PowerPC support. Caution: we need to add code for arm64 CPU to get_cpu_info_mac() in hostinfo_unix.cpp I have not removed is_native_i386_app() in app_start.cpp so it can be modified to identify arm64 apps --- client/app.h | 3 ++- client/app_start.cpp | 12 +++++++----- client/cs_platforms.cpp | 3 ++- client/hostinfo_unix.cpp | 18 ++---------------- clientgui/DlgAbout.cpp | 2 ++ 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/client/app.h b/client/app.h index 229b1ad87f5..c443431f428 100644 --- a/client/app.h +++ b/client/app.h @@ -182,8 +182,9 @@ struct ACTIVE_TASK { return _task_state; } -#if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__))) +#ifdef __APPLE__ // PowerPC apps emulated on i386 Macs crash if running graphics +// TODO: We may need to adapt this for x86_64 emulated on arm64 int powerpc_emulated_on_i386; int is_native_i386_app(char*); #endif diff --git a/client/app_start.cpp b/client/app_start.cpp index c0933623ce9..b35b1c50880 100644 --- a/client/app_start.cpp +++ b/client/app_start.cpp @@ -55,7 +55,7 @@ #include #endif -#if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__))) +#ifdef __APPLE__ #include #include #include @@ -989,9 +989,10 @@ int ACTIVE_TASK::start(bool test) { } app_client_shm.reset_msgs(); -#if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__))) +#ifdef __APPLE__ // PowerPC apps emulated on i386 Macs crash if running graphics - powerpc_emulated_on_i386 = ! is_native_i386_app(exec_path); +// TODO: We may need to adapt this for x86_64 emulated on arm64 +// powerpc_emulated_on_i386 = ! is_native_i386_app(exec_path); #endif if (cc_config.run_apps_manually) { pid = getpid(); // use the client's PID @@ -1248,13 +1249,14 @@ int ACTIVE_TASK::resume_or_start(bool first_time) { return 0; } -#if (defined (__APPLE__) && (defined(__i386__) || defined(__x86_64__))) - +#ifdef __APPLE__ union headeru { fat_header fat; mach_header mach; }; +// TODO: We may need to adapt this for x86_64 emulated on arm64 + // Read the mach-o headers to determine the architectures // supported by executable file. // Returns 1 if application can run natively on i386 / x86_64 Macs, diff --git a/client/cs_platforms.cpp b/client/cs_platforms.cpp index 5ea63fa5a4c..d00ce8f669a 100644 --- a/client/cs_platforms.cpp +++ b/client/cs_platforms.cpp @@ -40,7 +40,7 @@ LPFN_ISWOW64PROCESS fnIsWow64Process; #endif #endif -#if defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__)) +#ifdef __APPLE__ #include extern int compareOSVersionTo(int toMajor, int toMinor); #endif @@ -106,6 +106,7 @@ void CLIENT_STATE::detect_platforms() { } #elif defined(__arm64__) add_platform("arm64-apple-darwin"); +//TODO: Should we add_platform("x86_64-apple-darwin") if Apple Rosetta emulator is available? #else #error Mac client now requires a 64-bit system #endif diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index 2eab0560b29..7239b1dafd2 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -829,22 +829,8 @@ static void get_cpu_info_mac(HOST_INFO& host) { "%s [x86 Family %d Model %d Stepping %d]", brand_string, family, model, stepping ); -#else // PowerPC - char model[256]; - int response = 0; - int retval; - len = sizeof(response); - retval = sysctlbyname("hw.optional.altivec", &response, &len, NULL, 0); - if (response && (!retval)) { - safe_strcpy(host.p_features, "AltiVec"); - } - - len = sizeof(model); - sysctlbyname("hw.model", model, &len, NULL, 0); - - safe_strcpy(host.p_vendor, "Power Macintosh"); - snprintf(host.p_model, p_model_size, "%s [%s Model %s] [%s]", host.p_vendor, host.p_vendor, model, host.p_features); - +#else +// TODO: Add code for Apple arm64 CPU #endif host.p_model[p_model_size-1] = 0; diff --git a/clientgui/DlgAbout.cpp b/clientgui/DlgAbout.cpp index e0fe4e98aa3..c969e190af5 100644 --- a/clientgui/DlgAbout.cpp +++ b/clientgui/DlgAbout.cpp @@ -90,6 +90,8 @@ bool CDlgAbout::Create(wxWindow* parent, wxWindowID id, const wxString& caption, m_strVersion.Printf(wxT("%s (x86)"), wxT(BOINC_VERSION_STRING)); #elif defined(__ppc__) m_strVersion.Printf(wxT("%s (PowerPC)"), wxT(BOINC_VERSION_STRING)); +#elif defined(__arm64__) + m_strVersion.Printf(wxT("%s (arm64)"), wxT(BOINC_VERSION_STRING)); #else m_strVersion.Printf(wxT("%s (unknown)"), wxT(BOINC_VERSION_STRING)); #endif From 4ebbd1e4079f6165e45ab94e91b89e078bd1f8d9 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 4 Aug 2020 05:29:37 -0700 Subject: [PATCH 5/7] Mac: Fix script which creates debug build of wxWidgets library for arm64 architecture --- mac_build/buildWxMac.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac_build/buildWxMac.sh b/mac_build/buildWxMac.sh index f3282f7fc0d..58cf370b144 100644 --- a/mac_build/buildWxMac.sh +++ b/mac_build/buildWxMac.sh @@ -39,7 +39,7 @@ # Fix wxWidgets 3.1.0 to not use backingScaleFactor API on OS 10.6 6/8/18 # Update for compatibility with Xcode 10 (this script for BOINC 7.15+ only) 10/14/18 # Add patches to build with Xcode 11 and OS 10.15 sdk 3/1/20 -# Updated 7/28/20 TO build Apple Silicon / arm64 and x86_64 Universal binary +# Updated 8/4/20 TO build Apple Silicon / arm64 and x86_64 Universal binary # ## This script requires OS 10.6 or later ## @@ -390,7 +390,7 @@ else ## "-include unistd.h" is a workaround for a problem under Xcode 12 Beta ## $(ARCHS_STANDARD) builds Universal Binary (x86_64 & arm64) library under ## Xcode versions that can, otherwise it builds only the X86_64 library. - xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=${PIPESTATUS[0]} + xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.7" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -fno-strict-aliasing -fno-common -DWK_API_ENABLED=0 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=${PIPESTATUS[0]} if [ ${retval} -ne 0 ]; then return 1; fi if [ "x${lprefix}" != "x" ]; then # copy debug library to $PREFIX From 288b4e30d258d1be6ff12fd46c9f5ee87b2f4fcf Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 6 Aug 2020 04:38:18 -0700 Subject: [PATCH 6/7] Mac: Remove some obsolete code from Xcode project --- mac_build/boinc.xcodeproj/project.pbxproj | 63 ----------------------- 1 file changed, 63 deletions(-) diff --git a/mac_build/boinc.xcodeproj/project.pbxproj b/mac_build/boinc.xcodeproj/project.pbxproj index 0ac20449ad0..4c95ff3db01 100644 --- a/mac_build/boinc.xcodeproj/project.pbxproj +++ b/mac_build/boinc.xcodeproj/project.pbxproj @@ -2251,9 +2251,7 @@ DD3E14DE0A774397007E0084 /* Sources */, DD3E15300A774397007E0084 /* Frameworks */, DD3E15350A774397007E0084 /* CopyFiles */, - DD73550C0D91105F0006A9D1 /* ShellScript */, DD3E15390A774397007E0084 /* ShellScript */, - DDEE5E8E0D9112AF0056A99E /* ShellScript */, ); buildRules = ( ); @@ -2503,9 +2501,7 @@ buildPhases = ( DDD74D8407CF482E0065AC9D /* Sources */, DDD74D8507CF482E0065AC9D /* Frameworks */, - DD7355180D9110AE0006A9D1 /* ShellScript */, DD1B90070A954C9A00FF5591 /* ShellScript */, - DD73551E0D9111150006A9D1 /* ShellScript */, ); buildRules = ( ); @@ -2815,50 +2811,6 @@ shellPath = /bin/sh; shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/Postinstall.app/Contents/Resources/English.lproj\"\ncp -fpv \"${SRCROOT}/English.lproj/PostInstall-InfoPlist.strings\" \"${BUILT_PRODUCTS_DIR}/Postinstall.app/Contents/Resources/English.lproj/InfoPlist.strings\"\n"; }; - DD73550C0D91105F0006A9D1 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${BUILT_PRODUCTS_DIR}/BOINCManager.app/Contents/MacOS/BOINCManager", - ); - outputPaths = ( - "${BUILT_PRODUCTS_DIR}/SymbolTables/sgBOINCManager.dSYM", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" = \"Deployment\" ]; then\n ## echo \"Starting script 1\"\n echo ${BUILT_PRODUCTS_DIR} > \"${PROJECT_DIR}/Build_Deployment_Dir\"\n mkdir -p \"${BUILT_PRODUCTS_DIR}/SymbolTables\"\n if [ \"${BUILT_PRODUCTS_DIR}/BOINCManager.app/Contents/MacOS/BOINCManager\" -nt \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager.dSYM\" ]; then\n ## echo \"${BUILT_PRODUCTS_DIR}/BOINCManager.app/Contents/MacOS/BOINCManager is newer than ${TARGET_BUILD_DIR}/SymbolTables/BOINCManager.dSYM\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager_i386\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager_x86_64\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager_ppc\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager.dSYM\"\n cp -fp \"${BUILT_PRODUCTS_DIR}/BOINCManager.app.dSYM\" \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager.app.dSYM\"\n touch \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager.app.dSYM\"\n strip \"${BUILT_PRODUCTS_DIR}/BOINCManager.app/Contents/MacOS/BOINCManager\"\n fi\nelse\n echo ${BUILT_PRODUCTS_DIR} > \"${PROJECT_DIR}/Build_Development_Dir\"\nfi\n\n"; - }; - DD7355180D9110AE0006A9D1 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${BUILT_PRODUCTS_DIR}/$PRODUCT_NAME", - ); - outputPaths = ( - "${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" = \"Deployment\" ]; then\n ## echo \"Starting script 1\"\n echo ${BUILT_PRODUCTS_DIR} > \"${PROJECT_DIR}/Build_Deployment_Dir\"\n mkdir -p \"${BUILT_PRODUCTS_DIR}/SymbolTables\"\n if [ \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}\" -nt \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM\" ]; then\n ## echo \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME} is newer than ${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}_i386\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}_ppc\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}_x86_64\"\n rm -f \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM\"\n cp -fp \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}\" \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM\"\n touch \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM\"\n## strip \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}\"\n fi\nelse\n echo ${BUILT_PRODUCTS_DIR} > \"${PROJECT_DIR}/Build_Development_Dir\"\n\nfi\n\n"; - }; - DD73551E0D9111150006A9D1 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${BUILT_PRODUCTS_DIR}/$PRODUCT_NAME", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" = \"Deployment\" ]; then\n touch \"${BUILT_PRODUCTS_DIR}/SymbolTables/${PRODUCT_NAME}.dSYM\"\nfi\n"; - }; DD818296245EDA220076E5D0 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -2939,21 +2891,6 @@ shellPath = /bin/sh; shellScript = "if [ \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMig.h\" -nt \"${SRCROOT}/../api/MultiGPUMig.h\" ]; then\n cp -fp \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMig.h\" \"${SRCROOT}/../api/MultiGPUMig.h\"\nfi\nif [ \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMigServer.h\" -nt \"${SRCROOT}/../api/MultiGPUMigServer.h\" ]; then\n cp -fp \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMigServer.h\" \"${SRCROOT}/../api/MultiGPUMigServer.h\"\nfi\nif [ \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMigServer.c\" -nt \"${SRCROOT}/../api/MultiGPUMigServer.c\" ]; then\n cp -fp \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMigServer.c\" \"${SRCROOT}/../api/MultiGPUMigServer.c\"\nfi\nif [ \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMigUser.c\" -nt \"${SRCROOT}/../api/MultiGPUMigUser.c\" ]; then\n cp -fp \"${DERIVED_FILES_DIR}/x86_64/MultiGPUMigUser.c\" \"${SRCROOT}/../api/MultiGPUMigUser.c\"\nfi\n"; }; - DDEE5E8E0D9112AF0056A99E /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${BUILT_PRODUCTS_DIR}/$PRODUCT_NAME", - ); - outputPaths = ( - "", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if [ \"$CONFIGURATION\" = \"Deployment\" ]; then\n touch \"${BUILT_PRODUCTS_DIR}/SymbolTables/BOINCManager.app.dSYM\"\nfi\n"; - }; DDF9B764245C12AA00587EBE /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; From d4ea9271f2df3395a746c3a9de58c6d9ef1a7bf6 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 12 Aug 2020 04:53:43 -0700 Subject: [PATCH 7/7] Mac: add x86_64-apple-darwin platform to arm64 Macs, since Apple's Rosetta 2 emulator will run x86_64 apps --- client/cs_platforms.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/cs_platforms.cpp b/client/cs_platforms.cpp index d00ce8f669a..d5acbdf39d5 100644 --- a/client/cs_platforms.cpp +++ b/client/cs_platforms.cpp @@ -106,7 +106,8 @@ void CLIENT_STATE::detect_platforms() { } #elif defined(__arm64__) add_platform("arm64-apple-darwin"); -//TODO: Should we add_platform("x86_64-apple-darwin") if Apple Rosetta emulator is available? +//TODO: Add test for Mac OS Version when Apple Rosetta emulator is removed + add_platform("x86_64-apple-darwin"); #else #error Mac client now requires a 64-bit system #endif