commit:     5ffa7558b47964913a0c88edb85c0eca3020d7bc
Author:     Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 25 05:54:02 2022 +0000
Commit:     Thomas Beierlein <tomjbe <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 05:54:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ffa7558

sci-electronics/xnec2c: Fix musl related compile problems

After discussion with upstream drop left overs from experiments with
handling of some dynamic libraries. That fixes the problems with the use
of dlinfo() and backtrack_symbols().

Closes: https://bugs.gentoo.org/832744
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Thomas Beierlein <tomjbe <AT> gentoo.org>

 .../xnec2c/files/xnec2c-4.4.5-musl.patch           | 63 ++++++++++++++++++++++
 sci-electronics/xnec2c/xnec2c-4.4.5.ebuild         |  3 ++
 2 files changed, 66 insertions(+)

diff --git a/sci-electronics/xnec2c/files/xnec2c-4.4.5-musl.patch 
b/sci-electronics/xnec2c/files/xnec2c-4.4.5-musl.patch
new file mode 100644
index 000000000000..a995463224b0
--- /dev/null
+++ b/sci-electronics/xnec2c/files/xnec2c-4.4.5-musl.patch
@@ -0,0 +1,63 @@
+diff --git a/src/mathlib.c b/src/mathlib.c
+index 5354240..b28033e 100644
+--- a/src/mathlib.c
++++ b/src/mathlib.c
+@@ -155,9 +155,6 @@ int open_mathlib(mathlib_t *lib)
+               return 0;
+       }
+ 
+-      if (dlinfo(lib->handle, RTLD_DI_LMID, &lib->lmid) == -1)
+-              printf("dlinfo: %s: %s\n", lib->lib, dlerror());
+-
+       // Call the init() function if configured
+       if (lib->init != NULL)
+               lib->init(lib);
+@@ -217,14 +214,7 @@ void init_mathlib()
+                       mathlibs[libidx].available = 1;
+ 
+               // At this point the library load was successful, provide 
detail:
+-              if (mathlibs[libidx].handle != NULL)
+-              {
+-                      char lpath[PATH_MAX];
+-                      dlinfo(mathlibs[libidx].handle, RTLD_DI_ORIGIN, lpath);
+-                      printf("  loaded ok: %s/%s\n", lpath, 
mathlibs[libidx].lib);
+-              }
+-              else
+-                      printf("  loaded ok.\n");
++              printf("  loaded ok.\n");
+ 
+               // Set the default to the first one we find:
+               if (current_mathlib == NULL)
+diff --git a/src/utils.c b/src/utils.c
+index b803402..1462df2 100644
+--- a/src/utils.c
++++ b/src/utils.c
+@@ -17,7 +17,7 @@
+  *    https://www.xnec2c.org/
+  */
+ 
+-#include <execinfo.h>
++//#include <execinfo.h>
+ 
+ #include "utils.h"
+ #include "shared.h"
+@@ -736,18 +736,7 @@ void _print_backtrace(char **strings)
+ // Return an array of backtrace strings.  The value returned must be 
free()'ed.
+ char **_get_backtrace()
+ {
+-      void *array[10];
+-      char **strings;
+-      int size;
+-
+-      size = backtrace(array, 10);
+-      strings = backtrace_symbols(array, size);
+-
+-      // This wastes an array entry, but allows _print_backtrace() to find
+-      // the end of the list without realloc'ing space for a NULL:
+-      strings[size-1] = NULL;
+-
+-      return strings;
++      return NULL;
+ }
+ 
+ void print_backtrace(char *msg)

diff --git a/sci-electronics/xnec2c/xnec2c-4.4.5.ebuild 
b/sci-electronics/xnec2c/xnec2c-4.4.5.ebuild
index d305cccd2dda..6c495a7c80f8 100644
--- a/sci-electronics/xnec2c/xnec2c-4.4.5.ebuild
+++ b/sci-electronics/xnec2c/xnec2c-4.4.5.ebuild
@@ -21,10 +21,13 @@ RDEPEND="dev-libs/glib:2
 DEPEND="${RDEPEND}
        sys-devel/gettext"
 
+PATCHES=( "${FILESDIR}/$PN-4.4.5-musl.patch" )
+
 S="${WORKDIR}/${MY_P}"
 
 src_prepare() {
        eapply_user
+       eapply ${PATCHES[@]}
        eautoreconf
 }
 

Reply via email to