From de406f30b85422e02e235c6608af635064e2a3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= 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 +#include +#include +#include +#include + +#warning usage of non-standard #include 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?= 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 -#include -#include -#include -#include - -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?= 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 -#include -#include - -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?= 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 -#include -#define _GNU_SOURCE -#include - -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 |