kumquat-buildroot/package/libsidplay2/0001-sidplay2-libs-2.1.1.patch
Thomas Petazzoni df1b6d8cb2 libsidplay2: fix build on ppc64le by not autoreconfiguring
The libsidplay2 package build system is completely broken. It is made
of a top-level configure script, which calls into sub-configure
scripts in sub-directories. However, since it doesn't use the autoconf
provided AC_CONFIG_SUBDIRS() mechanism, an "autoreconf" doesn't
recurse into the subdirectories.

Due to this, the aclocal.m4 in the libsidplay/ subdirectory doesn't
get re-generated when Buildroot autoreconfs the package. However,
since we patch one of the .m4 files in this subdirectory, when build
time comes, the package notices its aclocal.m4 is older than one of
the .m4 file, and triggers an automatic autoreconf.

Since <pkg>_AUTORECONF = YES is enabled, this automatic autoreconf
works fine: host-autoconf and host-automake are available.

Expect that on powerpc64le, we patch the configure script itself to
make it recognize powerpc64le. But this patching of the configure
script itself gets overwritten by the automatic autoreconf at the
beginning of the build step, causing the build to fail on powerpc64le.

Switching to AC_CONFIG_SUBDIRS() would allow to fix this, but
libsidplay2 needs to pass custom configure options to each of the
sub-configure scripts, something that AC_CONFIG_SUBDIRS() doesn't
support. And since libsidplay2 upstream looks completely dead, the
incentive to fix the whole thing is very limited.

Since what's broken is the autoreconfiguration of the package, what we
do is modify patch 0001-sidplay2-libs-2.1.1.patch to directly tweak the
configure script (instead of the relevant .m4 file). Thanks to this,
<pkg>_AUTORECONF = YES is no longer needed, the .m4 file is no longer
newer than the sub-configure script, and no automatic autoreconf
triggers at build time. This allows the package to build properly on
powerpc64le.

While we normally don't like patching 'configure' scripts directly, in
this case the size of the change in the configure script is very small,
and as explained above, the incentive to fix the package properly is
very limited.

In detail, the changes:

 * Patch 0001-sidplay2-libs-2.1.1.patch is turned into a Git-formatted
   patch

 * The irrelevant changes to Makefile.in files, aclocal.m4, config.h.in,
   sidint.h are removed.

 * The change to my_macros.m4 is applied directly to the corresponding
   configure script.

 * The change to the configure.ac script regarding libdir is applied
   directly to the corresponding configure script.

 * The change to the configure.ac script regarding "*-k*bsd*-gnu" is
   dropped, since we don't care about kFreeBSD support.

 * LIBSIDPLAY2_AUTORECONF = YES is dropped from the .mk file.

Fixes:

  http://autobuild.buildroot.net/results/1f6a42bfece24e09c9c7f4078d549ec5c099c89d/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-01 22:50:36 +01:00

228 lines
7.7 KiB
Diff

From 38493fceb39ac33e12c9c69d78f5584413b479f4 Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Date: Wed, 1 Mar 2017 10:03:40 +0100
Subject: [PATCH] Various fixes to compile libsidplay2 with newer gcc compilers
Downloaded from
http://tsubasa.googlecode.com/svn/trunk/tsubasa/sidplay2-libs/sidplay2-libs-2.1.1.diff
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Thomas: adjusted to avoid the need to autoreconf, which doesn't work
properly on this package.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
builders/hardsid-builder/src/hardsid-builder.cpp | 1 +
builders/resid-builder/src/resid-builder.cpp | 1 +
builders/resid-builder/src/resid.cpp | 1 +
configure | 2 +-
libsidplay/configure | 5 +++--
libsidplay/include/sidplay/SmartPtr.h | 28 ++++++++++++------------
libsidplay/include/sidplay/sidendian.h | 18 +++++++++------
libsidutils/include/sidplay/utils/SidUsage.h | 2 +-
8 files changed, 33 insertions(+), 25 deletions(-)
diff --git a/builders/hardsid-builder/src/hardsid-builder.cpp b/builders/hardsid-builder/src/hardsid-builder.cpp
index f54d0a9..9375e40 100644
--- a/builders/hardsid-builder/src/hardsid-builder.cpp
+++ b/builders/hardsid-builder/src/hardsid-builder.cpp
@@ -47,6 +47,7 @@
***************************************************************************/
#include <stdio.h>
+#include <cstring>
#include "config.h"
#ifdef HAVE_EXCEPTIONS
diff --git a/builders/resid-builder/src/resid-builder.cpp b/builders/resid-builder/src/resid-builder.cpp
index e6e4eaa..4c7650f 100644
--- a/builders/resid-builder/src/resid-builder.cpp
+++ b/builders/resid-builder/src/resid-builder.cpp
@@ -37,6 +37,7 @@
***************************************************************************/
#include <stdio.h>
+#include <cstring>
#include "config.h"
#ifdef HAVE_EXCEPTIONS
diff --git a/builders/resid-builder/src/resid.cpp b/builders/resid-builder/src/resid.cpp
index 8c27850..d3123c5 100644
--- a/builders/resid-builder/src/resid.cpp
+++ b/builders/resid-builder/src/resid.cpp
@@ -16,6 +16,7 @@
* *
***************************************************************************/
+#include <cstring>
#include "config.h"
#ifdef HAVE_EXCEPTIONS
diff --git a/configure b/configure
index 1200eaf..77948b4 100755
--- a/configure
+++ b/configure
@@ -1227,7 +1227,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
#Variables
pwd=`pwd`
-builders='${libdir}'/sidplay/builders
+builders='${libdir}'/
ac_configure_args="$ac_configure_args --disable-library-checks"
ac_aux_dir=
diff --git a/libsidplay/configure b/libsidplay/configure
index 05a8ea6..3d93956 100755
--- a/libsidplay/configure
+++ b/libsidplay/configure
@@ -23466,8 +23466,9 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <fstream.h>
- #include <iomanip.h>
+#include <fstream>
+ #include <iomanip>
+ using namespace std;
int
main ()
{
diff --git a/libsidplay/include/sidplay/SmartPtr.h b/libsidplay/include/sidplay/SmartPtr.h
index c0cbb1a..15efd10 100644
--- a/libsidplay/include/sidplay/SmartPtr.h
+++ b/libsidplay/include/sidplay/SmartPtr.h
@@ -17,16 +17,16 @@ class SmartPtrBase_sidtt
doFree = bufOwner;
if ( bufferLen >= 1 )
{
- pBufCurrent = ( bufBegin = buffer );
- bufEnd = bufBegin + bufferLen;
- bufLen = bufferLen;
- status = true;
+ this->pBufCurrent = ( this->bufBegin = buffer );
+ this->bufEnd = this->bufBegin + bufferLen;
+ this->bufLen = bufferLen;
+ this->status = true;
}
else
{
- pBufCurrent = ( bufBegin = ( bufEnd = 0 ));
- bufLen = 0;
- status = false;
+ this->pBufCurrent = ( this->bufBegin = ( this->bufEnd = 0 ));
+ this->bufLen = 0;
+ this->status = false;
}
}
@@ -211,16 +211,16 @@ class SmartPtr_sidtt : public SmartPtrBase_sidtt<T>
{
if ( bufferLen >= 1 )
{
- pBufCurrent = ( bufBegin = buffer );
- bufEnd = bufBegin + bufferLen;
- bufLen = bufferLen;
- status = true;
+ this->pBufCurrent = ( this->bufBegin = buffer );
+ this->bufEnd = this->bufBegin + bufferLen;
+ this->bufLen = bufferLen;
+ this->status = true;
}
else
{
- pBufCurrent = bufBegin = bufEnd = 0;
- bufLen = 0;
- status = false;
+ this->pBufCurrent = this->bufBegin = this->bufEnd = 0;
+ this->bufLen = 0;
+ this->status = false;
}
}
};
diff --git a/libsidplay/include/sidplay/sidendian.h b/libsidplay/include/sidplay/sidendian.h
index 9fa8582..6115282 100644
--- a/libsidplay/include/sidplay/sidendian.h
+++ b/libsidplay/include/sidplay/sidendian.h
@@ -16,6 +16,10 @@
***************************************************************************/
/***************************************************************************
* $Log: sidendian.h,v $
+ * Revision 1.6 2005/11/20 11:02:06 s_a_white
+ * Work around for bug in gcc 4 (optimiser breaks if variable never has a
+ * direct assignment).
+ *
* Revision 1.5 2001/07/03 22:44:13 s_a_white
* Added endian_16 to convert a 16 bit value to an array of 8s.
*
@@ -141,7 +145,7 @@ inline void endian_16swap8 (uint_least16_t &word)
// Convert high-byte and low-byte to 16-bit word.
inline uint_least16_t endian_16 (uint8_t hi, uint8_t lo)
{
- uint_least16_t word;
+ uint_least16_t word = 0;
endian_16lo8 (word, lo);
endian_16hi8 (word, hi);
return word;
@@ -165,7 +169,7 @@ inline void endian_16 (uint8_t ptr[2], uint_least16_t word)
inline void endian_16 (char ptr[2], uint_least16_t word)
{
- endian_16 ((uint8_t *) ptr, word);
+ endian_16 ((uint8_t *) ptr, word);
}
// Convert high-byte and low-byte to 16-bit little endian word.
@@ -334,7 +338,7 @@ inline void endian_32swap16 (uint_least32_t &dword)
// Swap word endian.
inline void endian_32swap8 (uint_least32_t &dword)
{
- uint_least16_t lo, hi;
+ uint_least16_t lo = 0, hi = 0;
lo = endian_32lo16 (dword);
hi = endian_32hi16 (dword);
endian_16swap8 (lo);
@@ -346,8 +350,8 @@ inline void endian_32swap8 (uint_least32_t &dword)
// Convert high-byte and low-byte to 32-bit word.
inline uint_least32_t endian_32 (uint8_t hihi, uint8_t hilo, uint8_t hi, uint8_t lo)
{
- uint_least32_t dword;
- uint_least16_t word;
+ uint_least32_t dword = 0;
+ uint_least16_t word = 0;
endian_32lo8 (dword, lo);
endian_32hi8 (dword, hi);
endian_16lo8 (word, hilo);
@@ -374,7 +378,7 @@ inline void endian_little32 (uint8_t ptr[4], uint_least32_t dword)
defined(SID_WORDS_LITTLEENDIAN)
*((uint_least32_t *) ptr) = dword;
#else
- uint_least16_t word;
+ uint_least16_t word = 0;
ptr[0] = endian_32lo8 (dword);
ptr[1] = endian_32hi8 (dword);
word = endian_32hi16 (dword);
@@ -401,7 +405,7 @@ inline void endian_big32 (uint8_t ptr[4], uint_least32_t dword)
defined(SID_WORDS_BIGENDIAN)
*((uint_least32_t *) ptr) = dword;
#else
- uint_least16_t word;
+ uint_least16_t word = 0;
word = endian_32hi16 (dword);
ptr[1] = endian_16lo8 (word);
ptr[0] = endian_16hi8 (word);
diff --git a/libsidutils/include/sidplay/utils/SidUsage.h b/libsidutils/include/sidplay/utils/SidUsage.h
index 2afb0f3..0496eea 100755
--- a/libsidutils/include/sidplay/utils/SidUsage.h
+++ b/libsidutils/include/sidplay/utils/SidUsage.h
@@ -33,7 +33,7 @@ struct sid2_usage_t: public sid_usage_t
uint_least16_t length; // usage scan length
// Copy common parts of basic usage to extended usage.
- sid2_usage_t &sid2_usage_t::operator= (const sid_usage_t &usage)
+ sid2_usage_t &operator= (const sid_usage_t &usage)
{
*((sid_usage_t *) this) = usage;
return *this;
--
2.7.4