void-packages/srcpkgs/recode/patches/link-librecode.a.patch
Érico Rolim a7fba4f268 recode: fix librecode.so build, xlint.
librecode.so required an external `error` symbol, even on musl systems,
which don't provide one. This was worked around when building
fortune-mod by adding an error.o file into the build, but that wasn't
the correct fix.

This patch makes it so librecode also uses the librecode.a compat
library.
2020-12-17 12:20:04 -03:00

46 lines
1.6 KiB
Diff

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 237fe72..684ee68 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -22,6 +22,7 @@ AUTOMAKE_OPTIONS = gnits
noinst_LIBRARIES = libreco.a
noinst_HEADERS = error.h getopt.h gettext.h pathmax.h xstring.h
libreco_a_SOURCES = error.c getopt.c getopt1.c xstrdup.c
+libreco_a_CFLAGS = -fPIC
EXTRA_DIST = alloca.c gettext.c malloc.c realloc.c strtol.c strtoul.c
diff --git a/lib/error.c b/lib/error.c
index 53b650c..7f879aa 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -65,7 +65,7 @@ void (*error_print_progname) (
/* This variable is incremented each time `error' is called. */
unsigned int error_message_count;
-#ifdef _LIBC
+#if 1
/* In the GNU C library, there is a predefined variable for this. */
# define program_name program_invocation_name
@@ -73,8 +73,6 @@ unsigned int error_message_count;
/* In GNU libc we want do not want to use the common name `error' directly.
Instead make it a weak alias. */
-# define error __error
-# define error_at_line __error_at_line
#else /* not _LIBC */
diff --git a/src/Makefile.am b/src/Makefile.am
index c918aa7..dff6c71 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,6 +48,7 @@ recode_LDADD = librecode.la ../lib/libreco.a
librecode_la_SOURCES = argmatch.c charname.c combine.c fr-charname.c \
hash.c iconv.c libiconv.c localcharset.c merged.c names.c outer.c quotearg.c \
recode.c request.c strip-pool.c task.c xmalloc.c $(C_STEPS)
+librecode_la_LIBADD = ../lib/libreco.a
librecode_la_LDFLAGS = -version-info 0:0:0
INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I$(top_srcdir)/libiconv