From 835d418436f63cabd85c4509785d255f9ea64ddd Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 28 Sep 2023 05:55:40 +0300
Subject: [PATCH] mpg123-1.32.2
---
NEWS | 13 ++++++
configure | 24 +++++-----
configure.ac | 4 +-
mpg123.spec | 2 +-
ports/README | 24 +++-------
ports/cmake/CMakeLists.txt | 1 +
ports/cmake/src/CMakeLists.txt | 2 +-
ports/cmake/src/compat/CMakeLists.txt | 2 +-
ports/cmake/src/config.cmake.h.in | 3 --
ports/cmake/src/libmpg123/CMakeLists.txt | 8 +++-
src/config.h.in | 6 +--
src/libmpg123/lfs_wrap.c | 59 ++++++++++++++++--------
src/version.h | 2 +-
13 files changed, 87 insertions(+), 63 deletions(-)
diff --git a/NEWS b/NEWS
index 554ee41..4cde934 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,16 @@
+1.32.2
+------
+
+- libmpg123: Re-introduce _64 symbols on native 64 bit offset platforms. This
+ was a regression since 1.31 series. Sorry, too much cleanup, not enough
+ testing.
+- build:
+-- Better O_LARGEFILE logic, avoiding redefintion.
+- ports/cmake:
+-- Require C99 (bug 360, among other points, thanks to Ozkan Sezer).
+-- Fix broken O_LARGEFILE logic (bug 360).
+-- Typo fix and cleanup, also manual SSE switch for Android on old x86 (bug 359).
+
1.32.1
------
- Include man pages again in tarball and install. We cannot avoid the empty
diff --git a/configure b/configure
index f28539f..15e6f7e 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for mpg123 1.32.1.
+# Generated by GNU Autoconf 2.71 for mpg123 1.32.2.
#
# Report bugs to <maintainer@mpg123.org>.
#
@@ -621,8 +621,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='mpg123'
PACKAGE_TARNAME='mpg123'
-PACKAGE_VERSION='1.32.1'
-PACKAGE_STRING='mpg123 1.32.1'
+PACKAGE_VERSION='1.32.2'
+PACKAGE_STRING='mpg123 1.32.2'
PACKAGE_BUGREPORT='maintainer@mpg123.org'
PACKAGE_URL=''
@@ -1726,7 +1726,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures mpg123 1.32.1 to adapt to many kinds of systems.
+\`configure' configures mpg123 1.32.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1797,7 +1797,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mpg123 1.32.1:";;
+ short | recursive ) echo "Configuration of mpg123 1.32.2:";;
esac
cat <<\_ACEOF
@@ -2074,7 +2074,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-mpg123 configure 1.32.1
+mpg123 configure 1.32.2
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2619,7 +2619,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by mpg123 $as_me 1.32.1, which was
+It was created by mpg123 $as_me 1.32.2, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3989,7 +3989,7 @@ fi
# Define the identity of the package.
PACKAGE='mpg123'
- VERSION='1.32.1'
+ VERSION='1.32.2'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -17616,9 +17616,9 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_o_largefile" >&5
printf "%s\n" "$have_o_largefile" >&6; }
- if test x"$have_o_largefile" = xno; then
+ if test x"$have_o_largefile" = xyes; then
-printf "%s\n" "#define O_LARGEFILE 0" >>confdefs.h
+printf "%s\n" "#define HAVE_O_LARGEFILE 1" >>confdefs.h
fi
else
@@ -22648,7 +22648,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by mpg123 $as_me 1.32.1, which was
+This file was extended by mpg123 $as_me 1.32.2, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -22716,7 +22716,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-mpg123 config.status 1.32.1
+mpg123 config.status 1.32.2
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 64c76df..08ba614 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1311,8 +1311,8 @@ if test "x$have_off64_t" = xyes && test "x$ac_cv_func_lseek64" = xyes; then
}
])],[have_o_largefile=yes],[have_o_largefile=no])
AC_MSG_RESULT([$have_o_largefile])
- if test x"$have_o_largefile" = xno; then
- AC_DEFINE(O_LARGEFILE, 0, [ Define to 0 if system does not have/need it. ])
+ if test x"$have_o_largefile" = xyes; then
+ AC_DEFINE(HAVE_O_LARGEFILE, 1, [ Define if O_LARGEFILE flag for open(2) exists. ])
fi
else
use_largefile=no
diff --git a/mpg123.spec b/mpg123.spec
index 25698d4..ea24a01 100644
--- a/mpg123.spec
+++ b/mpg123.spec
@@ -3,7 +3,7 @@
# - devel packages for alsa, sdl, etc... to build the respective output modules.
Summary: The fast console mpeg audio decoder/player.
Name: mpg123
-Version: 1.32.1
+Version: 1.32.2
Release: 1
URL: http://www.mpg123.org/
License: GPL
diff --git a/ports/README b/ports/README
index 94e7b15..4d38741 100644
--- a/ports/README
+++ b/ports/README
@@ -1,19 +1,7 @@
-DISCLAIMER: The contents of the ports directory are included for convenience,
-but they usually contain files contributed by various people, not the core
-mpg123 team. The stuff is not tested by us. In some cases, it's even
-impossible to tell what is really inside. Use at your own risk (well, like
-all Free Software, actually;-).
+This directory used to contain some (contributed) works covering usage and/or
+building of mpg123/libmpg123 from different programming environments. Since
+they became too outdated, all but the CMake port were removed.
-This directory contains some (contributed) works covering usage and/or building
-of mpg123/libmpg123 from different programming environments. Note that those
-may be a bit outdated (especially when a file is added/removed in libmpg123
-sources); as the team lacks resource to test everything. But in any case,
-the ports can provide a good starting point on the respective platform, to get
-it to work with minimal fuzz.
-
-- cmake: CMake build to get started on non-Unix-like platforms, especially
- for just libmpg123 on Windows
-
-There used to be other ports, last of those for the Sony PSP. There was not
-much porting involved on that one, though, just a custom Makefile for building
-a generic libmpg123.
+The CMake build is primarily intended for platforms not well-supported by the
+primary autotools-based build. It is tested occasionally, had some tuning
+over time, but may get out of sync regarding possible build configurations.
diff --git a/ports/cmake/CMakeLists.txt b/ports/cmake/CMakeLists.txt
index c9af553..5e400a0 100644
--- a/ports/cmake/CMakeLists.txt
+++ b/ports/cmake/CMakeLists.txt
@@ -4,6 +4,7 @@ include(cmake/read_api_version.cmake)
read_api_version(MPG123_VERSION)
project(mpg123 VERSION ${MPG123_VERSION} LANGUAGES C ASM)
+set(CMAKE_C_STANDARD 99)
option(BUILD_LIBOUT123 "build libout123 (prerequisite for included programs)" ON)
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
diff --git a/ports/cmake/src/CMakeLists.txt b/ports/cmake/src/CMakeLists.txt
index b300408..930fe07 100644
--- a/ports/cmake/src/CMakeLists.txt
+++ b/ports/cmake/src/CMakeLists.txt
@@ -84,7 +84,7 @@ check_c_source_compiles(
#include <unistd.h>
#include <fcntl.h>
- int fd = open(\"/foo\", O_RDONLY|O_LARGEFILE);
+ int main(){ return open(\"/foo\", O_RDONLY|O_LARGEFILE); }
" HAVE_O_LARGEFILE)
endif()
endif()
diff --git a/ports/cmake/src/compat/CMakeLists.txt b/ports/cmake/src/compat/CMakeLists.txt
index f887f43..a98eccc 100644
--- a/ports/cmake/src/compat/CMakeLists.txt
+++ b/ports/cmake/src/compat/CMakeLists.txt
@@ -10,4 +10,4 @@ set_target_properties(${TARGET}_dl PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_library(${TARGET}_str OBJECT
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/compat/compat_str.c")
-set_target_properties(${TARGET}_dl PROPERTIES POSITION_INDEPENDENT_CODE ON)
+set_target_properties(${TARGET}_str PROPERTIES POSITION_INDEPENDENT_CODE ON)
diff --git a/ports/cmake/src/config.cmake.h.in b/ports/cmake/src/config.cmake.h.in
index ba44421..7176ae4 100644
--- a/ports/cmake/src/config.cmake.h.in
+++ b/ports/cmake/src/config.cmake.h.in
@@ -181,6 +181,3 @@
#cmakedefine LFS_LARGEFILE_64 1
#cmakedefine LFS_SENSITIVE 1
#cmakedefine HAVE_O_LARGEFILE 1
-#ifndef HAVE_O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
diff --git a/ports/cmake/src/libmpg123/CMakeLists.txt b/ports/cmake/src/libmpg123/CMakeLists.txt
index e891f64..64b3754 100644
--- a/ports/cmake/src/libmpg123/CMakeLists.txt
+++ b/ports/cmake/src/libmpg123/CMakeLists.txt
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.12)
option(NO_FEATURE_REPORT "Disable feature report function" OFF)
+if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ option(WITH_SSE "x86: build with SSE support if detected. Turn OFF for older devices where autodetection is misleading." ON)
+endif()
include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/")
@@ -121,6 +124,9 @@ elseif(MACHINE STREQUAL "x86")
endif()
cmake_host_system_information(RESULT HAVE_SSE QUERY HAS_SSE)
+ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ set(HAVE_SSE ${WITH_SSE})
+ endif()
if(HAVE_SSE)
set(PLATFORM_DEFINITIONS OPT_SSE)
set(PLATFORM_SOURCES
@@ -140,8 +146,6 @@ elseif(MACHINE STREQUAL "x86")
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct64_sse.S"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/synth_sse.S")
endif()
- target_sources(${TARGET} PRIVATE
- "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libmpg123/dct64_i386.c")
endif()
elseif(MACHINE STREQUAL "arm64")
set(PLATFORM_DEFINITIONS OPT_MULTI OPT_GENERIC OPT_GENERIC_DITHER OPT_NEON64)
diff --git a/src/config.h.in b/src/config.h.in
index 711df05..0e95291 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -181,6 +181,9 @@
/* Define to 1 if you have the <os2.h> header file. */
#undef HAVE_OS2_H
+/* Define if O_LARGEFILE flag for open(2) exists. */
+#undef HAVE_O_LARGEFILE
+
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
@@ -425,9 +428,6 @@
/* Define to disable warning messages. */
#undef NO_WARNING
-/* Define to 0 if system does not have/need it. */
-#undef O_LARGEFILE
-
/* Name of package */
#undef PACKAGE
diff --git a/src/libmpg123/lfs_wrap.c b/src/libmpg123/lfs_wrap.c
index 3b9c6e1..1474de7 100644
--- a/src/libmpg123/lfs_wrap.c
+++ b/src/libmpg123/lfs_wrap.c
@@ -496,8 +496,16 @@ int attribute_align_arg mpg123_position_32( mpg123_handle *mh, off_t INT123_fram
#endif
-// _64 aliases if we got some off64_t to work with.
+// _64 aliases if we either got some off64_t to work with or
+// if there is no explicit 64 bit API but off_t is just always
+// 64 bits.
+#if defined(LFS_LARGEFILE_64) || (SIZEOF_OFF_T == 8)
+
#ifdef LFS_LARGEFILE_64
+#define OFF64 off64_t
+#else
+#define OFF64 off_t
+#endif
int attribute_align_arg mpg123_open_64(mpg123_handle *mh, const char *path)
{
@@ -520,89 +528,90 @@ int attribute_align_arg mpg123_open_handle_64(mpg123_handle *mh, void *iohandle)
return mpg123_open_handle(mh, iohandle);
}
-int attribute_align_arg mpg123_framebyframe_decode_64(mpg123_handle *mh, off64_t *num, unsigned char **audio, size_t *bytes)
+int attribute_align_arg mpg123_framebyframe_decode_64(mpg123_handle *mh, OFF64 *num, unsigned char **audio, size_t *bytes)
{
return mpg123_framebyframe_decode64(mh, (int64_t*)num, audio, bytes);
}
-int attribute_align_arg mpg123_decode_frame_64(mpg123_handle *mh, off64_t *num, unsigned char **audio, size_t *bytes)
+int attribute_align_arg mpg123_decode_frame_64(mpg123_handle *mh, OFF64 *num, unsigned char **audio, size_t *bytes)
{
return mpg123_decode_frame64(mh, (int64_t*)num, audio, bytes);
}
-off64_t attribute_align_arg mpg123_timeframe_64(mpg123_handle *mh, double seconds)
+OFF64 attribute_align_arg mpg123_timeframe_64(mpg123_handle *mh, double seconds)
{
return mpg123_timeframe64(mh, seconds);
}
-off64_t attribute_align_arg mpg123_tell_64(mpg123_handle *mh)
+OFF64 attribute_align_arg mpg123_tell_64(mpg123_handle *mh)
{
return mpg123_tell64(mh);
}
-off64_t attribute_align_arg mpg123_tellframe_64(mpg123_handle *mh)
+OFF64 attribute_align_arg mpg123_tellframe_64(mpg123_handle *mh)
{
return mpg123_tellframe64(mh);
}
-off64_t attribute_align_arg mpg123_tell_stream_64(mpg123_handle *mh)
+OFF64 attribute_align_arg mpg123_tell_stream_64(mpg123_handle *mh)
{
return mpg123_tell_stream64(mh);
}
-off64_t attribute_align_arg mpg123_seek_64(mpg123_handle *mh, off64_t sampleoff, int whence)
+OFF64 attribute_align_arg mpg123_seek_64(mpg123_handle *mh, OFF64 sampleoff, int whence)
{
return mpg123_seek64(mh, (int64_t)sampleoff, whence);
}
-off64_t attribute_align_arg mpg123_feedseek_64(mpg123_handle *mh, off64_t sampleoff, int whence, off64_t *input_offset)
+OFF64 attribute_align_arg mpg123_feedseek_64(mpg123_handle *mh, OFF64 sampleoff, int whence, OFF64 *input_offset)
{
return mpg123_feedseek64(mh, (int64_t)sampleoff, whence, (int64_t*)input_offset);
}
-off64_t attribute_align_arg mpg123_seek_frame_64(mpg123_handle *mh, off64_t offset, int whence)
+OFF64 attribute_align_arg mpg123_seek_frame_64(mpg123_handle *mh, OFF64 offset, int whence)
{
return mpg123_seek_frame64(mh, (int64_t)offset, whence);
}
-int attribute_align_arg mpg123_set_filesize_64(mpg123_handle *mh, off64_t size)
+int attribute_align_arg mpg123_set_filesize_64(mpg123_handle *mh, OFF64 size)
{
return mpg123_set_filesize64(mh, (int64_t)size);
}
-off64_t attribute_align_arg mpg123_framelength_64(mpg123_handle *mh)
+OFF64 attribute_align_arg mpg123_framelength_64(mpg123_handle *mh)
{
return mpg123_framelength64(mh);
}
-off64_t attribute_align_arg mpg123_length_64(mpg123_handle *mh)
+OFF64 attribute_align_arg mpg123_length_64(mpg123_handle *mh)
{
return mpg123_length64(mh);
}
-int attribute_align_arg mpg123_index_64(mpg123_handle *mh, off64_t **offsets, off64_t *step, size_t *fill)
+int attribute_align_arg mpg123_index_64(mpg123_handle *mh, OFF64 **offsets, OFF64 *step, size_t *fill)
{
return mpg123_index64(mh, (int64_t**)offsets, (int64_t*)step, fill);
}
-int attribute_align_arg mpg123_set_index_64(mpg123_handle *mh, off64_t *offsets, off64_t step, size_t fill)
+int attribute_align_arg mpg123_set_index_64(mpg123_handle *mh, OFF64 *offsets, OFF64 step, size_t fill)
{
return mpg123_set_index64(mh, (int64_t*)offsets, (int64_t)step, fill);
}
-off64_t attribute_align_arg mpg123_framepos_64(mpg123_handle *mh)
+OFF64 attribute_align_arg mpg123_framepos_64(mpg123_handle *mh)
{
return mpg123_framepos64(mh);
}
-int attribute_align_arg mpg123_position_64( mpg123_handle *mh, off64_t INT123_frame_offset
-, off64_t buffered_bytes, off64_t *current_frame, off64_t *frames_left
+int attribute_align_arg mpg123_position_64( mpg123_handle *mh, OFF64 INT123_frame_offset
+, OFF64 buffered_bytes, OFF64 *current_frame, OFF64 *frames_left
, double *current_seconds, double *seconds_left )
{
return mpg123_position64( mh, (int64_t)INT123_frame_offset, (int64_t)buffered_bytes
, (int64_t*)current_frame, (int64_t*)frames_left, current_seconds, seconds_left );
}
+#undef OFF64
#endif
/* =========================================
@@ -769,7 +778,7 @@ int INT123_wrap_open(mpg123_handle *mh, void *handle, const char *path, int fd,
#ifdef O_BINARY
flags |= O_BINARY;
#endif
-#ifdef LFS_LARGEFILE_64
+#if defined(LFS_LARGEFILE_64) && defined(HAVE_O_LARGEFILE)
flags |= O_LARGEFILE;
#endif
errno = 0;
@@ -951,4 +960,16 @@ int attribute_align_arg mpg123_replace_reader_handle_64(mpg123_handle *mh, mpg12
return MPG123_OK;
}
+#elif SIZEOF_OFF_T == 8
+
+int attribute_align_arg mpg123_replace_reader_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (int, void *, size_t), off_t (*r_lseek)(int, off_t, int) )
+{
+ return mpg123_replace_reader(mh, r_read, r_lseek);
+}
+
+int attribute_align_arg mpg123_replace_reader_handle_64(mpg123_handle *mh, mpg123_ssize_t (*r_read) (void*, void *, size_t), off_t (*r_lseek)(void*, off_t, int), void (*cleanup)(void*))
+{
+ return mpg123_replace_reader_handle(mh, r_read, r_lseek, cleanup);
+}
+
#endif
diff --git a/src/version.h b/src/version.h
index 4bfd3d1..312db98 100644
--- a/src/version.h
+++ b/src/version.h
@@ -16,7 +16,7 @@
// only single spaces as separator to ease parsing by build scripts
#define MPG123_MAJOR 1
#define MPG123_MINOR 32
-#define MPG123_PATCH 1
+#define MPG123_PATCH 2
// Don't get too wild with that to avoid confusing m4. No brackets.
// Also, it should fit well into a sane file name for the tarball.
#define MPG123_SUFFIX ""