Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] Add error.h to musl-legacy-compat.
@ 2020-12-16 21:02 ericonr
  2020-12-16 21:07 ` [PR PATCH] [Updated] " ericonr
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 21:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

There is a new pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 7558 bytes --]

From de406f30b85422e02e235c6608af635064e2a3bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/4] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  4 ++--
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..2d01391db4b 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"

From b5acbbcce06628754e65a0184a25bb58bdaf9c12 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/4] elfutils: remove error.h copy.

---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      |  7 -------
 2 files changed, 34 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..151c0e3644a 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -26,13 +26,6 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }

From a9743bbdce5e61f0743dbe007fdccdd890f4b2f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/4] kbd: remove error.h copy.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  5 ++---
 2 files changed, 2 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..61963a07041 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -37,10 +37,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.a
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From 4fbb514fdaaed7202ed78646c79261e1cbb3e02b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 4/4] fortune-mod: remove error.{h,c} copy.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 10 ++++------
 3 files changed, 4 insertions(+), 29 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..9a0a25e6f50 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
@ 2020-12-16 21:07 ` ericonr
  2020-12-16 21:45 ` ericonr
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 21:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 7559 bytes --]

From 3d4634c41a6b328e486f6dcdc510f9b9d901f533 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/4] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  4 ++--
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..2d01391db4b 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"

From e1513f17ecbee596b2262d4fcf46519972966898 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/4] elfutils: remove error.h copy.

---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      |  7 -------
 2 files changed, 34 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..151c0e3644a 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -26,13 +26,6 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }

From 0f4ce873efefd373e145282d40c24626e391a12f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/4] kbd: remove error.h copy.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  5 ++---
 2 files changed, 2 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..1d7269e5485 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -37,10 +37,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From e47d972f9e0e09ae0f9e9f69deff2aa6f650a1c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 4/4] fortune-mod: remove error.{h,c} copy.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 10 ++++------
 3 files changed, 4 insertions(+), 29 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..9a0a25e6f50 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
  2020-12-16 21:07 ` [PR PATCH] [Updated] " ericonr
@ 2020-12-16 21:45 ` ericonr
  2020-12-16 22:10 ` ericonr
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 21:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 12288 bytes --]

From 3d4634c41a6b328e486f6dcdc510f9b9d901f533 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  4 ++--
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..2d01391db4b 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"

From e1513f17ecbee596b2262d4fcf46519972966898 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      |  7 -------
 2 files changed, 34 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..151c0e3644a 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -26,13 +26,6 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }

From 0f4ce873efefd373e145282d40c24626e391a12f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: remove error.h copy.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  5 ++---
 2 files changed, 2 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..1d7269e5485 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -37,10 +37,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From 0c20c980d06e5c3a7d45b25ee04de4b763c2c71c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] recode: fix librecode.so build.

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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 77 +++++++++++++++++++
 srcpkgs/recode/template                       |  8 +-
 2 files changed, 81 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..46fae884592
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,77 @@
+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..fbb79c0 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -65,46 +65,13 @@ 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
+ # include <errno.h>
+ 
+-/* 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 */
+-
+-/* The calling program should define program_name and set it to the
+-   name of the executing program.  */
+-extern char *program_name;
+-
+-# ifdef HAVE_STRERROR_R
+-#  define __strerror_r strerror_r
+-# else
+-#  if HAVE_STRERROR
+-#   ifndef strerror		/* On some systems, strerror is a macro */
+-char *strerror ();
+-#   endif
+-#  else
+-static char *
+-private_strerror (errnum)
+-     int errnum;
+-{
+-  extern char *sys_errlist[];
+-  extern int sys_nerr;
+-
+-  if (errnum > 0 && errnum <= sys_nerr)
+-    return _(sys_errlist[errnum]);
+-  return _("Unknown system error");
+-}
+-#   define strerror private_strerror
+-#  endif /* HAVE_STRERROR */
+-# endif	/* HAVE_STRERROR_R */
+-#endif	/* not _LIBC */
++#endif
+ 
+ /* Print the program name and error message MESSAGE, which is a printf-style
+    format string with optional args.
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..2d2bbc563c3 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,7 +1,7 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
+revision=10
 patch_args="-Np1"
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
@@ -15,9 +15,9 @@ distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
 	rm -f acinclude.m4
 	autoreconf -fi
 	libtoolize

From ae8941cb74c8d01e29d6fc8d1ef65e4f121dba0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
  2020-12-16 21:07 ` [PR PATCH] [Updated] " ericonr
  2020-12-16 21:45 ` ericonr
@ 2020-12-16 22:10 ` ericonr
  2020-12-16 23:01 ` ericonr
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 22:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 12540 bytes --]

From 3d4634c41a6b328e486f6dcdc510f9b9d901f533 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  4 ++--
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..2d01391db4b 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"

From f4ee2a2309eab7f2d6767dded67e178f875b2648 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

Also allow tests to fail.
---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      | 12 +++++-------
 2 files changed, 5 insertions(+), 34 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..2203330c4f6 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -26,17 +26,15 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }
 
+do_check() {
+	make check ${makejobs} ||
+		msg_warn "Failure in testsuite, expected on musl systems, at least"
+}
+
 libdebuginfod_package() {
 	short_desc+=" - debuginfod library"
 	pkg_install() {

From 5bc5492d99baa89fdc0e94964b36d94e62fba899 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: remove error.h copy.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  5 ++---
 2 files changed, 2 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..1d7269e5485 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -37,10 +37,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From d8d4b9f5662b06a9b189cb28427037604fd22ba6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] recode: fix librecode.so build.

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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 77 +++++++++++++++++++
 srcpkgs/recode/template                       |  8 +-
 2 files changed, 81 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..46fae884592
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,77 @@
+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..fbb79c0 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -65,46 +65,13 @@ 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
+ # include <errno.h>
+ 
+-/* 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 */
+-
+-/* The calling program should define program_name and set it to the
+-   name of the executing program.  */
+-extern char *program_name;
+-
+-# ifdef HAVE_STRERROR_R
+-#  define __strerror_r strerror_r
+-# else
+-#  if HAVE_STRERROR
+-#   ifndef strerror		/* On some systems, strerror is a macro */
+-char *strerror ();
+-#   endif
+-#  else
+-static char *
+-private_strerror (errnum)
+-     int errnum;
+-{
+-  extern char *sys_errlist[];
+-  extern int sys_nerr;
+-
+-  if (errnum > 0 && errnum <= sys_nerr)
+-    return _(sys_errlist[errnum]);
+-  return _("Unknown system error");
+-}
+-#   define strerror private_strerror
+-#  endif /* HAVE_STRERROR */
+-# endif	/* HAVE_STRERROR_R */
+-#endif	/* not _LIBC */
++#endif
+ 
+ /* Print the program name and error message MESSAGE, which is a printf-style
+    format string with optional args.
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..2d2bbc563c3 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,7 +1,7 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
+revision=10
 patch_args="-Np1"
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
@@ -15,9 +15,9 @@ distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
 	rm -f acinclude.m4
 	autoreconf -fi
 	libtoolize

From 9f9ffa621acc92cf29f3da6ef08882acab474f2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (2 preceding siblings ...)
  2020-12-16 22:10 ` ericonr
@ 2020-12-16 23:01 ` ericonr
  2020-12-16 23:22 ` ericonr
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 23:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 13751 bytes --]

From 4203920eceb01067bd2ef38cb1da7cd6af712743 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  8 ++++---
 2 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..991f7ccd536 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"
@@ -10,9 +10,11 @@ license="BSD-2-Clause, BSD-3-Clause"
 homepage="http://www.voidlinux.org"
 
 do_install() {
-	for f in ${FILESDIR}/*.h; do
+	for f in ${FILESDIR}/{cdefs,queue,tree}.h
+	do
 		vinstall ${f} 644 usr/include/sys
 	done
+	vinstall ${FILESDIR}/error.h 644 usr/include/sys
 
 	sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause
 	sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause

From 74bec773bc8b7ffe42c592b7df80eccf5aa8e5fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

Also allow tests to fail.
---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      | 12 +++++-------
 2 files changed, 5 insertions(+), 34 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..2203330c4f6 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -26,17 +26,15 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }
 
+do_check() {
+	make check ${makejobs} ||
+		msg_warn "Failure in testsuite, expected on musl systems, at least"
+}
+
 libdebuginfod_package() {
 	short_desc+=" - debuginfod library"
 	pkg_install() {

From 68fc9d9d3b941a051953e18cb65b8eec0c668151 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: remove error.h copy, add musl-legacy-compat.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  9 ++++++---
 2 files changed, 6 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..0b997ca9f2e 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -14,6 +14,10 @@ homepage="http://www.kbd-project.org/"
 distfiles="${KERNEL_SITE}/utils/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=685056143cb8effd0a1d44b5c391eb50d80dcfd014b1a4d6e2650a28d61cb82a
 
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
 pre_configure() {
 	# Rename keymap files with the same names
 	# this is needed because when only name of keymap is specified
@@ -37,10 +41,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From 806c0067d20886d3c6d9fdf410d1bc0c13e9a98f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] 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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 77 +++++++++++++++++++
 srcpkgs/recode/template                       | 16 ++--
 2 files changed, 85 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..46fae884592
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,77 @@
+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..fbb79c0 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -65,46 +65,13 @@ 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
+ # include <errno.h>
+ 
+-/* 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 */
+-
+-/* The calling program should define program_name and set it to the
+-   name of the executing program.  */
+-extern char *program_name;
+-
+-# ifdef HAVE_STRERROR_R
+-#  define __strerror_r strerror_r
+-# else
+-#  if HAVE_STRERROR
+-#   ifndef strerror		/* On some systems, strerror is a macro */
+-char *strerror ();
+-#   endif
+-#  else
+-static char *
+-private_strerror (errnum)
+-     int errnum;
+-{
+-  extern char *sys_errlist[];
+-  extern int sys_nerr;
+-
+-  if (errnum > 0 && errnum <= sys_nerr)
+-    return _(sys_errlist[errnum]);
+-  return _("Unknown system error");
+-}
+-#   define strerror private_strerror
+-#  endif /* HAVE_STRERROR */
+-# endif	/* HAVE_STRERROR_R */
+-#endif	/* not _LIBC */
++#endif
+ 
+ /* Print the program name and error message MESSAGE, which is a printf-style
+    format string with optional args.
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..bba0c7862d4 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,24 +1,24 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
-patch_args="-Np1"
+revision=10
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
  jm_cv_func_working_realloc=yes"
 hostmakedepends="automake gettext libtool texinfo"
 short_desc="Character set conversion utility"
-homepage="http://recode.progiciels-bpi.ca/"
-license="GPL-2"
 maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-or-later"
+homepage="http://recode.progiciels-bpi.ca/"
 distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
+patch_args="-Np1"
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
-	rm -f acinclude.m4
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
+	rm acinclude.m4
 	autoreconf -fi
 	libtoolize
 }

From 65a0bac14281f30a874cb2e007f384b7490bfb90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (3 preceding siblings ...)
  2020-12-16 23:01 ` ericonr
@ 2020-12-16 23:22 ` ericonr
  2020-12-16 23:55 ` ericonr
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 23:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 13747 bytes --]

From b357455d145130ed1ee00e314480f95d8e992dd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  8 ++++---
 2 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..afc447314f4 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"
@@ -10,9 +10,11 @@ license="BSD-2-Clause, BSD-3-Clause"
 homepage="http://www.voidlinux.org"
 
 do_install() {
-	for f in ${FILESDIR}/*.h; do
+	for f in ${FILESDIR}/{cdefs,queue,tree}.h
+	do
 		vinstall ${f} 644 usr/include/sys
 	done
+	vinstall ${FILESDIR}/error.h 644 usr/include
 
 	sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause
 	sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause

From 7f5b24bf099c18821ef3ba103f27a86be7845898 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

Also allow tests to fail.
---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      | 12 +++++-------
 2 files changed, 5 insertions(+), 34 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..2203330c4f6 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -26,17 +26,15 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }
 
+do_check() {
+	make check ${makejobs} ||
+		msg_warn "Failure in testsuite, expected on musl systems, at least"
+}
+
 libdebuginfod_package() {
 	short_desc+=" - debuginfod library"
 	pkg_install() {

From 69a1ba6dc314851117a298cdd835154ab212a8be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: remove error.h copy, add musl-legacy-compat.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  9 ++++++---
 2 files changed, 6 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..0b997ca9f2e 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -14,6 +14,10 @@ homepage="http://www.kbd-project.org/"
 distfiles="${KERNEL_SITE}/utils/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=685056143cb8effd0a1d44b5c391eb50d80dcfd014b1a4d6e2650a28d61cb82a
 
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
 pre_configure() {
 	# Rename keymap files with the same names
 	# this is needed because when only name of keymap is specified
@@ -37,10 +41,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From 4edd87cb7d2e90bbda8a908e4ba3aa721322135d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] 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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 77 +++++++++++++++++++
 srcpkgs/recode/template                       | 16 ++--
 2 files changed, 85 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..46fae884592
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,77 @@
+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..fbb79c0 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -65,46 +65,13 @@ 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
+ # include <errno.h>
+ 
+-/* 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 */
+-
+-/* The calling program should define program_name and set it to the
+-   name of the executing program.  */
+-extern char *program_name;
+-
+-# ifdef HAVE_STRERROR_R
+-#  define __strerror_r strerror_r
+-# else
+-#  if HAVE_STRERROR
+-#   ifndef strerror		/* On some systems, strerror is a macro */
+-char *strerror ();
+-#   endif
+-#  else
+-static char *
+-private_strerror (errnum)
+-     int errnum;
+-{
+-  extern char *sys_errlist[];
+-  extern int sys_nerr;
+-
+-  if (errnum > 0 && errnum <= sys_nerr)
+-    return _(sys_errlist[errnum]);
+-  return _("Unknown system error");
+-}
+-#   define strerror private_strerror
+-#  endif /* HAVE_STRERROR */
+-# endif	/* HAVE_STRERROR_R */
+-#endif	/* not _LIBC */
++#endif
+ 
+ /* Print the program name and error message MESSAGE, which is a printf-style
+    format string with optional args.
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..bba0c7862d4 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,24 +1,24 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
-patch_args="-Np1"
+revision=10
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
  jm_cv_func_working_realloc=yes"
 hostmakedepends="automake gettext libtool texinfo"
 short_desc="Character set conversion utility"
-homepage="http://recode.progiciels-bpi.ca/"
-license="GPL-2"
 maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-or-later"
+homepage="http://recode.progiciels-bpi.ca/"
 distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
+patch_args="-Np1"
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
-	rm -f acinclude.m4
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
+	rm acinclude.m4
 	autoreconf -fi
 	libtoolize
 }

From 684084f65aa20dd100d781e871892aac6367db84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (4 preceding siblings ...)
  2020-12-16 23:22 ` ericonr
@ 2020-12-16 23:55 ` ericonr
  2020-12-17  0:47 ` ericonr
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-16 23:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 14143 bytes --]

From a203b9ed1f627821d0de96b491595feb250308e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  8 ++++---
 2 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..afc447314f4 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"
@@ -10,9 +10,11 @@ license="BSD-2-Clause, BSD-3-Clause"
 homepage="http://www.voidlinux.org"
 
 do_install() {
-	for f in ${FILESDIR}/*.h; do
+	for f in ${FILESDIR}/{cdefs,queue,tree}.h
+	do
 		vinstall ${f} 644 usr/include/sys
 	done
+	vinstall ${FILESDIR}/error.h 644 usr/include
 
 	sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause
 	sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause

From 7614a8929430f26e03f050763bd57d0176813bf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

Also allow tests to fail.
---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      | 14 ++++++--------
 2 files changed, 6 insertions(+), 35 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..2f4fb896ec9 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -18,7 +18,7 @@ checksum=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858
 subpackages="debuginfod libdebuginfod libelf elfutils-devel"
 
 CFLAGS="-Wno-error"
-CXXFLAGS="-Wl,-z,stack-size=2097152"
+CXXFLAGS="-Wno-error -Wl,-z,stack-size=2097152"
 
 if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	makedepends+=" argp-standalone musl-fts-devel musl-obstack-devel musl-legacy-compat"
@@ -26,17 +26,15 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }
 
+do_check() {
+	make check ${makejobs} ||
+		msg_warn "Failure in testsuite, expected on musl systems, at least"
+}
+
 libdebuginfod_package() {
 	short_desc+=" - debuginfod library"
 	pkg_install() {

From 5fb42076516915992c2188994bd443723d65b6ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: remove error.h copy, add musl-legacy-compat.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  9 ++++++---
 2 files changed, 6 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..0b997ca9f2e 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -14,6 +14,10 @@ homepage="http://www.kbd-project.org/"
 distfiles="${KERNEL_SITE}/utils/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=685056143cb8effd0a1d44b5c391eb50d80dcfd014b1a4d6e2650a28d61cb82a
 
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
 pre_configure() {
 	# Rename keymap files with the same names
 	# this is needed because when only name of keymap is specified
@@ -37,10 +41,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From a2f3ff630ca70e4ab6d3e3279aeefbd52ae1f3fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] 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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 77 +++++++++++++++++++
 srcpkgs/recode/template                       | 16 ++--
 2 files changed, 85 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..46fae884592
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,77 @@
+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..fbb79c0 100644
+--- a/lib/error.c
++++ b/lib/error.c
+@@ -65,46 +65,13 @@ 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
+ # include <errno.h>
+ 
+-/* 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 */
+-
+-/* The calling program should define program_name and set it to the
+-   name of the executing program.  */
+-extern char *program_name;
+-
+-# ifdef HAVE_STRERROR_R
+-#  define __strerror_r strerror_r
+-# else
+-#  if HAVE_STRERROR
+-#   ifndef strerror		/* On some systems, strerror is a macro */
+-char *strerror ();
+-#   endif
+-#  else
+-static char *
+-private_strerror (errnum)
+-     int errnum;
+-{
+-  extern char *sys_errlist[];
+-  extern int sys_nerr;
+-
+-  if (errnum > 0 && errnum <= sys_nerr)
+-    return _(sys_errlist[errnum]);
+-  return _("Unknown system error");
+-}
+-#   define strerror private_strerror
+-#  endif /* HAVE_STRERROR */
+-# endif	/* HAVE_STRERROR_R */
+-#endif	/* not _LIBC */
++#endif
+ 
+ /* Print the program name and error message MESSAGE, which is a printf-style
+    format string with optional args.
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..bba0c7862d4 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,24 +1,24 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
-patch_args="-Np1"
+revision=10
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
  jm_cv_func_working_realloc=yes"
 hostmakedepends="automake gettext libtool texinfo"
 short_desc="Character set conversion utility"
-homepage="http://recode.progiciels-bpi.ca/"
-license="GPL-2"
 maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-or-later"
+homepage="http://recode.progiciels-bpi.ca/"
 distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
+patch_args="-Np1"
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
-	rm -f acinclude.m4
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
+	rm acinclude.m4
 	autoreconf -fi
 	libtoolize
 }

From 6045d937a6d18508380a5efa9784815ff2951c1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (5 preceding siblings ...)
  2020-12-16 23:55 ` ericonr
@ 2020-12-17  0:47 ` ericonr
  2020-12-17  1:27 ` [PR REVIEW] " sgn
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-17  0:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 13326 bytes --]

From a203b9ed1f627821d0de96b491595feb250308e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  8 ++++---
 2 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..afc447314f4 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"
@@ -10,9 +10,11 @@ license="BSD-2-Clause, BSD-3-Clause"
 homepage="http://www.voidlinux.org"
 
 do_install() {
-	for f in ${FILESDIR}/*.h; do
+	for f in ${FILESDIR}/{cdefs,queue,tree}.h
+	do
 		vinstall ${f} 644 usr/include/sys
 	done
+	vinstall ${FILESDIR}/error.h 644 usr/include
 
 	sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause
 	sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause

From 7614a8929430f26e03f050763bd57d0176813bf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

Also allow tests to fail.
---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      | 14 ++++++--------
 2 files changed, 6 insertions(+), 35 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..2f4fb896ec9 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -18,7 +18,7 @@ checksum=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858
 subpackages="debuginfod libdebuginfod libelf elfutils-devel"
 
 CFLAGS="-Wno-error"
-CXXFLAGS="-Wl,-z,stack-size=2097152"
+CXXFLAGS="-Wno-error -Wl,-z,stack-size=2097152"
 
 if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	makedepends+=" argp-standalone musl-fts-devel musl-obstack-devel musl-legacy-compat"
@@ -26,17 +26,15 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }
 
+do_check() {
+	make check ${makejobs} ||
+		msg_warn "Failure in testsuite, expected on musl systems, at least"
+}
+
 libdebuginfod_package() {
 	short_desc+=" - debuginfod library"
 	pkg_install() {

From 5fb42076516915992c2188994bd443723d65b6ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: remove error.h copy, add musl-legacy-compat.

Also use vsed where appropriate.
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      |  9 ++++++---
 2 files changed, 6 insertions(+), 23 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..0b997ca9f2e 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -14,6 +14,10 @@ homepage="http://www.kbd-project.org/"
 distfiles="${KERNEL_SITE}/utils/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=685056143cb8effd0a1d44b5c391eb50d80dcfd014b1a4d6e2650a28d61cb82a
 
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" musl-legacy-compat"
+fi
+
 pre_configure() {
 	# Rename keymap files with the same names
 	# this is needed because when only name of keymap is specified
@@ -37,10 +41,9 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
 	cd $wrksrc
 
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
+	vsed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
+	vsed -e 's,tests ,,g' -i Makefile.am
 
-	cp $FILESDIR/error.h .
 	autoreconf -fi
 }
 post_install() {

From 5bae7db501f5158eb7ce3d38db725a66b6f7fc26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] 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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 46 +++++++++++++++++++
 srcpkgs/recode/template                       | 16 +++----
 2 files changed, 54 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..3e212daf0b5
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,46 @@
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..bba0c7862d4 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,24 +1,24 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
-patch_args="-Np1"
+revision=10
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
  jm_cv_func_working_realloc=yes"
 hostmakedepends="automake gettext libtool texinfo"
 short_desc="Character set conversion utility"
-homepage="http://recode.progiciels-bpi.ca/"
-license="GPL-2"
 maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-or-later"
+homepage="http://recode.progiciels-bpi.ca/"
 distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
+patch_args="-Np1"
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
-	rm -f acinclude.m4
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
+	rm acinclude.m4
 	autoreconf -fi
 	libtoolize
 }

From 5b71abfd7556803a6f6b4e6b9e52506ffebca483 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR REVIEW] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (6 preceding siblings ...)
  2020-12-17  0:47 ` ericonr
@ 2020-12-17  1:27 ` sgn
  2020-12-17  2:33 ` ericonr
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: sgn @ 2020-12-17  1:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/27204#discussion_r544743086

Comment:
This `error_message_count` is internal linkage, thus isn't shared by different translation units.
It may work when removing static and add `-fcommon` but `-fcommon` hurts compiler optimization.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR REVIEW] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (7 preceding siblings ...)
  2020-12-17  1:27 ` [PR REVIEW] " sgn
@ 2020-12-17  2:33 ` ericonr
  2020-12-17  4:42 ` ericonr
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-17  2:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/27204#discussion_r544766470

Comment:
I'm not sure any of the applications actually use it... Maybe we can just remove it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR REVIEW] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (8 preceding siblings ...)
  2020-12-17  2:33 ` ericonr
@ 2020-12-17  4:42 ` ericonr
  2020-12-17  4:45 ` [PR PATCH] [Updated] " ericonr
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-17  4:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/27204#discussion_r544807774

Comment:
Ok, it's definitely used by elfutils already... For what it's worth, this is the file that was already there and I didn't observe any issues... Or at least I think I didn't. Most of the usage happens inside individual applications.

recode doesn't use the variable either.

And it turns out kbd doesn't require it at all.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (9 preceding siblings ...)
  2020-12-17  4:42 ` ericonr
@ 2020-12-17  4:45 ` ericonr
  2020-12-17 15:20 ` [PR REVIEW] " ericonr
  2020-12-17 15:20 ` [PR PATCH] [Merged]: " ericonr
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-17  4:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages legacy
https://github.com/void-linux/void-packages/pull/27204

Add error.h to musl-legacy-compat.


A patch file from https://github.com/void-linux/void-packages/pull/27204.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-legacy-27204.patch --]
[-- Type: text/x-diff, Size: 13533 bytes --]

From a203b9ed1f627821d0de96b491595feb250308e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:56:20 -0300
Subject: [PATCH 1/5] musl-legacy-compat: add error.h header.

---
 srcpkgs/musl-legacy-compat/files/error.h | 29 ++++++++++++++++++++++++
 srcpkgs/musl-legacy-compat/template      |  8 ++++---
 2 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 srcpkgs/musl-legacy-compat/files/error.h

diff --git a/srcpkgs/musl-legacy-compat/files/error.h b/srcpkgs/musl-legacy-compat/files/error.h
new file mode 100644
index 00000000000..4505784182a
--- /dev/null
+++ b/srcpkgs/musl-legacy-compat/files/error.h
@@ -0,0 +1,29 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#warning usage of non-standard #include <error.h> is deprecated
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+	va_list ap;
+	fprintf(stderr, "%s: ", program_invocation_name);
+	va_start(ap, format);
+	vfprintf(stderr, format, ap);
+	va_end(ap);
+	if (errnum)
+		fprintf(stderr, ": %s", strerror(errnum));
+	fprintf(stderr, "\n");
+	error_message_count++;
+	if (status)
+		exit(status);
+}
+
+#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/musl-legacy-compat/template b/srcpkgs/musl-legacy-compat/template
index 3c926e315cd..afc447314f4 100644
--- a/srcpkgs/musl-legacy-compat/template
+++ b/srcpkgs/musl-legacy-compat/template
@@ -1,7 +1,7 @@
 # Template file for 'musl-legacy-compat'
 pkgname=musl-legacy-compat
-version=0.3
-revision=4
+version=0.4
+revision=1
 archs="*-musl"
 bootstrap=yes
 short_desc="Legacy compatibility headers for the musl libc"
@@ -10,9 +10,11 @@ license="BSD-2-Clause, BSD-3-Clause"
 homepage="http://www.voidlinux.org"
 
 do_install() {
-	for f in ${FILESDIR}/*.h; do
+	for f in ${FILESDIR}/{cdefs,queue,tree}.h
+	do
 		vinstall ${f} 644 usr/include/sys
 	done
+	vinstall ${FILESDIR}/error.h 644 usr/include
 
 	sed -n '3,32p' < ${FILESDIR}/queue.h > LICENSE.BSD-3-Clause
 	sed -n '2,26p' < ${FILESDIR}/tree.h > LICENSE.BSD-2-Clause

From 7614a8929430f26e03f050763bd57d0176813bf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:57:00 -0300
Subject: [PATCH 2/5] elfutils: remove error.h copy.

Also allow tests to fail.
---
 srcpkgs/elfutils/files/error.h | 27 ---------------------------
 srcpkgs/elfutils/template      | 14 ++++++--------
 2 files changed, 6 insertions(+), 35 deletions(-)
 delete mode 100644 srcpkgs/elfutils/files/error.h

diff --git a/srcpkgs/elfutils/files/error.h b/srcpkgs/elfutils/files/error.h
deleted file mode 100644
index ef06827a0ba..00000000000
--- a/srcpkgs/elfutils/files/error.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-static unsigned int error_message_count = 0;
-
-static inline void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ": %s", strerror(errnum));
-	fprintf(stderr, "\n");
-	error_message_count++;
-	if (status)
-		exit(status);
-}
-
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/elfutils/template b/srcpkgs/elfutils/template
index 3dfea2970a5..2f4fb896ec9 100644
--- a/srcpkgs/elfutils/template
+++ b/srcpkgs/elfutils/template
@@ -18,7 +18,7 @@ checksum=ecc406914edf335f0b7fc084ebe6c460c4d6d5175bfdd6688c1c78d9146b8858
 subpackages="debuginfod libdebuginfod libelf elfutils-devel"
 
 CFLAGS="-Wno-error"
-CXXFLAGS="-Wl,-z,stack-size=2097152"
+CXXFLAGS="-Wno-error -Wl,-z,stack-size=2097152"
 
 if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	makedepends+=" argp-standalone musl-fts-devel musl-obstack-devel musl-legacy-compat"
@@ -26,17 +26,15 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	CFLAGS+=" -DFNM_EXTMATCH=0"
 fi
 
-post_extract() {
-	if [ "$XBPS_TARGET_LIBC" = musl ]; then
-		cp ${FILESDIR}/error.h lib
-		cp ${FILESDIR}/error.h src
-	fi
-}
-
 pre_configure() {
 	autoreconf -if
 }
 
+do_check() {
+	make check ${makejobs} ||
+		msg_warn "Failure in testsuite, expected on musl systems, at least"
+}
+
 libdebuginfod_package() {
 	short_desc+=" - debuginfod library"
 	pkg_install() {

From 3ca9a149191506de1c4fab8ca40241a1e06611a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:58:01 -0300
Subject: [PATCH 3/5] kbd: clean up.

- remove error.h, no longer necessary
- remove unnecessary sed commands
---
 srcpkgs/kbd/files/error.h | 20 --------------------
 srcpkgs/kbd/template      | 11 ++---------
 2 files changed, 2 insertions(+), 29 deletions(-)
 delete mode 100644 srcpkgs/kbd/files/error.h

diff --git a/srcpkgs/kbd/files/error.h b/srcpkgs/kbd/files/error.h
deleted file mode 100644
index 5eb8ed5115f..00000000000
--- a/srcpkgs/kbd/files/error.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef ERROR_H
-#define ERROR_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-
-static inline void error(int status, int errnum, const char *fmt, ...)
-{
-	va_list ap;
-	void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
-	void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
-	fflush(stdout);
-	va_start(ap, fmt);
-	if (status != 0)
-		errfunc[errnum==0](status, fmt, ap); /* does not return */
-	warnfunc[errnum==0](fmt, ap);
-	va_end(ap);
-}
-#endif
diff --git a/srcpkgs/kbd/template b/srcpkgs/kbd/template
index 47604e8ad55..e88ebf5d7fb 100644
--- a/srcpkgs/kbd/template
+++ b/srcpkgs/kbd/template
@@ -14,10 +14,10 @@ homepage="http://www.kbd-project.org/"
 distfiles="${KERNEL_SITE}/utils/${pkgname}/${pkgname}-${version}.tar.xz"
 checksum=685056143cb8effd0a1d44b5c391eb50d80dcfd014b1a4d6e2650a28d61cb82a
 
-pre_configure() {
+post_patch() {
 	# Rename keymap files with the same names
 	# this is needed because when only name of keymap is specified
-	# oadkeys loads the first keymap it can find, which is bad
+	# loadkeys loads the first keymap it can find, which is bad
 	# this should be removed when upstream adopts the change
 	mv data/keymaps/i386/qwertz/cz{,-qwertz}.map
 	mv data/keymaps/i386/olpc/es{,-olpc}.map
@@ -35,13 +35,6 @@ pre_configure() {
 	cp azerty/fr-latin9.map azerty/fr.map
 
 	cp azerty/fr-latin9.map azerty/fr-latin0.map # legacy alias
-	cd $wrksrc
-
-	sed -e '/^PKG_CHECK_MODULES.*/d' -i configure.ac
-	sed -e 's,tests ,,g' -i Makefile.am
-
-	cp $FILESDIR/error.h .
-	autoreconf -fi
 }
 post_install() {
 	# Remove keymaps for sun, amiga and atari.

From ac308063cb1d0112df645d7bb3a97b0ed26cc7ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 18:43:06 -0300
Subject: [PATCH 4/5] 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.
---
 srcpkgs/recode/patches/link-librecode.a.patch | 46 +++++++++++++++++++
 srcpkgs/recode/template                       | 16 +++----
 2 files changed, 54 insertions(+), 8 deletions(-)
 create mode 100644 srcpkgs/recode/patches/link-librecode.a.patch

diff --git a/srcpkgs/recode/patches/link-librecode.a.patch b/srcpkgs/recode/patches/link-librecode.a.patch
new file mode 100644
index 00000000000..3e212daf0b5
--- /dev/null
+++ b/srcpkgs/recode/patches/link-librecode.a.patch
@@ -0,0 +1,46 @@
+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
diff --git a/srcpkgs/recode/template b/srcpkgs/recode/template
index c57c8e4b937..bba0c7862d4 100644
--- a/srcpkgs/recode/template
+++ b/srcpkgs/recode/template
@@ -1,24 +1,24 @@
 # Template file for 'recode'
 pkgname=recode
 version=3.6
-revision=9
-patch_args="-Np1"
+revision=10
 build_style=gnu-configure
 configure_args="--without-included-gettext jm_cv_func_working_malloc=yes
  jm_cv_func_working_realloc=yes"
 hostmakedepends="automake gettext libtool texinfo"
 short_desc="Character set conversion utility"
-homepage="http://recode.progiciels-bpi.ca/"
-license="GPL-2"
 maintainer="Orphaned <orphan@voidlinux.org>"
+license="GPL-2.0-or-later"
+homepage="http://recode.progiciels-bpi.ca/"
 distfiles="${DEBIAN_SITE}/main/r/${pkgname}/${pkgname}_${version}.orig.tar.gz"
 checksum=e3e6a4f3f8e5c6052ab70155990c074d87aa0b614fc1be31d194750d1d962fcf
+patch_args="-Np1"
 
 pre_configure() {
-	sed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
-	sed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
-	sed -i -e "s/ansi2knr//" src/Makefile.am
-	rm -f acinclude.m4
+	vsed -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' -i configure.in
+	vsed -i -e "/^AM_C_PROTOTYPES.*/d" configure.in
+	vsed -i -e "s/ansi2knr//" src/Makefile.am
+	rm acinclude.m4
 	autoreconf -fi
 	libtoolize
 }

From bfc218295b8f759be060d9900a8fdcc338fd206d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Wed, 16 Dec 2020 17:59:10 -0300
Subject: [PATCH 5/5] fortune-mod: remove error.{h,c} copy.

Revbump to pick up the fix from librecode.

Also use vsed where appropriate.
---
 srcpkgs/fortune-mod/files/error.c | 19 -------------------
 srcpkgs/fortune-mod/files/error.h |  4 ----
 srcpkgs/fortune-mod/template      | 12 +++++-------
 3 files changed, 5 insertions(+), 30 deletions(-)
 delete mode 100644 srcpkgs/fortune-mod/files/error.c
 delete mode 100644 srcpkgs/fortune-mod/files/error.h

diff --git a/srcpkgs/fortune-mod/files/error.c b/srcpkgs/fortune-mod/files/error.c
deleted file mode 100644
index 7b12fe45adf..00000000000
--- a/srcpkgs/fortune-mod/files/error.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#define _GNU_SOURCE
-#include <errno.h>
-
-void error(int status, int errnum, const char* format, ...)
-{
-	va_list ap;
-
-	fflush(stdout);
-	fprintf(stderr, "%s: ", program_invocation_name);
-	va_start(ap, format);
-	vfprintf(stderr, format, ap);
-	va_end(ap);
-	if (errnum)
-		fprintf(stderr, ":%d", errnum);
-	if (status)
-		exit(status);
-}
diff --git a/srcpkgs/fortune-mod/files/error.h b/srcpkgs/fortune-mod/files/error.h
deleted file mode 100644
index 81a410f8cfc..00000000000
--- a/srcpkgs/fortune-mod/files/error.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _ERROR_H_
-#define _ERROR_H_
-void error(int status, int errnum, const char* format, ...);
-#endif	/* _ERROR_H_ */
diff --git a/srcpkgs/fortune-mod/template b/srcpkgs/fortune-mod/template
index 0eb27936c07..27824c3617e 100644
--- a/srcpkgs/fortune-mod/template
+++ b/srcpkgs/fortune-mod/template
@@ -1,7 +1,7 @@
 # Template file for 'fortune-mod'
 pkgname=fortune-mod
 version=1.99.1
-revision=5
+revision=6
 hostmakedepends="recode"
 makedepends="recode-devel"
 short_desc="Implementation of the BSDGames 'fortune' program"
@@ -18,14 +18,12 @@ if [ "$CROSS_BUILD" ]; then
 fi
 
 do_build() {
-	sed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
-	sed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
-	sed -i "s;u_int;uint;" util/strfile.h
+	vsed -i "s|^CFLAGS=.*|CFLAGS=${CFLAGS} -fsigned-char \$(DEFINES)|" Makefile
+	vsed -i "s|^LDFLAGS=.*|LDFLAGS=${LDFLAGS}|" Makefile
+	vsed -i "s;u_int;uint;" util/strfile.h
 	case "$XBPS_TARGET_MACHINE" in
 		*-musl)
-			cp ${FILESDIR}/error.{c,h} ${wrksrc}/fortune
-			sed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
-			sed -e "s;fortune\.o;fortune.o error.o;" -i fortune/Makefile
+			vsed -e "s;-DBSD_REGEX;-DPOSIX_REGEX;" -i Makefile
 	esac
 	make CC=$CC COOKIEDIR=/usr/share/fortunes $_strfile
 	sed -n '/[*][[:space:]]*The Regents/,/SUCH DAMAGE/p' fortune/fortune.c |

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR REVIEW] Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (10 preceding siblings ...)
  2020-12-17  4:45 ` [PR PATCH] [Updated] " ericonr
@ 2020-12-17 15:20 ` ericonr
  2020-12-17 15:20 ` [PR PATCH] [Merged]: " ericonr
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-17 15:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/27204#discussion_r545171642

Comment:
I'm going to leave it as static for the moment.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Merged]: Add error.h to musl-legacy-compat.
  2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
                   ` (11 preceding siblings ...)
  2020-12-17 15:20 ` [PR REVIEW] " ericonr
@ 2020-12-17 15:20 ` ericonr
  12 siblings, 0 replies; 14+ messages in thread
From: ericonr @ 2020-12-17 15:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

There's a merged pull request on the void-packages repository

Add error.h to musl-legacy-compat.
https://github.com/void-linux/void-packages/pull/27204

Description:


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-12-17 15:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 21:02 [PR PATCH] Add error.h to musl-legacy-compat ericonr
2020-12-16 21:07 ` [PR PATCH] [Updated] " ericonr
2020-12-16 21:45 ` ericonr
2020-12-16 22:10 ` ericonr
2020-12-16 23:01 ` ericonr
2020-12-16 23:22 ` ericonr
2020-12-16 23:55 ` ericonr
2020-12-17  0:47 ` ericonr
2020-12-17  1:27 ` [PR REVIEW] " sgn
2020-12-17  2:33 ` ericonr
2020-12-17  4:42 ` ericonr
2020-12-17  4:45 ` [PR PATCH] [Updated] " ericonr
2020-12-17 15:20 ` [PR REVIEW] " ericonr
2020-12-17 15:20 ` [PR PATCH] [Merged]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).