From 7ccab4ea7d1dc72e7117674983f3fcda1152b170 Mon Sep 17 00:00:00 2001 From: fbrosson Date: Sun, 26 Apr 2015 18:27:53 +0000 Subject: [PATCH] cherry-picking fixes from the latest schilytools --- .../cdrtools/patches/cdrtools-3.01~a28.patch | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) diff --git a/app-cdr/cdrtools/patches/cdrtools-3.01~a28.patch b/app-cdr/cdrtools/patches/cdrtools-3.01~a28.patch index a6fd01c46..1304d22a5 100644 --- a/app-cdr/cdrtools/patches/cdrtools-3.01~a28.patch +++ b/app-cdr/cdrtools/patches/cdrtools-3.01~a28.patch @@ -62,3 +62,225 @@ diff -ur cdrtools-3.01/RULES/MKLINKS cdrtools-3.01-haiku/RULES/MKLINKS +$symlink bepc-haiku-cc.rul x86_64-haiku-cc.rul +$symlink bepc-haiku-gcc.rul x86_64-haiku-gcc.rul $symlink alpha-openvms-cc.rul alphaserver_ds20_500_mhz-openvms-cc.rul +diff -urp cdrtools-3.01/cdda2wav/cdda2wav.c cdrtools-3.01-haiku/cdda2wav/cdda2wav.c +--- cdrtools-3.01/cdda2wav/cdda2wav.c 2015-01-01 14:21:58.000000000 +0000 ++++ cdrtools-3.01-haiku/cdda2wav/cdda2wav.c +@@ -3822,9 +3822,16 @@ main(argc, argv) + _("find_area: no such area name.\n")); + exit(SHMMEM_ERROR); + } +- /* clone the parent mapping without cow. */ ++ /* ++ * clone the parent mapping without cow. ++ * The original implementaion used ++ * B_ANY_ADDRESS, but newer Haiku versions ++ * implement address randomization that ++ * prevents us from using the pointer in the ++ * child. So we now use B_EXACT_ADDRESS. ++ */ + if (B_OK > clone_area("shm_child", +- &area_address, B_ANY_ADDRESS, ++ &area_address, B_EXACT_ADDRESS, + B_READ_AREA | B_WRITE_AREA, area_parent)) { + errmsgno(EX_BAD, + _("clone_area failed\n")); +diff -urp cdrtools-3.01/cdrecord/fifo.c cdrtools-3.01-haiku/cdrecord/fifo.c +--- cdrtools-3.01/cdrecord/fifo.c 2010-12-19 18:39:36.000000000 +0000 ++++ cdrtools-3.01-haiku/cdrecord/fifo.c +@@ -383,9 +383,12 @@ beosshm_child() + delete_area(area_for(faio_addr)); + /* + * Clone (share) the original one. ++ * The original implementaion used B_ANY_ADDRESS, but newer Haiku ++ * versions implement address randomization that prevents us from ++ * using the pointer in the child. So we now use B_EXACT_ADDRESS. + */ + faio_aid = clone_area(faio_name, &faio_addr, +- B_ANY_ADDRESS, B_READ_AREA|B_WRITE_AREA, ++ B_EXACT_ADDRESS, B_READ_AREA|B_WRITE_AREA, + faio_aid); + if (bufbase != faio_addr) { + comerrno(EX_BAD, _("Panic FIFO addr.\n")); +diff -urp cdrtools-3.01/include/schily/dbgmalloc.h cdrtools-3.01-haiku/include/schily/dbgmalloc.h +--- cdrtools-3.01/include/schily/dbgmalloc.h 2010-09-18 22:14:44.000000000 +0000 ++++ cdrtools-3.01-haiku/include/schily/dbgmalloc.h +@@ -47,6 +47,9 @@ extern void *dbg_realloc __PR((void *t, + + #endif /* DBG_MALLOC */ + ++#ifdef USE_JS_BOOL /* #define USE_JS_BOOL if there is a */ ++#define BOOL JS_BOOL /* different (incompatible) BOOL in */ ++#endif /* the using code */ + #include + + #ifdef __cplusplus +@@ -57,6 +60,10 @@ extern BOOL acheckdamage __PR((void)); + extern void freechecking __PR((BOOL val)); + extern void nomemraising __PR((BOOL val)); + ++#ifdef USE_JS_BOOL /* If in workaround mode, */ ++#undef BOOL /* revert to default BOOL */ ++#endif ++ + #ifdef __cplusplus + } + #endif +diff -urp cdrtools-3.01/include/schily/schily.h cdrtools-3.01-haiku/include/schily/schily.h +--- cdrtools-3.01/include/schily/schily.h 2015-03-03 19:54:11.000000000 +0000 ++++ cdrtools-3.01-haiku/include/schily/schily.h +@@ -476,6 +476,8 @@ extern int qftoes __PR((char *, long dou + extern int qftofs __PR((char *, long double, int, int)); + #endif + ++/*PRINTFLIKE1*/ ++extern int js_error __PR((const char *, ...)) __printflike__(1, 2); + #ifdef EOF /* stdio.h has been included */ + /*PRINTFLIKE2*/ + extern int js_fprintf __PR((FILE *, const char *, ...)) +@@ -532,6 +534,10 @@ extern int _openfd64 __PR((const char *, + + #ifndef NO_SCHILY_PRINT /* Define to disable *printf() redirects */ + #ifdef SCHILY_PRINT ++#ifdef __never__ ++#undef error ++#define error js_error ++#endif + #undef fprintf + #define fprintf js_fprintf + #undef printf +diff -urp cdrtools-3.01/include/schily/sysexits.h cdrtools-3.01-haiku/include/schily/sysexits.h +--- cdrtools-3.01/include/schily/sysexits.h 2009-06-14 13:00:23.000000000 +0000 ++++ cdrtools-3.01-haiku/include/schily/sysexits.h +@@ -42,7 +42,7 @@ + + #ifdef HAVE_SYSEXITS_H + #include +-#else ++#endif /* HAVE_SYSEXITS_H */ + + /* + * SYSEXITS.H -- Exit status codes for system programs. +@@ -99,10 +99,17 @@ + * perform the operation. This is not intended for + * file system problems, which should use NOINPUT or + * CANTCREAT, but rather for higher level permissions. ++ * ++ * Haiku recently added an #ifdef _BSD_SOURCE around the definitions, ++ * so we may need to #define things even though we did include the ++ * system's sysexits.h. + */ + ++#ifndef EX_OK + #define EX_OK 0 /* successful termination */ ++#endif + ++#ifndef EX__BASE + #define EX__BASE 64 /* base value for error messages */ + + #define EX_USAGE 64 /* command line usage error */ +@@ -123,6 +130,6 @@ + + #define EX_NOTFOUND 79 /* entry not found */ + #define EX__MAX 79 /* maximum listed value */ ++#endif + +-#endif /* HAVE_SYSEXITS_H */ + #endif /* !_SCHILY_SYSEXITS_H */ +diff -urp cdrtools-3.01/include/schily/wait.h cdrtools-3.01-haiku/include/schily/wait.h +--- cdrtools-3.01/include/schily/wait.h 2011-07-19 18:06:06.000000000 +0000 ++++ cdrtools-3.01-haiku/include/schily/wait.h +@@ -157,8 +157,12 @@ extern "C" { + # define WTERMSIG(status) (_W_I(status) & 0x7F) + # endif + # ifndef WCOREDUMP ++# ifdef WIFCORED /* Haiku */ ++# define WCOREDUMP(status) (WIFCORED(_W_I(status)) ++# else + # define WCOREDUMP(status) (_W_I(status) & 0x80) + # endif ++# endif + # ifndef WEXITSTATUS + # define WEXITSTATUS(status) ((_W_I(status) >> 8) & 0xFF) + # endif +diff -urp cdrtools-3.01/libschily/error.c cdrtools-3.01-haiku/libschily/error.c +--- cdrtools-3.01/libschily/error.c 2009-07-10 19:54:04.000000000 +0000 ++++ cdrtools-3.01-haiku/libschily/error.c +@@ -22,6 +22,10 @@ + #include + #include + ++#undef error ++#ifdef HAVE_PRAGMA_WEAK ++#pragma weak error = js_error ++#else + /* VARARGS1 */ + #ifdef PROTOTYPES + EXPORT int +@@ -32,6 +36,31 @@ error(fmt, va_alist) + char *fmt; + va_dcl + #endif ++{ ++ va_list args; ++ int ret; ++ ++#ifdef PROTOTYPES ++ va_start(args, fmt); ++#else ++ va_start(args); ++#endif ++ ret = js_fprintf(stderr, "%r", fmt, args); ++ va_end(args); ++ return (ret); ++} ++#endif ++ ++/* VARARGS1 */ ++#ifdef PROTOTYPES ++EXPORT int ++js_error(const char *fmt, ...) ++#else ++EXPORT int ++js_error(fmt, va_alist) ++ char *fmt; ++ va_dcl ++#endif + { + va_list args; + int ret; +diff -urp cdrtools-3.01/libschily/strlcatl.c cdrtools-3.01-haiku/libschily/strlcatl.c +--- cdrtools-3.01/libschily/strlcatl.c 2015-03-03 19:50:42.000000000 +0000 ++++ cdrtools-3.01-haiku/libschily/strlcatl.c +@@ -37,7 +37,7 @@ EXPORT size_t + strlcatl(char *to, size_t len, ...) + #else + EXPORT size_t +-strlcatl(to, len va_alist) ++strlcatl(to, len, va_alist) + char *to; + size_t len; + va_dcl +diff -urp cdrtools-3.01/libschily/wcslcatl.c cdrtools-3.01-haiku/libschily/wcslcatl.c +--- cdrtools-3.01/libschily/wcslcatl.c 2015-03-03 19:50:42.000000000 +0000 ++++ cdrtools-3.01-haiku/libschily/wcslcatl.c +@@ -38,7 +38,7 @@ EXPORT size_t + wcslcatl(wchar_t *to, size_t len, ...) + #else + EXPORT size_t +-wcslcatl(to, len va_alist) ++wcslcatl(to, len, va_alist) + wchar_t *to; + size_t len; + va_dcl +diff -urp cdrtools-3.01/readcd/readcd.1 cdrtools-3.01-haiku/readcd/readcd.1 +--- cdrtools-3.01/readcd/readcd.1 2014-12-03 19:13:13.000000000 +0000 ++++ cdrtools-3.01-haiku/readcd/readcd.1 +@@ -603,7 +603,7 @@ login shell. + .SH FILES + .SH SEE ALSO + .BR cdrecord (1), +-.BR mkisofs (1), ++.BR mkisofs (8), + .BR scg (7), + .BR fbk (7), + .BR rcmd (3),