From 519c89efe3a9ddc8f3a57d1bb4940ff355086576 Mon Sep 17 00:00:00 2001 From: Daniel Engberg Date: Fri, 6 May 2022 11:47:30 +0200 Subject: audio/libmad: Update to 0.16.0 Switch to Tenacity's fork which contains patched code for all known CVEs and various build fixes. This also makes it easier to maintain as we're using an active fork. Upstream has also switched to CMake. PR: 262874 Approved by: sunpoet (maintainer timeout 4+ weeks) --- audio/libmad/Makefile | 30 +++---- audio/libmad/distinfo | 9 +- audio/libmad/files/mad.pc.in | 11 --- audio/libmad/files/patch-configure | 40 --------- audio/libmad/files/patch-layer12.c | 175 ------------------------------------- audio/libmad/files/patch-layer3.c | 17 ---- audio/libmad/pkg-plist | 10 ++- 7 files changed, 23 insertions(+), 269 deletions(-) delete mode 100644 audio/libmad/files/mad.pc.in delete mode 100644 audio/libmad/files/patch-configure delete mode 100644 audio/libmad/files/patch-layer12.c delete mode 100644 audio/libmad/files/patch-layer3.c diff --git a/audio/libmad/Makefile b/audio/libmad/Makefile index 8eec6b24bf38..9d5d6fe91a5f 100644 --- a/audio/libmad/Makefile +++ b/audio/libmad/Makefile @@ -1,35 +1,25 @@ # Created by: Sergey Akifyev PORTNAME= libmad -PORTVERSION= 0.15.1b -PORTREVISION= 7 +DISTVERSION= 0.16.0 CATEGORIES= audio -MASTER_SITES= SF/mad/${PORTNAME}/${PORTVERSION} + +PATCH_SITES= https://github.com/tenacityteam/libmad/commit/ +PATCHFILES= c2eb5e1a728c973ea3f957d4cb6e04d77f745568.patch:-p1 \ + a8ca654e3666f442805d93722290bb218b633428.patch:-p1 MAINTAINER= sunpoet@FreeBSD.org COMMENT= Libmad library (part of MAD project) LICENSE= GPLv2 -USES= cpe libtool - -CONFIGURE_ARGS= --disable-debugging --enable-sso -GNU_CONFIGURE= yes -INSTALL_TARGET= install-strip -USE_LDCONFIG= yes - -SUB_LIST= VERSION=${PORTVERSION} -SUB_FILES= mad.pc - +USES= cmake cpe pathfix CPE_VENDOR= underbit -OPTIONS_DEFINE= SPEED -SPEED_DESC= Optimize for speed over accuracy - -SPEED_CONFIGURE_ON= --enable-speed -SPEED_CONFIGURE_OFF= --enable-accuracy +USE_GITHUB= yes +GH_ACCOUNT= tenacityteam +GH_TAGNAME= 15d1ef05 -post-install: - ${INSTALL_DATA} ${WRKDIR}/mad.pc ${STAGEDIR}${PREFIX}/libdata/pkgconfig/ +USE_LDCONFIG= yes .include diff --git a/audio/libmad/distinfo b/audio/libmad/distinfo index 45ba3689d2e1..72b5f612ddcc 100644 --- a/audio/libmad/distinfo +++ b/audio/libmad/distinfo @@ -1,2 +1,7 @@ -SHA256 (libmad-0.15.1b.tar.gz) = bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690 -SIZE (libmad-0.15.1b.tar.gz) = 502379 +TIMESTAMP = 1648676242 +SHA256 (tenacityteam-libmad-0.16.0-15d1ef05_GH0.tar.gz) = e380ee75784732cbf619c44df10418d652a30134f24e40b41d44b59b0a9f5579 +SIZE (tenacityteam-libmad-0.16.0-15d1ef05_GH0.tar.gz) = 213534 +SHA256 (c2eb5e1a728c973ea3f957d4cb6e04d77f745568.patch) = 6bc3b4656686801cbc526554226594361ddf97a6334eaadcb4765efd1c0ed916 +SIZE (c2eb5e1a728c973ea3f957d4cb6e04d77f745568.patch) = 972 +SHA256 (a8ca654e3666f442805d93722290bb218b633428.patch) = c15bf57d20090bd13a1749454ca987f47262136c4ae4781914062247b376a7df +SIZE (a8ca654e3666f442805d93722290bb218b633428.patch) = 814 diff --git a/audio/libmad/files/mad.pc.in b/audio/libmad/files/mad.pc.in deleted file mode 100644 index a7689a62deec..000000000000 --- a/audio/libmad/files/mad.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=%%PREFIX%% -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: mad -Description: MPEG Audio Decoder -Requires: -Version: %%VERSION%% -Libs: -L${libdir} -lmad -lm -Cflags: -I${includedir} diff --git a/audio/libmad/files/patch-configure b/audio/libmad/files/patch-configure deleted file mode 100644 index 5d5c3f1563f6..000000000000 --- a/audio/libmad/files/patch-configure +++ /dev/null @@ -1,40 +0,0 @@ ---- configure.orig 2004-02-05 09:34:07 UTC -+++ configure -@@ -19096,24 +19096,30 @@ then - esac - fi - -+ if $CC -v 2>&1 | grep clang > /dev/null; then -+ CLANG=yes -+ else -+ CLANG=no -+ fi -+ - case "$optimize" in - -O|"-O "*) - optimize="-O" -- optimize="$optimize -fforce-mem" -- optimize="$optimize -fforce-addr" -+ optimize="$optimize" -+ test $CLANG = no && optimize="$optimize -fforce-addr" - : #x optimize="$optimize -finline-functions" - : #- optimize="$optimize -fstrength-reduce" -- optimize="$optimize -fthread-jumps" -- optimize="$optimize -fcse-follow-jumps" -- optimize="$optimize -fcse-skip-blocks" -+ test $CLANG = no && optimize="$optimize -fthread-jumps" -+ test $CLANG = no && optimize="$optimize -fcse-follow-jumps" -+ test $CLANG = no && optimize="$optimize -fcse-skip-blocks" - : #x optimize="$optimize -frerun-cse-after-loop" - : #x optimize="$optimize -frerun-loop-opt" - : #x optimize="$optimize -fgcse" - optimize="$optimize -fexpensive-optimizations" -- optimize="$optimize -fregmove" -+ test $CLANG = no && optimize="$optimize -fregmove" - : #* optimize="$optimize -fdelayed-branch" - : #x optimize="$optimize -fschedule-insns" -- optimize="$optimize -fschedule-insns2" -+ test $CLANG = no && optimize="$optimize -fschedule-insns2" - : #? optimize="$optimize -ffunction-sections" - : #? optimize="$optimize -fcaller-saves" - : #> optimize="$optimize -funroll-loops" diff --git a/audio/libmad/files/patch-layer12.c b/audio/libmad/files/patch-layer12.c deleted file mode 100644 index 27e572259ff9..000000000000 --- a/audio/libmad/files/patch-layer12.c +++ /dev/null @@ -1,175 +0,0 @@ -Obtained from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508133#15 - ---- layer12.c.orig 2004-02-05 09:02:39 UTC -+++ layer12.c -@@ -134,6 +134,12 @@ int mad_layer_I(struct mad_stream *strea - for (sb = 0; sb < bound; ++sb) { - for (ch = 0; ch < nch; ++ch) { - nb = mad_bit_read(&stream->ptr, 4); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - if (nb == 15) { - stream->error = MAD_ERROR_BADBITALLOC; -@@ -146,6 +152,12 @@ int mad_layer_I(struct mad_stream *strea - - for (sb = bound; sb < 32; ++sb) { - nb = mad_bit_read(&stream->ptr, 4); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - if (nb == 15) { - stream->error = MAD_ERROR_BADBITALLOC; -@@ -162,6 +174,12 @@ int mad_layer_I(struct mad_stream *strea - for (ch = 0; ch < nch; ++ch) { - if (allocation[ch][sb]) { - scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - # if defined(OPT_STRICT) - /* -@@ -187,6 +205,12 @@ int mad_layer_I(struct mad_stream *strea - frame->sbsample[ch][s][sb] = nb ? - mad_f_mul(I_sample(&stream->ptr, nb), - sf_table[scalefactor[ch][sb]]) : 0; -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - } - } - -@@ -195,6 +219,12 @@ int mad_layer_I(struct mad_stream *strea - mad_fixed_t sample; - - sample = I_sample(&stream->ptr, nb); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - for (ch = 0; ch < nch; ++ch) { - frame->sbsample[ch][s][sb] = -@@ -403,7 +433,15 @@ int mad_layer_II(struct mad_stream *stre - nbal = bitalloc_table[offsets[sb]].nbal; - - for (ch = 0; ch < nch; ++ch) -+ { - allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } -+ } - } - - for (sb = bound; sb < sblimit; ++sb) { -@@ -411,6 +449,13 @@ int mad_layer_II(struct mad_stream *stre - - allocation[0][sb] = - allocation[1][sb] = mad_bit_read(&stream->ptr, nbal); -+ -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - } - - /* decode scalefactor selection info */ -@@ -419,6 +464,12 @@ int mad_layer_II(struct mad_stream *stre - for (ch = 0; ch < nch; ++ch) { - if (allocation[ch][sb]) - scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - } - } - -@@ -442,6 +493,12 @@ int mad_layer_II(struct mad_stream *stre - for (ch = 0; ch < nch; ++ch) { - if (allocation[ch][sb]) { - scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - switch (scfsi[ch][sb]) { - case 2: -@@ -452,11 +509,23 @@ int mad_layer_II(struct mad_stream *stre - - case 0: - scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - /* fall through */ - - case 1: - case 3: - scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - } - - if (scfsi[ch][sb] & 1) -@@ -488,6 +557,12 @@ int mad_layer_II(struct mad_stream *stre - index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; - - II_samples(&stream->ptr, &qc_table[index], samples); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - for (s = 0; s < 3; ++s) { - frame->sbsample[ch][3 * gr + s][sb] = -@@ -506,6 +581,12 @@ int mad_layer_II(struct mad_stream *stre - index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1]; - - II_samples(&stream->ptr, &qc_table[index], samples); -+ if (mad_bit_nextbyte(&stream->ptr) > stream->next_frame) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - for (ch = 0; ch < nch; ++ch) { - for (s = 0; s < 3; ++s) { diff --git a/audio/libmad/files/patch-layer3.c b/audio/libmad/files/patch-layer3.c deleted file mode 100644 index 5f7455f5382b..000000000000 --- a/audio/libmad/files/patch-layer3.c +++ /dev/null @@ -1,17 +0,0 @@ -Obtained from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508133#15 - ---- layer3.c.orig 2004-01-23 09:41:32 UTC -+++ layer3.c -@@ -2608,6 +2608,12 @@ int mad_layer_III(struct mad_stream *str - next_md_begin = 0; - - md_len = si.main_data_begin + frame_space - next_md_begin; -+ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) -+ { -+ stream->error = MAD_ERROR_LOSTSYNC; -+ stream->sync = 0; -+ return -1; -+ } - - frame_used = 0; - diff --git a/audio/libmad/pkg-plist b/audio/libmad/pkg-plist index 5df894177e6c..bd16846cadd9 100644 --- a/audio/libmad/pkg-plist +++ b/audio/libmad/pkg-plist @@ -1,6 +1,8 @@ include/mad.h -lib/libmad.a +lib/cmake/mad/madConfig.cmake +lib/cmake/mad/madConfigVersion.cmake +lib/cmake/mad/madTargets-%%CMAKE_BUILD_TYPE%%.cmake +lib/cmake/mad/madTargets.cmake lib/libmad.so -lib/libmad.so.0 -lib/libmad.so.0.2.1 -libdata/pkgconfig/mad.pc +lib/libmad.so.0.16.0 +libdata/pkgconfig/libmad.pc -- cgit v1.2.3