git: d78f92cabfc6 - main - multimedia/{mplayer|mencoder}: Fix WITH_DEBUG build

From: Thomas Zander <riggs_at_FreeBSD.org>
Date: Sat, 19 Oct 2024 15:40:55 UTC
The branch main has been updated by riggs:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d78f92cabfc61e61fa5f13705134f6b0e0e2f599

commit d78f92cabfc61e61fa5f13705134f6b0e0e2f599
Author:     Thomas Zander <riggs@FreeBSD.org>
AuthorDate: 2024-10-19 15:32:01 +0000
Commit:     Thomas Zander <riggs@FreeBSD.org>
CommitDate: 2024-10-19 15:40:53 +0000

    multimedia/{mplayer|mencoder}: Fix WITH_DEBUG build
    
    Newer clang versions are not happy when passing -mcpu=<something> on
    i386 and amd64. This fixes the construction of CFLAGS during configure
    in the WITH_DEBUG case.
    Also, as it turns out, there was a const ptr issue in
    libmpcodecs/ad_spdif.c whith also needed to be fixed.
    
    PR:             280818
    Reported by:    cryptogranny@gmail.com
---
 multimedia/mencoder/Makefile                       |  1 +
 multimedia/mplayer/Makefile                        |  1 +
 multimedia/mplayer/files/patch-configure           | 39 ++++++++++++++--------
 .../mplayer/files/patch-libmpcodecs_ad__spdif.c    | 11 ++++++
 4 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/multimedia/mencoder/Makefile b/multimedia/mencoder/Makefile
index 181fa7f55f9b..76a31e365c92 100644
--- a/multimedia/mencoder/Makefile
+++ b/multimedia/mencoder/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	mencoder
 PORTVERSION=	${MPLAYER_PORT_VERSION}.${MPLAYER_SNAPSHOT_DATE:S/-//g}
+PORTREVISION=	1
 CATEGORIES=	multimedia audio
 
 MAINTAINER=	riggs@FreeBSD.org
diff --git a/multimedia/mplayer/Makefile b/multimedia/mplayer/Makefile
index 737ad94c1077..40a1dc0f450b 100644
--- a/multimedia/mplayer/Makefile
+++ b/multimedia/mplayer/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	mplayer
 PORTVERSION=	${MPLAYER_PORT_VERSION}.${MPLAYER_SNAPSHOT_DATE:S/-//g}
+PORTREVISION=	1
 CATEGORIES=	multimedia audio
 
 MAINTAINER=	riggs@FreeBSD.org
diff --git a/multimedia/mplayer/files/patch-configure b/multimedia/mplayer/files/patch-configure
index 7dd394ab72c7..a079eeeccd3e 100644
--- a/multimedia/mplayer/files/patch-configure
+++ b/multimedia/mplayer/files/patch-configure
@@ -89,7 +89,20 @@
  
  if test -z "$_target" ; then
    cat > $TMPC << EOF
-@@ -3104,7 +3073,7 @@ if x86_32 ; then
+@@ -2975,7 +2944,11 @@ if test -z "$CFLAGS" || test "$_profile" != "" || test
+   fi
+ 
+   if test "$_profile" != "" || test "$_debug" != ""; then
+-    CFLAGS="-O2 $_march $_mcpu $_pipe $_debug $_profile"
++    if test "$cc_vendor" = "gnu"; then
++      CFLAGS="-O2 $_march $_mcpu $_pipe $_debug $_profile"
++    else
++      CFLAGS="-O2 $_march $_pipe $_debug $_profile"
++    fi
+     WARNFLAGS="-W -Wall $WARNFLAGS"
+     _install_strip=
+   fi
+@@ -3104,7 +3077,7 @@ if x86_32 ; then
      _pref_as_version='2.16.92'
      echo 'pabsd %xmm0, %xmm1' >> $TMPS
    fi
@@ -98,7 +111,7 @@
  
    if test "$as_verc_fail" != yes ; then
      echores "ok"
-@@ -3264,8 +3233,8 @@ if ppc && ( test "$_altivec" = yes || test "$_runtime_
+@@ -3264,8 +3237,8 @@ if ppc && ( test "$_altivec" = yes || test "$_runtime_
  
      # check if AltiVec is supported by the compiler, and how to enable it
      echocheck "GCC AltiVec flags"
@@ -109,7 +122,7 @@
      # check if <altivec.h> should be included
          if $(header_check altivec.h $_altivec_gcc_flags) ; then
              def_altivec_h='#define HAVE_ALTIVEC_H 1'
-@@ -3371,6 +3340,13 @@ if arm ; then
+@@ -3371,6 +3344,13 @@ if arm ; then
    fi
    echores "$setend"
  
@@ -123,7 +136,7 @@
    echocheck "softfloat ABI"
    softfloat=yes
    cpp_condition_check '' 'defined(__ARM_PCS_VFP) || (!defined(__ARM_PCS) && !defined(__SOFTFP__))' && softfloat=no
-@@ -4281,7 +4257,7 @@ elif freebsd || netbsd || openbsd || bsdos ; then
+@@ -4281,7 +4261,7 @@ elif freebsd || netbsd || openbsd || bsdos ; then
  if linux ; then
    THREAD_CFLAGS=-D_REENTRANT
  elif freebsd || netbsd || openbsd || bsdos ; then
@@ -132,7 +145,7 @@
  fi
  if test "$_pthreads" = auto ; then
  cat > $TMPC << EOF
-@@ -4291,7 +4267,7 @@ if ! hpux ; then
+@@ -4291,7 +4271,7 @@ if ! hpux ; then
  EOF
  _pthreads=no
  if ! hpux ; then
@@ -141,7 +154,7 @@
      # for crosscompilation, we cannot execute the program, be happy if we can link statically
      cc_check $THREAD_CFLAGS $ld_tmp && (tmp_run || test "$ld_static") && ld_pthread="$ld_tmp" && _pthreads=yes && break
    done
-@@ -4434,7 +4410,7 @@ EOF
+@@ -4434,7 +4414,7 @@ EOF
  }
  EOF
    _iconv=no
@@ -150,7 +163,7 @@
      cc_check $ld_tmp && extra_ldflags="$extra_ldflags $ld_tmp" &&
        ld_iconv="$ld_tmp" && _iconv=yes && break
    done
-@@ -5848,15 +5824,6 @@ EOF
+@@ -5848,15 +5828,6 @@ EOF
        break
      fi
    done
@@ -166,7 +179,7 @@
    if win32 && cc_check -DGL_WIN32 -lopengl32 ; then
      _gl=yes
      _gl_win32=yes
-@@ -6391,7 +6358,7 @@ elif freebsd ; then
+@@ -6391,7 +6362,7 @@ elif freebsd ; then
  elif dragonfly ; then
    default_cdrom_device="/dev/cd0"
  elif freebsd ; then
@@ -175,7 +188,7 @@
  elif openbsd ; then
    default_cdrom_device="/dev/rcd0c"
  elif sunos ; then
-@@ -6404,7 +6371,7 @@ fi
+@@ -6404,7 +6375,7 @@ fi
    default_cdrom_device="/dev/cdrom"
  fi
  
@@ -184,7 +197,7 @@
    default_dvd_device=$default_cdrom_device
  elif darwin ; then
    default_dvd_device="/dev/rdiskN"
-@@ -6931,7 +6898,7 @@ if test "$_libgsm" = auto ; then
+@@ -6931,7 +6902,7 @@ if test "$_libgsm" = auto ; then
  echocheck "libgsm"
  if test "$_libgsm" = auto ; then
    _libgsm=no
@@ -193,7 +206,7 @@
  fi
  if test "$_libgsm" = yes ; then
    def_libgsm='#define CONFIG_LIBGSM 1'
-@@ -7363,6 +7330,16 @@ if test "$_librtmp" = yes && test "$networking" = yes;
+@@ -7363,6 +7334,16 @@ if test "$_librtmp" = yes && test "$networking" = yes;
    nolibrtmp=no
    def_librtmp='#define CONFIG_LIBRTMP 1'
    inputmodules="librtmp $inputmodules"
@@ -210,7 +223,7 @@
  else
    nolibrtmp=yes
    _librtmp=no
-@@ -7780,7 +7757,7 @@ if test "$_mencoder" = no ; then
+@@ -7780,7 +7761,7 @@ if test "$_mencoder" = no ; then
  echocheck "mencoder"
  if test "$_mencoder" = no ; then
    # mpeg1video for vf_lavc, snow for vf_uspp / vf_mcdeint,
@@ -219,7 +232,7 @@
  fi
  echores "$_mencoder"
  
-@@ -8384,7 +8361,7 @@ libs_mplayer=$ld_tmp
+@@ -8384,7 +8365,7 @@ libs_mplayer=$ld_tmp
  
  #############################################################################
  
diff --git a/multimedia/mplayer/files/patch-libmpcodecs_ad__spdif.c b/multimedia/mplayer/files/patch-libmpcodecs_ad__spdif.c
new file mode 100644
index 000000000000..dbd61b231791
--- /dev/null
+++ b/multimedia/mplayer/files/patch-libmpcodecs_ad__spdif.c
@@ -0,0 +1,11 @@
+--- libmpcodecs/ad_spdif.c.orig	2024-09-21 09:30:04 UTC
++++ libmpcodecs/ad_spdif.c
+@@ -54,7 +54,7 @@ static int read_packet(void *p, uint8_t *buf, int buf_
+     return 0;
+ }
+ 
+-static int write_packet(void *p, const uint8_t *buf, int buf_size)
++static int write_packet(void *p, uint8_t *buf, int buf_size)
+ {
+     int len;
+     struct spdifContext *ctx = p;