Message ID | patch-v2-1.1-3de7cdbd260-20221215T084129Z-avarab@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 35898ad24d83317135d7fdad601dc17375ac373e |
Headers | show |
Series | [v2] Makefile: use sha1collisiondetection by default on OSX and Darwin | expand |
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > Let's also use sha1collisiondetection on OSX, to do so we'll need to > split up the "APPLE_COMMON_CRYPTO" flag into that flag and a new > "APPLE_COMMON_CRYPTO_SHA1". That's well reasoned This leaves these in Makefile: # Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X # and do not want to use Apple's CommonCrypto library. This allows you # to provide your own OpenSSL library, for example from MacPorts. ifndef NO_APPLE_COMMON_CRYPTO NO_OPENSSL = YesPlease APPLE_COMMON_CRYPTO = YesPlease COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO endif Because we only mention what it does to use NO_APPLE_COMMON_CRYPTO here, without promising anything about what happens otherwise, we can do this change without breaking any promises ;-) However there is this bit: ifdef APPLE_COMMON_CRYPTO LIB_4_CRYPTO += -framework Security -framework CoreFoundation endif So, if one says make NO_APPLE_COMMON_CRYPTO=NoThanks APPLE_COMMON_CRYPTO_SHA1=YesPlease presumably the end result will fail to link? I _think_ that falls into "if it hurts, don't do that", and (1) automatically disabling the latter when the former is set would be more confusing than helpful. (2) explicitly detecting the situation and issue an error message from the Makefile might appear nicer, but if the linker does the failing with a messaage fine, that would be sufficient. so in the end, the posted patch as-is should be fine, I think.
diff --git a/Makefile b/Makefile index 0f7d7ab1fd2..db447d07383 100644 --- a/Makefile +++ b/Makefile @@ -511,10 +511,8 @@ include shared.mak # Define BLK_SHA1 to make use of optimized C SHA-1 routines bundled # with git (in the block-sha1/ directory). # -# Define NO_APPLE_COMMON_CRYPTO on OSX to opt-out of using the -# "APPLE_COMMON_CRYPTO" backend for SHA-1, which is currently the -# default on that OS. On macOS 01.4 (Tiger) or older, -# NO_APPLE_COMMON_CRYPTO is defined by default. +# Define APPLE_COMMON_CRYPTO_SHA1 to use Apple's CommonCrypto for +# SHA-1. # # If don't enable any of the *_SHA1 settings in this section, Git will # default to its built-in sha1collisiondetection library, which is a @@ -1911,7 +1909,7 @@ ifdef NO_POSIX_GOODIES BASIC_CFLAGS += -DNO_POSIX_GOODIES endif -ifdef APPLE_COMMON_CRYPTO +ifdef APPLE_COMMON_CRYPTO_SHA1 # Apple CommonCrypto requires chunking SHA1_MAX_BLOCK_SIZE = 1024L*1024L*1024L endif @@ -1928,7 +1926,7 @@ ifdef BLK_SHA1 LIB_OBJS += block-sha1/sha1.o BASIC_CFLAGS += -DSHA1_BLK else -ifdef APPLE_COMMON_CRYPTO +ifdef APPLE_COMMON_CRYPTO_SHA1 COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL BASIC_CFLAGS += -DSHA1_APPLE else diff --git a/ci/lib.sh b/ci/lib.sh index 706e3ba7e93..db7105e8a8d 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -258,8 +258,7 @@ macos-*) MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python3)" else MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=$(which python2)" - MAKEFLAGS="$MAKEFLAGS NO_APPLE_COMMON_CRYPTO=NoThanks" - MAKEFLAGS="$MAKEFLAGS NO_OPENSSL=NoThanks" + MAKEFLAGS="$MAKEFLAGS APPLE_COMMON_CRYPTO_SHA1=Yes" fi ;; esac