diff --git a/lib/crypt.cpp b/lib/crypt.cpp index 01249cfc34..9b1f69160b 100644 --- a/lib/crypt.cpp +++ b/lib/crypt.cpp @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2021 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 @@ -672,7 +672,10 @@ int check_validity_of_cert( } #ifdef HAVE_OPAQUE_RSA_DSA_DH RSA *rsa; - rsa = EVP_PKEY_get0_RSA(pubKey); + // CAUTION: In OpenSSL 3.0.0, EVP_PKEY_get0_RSA() now returns a + // pointer of type "const struct rsa_st*" to an immutable value. + // Do not try to modify the contents of the returned struct. + rsa = (rsa_st*)EVP_PKEY_get0_RSA(pubKey); if (!RSA_blinding_on(rsa, c)) { #else if (!RSA_blinding_on(pubKey->pkey.rsa, c)) { diff --git a/mac_build/boinc.xcodeproj/project.pbxproj b/mac_build/boinc.xcodeproj/project.pbxproj index 1bc0277994..ed06b6a061 100644 --- a/mac_build/boinc.xcodeproj/project.pbxproj +++ b/mac_build/boinc.xcodeproj/project.pbxproj @@ -4330,14 +4330,14 @@ HEADER_SEARCH_PATHS = ( ../api/, ../samples/jpeglib/, - "../../freetype-2.9/include", + "../../freetype-2.11.0/include", "../../ftgl-2.1.3~rc5/src", "../lib/**", ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "${BUILT_PRODUCTS_DIR}/", - "../../freetype-2.9/objs/.libs", + "../../freetype-2.11.0/objs/.libs", "../../ftgl-2.1.3~rc5/src/.libs", ); OTHER_LDFLAGS = ( @@ -4358,14 +4358,14 @@ HEADER_SEARCH_PATHS = ( ../api/, ../samples/jpeglib/, - "../../freetype-2.9/include", + "../../freetype-2.11.0/include", "../../ftgl-2.1.3~rc5/src", "../lib/**", ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "${BUILT_PRODUCTS_DIR}/", - "../../freetype-2.9/objs/.libs", + "../../freetype-2.11.0/objs/.libs", "../../ftgl-2.1.3~rc5/src/.libs", ); OTHER_LDFLAGS = ( @@ -4431,18 +4431,19 @@ DD9843DE09920F220090855B /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_X86_VECTOR_INSTRUCTIONS = default; COPY_PHASE_STRIP = NO; DEPLOYMENT_POSTPROCESSING = YES; HEADER_SEARCH_PATHS = ( - "../../curl-7.73.0/include", - "../../openssl-1.1.0l/include", + "../../curl-7.79.1/include", + "../../openssl-3.0.0/include", "../lib/**", ); INFOPLIST_PREPROCESSOR_DEFINITIONS = ""; LIBRARY_SEARCH_PATHS = ( - "../../curl-7.73.0/lib/.libs", - "../../c-ares-1.13.0/.libs", - "../../openssl-1.1.0l/", + "../../curl-7.79.1/lib/.libs", + "../../c-ares-1.17.2/src/lib/.libs", + "../../openssl-3.0.0/", ); OTHER_LDFLAGS = ( "-L.", @@ -4455,7 +4456,7 @@ ); PRODUCT_NAME = boinc; STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "../../curl-7.73.0/include ../../openssl-1.1.0l/include ../lib/**"; + USER_HEADER_SEARCH_PATHS = "../../curl-7.79.1/include ../../openssl-3.0.0/include ../lib/**"; }; name = Deployment; }; @@ -4599,18 +4600,19 @@ DD9E2366091CBDAE0048316E /* Development */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_X86_VECTOR_INSTRUCTIONS = default; COPY_PHASE_STRIP = NO; DEPLOYMENT_POSTPROCESSING = YES; HEADER_SEARCH_PATHS = ( - "../../curl-7.73.0/include", - "../../openssl-1.1.0l/include", + "../../curl-7.79.1/include", + "../../openssl-3.0.0/include", "../lib/**", ); INFOPLIST_PREPROCESSOR_DEFINITIONS = ""; LIBRARY_SEARCH_PATHS = ( - "../../curl-7.73.0/lib/.libs", - "../../c-ares-1.13.0/.libs", - "../../openssl-1.1.0l/", + "../../curl-7.79.1/lib/.libs", + "../../c-ares-1.17.2/src/lib/.libs", + "../../openssl-3.0.0/", ); OTHER_CFLAGS = ( "-D_THREAD_SAFE", @@ -4629,7 +4631,7 @@ ); PRODUCT_NAME = boinc; STRIP_INSTALLED_PRODUCT = NO; - USER_HEADER_SEARCH_PATHS = "../../curl-7.73.0/include ../../openssl-1.1.0l/include ../lib/**"; + USER_HEADER_SEARCH_PATHS = "../../curl-7.79.1/include ../../openssl-3.0.0/include ../lib/**"; }; name = Development; }; diff --git a/mac_build/buildFTGL.sh b/mac_build/buildFTGL.sh index a7caed0331..7b326b437a 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) 2020 University of California +# Copyright (C) 2021 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,8 +27,9 @@ # 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 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary +# Updated 8/22/20 to build Apple Silicon / arm64 and x86_64 Universal binary # Updated 5/18/21 for compatibility with zsh +# Updated 10/18/21 for building with freetype 2.11.0 # ## This script requires OS 10.8 or later # @@ -70,7 +71,7 @@ while [[ $# -gt 0 ]]; do shift # past argument or value done -# needed for ftgl 2.1.3-rc5 to find our freetype 2.9 build not the system one +# needed for ftgl to find our freetype build not the system one export PKG_CONFIG_PATH=${libftpath}/lib/pkgconfig:${PKG_CONFIG_PATH} SRCDIR=$PWD @@ -146,13 +147,19 @@ SDKPATH=`xcodebuild -version -sdk macosx Path` # Build for x86_64 architecture +## The "-Werror=unguarded-availability" compiler flag generates an error if +## there is an unguarded API not available in our Deployment Target. This +## helps ensure FTGL won't try to use unavailable APIs on older Mac +## systems supported by BOINC. +## It also causes configure to reject any such APIs for which it tests. +## export CC="${GCCPATH}";export CXX="${GPPPATH}" export CPPFLAGS="" export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" -export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" -export CFLAGS="-isysroot ${SDKPATH} -arch x86_64 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CXXFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" +export CFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" export SDKROOT="${SDKPATH}" -export MACOSX_DEPLOYMENT_TARGET=10.7 +export MACOSX_DEPLOYMENT_TARGET=10.9 if [ "x${lprefix}" != "x" ]; then ./configure --prefix="${lprefix}" --enable-shared=NO --disable-freetypetest --with-ft-prefix="${libftpath}" --host=x86_64 @@ -185,11 +192,11 @@ if [ $GCC_can_build_arm64 = "yes" ]; then 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 CPPFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" + export CXXFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" + export CFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -mmacosx-version-min=10.9 -target arm64-apple-macos -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" export SDKROOT="${SDKPATH}" - export MACOSX_DEPLOYMENT_TARGET=10.7 + export MACOSX_DEPLOYMENT_TARGET=10.9 if [ "x${lprefix}" != "x" ]; then ./configure --prefix="${lprefix}" --enable-shared=NO --disable-freetypetest --with-ft-prefix="${libftpath}" --host=arm diff --git a/mac_build/buildc-ares.sh b/mac_build/buildc-ares.sh index 748b98c416..76d65b5d65 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) 2020 University of California +# Copyright (C) 2021 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 @@ -33,6 +33,8 @@ # Updated 1/23/19 use libc++ instead of libstdc++ for Xcode 10 compatibility # Updated 8/22/20 to build Apple Silicon / arm64 and x86_64 Universal binary # Updated 5/18/21 for compatibility with zsh +# Updated 10/18/21 for building c-ares 1.17.2 + # ## This script requires OS 10.8 or later # @@ -52,15 +54,15 @@ ## function patch_ares_config() { - # Patch ares_config.h to not use clock_gettime(), which is + # Patch src/lib/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 src/lib/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 +--- src/lib/ares_config_orig.h 2018-01-25 04:15:37.000000000 -0800 ++++ src/lib/ares_config.h 2018-02-22 01:30:57.000000000 -0800 @@ -74,7 +74,7 @@ #define HAVE_BOOL_T 1 @@ -72,15 +74,15 @@ function patch_ares_config() { /* #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 + patch -bfi /tmp/ares_config_h_diff src/lib/ares_config.h + rm -f /tmp/ares_config_h_diff + rm -f src/lib/ares_config.h.rej } doclean="" stdout_target="/dev/stdout" lprefix="/tmp/installed-c-ares" -libPath=".libs" +libPath="src/lib/.libs" while [[ $# -gt 0 ]]; do key="$1" case $key in @@ -164,15 +166,25 @@ if [ -d "${libPath}" ]; then if [ $? -ne 0 ]; then return 1; fi fi +# Build for x86_64 architecture + +## The "-Werror=partial-availability" compiler flag generates an error if +## there is an unguarded API not available in our Deployment Target. This +## helps ensure c-ares won't try to use unavailable APIs on older Mac +## systems supported by BOINC. +## It also causes configure to reject any such APIs for which it tests; +## this actually makes the call to the patch_ares_config function +## redundant, but it does no harm to leave it in. +## export CC="${GCCPATH}";export CXX="${GPPPATH}" export CPPFLAGS="" export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" -export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++" -export CFLAGS="-isysroot ${SDKPATH} -arch x86_64" +export CXXFLAGS="-isysroot ${SDKPATH} -Werror=partial-availability -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++" +export CFLAGS="-isysroot ${SDKPATH} -Werror=partial-availability -mmacosx-version-min=10.9 -arch x86_64" 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 +export MACOSX_DEPLOYMENT_TARGET=10.9 +export MAC_OS_X_VERSION_MAX_ALLOWED=1090 +export MAC_OS_X_VERSION_MIN_REQUIRED=1090 ./configure --prefix=${lprefix} --enable-shared=NO --host=x86_64 if [ $? -ne 0 ]; then return 1; fi @@ -195,12 +207,12 @@ if [ $GCC_can_build_arm64 = "yes" ]; then 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 CXXFLAGS="-isysroot ${SDKPATH} -Werror=partial-availability -target arm64-apple-macos10.9 -mmacosx-version-min=10.9 -stdlib=libc++" + export CFLAGS="-isysroot ${SDKPATH} -Werror=partial-availability -mmacosx-version-min=10.9 -target arm64-apple-macos10.9" 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 + export MACOSX_DEPLOYMENT_TARGET=10.9 + export MAC_OS_X_VERSION_MAX_ALLOWED=1090 + export MAC_OS_X_VERSION_MIN_REQUIRED=1090 ./configure --prefix=${lprefix} --enable-shared=NO --host=arm if [ $? -ne 0 ]; then @@ -209,14 +221,14 @@ if [ $GCC_can_build_arm64 = "yes" ]; then echo " ******" else - patch_ares_config + 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 + mv -f "${libPath}/libcares.a" libcares_x86_64.a # Build for arm64 architecture make clean 1>$stdout_target @@ -232,15 +244,16 @@ if [ $GCC_can_build_arm64 = "yes" ]; then # 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 + mv -f "${libPath}/libcares.a" libcares_arm64.a + # combine x86_64 and arm libraries - lipo -create libcares_x86_64.a .libs/libcares_arm64.a -output .libs/libcares.a + lipo -create libcares_x86_64.a libcares_arm64.a -output "${libPath}/libcares.a" if [ $? -ne 0 ]; then - rm -f libcares_x86_64.a .libs/libcares_arm64.a + rm -f libcares_x86_64.a libcares_arm64.a return 1 fi - rm -f libcares_x86_64.a .libs/libcares_arm64.a + rm -f libcares_x86_64.a libcares_arm64.a make install 1>$stdout_target if [ $? -ne 0 ]; then return 1; fi diff --git a/mac_build/buildcurl.sh b/mac_build/buildcurl.sh index 1c8c7a4715..ba69d08559 100644 --- a/mac_build/buildcurl.sh +++ b/mac_build/buildcurl.sh @@ -36,13 +36,17 @@ # 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 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary +# Updated 8/22/20 to build Apple Silicon / arm64 and x86_64 Universal binary # Updated 12/24/20 for curl 7.73.0 # Updated 5/18/21 for compatibility with zsh # Updated 10/11/21 to use Secure Transport instead of OpenSSL (uses MacOS certificate store # instead of ca-bundle.crt) +# Updated 10/18/21 for curl 7.79.1 # -## This script requires OS 10.8 or later +## Curl's configure and make set the "-Werror=partial-availability" compiler flag, +## which generates an error if there is an API not available in our Deployment +## Target. This helps ensure curl won't try to use unavailable APIs on older Mac +## systems supported by BOINC. # ## After first installing Xcode, you must have opened Xcode and ## clicked the Install button on the dialog which appears to @@ -58,7 +62,7 @@ ## if --prefix is given as absolute path the library is installed into there ## use -q or --quiet to redirect build output to /dev/null instead of /dev/stdout # -## NOTE: cURL depends on OpenSLL and c-ares, so they must be built before cURL. +## NOTE: cURL depends on c-ares, so it must be built before cURL. # function patch_curl_config { @@ -74,7 +78,7 @@ function patch_curl_config { 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 -@@ -165,5 +165,5 @@ +@@ -168,5 +168,5 @@ /* Define to 1 if you have the __builtin_available function. */ -#define HAVE_BUILTIN_AVAILABLE 1 @@ -93,7 +97,7 @@ ENDOFFILE 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 -@@ -168,5 +168,5 @@ +@@ -171,5 +171,5 @@ /* Define to 1 if you have the clock_gettime function and monotonic timer. */ -#define HAVE_CLOCK_GETTIME_MONOTONIC 1 @@ -206,6 +210,8 @@ fi # 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 +# Build for x86_64 architecture + export PATH=/usr/local/bin:$PATH export CC="${GCCPATH}";export CXX="${GPPPATH}" export SDKROOT="${SDKPATH}" @@ -215,16 +221,16 @@ export MAC_OS_X_VERSION_MIN_REQUIRED=1090 if [ "x${lprefix}" != "x" ]; then export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" - export CPPFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++" - export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++" - export CFLAGS="-isysroot ${SDKPATH} -arch x86_64" + export CPPFLAGS="-isysroot ${SDKPATH} -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++" + export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++" + export CFLAGS="-isysroot ${SDKPATH} -mmacosx-version-min=10.9 -arch x86_64" PKG_CONFIG_PATH="${lprefix}/lib/pkgconfig" ./configure --prefix=${lprefix} --enable-ares --disable-shared --with-secure-transport --host=x86_64-apple-darwin if [ $? -ne 0 ]; then return 1; fi else # Get the name of the current versions of c-ares from the # dependencyNames.sh file in the same directory as this script. myScriptPath="${BASH_SOURCE[0]}" - if [ -z ${myScriptPath} ]; then + if [ -z "${myScriptPath}" ]; then myScriptPath="$0" # for zsh fi myScriptDir="${myScriptPath%/*}" @@ -241,10 +247,10 @@ else cd "${CURL_DIR}" || return 1 fi - export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" - export CPPFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++" - export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++" - export CFLAGS="-isysroot ${SDKPATH} -arch x86_64" + export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64, " + export CPPFLAGS="-isysroot ${SDKPATH} -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++" + export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++" + export CFLAGS="-isysroot ${SDKPATH} -mmacosx-version-min=10.9 -arch x86_64" ./configure --disable-shared --with-secure-transport --enable-ares="${libcares}" --host=x86_64-apple-darwin if [ $? -ne 0 ]; then return 1; fi echo "" @@ -274,15 +280,15 @@ if [ $GCC_can_build_arm64 = "yes" ]; then ## cp -f ../"${caresDirName}"/ares_build_arm.h /tmp/installed-c-ares/include/ares_build.h if [ "x${lprefix}" != "x" ]; then export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" - export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -stdlib=libc++" - export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -stdlib=libc++" - export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos" + export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++" + export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++" + export CFLAGS="-isysroot ${SDKPATH} -mmacosx-version-min=10.9 -target arm64-apple-macos" PKG_CONFIG_PATH="${lprefix}/lib/pkgconfig" ./configure --prefix=${lprefix} --enable-ares --disable-shared --with-secure-transport --host=arm-apple-darwin else export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" - export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -stdlib=libc++" - export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -stdlib=libc++" - export CFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos" + export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++" + export CXXFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++" + export CFLAGS="-isysroot ${SDKPATH} -mmacosx-version-min=10.9 -target arm64-apple-macos" ./configure --disable-shared --with-secure-transport --enable-ares="${libcares}" --host=arm-apple-darwin echo "" diff --git a/mac_build/buildfreetype.sh b/mac_build/buildfreetype.sh index f3ebd09adc..7fce99e4fc 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) 2020 University of California +# Copyright (C) 2021 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,8 +31,9 @@ # 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 8/22/20 TO build Apple Silicon / arm64 and x86_64 Universal binary +# Updated 8/22/20 to build Apple Silicon / arm64 and x86_64 Universal binary # Updated 5/18/21 for compatibility with zsh +# Updated 10/18/21 for for building freetype 2.11.0 # ## This script requires OS 10.8 or later # @@ -154,15 +155,22 @@ SDKPATH=`xcodebuild -version -sdk macosx Path` rm -fR "../freetype_install/" # Build for x86_64 architecture + +## The "-Werror=unguarded-availability" compiler flag generates an error if +## there is an unguarded API not available in our Deployment Target. This +## helps ensure FreeType won't try to use unavailable APIs on older Mac +## systems supported by BOINC. +## It also causes configure to reject any such APIs for which it tests. +## export CC="${GCCPATH}";export CXX="${GPPPATH}" export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" -export CPPFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" -export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" -export CFLAGS="-isysroot ${SDKPATH} -arch x86_64 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export CPPFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" +export CXXFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" +export CFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" export SDKROOT="${SDKPATH}" -export MACOSX_DEPLOYMENT_TARGET=10.7 +export MACOSX_DEPLOYMENT_TARGET=10.9 -./configure --enable-shared=NO --prefix=${lprefix} --without-png --host=x86_64 +./configure --enable-shared=NO --prefix=${lprefix} --enable-freetype-config --without-png --host=x86_64 if [ $? -ne 0 ]; then return 1; fi if [ "${doclean}" = "yes" ]; then @@ -178,13 +186,13 @@ if [ $GCC_can_build_arm64 = "yes" ]; then export CC="${GCCPATH}";export CXX="${GPPPATH}" export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,arm64" - export CPPFLAGS="-isysroot ${SDKPATH} -target arm64-apple-macos10.7 -stdlib=libc++ -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 CPPFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" + export CXXFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" + export CFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -mmacosx-version-min=10.9 -target arm64-apple-macos -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" export SDKROOT="${SDKPATH}" - export MACOSX_DEPLOYMENT_TARGET=10.7 + export MACOSX_DEPLOYMENT_TARGET=10.9 - ./configure --enable-shared=NO --prefix=${lprefix} --without-png --host=arm + ./configure --enable-shared=NO --prefix=${lprefix} --enable-freetype-config --without-png --host=arm if [ $? -ne 0 ]; then echo " ******" echo "Freetype: x86_64 build succeeded but could not build for arm64." diff --git a/mac_build/buildopenssl.sh b/mac_build/buildopenssl.sh index 20b37c7b62..4f3b6af108 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) 2020 University of California +# Copyright (C) 2021 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 @@ -37,8 +37,9 @@ # Updated 10/20/20 To build Apple Silicon / arm64 and x86_64 Universal binary # Updated 12/24/20 for openssl-1.1.0l # Updated 5/18/21 for compatibility with zsh +# Updated 10/18/21 for building OpenSSL 3.0.0 # -## This script requires OS 10.8 or later +## Building OpenSSL 3.0 requires Xcode 10.2 or later # ## After first installing Xcode, you must have opened Xcode and ## clicked the Install button on the dialog which appears to @@ -117,41 +118,6 @@ if [ "${doclean}" != "yes" ]; then fi fi fi - -## openssl 1.1.0g does not have a configure option for darwin arm64, -## so we patch Configurations/10-main.conf to add it. -## Derived from https://github.com/openssl/openssl/pull/12369/files -## and https://cutecoder.org/programming/compile-open-ssl-apple-silicon/ -## -## Note: setting perlasm_scheme to "ios64" tells configure to use -## the correct assembler instructions for Apple Silicon. Setting -## it to "macosx" causes it to use x86_64 assembler instructions. -## -if [ ! -f Configurations/10-main.conf.orig ]; then - cat >> /tmp/0-main_conf_diff << ENDOFFILE ---- 10-main.conf 2017-11-02 07:29:01.000000000 -0700 -+++ 10-main_patched.con2020-10-19 01:34:06.000000000 -0700 -@@ -1599,6 +1599,14 @@ - perlasm_scheme => "macosx", - shared_ldflag => "-arch x86_64 -dynamiclib", - }, -+ "darwin64-arm64-cc" => { -+ inherit_from => [ "darwin-common", asm("aarch64_asm") ], -+ CFLAGS => add("-Wall"), -+ cflags => add("-arch arm64"), -+ lib_cppflags => add("-DL_ENDIAN"), -+ bn_ops => "SIXTY_FOUR_BIT_LONG", -+ perlasm_scheme => "ios64", -+ }, - - #### iPhoneOS/iOS - # -ENDOFFILE - patch -bfi /tmp/0-main_conf_diff Configurations/10-main.conf - rm -f /tmp/0-main_conf_diff -else - echo "Configurations/10-main.conf already patched" -fi echo "" GPPPATH=`xcrun -find g++` @@ -185,15 +151,66 @@ if [ -d "${libPath}" ]; then rm -f ${libPath}/libcrypto.a fi +echo "" + # Build for x86_64 architecture +## avx-512 cpu extensions are first supported in Xcode 10.2, but there is a bug in +## crypto/bn/asm/rsaz-avx512.pl which causes OpenSSL to try to build with avx-512 +## instructions on earlier versions of Xcode, causing many build errors. In those +## cases, we patch rsaz-avx512.pl to prevent that. +## +## This code works for versions of both forms major.minor and major.minor.revision +## Get Xcode version and remove "Xcode " from resulting string +fullversion=`xcodebuild -version | cut -d' ' -f2` +## Remove all after the actual version number x.y or x.y.z under bash +fullversion=`echo $fullversion | cut -d' ' -f1` +## The next line is needed under zsh to finish removing all after x.y or x.y.z +fullversion=`echo $fullversion | sed '/version/d'` +major=`echo $fullversion | cut -d. -f1` +minor=`echo $fullversion | cut -d. -f2` +## $revision will be empty string if no revision number (only x.y not x.y.z) +##revision=`echo $fullversion | cut -d. -f3` # We don't need the revision number +if [[ $major -lt 10 || ($major -eq 10 && $minor -lt 2 ) ]]; then +# Disable avx-512 support because not available in this Xcode verson + rm -f crypto/bn/asm/rsaz-avx512.pl.orig + rm -f /tmp/rsaz-avx512_pl_diff + # We must escape all the $ as \$ in the diff for the shell to treat them as literals + cat >> /tmp/rsaz-avx512_pl_diff << ENDOFFILE +--- /Volumes/Dev/BOINC_GIT/openssl-3.0.0-patched/crypto/bn/asm/rsaz-avx512-orig.pl 2021-09-07 04:46:32.000000000 -0700 ++++ /Volumes/Dev/BOINC_GIT/openssl-3.0.0-patched/crypto/bn/asm/rsaz-avx512.pl 2021-10-14 01:16:23.000000000 -0700 +@@ -52,6 +52,9 @@ + \$avx512ifma = (\$2>=7.0); + } + ++# Disable avx-512 support because not available in this Xcode verson ++\$avx512ifma = 0; ++ + open OUT,"| \"\$^X\" \"\$xlate\" \$flavour \"\$output\"" + or die "can't call \$xlate: \$!"; + *STDOUT=*OUT; +ENDOFFILE + + patch -bfi /tmp/rsaz-avx512_pl_diff crypto/bn/asm/rsaz-avx512.pl + rm -f /tmp/rsaz-avx512_pl_diff + rm -f crypto/bn/asm/rsaz-avx512.pl.rej +else + echo "crypto/bn/asm/rsaz-avx512.pl is OK for this Xcode version\n" +fi +echo "" + +## The "-Werror=unguarded-availability" compiler flag generates an error if +## there is an unguarded API not available in our Deployment Target. This +## helps ensure openssl won't try to use unavailable APIs on older Mac +## systems supported by BOINC. +## export CC="${GCCPATH}";export CXX="${GPPPATH}" export CPPFLAGS="" -export LDFLAGS="-Wl,-sysroot,${SDKPATH},-syslibroot,${SDKPATH},-arch,x86_64" -export CXXFLAGS="-isysroot ${SDKPATH} -arch x86_64 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" -export CFLAGS="-isysroot ${SDKPATH} -arch x86_64 -DMAC_OS_X_VERSION_MAX_ALLOWED=1070 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070" +export LDFLAGS="-Wl,-syslibroot,${SDKPATH},-arch,x86_64" +export CXXFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" +export CFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -arch x86_64 -mmacosx-version-min=10.9 -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" export SDKROOT="${SDKPATH}" -export MACOSX_DEPLOYMENT_TARGET=10.7 +export MACOSX_DEPLOYMENT_TARGET=10.9 export LIBRARY_PATH="${SDKPATH}/usr/lib" if [ "x${lprefix}" != "x" ]; then @@ -217,11 +234,12 @@ if [ $GCC_can_build_arm64 = "yes" ]; then 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 CPPFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" + export CXXFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -target arm64-apple-macos -mmacosx-version-min=10.9 -stdlib=libc++ -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" + export CFLAGS="-isysroot ${SDKPATH} -Werror=unguarded-availability -mmacosx-version-min=10.9 -target arm64-apple-macos -DMAC_OS_X_VERSION_MAX_ALLOWED=1090 -DMAC_OS_X_VERSION_MIN_REQUIRED=1090" export SDKROOT="${SDKPATH}" - export MACOSX_DEPLOYMENT_TARGET=10.7 + export MACOSX_DEPLOYMENT_TARGET=10.9 + export LIBRARY_PATH="${SDKPATH}/usr/lib" if [ "x${lprefix}" != "x" ]; then ./configure --prefix=${lprefix} no-shared darwin64-arm64-cc @@ -276,14 +294,6 @@ if [ $GCC_can_build_arm64 = "yes" ]; then fi myScriptDir="${myScriptPath%/*}" source "${myScriptDir}/dependencyNames.sh" - - if [ "${opensslDirName}" != "openssl-1.1.0l" ]; 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 "************************************" - fi fi if [ "x${lprefix}" != "x" ]; then diff --git a/mac_build/dependencyNames.sh b/mac_build/dependencyNames.sh index c326a7ce6c..4889cb55d8 100644 --- a/mac_build/dependencyNames.sh +++ b/mac_build/dependencyNames.sh @@ -2,7 +2,7 @@ # This file is part of BOINC. # http://boinc.berkeley.edu -# Copyright (C) 2017 University of California +# Copyright (C) 2021 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 @@ -37,25 +37,25 @@ ## build settings. ## -opensslDirName="openssl-1.1.0l" -opensslFileName="openssl-1.1.0l.tar.gz" -opensslURL="https://www.openssl.org/source/openssl-1.1.0l.tar.gz" +opensslDirName="openssl-3.0.0" +opensslFileName="openssl-3.0.0.tar.gz" +opensslURL="https://www.openssl.org/source/openssl-3.0.0.tar.gz" -caresDirName="c-ares-1.13.0" -caresFileName="c-ares-1.13.0.tar.gz" -caresURL="https://c-ares.haxx.se/download/c-ares-1.13.0.tar.gz" +caresDirName="c-ares-1.17.2" +caresFileName="c-ares-1.17.2.tar.gz" +caresURL="https://c-ares.org/download/c-ares-1.17.2.tar.gz" -curlDirName="curl-7.73.0" -curlFileName="curl-7.73.0.tar.gz" -curlURL="https://curl.haxx.se/download/curl-7.73.0.tar.gz" +curlDirName="curl-7.79.1" +curlFileName="curl-7.79.1.tar.gz" +curlURL="https://curl.haxx.se/download/curl-7.79.1.tar.gz" wxWidgetsDirName="wxWidgets-3.1.5" wxWidgetsFileName="wxWidgets-3.1.5.tar.bz2" wxWidgetsURL="https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.5/wxWidgets-3.1.5.tar.bz2" -freetypeDirName="freetype-2.9" -freetypeFileName="freetype-2.9.tar.bz2" -freetypeURL="https://sourceforge.net/projects/freetype/files/freetype2/2.9/freetype-2.9.tar.bz2" +freetypeDirName="freetype-2.11.0" +freetypeFileName="freetype-2.11.0.tar.gz" +freetypeURL="https://download.savannah.gnu.org/releases/freetype/freetype-2.11.0.tar.gz" ftglDirName="ftgl-2.1.3~rc5" ftglFileName="ftgl-2.1.3-rc5.tar.gz"