commit:     db5ba8d0625e670e679f558e0943006f238f952b
Author:     Jonathan Scruggs <j.scruggs <AT> gmail <DOT> com>
AuthorDate: Fri Oct 28 09:31:09 2016 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Fri Oct 28 22:30:29 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db5ba8d0

media-libs/audiofile: Add gcc 6 build fixes patch

Gentoo-bug: 582792

Signed-off by: Jonathan Scruggs (j.scruggs <AT> gmail.com)
Closes: https://github.com/gentoo/gentoo/pull/2684

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 media-libs/audiofile/audiofile-0.3.6-r2.ebuild     |  50 ++++++++
 .../files/audiofile-0.3.6-gcc6-build-fixes.patch   | 127 +++++++++++++++++++++
 2 files changed, 177 insertions(+)

diff --git a/media-libs/audiofile/audiofile-0.3.6-r2.ebuild 
b/media-libs/audiofile/audiofile-0.3.6-r2.ebuild
new file mode 100644
index 00000000..53ee8b6
--- /dev/null
+++ b/media-libs/audiofile/audiofile-0.3.6-r2.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools gnome.org multilib-minimal
+
+DESCRIPTION="An elegant API for accessing audio files"
+HOMEPAGE="http://www.68k.org/~michael/audiofile/";
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0/1" # subslot = soname major version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc \
+       ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux \
+       ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="flac static-libs test"
+
+RDEPEND="flac? ( >=media-libs/flac-1.2.1[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       test? ( dev-cpp/gtest[${MULTILIB_USEDEP}] )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.3.6-gcc6-build-fixes.patch
+       "${FILESDIR}"/${PN}-0.3.6-system-gtest.patch
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+multilib_src_configure() {
+       local myconf=(
+               --enable-largefile
+               --disable-werror
+               --disable-examples
+               $(use_enable flac)
+               $(use_enable static-libs static)
+       )
+       ECONF_SOURCE="${S}" econf "${myconf[@]}"
+}
+
+multilib_src_install_all() {
+       einstalldocs
+
+       # package provides .pc file
+       find "${D}" -name '*.la' -delete || die
+}

diff --git a/media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch 
b/media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch
new file mode 100644
index 00000000..02d96f1
--- /dev/null
+++ b/media-libs/audiofile/files/audiofile-0.3.6-gcc6-build-fixes.patch
@@ -0,0 +1,127 @@
+From 308571e254ad30101be8c1247d2b0b64cf488386 Mon Sep 17 00:00:00 2001
+From: Michael Schwendt <[email protected]>
+Date: Wed, 3 Feb 2016 21:56:11 +0100
+Subject: [PATCH] left shifting a negative int is undefined behaviour /
+ narrowing conversion issues / for GCC 6
+
+fix left shifts for 32-bit to avoid int overflow
+
+avoid int overflow too
+
+char on ARM is unsigned by default
+---
+ libaudiofile/modules/SimpleModule.h |  2 +-
+ test/FloatToInt.cpp                 |  2 +-
+ test/IntToFloat.cpp                 |  2 +-
+ test/NeXT.cpp                       | 14 +++++++-------
+ test/Sign.cpp                       |  2 +-
+ 5 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/libaudiofile/modules/SimpleModule.h 
b/libaudiofile/modules/SimpleModule.h
+index 03c6c69..e4cc138 100644
+--- a/libaudiofile/modules/SimpleModule.h
++++ b/libaudiofile/modules/SimpleModule.h
+@@ -123,7 +123,7 @@ struct signConverter
+       typedef typename IntTypes<Format>::UnsignedType UnsignedType;
+ 
+       static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
+-      static const int kMinSignedValue = -1 << kScaleBits;
++      static const int kMinSignedValue = 0-(1U<<kScaleBits);
+ 
+       struct signedToUnsigned : public std::unary_function<SignedType, 
UnsignedType>
+       {
+diff --git a/test/FloatToInt.cpp b/test/FloatToInt.cpp
+index 0d179a8..bf491b2 100644
+--- a/test/FloatToInt.cpp
++++ b/test/FloatToInt.cpp
+@@ -115,7 +115,7 @@ TEST_F(FloatToIntTest, Int16)
+               EXPECT_EQ(readData[i], expectedData[i]);
+ }
+ 
+-static const int32_t kMinInt24 = -1<<23;
++static const int32_t kMinInt24 = 0-(1U<<23);
+ static const int32_t kMaxInt24 = (1<<23) - 1;
+ 
+ TEST_F(FloatToIntTest, Int24)
+diff --git a/test/IntToFloat.cpp b/test/IntToFloat.cpp
+index b716635..1d91b58 100644
+--- a/test/IntToFloat.cpp
++++ b/test/IntToFloat.cpp
+@@ -117,7 +117,7 @@ TEST_F(IntToFloatTest, Int16)
+               EXPECT_EQ(readData[i], expectedData[i]);
+ }
+ 
+-static const int32_t kMinInt24 = -1<<23;
++static const int32_t kMinInt24 = 0-(1U<<23);
+ static const int32_t kMaxInt24 = (1<<23) - 1;
+ 
+ TEST_F(IntToFloatTest, Int24)
+diff --git a/test/NeXT.cpp b/test/NeXT.cpp
+index 7e39850..a37cea1 100644
+--- a/test/NeXT.cpp
++++ b/test/NeXT.cpp
+@@ -37,13 +37,13 @@
+ 
+ #include "TestUtilities.h"
+ 
+-const char kDataUnspecifiedLength[] =
++const signed char kDataUnspecifiedLength[] =
+ {
+       '.', 's', 'n', 'd',
+       0, 0, 0, 24, // offset of 24 bytes
+-      0xff, 0xff, 0xff, 0xff, // unspecified length
++      -1, -1, -1, -1, // unspecified length
+       0, 0, 0, 3, // 16-bit linear
+-      0, 0, 172, 68, // 44100 Hz
++      0, 0, -84, 68, // 44100 Hz (0xAC44)
+       0, 0, 0, 1, // 1 channel
+       0, 1,
+       0, 1,
+@@ -57,13 +57,13 @@ const char kDataUnspecifiedLength[] =
+       0, 55
+ };
+ 
+-const char kDataTruncated[] =
++const signed char kDataTruncated[] =
+ {
+       '.', 's', 'n', 'd',
+       0, 0, 0, 24, // offset of 24 bytes
+       0, 0, 0, 20, // length of 20 bytes
+       0, 0, 0, 3, // 16-bit linear
+-      0, 0, 172, 68, // 44100 Hz
++      0, 0, -84, 68, // 44100 Hz (0xAC44)
+       0, 0, 0, 1, // 1 channel
+       0, 1,
+       0, 1,
+@@ -152,13 +152,13 @@ TEST(NeXT, Truncated)
+       ASSERT_EQ(::unlink(testFileName.c_str()), 0);
+ }
+ 
+-const char kDataZeroChannels[] =
++const signed char kDataZeroChannels[] =
+ {
+       '.', 's', 'n', 'd',
+       0, 0, 0, 24, // offset of 24 bytes
+       0, 0, 0, 2, // 2 bytes
+       0, 0, 0, 3, // 16-bit linear
+-      0, 0, 172, 68, // 44100 Hz
++      0, 0, -84, 68, // 44100 Hz (0xAC44)
+       0, 0, 0, 0, // 0 channels
+       0, 1
+ };
+diff --git a/test/Sign.cpp b/test/Sign.cpp
+index 7275399..c339514 100644
+--- a/test/Sign.cpp
++++ b/test/Sign.cpp
+@@ -116,7 +116,7 @@ TEST_F(SignConversionTest, Int16)
+               EXPECT_EQ(readData[i], expectedData[i]);
+ }
+ 
+-static const int32_t kMinInt24 = -1<<23;
++static const int32_t kMinInt24 = 0-(1U<<23);
+ static const int32_t kMaxInt24 = (1<<23) - 1;
+ static const uint32_t kMaxUInt24 = (1<<24) - 1;
+ 
+-- 
+2.10.1
+

Reply via email to