commit:     10dfb40fbc837b96626e586b484ed308fbc3ce6b
Author:     Philipp Rösner <rndxelement <AT> protonmail <DOT> com>
AuthorDate: Wed Apr  3 21:16:15 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sat Jun  1 09:31:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10dfb40f

media-sound/alacenc: fix musl build

Add patch for including missing endian.h header file.
Replace use of 'uint' with 'unsigned int'.

Closes: https://bugs.gentoo.org/927902
Signed-off-by: Philipp Rösner <rndxelement <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/36085
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 media-sound/alacenc/alacenc-0.4.0.ebuild           |  4 +++
 media-sound/alacenc/files/alacenc-0.4.0-musl.patch | 30 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/media-sound/alacenc/alacenc-0.4.0.ebuild 
b/media-sound/alacenc/alacenc-0.4.0.ebuild
index d1e6d081f081..a18ef84e118d 100644
--- a/media-sound/alacenc/alacenc-0.4.0.ebuild
+++ b/media-sound/alacenc/alacenc-0.4.0.ebuild
@@ -15,6 +15,10 @@ KEYWORDS="~amd64 ~x86"
 
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+       "${FILESDIR}/${P}-musl.patch"
+)
+
 src_install() {
        dobin "${BUILD_DIR}/alacenc"
        einstalldocs

diff --git a/media-sound/alacenc/files/alacenc-0.4.0-musl.patch 
b/media-sound/alacenc/files/alacenc-0.4.0-musl.patch
new file mode 100644
index 000000000000..e42a0def06d9
--- /dev/null
+++ b/media-sound/alacenc/files/alacenc-0.4.0-musl.patch
@@ -0,0 +1,30 @@
+# Include endian.h because otherwise constants like BYTE_ORDER,
+# LITTLE_ENDIAN or BIG_ENDIAN as well as functions like
+# toBigEndian are missing when building with musl.
+# On glibc these symbols are present without including
+# endian.h, however including it anyway is fine.
+#
+# Related bug: https://bugs.gentoo.org/927902
+--- a/types.h
++++ b/types.h
+@@ -40,6 +40,7 @@
+ #include <fstream>
+ #include <array>
+ #include <cstdint>
++#include <endian.h>
+ 
+ class Error : public std::runtime_error
+ {
+# There is no typedef for uint in musl, so replace it
+# Upstream PR: https://github.com/flacon/alacenc/pull/4
+--- a/atoms.cpp
++++ b/atoms.cpp
+@@ -655,7 +655,7 @@ OutFile &operator<<(OutFile &os, const FreeAtom &atom)
+ {
+     os << uint32_t(atom.mSize);
+     os << "free";
+-    for (uint i = 0; i < atom.mSize - 8; ++i) {
++    for (unsigned int i = 0; i < atom.mSize - 8; ++i) {
+         os << '\0';
+     }
+     return os;

Reply via email to