git: 075897a01745 - main - audio/icecast: Use pkg-config to check libxml2 and libxslt

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Fri, 25 Mar 2022 13:49:28 UTC
The branch main has been updated by sunpoet:

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

commit 075897a017453e1bb046c4ccd106003873b73af2
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-03-25 13:12:29 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-03-25 13:38:02 +0000

    audio/icecast: Use pkg-config to check libxml2 and libxslt
    
    - Add libxml2 check
    - Use pkg-config instead of xslt-config
    
    PR:             262408
    Reported by:    Daniel Engberg <diizzy@FreeBSD.org>
---
 audio/icecast/Makefile              |   2 +-
 audio/icecast/files/patch-configure | 410 ++++++++++++++++++++++++++++++++++++
 2 files changed, 411 insertions(+), 1 deletion(-)

diff --git a/audio/icecast/Makefile b/audio/icecast/Makefile
index 9cb6f3d6e60f..e21043e400db 100644
--- a/audio/icecast/Makefile
+++ b/audio/icecast/Makefile
@@ -25,7 +25,7 @@ LIB_DEPENDS=	libcurl.so:ftp/curl \
 		libtheora.so:multimedia/libtheora \
 		libvorbis.so:audio/libvorbis
 
-USES=		cpe gmake gnome localbase ssl
+USES=		cpe gmake gnome localbase pkgconfig ssl
 USE_GNOME=	libxml2 libxslt
 
 GNU_CONFIGURE=	yes
diff --git a/audio/icecast/files/patch-configure b/audio/icecast/files/patch-configure
new file mode 100644
index 000000000000..9427d3671c39
--- /dev/null
+++ b/audio/icecast/files/patch-configure
@@ -0,0 +1,410 @@
+--- configure.orig	2018-10-31 18:26:07 UTC
++++ configure
+@@ -673,7 +673,13 @@ OGG_LDFLAGS
+ OGG_CFLAGS
+ OGG_LIBS
+ OGG_PREFIX
+-XSLTCONFIG
++LIBXML2_LIBS
++LIBXML2_CFLAGS
++LIBXSLT_LIBS
++LIBXSLT_CFLAGS
++PKG_CONFIG_LIBDIR
++PKG_CONFIG_PATH
++PKG_CONFIG
+ CPP
+ LT_SYS_LIBRARY_PATH
+ OTOOL64
+@@ -806,7 +812,6 @@ with_gnu_ld
+ with_sysroot
+ enable_libtool_lock
+ enable_largefile
+-with_xslt_config
+ with_ogg
+ with_vorbis
+ with_theora
+@@ -826,7 +831,13 @@ LIBS
+ CPPFLAGS
+ LT_SYS_LIBRARY_PATH
+ CPP
+-XSLTCONFIG
++PKG_CONFIG
++PKG_CONFIG_PATH
++PKG_CONFIG_LIBDIR
++LIBXSLT_CFLAGS
++LIBXSLT_LIBS
++LIBXML2_CFLAGS
++LIBXML2_LIBS
+ OGG_PREFIX
+ VORBIS_PREFIX
+ THEORA
+@@ -1488,7 +1499,6 @@ Optional Packages:
+   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+   --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
+                           compiler's sysroot if not specified).
+-  --with-xslt-config=PATH use xslt-config in PATH to find libxslt
+   --with-ogg=PREFIX       Prefix where libogg is installed (optional)
+   --with-vorbis=PREFIX    Prefix where libvorbis is installed (optional)
+   --with-theora=PREFIX    Prefix where libtheora is installed (optional)
+@@ -1509,7 +1519,19 @@ Some influential environment variables:
+   LT_SYS_LIBRARY_PATH
+               User-defined run-time library search path.
+   CPP         C preprocessor
+-  XSLTCONFIG  XSLT configuration program
++  PKG_CONFIG  path to pkg-config utility
++  PKG_CONFIG_PATH
++              directories to add to pkg-config's search path
++  PKG_CONFIG_LIBDIR
++              path overriding pkg-config's built-in search path
++  LIBXSLT_CFLAGS
++              C compiler flags for LIBXSLT, overriding pkg-config
++  LIBXSLT_LIBS
++              linker flags for LIBXSLT, overriding pkg-config
++  LIBXML2_CFLAGS
++              C compiler flags for LIBXML2, overriding pkg-config
++  LIBXML2_LIBS
++              linker flags for LIBXML2, overriding pkg-config
+   OGG_PREFIX  path to ogg installation
+   VORBIS_PREFIX
+               path to vorbis installation
+@@ -13031,22 +13053,66 @@ fi
+ 
+ 
+ 
+-# Check whether --with-xslt-config was given.
+-if test "${with_xslt_config+set}" = set; then :
+-  withval=$with_xslt_config; XSLTCONFIG="$withval"
++
++
++
++
++
++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
++	if test -n "$ac_tool_prefix"; then
++  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
++$as_echo_n "checking for $ac_word... " >&6; }
++if ${ac_cv_path_PKG_CONFIG+:} false; then :
++  $as_echo_n "(cached) " >&6
+ else
+-  for ac_prog in xslt-config
++  case $PKG_CONFIG in
++  [\\/]* | ?:[\\/]*)
++  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
++  ;;
++  *)
++  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
++for as_dir in $PATH
+ do
+-  # Extract the first word of "$ac_prog", so it can be a program name with args.
+-set dummy $ac_prog; ac_word=$2
++  IFS=$as_save_IFS
++  test -z "$as_dir" && as_dir=.
++    for ac_exec_ext in '' $ac_executable_extensions; do
++  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
++    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
++    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
++    break 2
++  fi
++done
++  done
++IFS=$as_save_IFS
++
++  ;;
++esac
++fi
++PKG_CONFIG=$ac_cv_path_PKG_CONFIG
++if test -n "$PKG_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
++$as_echo "$PKG_CONFIG" >&6; }
++else
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++fi
++
++
++fi
++if test -z "$ac_cv_path_PKG_CONFIG"; then
++  ac_pt_PKG_CONFIG=$PKG_CONFIG
++  # Extract the first word of "pkg-config", so it can be a program name with args.
++set dummy pkg-config; ac_word=$2
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+ $as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_path_XSLTCONFIG+:} false; then :
++if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+-  case $XSLTCONFIG in
++  case $ac_pt_PKG_CONFIG in
+   [\\/]* | ?:[\\/]*)
+-  ac_cv_path_XSLTCONFIG="$XSLTCONFIG" # Let the user override the test with a path.
++  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+   ;;
+   *)
+   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+@@ -13056,7 +13122,7 @@ do
+   test -z "$as_dir" && as_dir=.
+     for ac_exec_ext in '' $ac_executable_extensions; do
+   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+-    ac_cv_path_XSLTCONFIG="$as_dir/$ac_word$ac_exec_ext"
++    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+     break 2
+   fi
+@@ -13067,35 +13133,198 @@ IFS=$as_save_IFS
+   ;;
+ esac
+ fi
+-XSLTCONFIG=$ac_cv_path_XSLTCONFIG
+-if test -n "$XSLTCONFIG"; then
+-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTCONFIG" >&5
+-$as_echo "$XSLTCONFIG" >&6; }
++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
++if test -n "$ac_pt_PKG_CONFIG"; then
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
++$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+ else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ $as_echo "no" >&6; }
+ fi
+ 
++  if test "x$ac_pt_PKG_CONFIG" = x; then
++    PKG_CONFIG=""
++  else
++    case $cross_compiling:$ac_tool_warned in
++yes:)
++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
++ac_tool_warned=yes ;;
++esac
++    PKG_CONFIG=$ac_pt_PKG_CONFIG
++  fi
++else
++  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
++fi
+ 
+-  test -n "$XSLTCONFIG" && break
+-done
+-test -n "$XSLTCONFIG" || XSLTCONFIG=""""
++fi
++if test -n "$PKG_CONFIG"; then
++	_pkg_min_version=0.9.0
++	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
++	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
++		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++	else
++		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++		PKG_CONFIG=""
++	fi
++fi
+ 
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBXSLT" >&5
++$as_echo_n "checking for LIBXSLT... " >&6; }
+ 
++if test -n "$LIBXSLT_CFLAGS"; then
++    pkg_cv_LIBXSLT_CFLAGS="$LIBXSLT_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxslt\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libxslt") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBXSLT_CFLAGS=`$PKG_CONFIG --cflags "libxslt" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
+ fi
++ else
++    pkg_failed=untried
++fi
++if test -n "$LIBXSLT_LIBS"; then
++    pkg_cv_LIBXSLT_LIBS="$LIBXSLT_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxslt\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libxslt") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBXSLT_LIBS=`$PKG_CONFIG --libs "libxslt" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
+ 
+-if test "x$XSLTCONFIG" = "x"; then
+-    as_fn_error $? "XSLT configuration could not be found" "$LINENO" 5
++
++
++if test $pkg_failed = yes; then
++   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++        _pkg_short_errors_supported=yes
++else
++        _pkg_short_errors_supported=no
+ fi
+-if ! test -x "$XSLTCONFIG"; then
+-    as_fn_error $? "$XSLTCONFIG cannot be executed" "$LINENO" 5
++        if test $_pkg_short_errors_supported = yes; then
++	        LIBXSLT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxslt" 2>&1`
++        else
++	        LIBXSLT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxslt" 2>&1`
++        fi
++	# Put the nasty error message in config.log where it belongs
++	echo "$LIBXSLT_PKG_ERRORS" >&5
++
++
++  as_fn_error $? "${LIBXSLT_PKG_ERRORS}. libxslt is required." "$LINENO" 5
++
++elif test $pkg_failed = untried; then
++     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++  as_fn_error $? "${LIBXSLT_PKG_ERRORS}. libxslt is required." "$LINENO" 5
++
++else
++	LIBXSLT_CFLAGS=$pkg_cv_LIBXSLT_CFLAGS
++	LIBXSLT_LIBS=$pkg_cv_LIBXSLT_LIBS
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
+ fi
+-XSLT_LIBS="$($XSLTCONFIG --libs)"
+-XSLT_CFLAGS="$($XSLTCONFIG --cflags)"
+-ac_xslt_save_LIBS="$LIBS"
+-ac_xslt_save_CFLAGS="$CFLAGS"
+-LIBS="$XSLT_LIBS $LIBS"
+-CFLAGS="$CFLAGS $XSLT_CFLAGS"
++
++CFLAGS="${CFLAGS} ${LIBXSLT_CFLAGS}"
++LIBS="${LIBS} ${LIBXSLT_LIBS}"
++
++
++pkg_failed=no
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBXML2" >&5
++$as_echo_n "checking for LIBXML2... " >&6; }
++
++if test -n "$LIBXML2_CFLAGS"; then
++    pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++if test -n "$LIBXML2_LIBS"; then
++    pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS"
++ elif test -n "$PKG_CONFIG"; then
++    if test -n "$PKG_CONFIG" && \
++    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5
++  ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5
++  ac_status=$?
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
++  pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0" 2>/dev/null`
++		      test "x$?" != "x0" && pkg_failed=yes
++else
++  pkg_failed=yes
++fi
++ else
++    pkg_failed=untried
++fi
++
++
++
++if test $pkg_failed = yes; then
++   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
++        _pkg_short_errors_supported=yes
++else
++        _pkg_short_errors_supported=no
++fi
++        if test $_pkg_short_errors_supported = yes; then
++	        LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1`
++        else
++	        LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1`
++        fi
++	# Put the nasty error message in config.log where it belongs
++	echo "$LIBXML2_PKG_ERRORS" >&5
++
++
++  as_fn_error $? "${LIBXML2_PKG_ERRORS}. libxml2 is required." "$LINENO" 5
++
++elif test $pkg_failed = untried; then
++     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
++
++  as_fn_error $? "${LIBXML2_PKG_ERRORS}. libxml2 is required." "$LINENO" 5
++
++else
++	LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS
++	LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS
++        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
++$as_echo "yes" >&6; }
++
++fi
+ for ac_func in xsltSaveResultToString
+ do :
+   ac_fn_c_check_func "$LINENO" "xsltSaveResultToString" "ac_cv_func_xsltSaveResultToString"
+@@ -13107,37 +13336,9 @@ _ACEOF
+ fi
+ done
+ 
+-CFLAGS="$ac_xslt_save_CFLAGS"
+-LIBS="$ac_xslt_save_LIBS"
+ 
+-
+-for arg in $XSLT_CFLAGS
+-do
+-  if { cat <<EOF
+- $XIPH_CPPFLAGS x
+-EOF
+-} | $FGREP -v -e " $arg " > /dev/null
+-  then
+-    XIPH_CPPFLAGS="$XIPH_CPPFLAGS $arg"
+-  fi
+-done
+-
+-
+-xt_compare="$XIPH_LIBS"
+-xt_filtered=""
+-for arg in $XSLT_LIBS
+-do
+-  if { cat <<EOF
+- $xt_compare x
+-EOF
+-} | $FGREP -v -e " $arg " > /dev/null
+-  then
+-    xt_compare="$arg $xt_compare"
+-    xt_filtered="$xt_filtered $arg"
+-  fi
+-done
+-XIPH_LIBS="$xt_filtered $XIPH_LIBS"
+-
++CFLAGS="${CFLAGS} ${LIBXML2_CFLAGS}"
++LIBS="${LIBS} ${LIBXML2_LIBS}"
+ 
+ 
+