Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DED_LDFLAGS tomfoolery for macOS 10.13 #230

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions kerl
Expand Up @@ -538,6 +538,16 @@ 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
}

_do_build()
{
case "$KERL_SYSTEM" in
Expand All @@ -552,9 +562,9 @@ _do_build()
if [ $? -ne 0 ]; then
KERL_CONFIGURE_OPTIONS="$KERL_CONFIGURE_OPTIONS --enable-darwin-64bit"
fi

case "$OSVERSION" in
16*|15*)
17*|16*|15*)
echo -n $KERL_CONFIGURE_OPTIONS | grep "ssl" 1>/dev/null 2>&1
# Reminder to self: 0 from grep means the string was detected
if [ $? -ne 0 ]; then
Expand Down Expand Up @@ -590,7 +600,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"
Expand Down Expand Up @@ -622,15 +632,15 @@ _do_build()
fi
if [ -n "$KERL_USE_AUTOCONF" ]; then
./otp_build autoconf $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1 && \
CFLAGS="$CFLAGS" ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
_flags ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
else
CFLAGS="$CFLAGS" ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
_flags ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1

fi
echo -n $KERL_CONFIGURE_OPTIONS | grep "--enable-native-libs" 1>/dev/null 2>&1
if [ $? -ne 0 ]; then
make clean >> "$LOGFILE" 2>&1
CFLAGS="$CFLAGS" ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
_flags ./otp_build configure $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
fi
if [ $? -ne 0 ]; then
show_logfile "Configure failed." "$LOGFILE"
Expand Down Expand Up @@ -665,7 +675,7 @@ _do_build()
done
fi

CFLAGS="$CFLAGS" ./otp_build boot -a $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
_flags ./otp_build boot -a $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
if [ $? -ne 0 ]; then
show_logfile "Build failed." "$LOGFILE"
list_remove builds "$1 $2"
Expand Down