[macppc+ports-gcc-6.4] Fix devel/libaudiofile

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[macppc+ports-gcc-6.4] Fix devel/libaudiofile

Charlene Wendling
Hi ports!  

Here is a fix [1] for libaudiofile that allows building [2] with
ports-gcc-6.4 on macppc.

I can't do better than quoting the patch commit message:

libaudiofile: fix the second undefined behaviour in the same line of
code, cstatic which isn't actually a cstatic. switch to just defining
it in the accessor. GCC optimized this undefined behaviour away leading
to an undefined reference in the builds.

Testing:

- 'make test' passes (see [2])
- i've built audio/normalize without issues, the runtime [3] is as
expected. Same thing using ports-gcc-4.9.
- it doesn't break the amd64 build and audio/normalize runtime is fine
there as well.

I'm joining a diff.

Charlène.

[1]
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h?rev=1.3&content-type=text/x-cvsweb-markup&only_with_tag=MAIN
[2] http://ix.io/1v1W
[3] It requires a patch for audio/mpg321 if you need to normalize mp3
files, not yet commited as i'm writing this

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libaudiofile/Makefile,v
retrieving revision 1.58
diff -u -p -r1.58 Makefile
--- Makefile 22 Nov 2018 20:28:25 -0000 1.58
+++ Makefile 4 Dec 2018 14:03:15 -0000
@@ -10,7 +10,7 @@ SUBST_VARS= V
 
 DISTNAME= audiofile-${V}
 PKGNAME= lib${DISTNAME}
-REVISION= 5
+REVISION= 6
 
 SHARED_LIBS +=  audiofile            1.0      # 1.0
 
Index: patches/patch-libaudiofile_modules_SimpleModule_h
===================================================================
RCS
file: /cvs/ports/devel/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule_h,v
retrieving revision 1.1 diff -u -p -r1.1
patch-libaudiofile_modules_SimpleModule_h
--- patches/patch-libaudiofile_modules_SimpleModule_h 22 Nov
2018 20:28:25 -0000 1.1 +++
patches/patch-libaudiofile_modules_SimpleModule_h 4 Dec 2018
14:03:15 -0000 @@ -1,18 +1,38 @@ $OpenBSD:
patch-libaudiofile_modules_SimpleModule_h,v 1.1 2018/11/22 20:28:25
naddy Exp $ Fix undefined behavior in sign conversion.
-https://github.com/mpruett/audiofile/commit/b62c902dd258125cac86cd2df21fc898035a43d3
+From
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h?rev=1.3&content-type=text/x-cvsweb-markup&only_with_tag=MAIN 
 Index: libaudiofile/modules/SimpleModule.h
 --- libaudiofile/modules/SimpleModule.h.orig
 +++ libaudiofile/modules/SimpleModule.h
-@@ -123,7 +123,8 @@ struct signConverter
+@@ -122,17 +122,24 @@ struct signConverter
+ typedef typename IntTypes<Format>::SignedType SignedType;
  typedef typename IntTypes<Format>::UnsignedType UnsignedType;
 
- static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
+- static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
 - static const int kMinSignedValue = -1 << kScaleBits;
-+ static const int kMaxSignedValue = (((1 << (kScaleBits - 1))
- 1) << 1) + 1; -+ static const int kMinSignedValue =
-kMaxSignedValue - 1;
-
+-
  struct signedToUnsigned : public
std::unary_function<SignedType, UnsignedType> {
+- UnsignedType operator()(SignedType x) { return x -
kMinSignedValue; } ++ UnsignedType operator()(SignedType
x) { ++ int kScaleBits = (Format + 1) * CHAR_BIT
- 1; ++ int kMaxSignedValue = (((1 <<
(kScaleBits - 1)) - 1) << 1) + 1; ++ int
kMinSignedValue = -kMaxSignedValue - 1; ++
return x - kMinSignedValue; ++ }
+ };
+
+ struct unsignedToSigned : public
std::unary_function<SignedType, UnsignedType>
+ {
+- SignedType operator()(UnsignedType x) { return x +
kMinSignedValue; } ++ SignedType operator()(UnsignedType
x) { ++ int kScaleBits = (Format + 1) * CHAR_BIT
- 1; ++ int kMaxSignedValue = (((1 <<
(kScaleBits - 1)) - 1) << 1) + 1; ++ int
kMinSignedValue = -kMaxSignedValue - 1; ++
return x + kMinSignedValue; ++ }
+ };
+ };
+

Reply | Threaded
Open this post in threaded view
|

Re: [macppc+ports-gcc-6.4] Fix devel/libaudiofile

Christian Weisgerber
Charlene Wendling:

> Here is a fix [1] for libaudiofile that allows building [2] with
> ports-gcc-6.4 on macppc.

What problem are you trying to fix?

The last build log I can find
http://build-failures.rhaalovely.net/powerpc/2018-11-20/devel/libaudiofile.log
shows the error I already fixed in revision 5.

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [macppc+ports-gcc-6.4] Fix devel/libaudiofile

Charlene Wendling
On Wed, 5 Dec 2018 22:00:34 +0100
Christian Weisgerber wrote:

> Charlene Wendling:
>
> > Here is a fix [1] for libaudiofile that allows building [2] with
> > ports-gcc-6.4 on macppc.
>
> What problem are you trying to fix?
>
> The last build log I can find
> http://build-failures.rhaalovely.net/powerpc/2018-11-20/devel/libaudiofile.log
> shows the error I already fixed in revision 5.

This was that problem, and revision 5 fixed it with ports-gcc-6.4 as
well. Once again i should have tried as-is before... sorry for the
noise.

Charlène.

> --
> Christian "naddy" Weisgerber
> [hidden email]
>