From 3d0d4a0fbf8f468047ca3be099d1657d0162506c Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Mon, 2 Oct 2017 16:44:45 -0500 Subject: Maybe munge LD and DED flags when macOS >= 10.13 As explained in #230, DED_LDFLAGS must be set correctly for clang 9 to compile various OTP applications correctly including crypto. This patch reworks #230 a little bit so that it's a tiny bit more generalized, in case we run across another situation where this needs to be done for a particular operating system. --- kerl | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/kerl b/kerl index 561d727..9bdaedc 100755 --- a/kerl +++ b/kerl @@ -538,14 +538,29 @@ do_normal_build() list_add builds "$1,$2" } -_flags(){ - host=$(./erts/autoconf/config.guess) - DARWIN_VERSION=$(uname -r | sed $SED_OPT -e 's/R?([0-9]{1,2}).+/\1/') - if [ "$DARWIN_VERSION" -ge 17 ]; then - CFLAGS="$CFLAGS" DED_LD="clang" CC="clang" DED_LDFLAGS="-m64 -bundle -bundle_loader ${ERL_TOP}/bin/$host/beam.smp" $@ - else - CFLAGS="$CFLAGS" $@ - fi +_flags() +{ + + # We need to munge the LD and DED flags for clang 9 shipped with + # High Sierra (macOS 10.13) + case "$KERL_SYSTEM" in + Darwin) + osver=$(uname -r) + case "$osver" in + 17*) + host=$(./erts/autoconf/config.guess) + CFLAGS="$CFLAGS" DED_LD="clang" CC="clang" DED_LDFLAGS="-m64 -bundle -bundle_loader ${ERL_TOP}/bin/$host/beam.smp" $@ + ;; + *) + CFLAGS="$CFLAGS" $@ + ;; + esac + ;; + *) + CFLAGS="$CFLAGS" $@ + ;; + esac + } _do_build() @@ -562,7 +577,7 @@ _do_build() if [ $? -ne 0 ]; then KERL_CONFIGURE_OPTIONS="$KERL_CONFIGURE_OPTIONS --enable-darwin-64bit" fi - + case "$OSVERSION" in 17*|16*|15*) echo -n $KERL_CONFIGURE_OPTIONS | grep "ssl" 1>/dev/null 2>&1 @@ -600,7 +615,7 @@ _do_build() ERL_TOP="$KERL_BUILD_DIR/$2/otp_src_$1" cd "$ERL_TOP" || exit 1 LOGFILE="$KERL_BUILD_DIR/$2/otp_build_$1.log" - + # Check to see if configuration options need to be stored or have changed TMPOPT="/tmp/kerloptions.$$" echo "$CFLAGS" > "$TMPOPT" -- cgit v1.2.3