File 0546-Fix-failure-to-build-OTP-on-macOS-Catalina-10.15.patch of Package erlang

From 46430413dd9b7ccc33675ebff4bc54e971e75c25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 10 Oct 2019 09:53:53 +0200
Subject: [PATCH] Fix failure to build OTP on macOS Catalina (10.15)

The build of Erlang/OTP crashes on macOS Catalina (10.15).

The reason is that the default for stack checks have changed. Stack
checks are now on by default (when the target is macOS 10.15 or
later). They used to be off by default. There seems to be some
pre-existing bug in Clang so that it could generate code that crashes
when stack checks are turned on. If stack checks are turned on when
compiling for macOS 10.14 (Mojave), the build will crash in the same
way.

This commit turns off stack checks when building Erlang/OTP on
macOS Catalina.

Here are some useful links I found while investigating this issue:

https://forums.developer.apple.com/thread/121887
https://code.videolan.org/videolan/libbluray/issues/20

https://bugs.erlang.org/browse/ERL-1063
---
 erts/configure.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/erts/configure.in b/erts/configure.in
index 716dc7bd27..06d1bc7eec 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -1005,6 +1005,18 @@ case "${host}:${GCC}" in
 esac
 
 
+case $host_os in
+        darwin19*)
+	    # Disable stack checking to avoid crashing with a segment fault
+	    # in macOS Catalina.
+	    AC_MSG_NOTICE([Turning off stack check on macOS 10.15 (Catalina)])
+	    CFLAGS="-fno-stack-check $CFLAGS"
+	    ;;
+        *)
+	    ;;
+esac
+
+
 dnl ----------------------------------------------------------------------
 dnl Checks for libraries.
 dnl ----------------------------------------------------------------------
-- 
2.16.4

openSUSE Build Service is sponsored by