File 1454-Fix-configuration-and-build-of-wxWidgets-driver-when.patch of Package erlang
From 5e22464c427cdc2b955de58e31d6e89083151cd0 Mon Sep 17 00:00:00 2001
From: Yaroslav Maslennikov <ymaslenn@cisco.com>
Date: Wed, 10 Jan 2024 17:46:03 +0100
Subject: [PATCH] Fix configuration and build of wxWidgets driver when PIE is
present in CFLAGS/LDFLAGS
---
lib/wx/configure | 10 +++++++++-
lib/wx/configure.ac | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/wx/configure b/lib/wx/configure
index a75252c8f0..9c0df916d4 100755
--- a/lib/wx/configure
+++ b/lib/wx/configure
@@ -2553,6 +2553,12 @@ esac
TARGET=$host
+# The resulting binary should be a library, not an executable. Therefore, the
+# various PIE flags are not needed.
+CFLAGS="$(echo $CFLAGS | sed -e 's!-fPIE!!g' -e 's!-fpie!!g')"
+LDFLAGS="$(echo $LDFLAGS | sed -e 's!-fPIE!!' -e 's!-fpie!!' -e 's!-pie!!')"
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5267,7 +5272,10 @@ case $host_os in
GL_LIBS="-lglu32 -lOpengl32"
;;
*)
- LDFLAGS="-shared -fPIC $LDFLAGS"
+ # When checking linkage we'd like to see that symbols are resolved.
+ # In order to notice errors, we must test without `-shared`.
+ LDFLAGS="-fPIC $LDFLAGS"
+ EXTRA_LDFLAGS=" -shared "
GL_LIBS="-lGL -lGLU"
;;
esac
diff --git a/lib/wx/configure.in b/lib/wx/configure.in
index db930a7e84..7d8b606ae4 100644
--- a/lib/wx/configure.in
+++ b/lib/wx/configure.in
@@ -61,6 +61,11 @@ esac
TARGET=$host
AC_SUBST(TARGET)
+# The resulting binary should be a library, not an executable. Therefore, the
+# various PIE flags are not needed.
+CFLAGS="$(echo $CFLAGS | sed -e 's!-fPIE!!g' -e 's!-fpie!!g')"
+LDFLAGS="$(echo $LDFLAGS | sed -e 's!-fPIE!!' -e 's!-fpie!!' -e 's!-pie!!')"
+
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
@@ -219,7 +224,10 @@ case $host_os in
GL_LIBS="-lglu32 -lOpengl32"
;;
*)
- LDFLAGS="-shared -fPIC $LDFLAGS"
+ # When checking linkage we'd like to see that symbols are resolved.
+ # In order to notice errors, we must test without `-shared`.
+ LDFLAGS="-fPIC $LDFLAGS"
+ EXTRA_LDFLAGS=" -shared "
GL_LIBS="-lGL -lGLU"
;;
esac
--
2.35.3