fortune-mod: unbreak musl

This commit is contained in:
jbu 2015-07-10 20:11:39 +02:00
parent e6b34ca994
commit d8486c22f0
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#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);
}

View File

@ -0,0 +1,4 @@
#ifndef _ERROR_H_
#define _ERROR_H_
void error(int status, int errnum, const char* format, ...);
#endif /* _ERROR_H_ */

View File

@ -15,6 +15,13 @@ nocross=yes
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
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
esac
make CC=$CC COOKIEDIR=/usr/share/fortunes
}
do_install() {