From 1c8307e48fd47162dac3754d8e709e8af61381b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Thu, 19 Nov 2015 14:02:16 +0100 Subject: [PATCH] enigma: better musl-redirect.patch Thanks to @chneukirchen. freopen(3) works with stdout and stderr, just the assigment to *stdout and *stderr is not possible. --- srcpkgs/enigma/patches/musl-redirect.patch | 44 +++++++++++----------- srcpkgs/enigma/template | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/srcpkgs/enigma/patches/musl-redirect.patch b/srcpkgs/enigma/patches/musl-redirect.patch index 15406d1ad50..cfbedf12ce4 100644 --- a/srcpkgs/enigma/patches/musl-redirect.patch +++ b/srcpkgs/enigma/patches/musl-redirect.patch @@ -1,31 +1,31 @@ -In musl libc stdout and stderr are const and can't be -set to different files, thus disable --redirect. +We can't assign to *stdout and *stderr with musl libc +because both file pointers are const. --- src/main.cc 2014-12-19 22:24:38.000000000 +0100 -+++ src/main.cc 2015-11-18 21:54:09.698790150 +0100 -@@ -131,7 +131,9 @@ - " --nomusic Disable music\n" - " --nosound Disable music and sound effects\n" - " --pref -p file Use filename or dirname for preferences\n" -+#if defined(__GLIBC__) - " --redirect Redirect stdout/stderr to files on user path\n" -+#endif - " --robinson avoid connections to the internet\n" - " --showfps Show the framerate (FPS) during the Game\n" - " --version Print the executable's version number\n" -@@ -298,6 +300,7 @@ - #ifdef WIN32 - ap.redirect = true; - #endif -+#if defined(__GLIBC__) ++++ src/main.cc 2015-11-19 13:53:23.419299858 +0100 +@@ -301,21 +301,25 @@ if (ap.redirect) { FILE *newfp; newfp = std::freopen((userStdPath + "/Output.log").c_str(), "w", stdout); -@@ -318,6 +321,7 @@ ++#if defined(__GLIBC__) + if ( newfp == NULL ) { // This happens on NT + newfp = fopen((userStdPath + "/Output.log").c_str(), "w"); + if (newfp) { // in case stdout is a macro + *stdout = *newfp; + } } ++#endif + setvbuf(stdout, NULL, _IOLBF, BUFSIZ); // Line buffered + + newfp = std::freopen((userStdPath + "/Error.log").c_str(), "w", stderr); ++#if defined(__GLIBC__) + if ( newfp == NULL ) { // This happens on NT + newfp = fopen((userStdPath + "/Error.log").c_str(), "w"); + if (newfp) { // in case stderr is a macro + *stderr = *newfp; + } + } ++#endif setbuf(stderr, NULL); // No buffering } -+#endif - // initialize logfile -- needs ap - if (ap.do_log) diff --git a/srcpkgs/enigma/template b/srcpkgs/enigma/template index 1b94489a7f3..d2a2440b143 100644 --- a/srcpkgs/enigma/template +++ b/srcpkgs/enigma/template @@ -1,7 +1,7 @@ # Template file for 'enigma' pkgname=enigma version=1.21 -revision=1 +revision=2 build_style=gnu-configure hostmakedepends="ImageMagick automake libtool gettext-devel SDL-devel pkg-config" makedepends="libcurl-devel libxerces-c-devel SDL_mixer-devel SDL_image-devel SDL_ttf-devel"