File 1384-Fix-macOS-wx-build-error-on-OTP-25.3.2.7.patch of Package erlang
From 305930853cf643cff1b1ea2387d333a8268f3fd7 Mon Sep 17 00:00:00 2001
From: Kenji Rikitake <kenji.rikitake@acm.org>
Date: Fri, 13 Oct 2023 10:49:21 +0900
Subject: [PATCH] Fix macOS wx build error on OTP-25.3.2.7
* This fix is a backport of the fix for OTP-18768 in OTP-26.1.1.
* Reference: https://github.com/erlang/otp/pull/7670
---
lib/wx/c_src/Makefile.in | 2 +-
lib/wx/configure | 15 ++++++++++-----
lib/wx/configure.ac | 17 +++++++++++------
3 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in
index 87fc0354b6..910e3558fa 100644
--- a/lib/wx/c_src/Makefile.in
+++ b/lib/wx/c_src/Makefile.in
@@ -177,7 +177,7 @@ $(TARGET_DIR)/wxe_driver$(SO_EXT): $(WX_OBJECTS)
$(TARGET_DIR)/erl_gl$(SO_EXT): $(GL_OBJECTS)
$(V_at)mkdir -p $(TARGET_DIR)
- $(V_CC) $(LDFLAGS) $(GL_OBJECTS) $(GL_LIBS) -o $@
+ $(V_CXX) $(LDFLAGS) $(GL_OBJECTS) $(GL_LIBS) -o $@
# ----------------------------------------------------
diff --git a/lib/wx/configure b/lib/wx/configure
index d3dc12b32a..cd6647917a 100755
--- a/lib/wx/configure
+++ b/lib/wx/configure
@@ -5256,13 +5256,14 @@ esac
+EXTRA_LDFLAGS=
+
case $host_os in
darwin*)
- LDFLAGS="$MAC_MIN -bundle -flat_namespace -undefined warning -fPIC $LDFLAGS"
- # Check sizof_void_p as future will hold 64bit MacOS wx
- if test $ac_cv_sizeof_void_p = 4; then
- LDFLAGS="-m32 $LDFLAGS"
- fi
+ # beam.smp has not been built yet, so we must not use the
+ # -bundle_loader option in the configuration tests.
+ LDFLAGS="$MAC_MIN -bundle $LDFLAGS"
+ EXTRA_LDFLAGS=" -bundle_loader ${ERL_TOP}/bin/$host/beam.smp"
GL_LIBS="-framework OpenGL"
;;
win32)
@@ -7027,6 +7028,8 @@ saved_LIBS=$LIBS
if test X"$WX_HAVE_STATIC_LIBS" = X"true" ; then
LIBS=$WX_LIBS_STATIC
+else
+ LIBS=$WX_LIBS
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -7087,6 +7090,8 @@ fi
fi
fi
+LDFLAGS="$LDFLAGS$EXTRA_LDFLAGS"
+
if test "x$GCC" = xyes; then
diff --git a/lib/wx/configure.ac b/lib/wx/configure.ac
index d49399c540..cee2c92d5b 100644
--- a/lib/wx/configure.in
+++ b/lib/wx/configure.in
@@ -200,13 +200,14 @@ AC_SUBST(GLIB_LIBS)
AC_SUBST(OBJC_CC)
AC_SUBST(OBJC_CFLAGS)
+EXTRA_LDFLAGS=
+
case $host_os in
darwin*)
- LDFLAGS="$MAC_MIN -bundle -flat_namespace -undefined warning -fPIC $LDFLAGS"
- # Check sizof_void_p as future will hold 64bit MacOS wx
- if test $ac_cv_sizeof_void_p = 4; then
- LDFLAGS="-m32 $LDFLAGS"
- fi
+ # beam.smp has not been built yet, so we must not use the
+ # -bundle_loader option in the configuration tests.
+ LDFLAGS="$MAC_MIN -bundle $LDFLAGS"
+ EXTRA_LDFLAGS=" -bundle_loader ${ERL_TOP}/bin/$host/beam.smp"
GL_LIBS="-framework OpenGL"
;;
win32)
@@ -666,6 +667,8 @@ saved_LIBS=$LIBS
if test X"$WX_HAVE_STATIC_LIBS" = X"true" ; then
LIBS=$WX_LIBS_STATIC
+else
+ LIBS=$WX_LIBS
fi
AC_LINK_IFELSE([AC_LANG_SOURCE([
@@ -703,6 +706,8 @@ fi
fi dnl - if test "$WXERL_CAN_BUILD_DRIVER" != "false"
+LDFLAGS="$LDFLAGS$EXTRA_LDFLAGS"
+
AC_SUBST(WXERL_CAN_BUILD_DRIVER)
if test "x$GCC" = xyes; then
--
2.35.3