no CMake? no problem!

This commit is contained in:
tildearrow 2025-10-23 03:09:09 -05:00
parent 763017886e
commit 42651f0b0c
11 changed files with 1707 additions and 9 deletions

View file

@ -308,7 +308,12 @@ if (WITH_OGG)
endif()
if (WITH_MPEG)
list(APPEND DEPENDENCIES_DEFINES HAVE_MP3_EXPORT)
# why do I have to provide an absolute path?
set(MP3LAME_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/lame/include CACHE STRING "LAME include dir" FORCE)
set(MP3LAME_LIBRARY mp3lame CACHE STRING "LAME library" FORCE)
add_subdirectory(extern/lame EXCLUDE_FROM_ALL)
add_subdirectory(extern/mpg123/ports/cmake EXCLUDE_FROM_ALL)
endif()
if (USE_SNDFILE)
@ -328,7 +333,7 @@ if (USE_SNDFILE)
set(BUILD_PROGRAMS OFF CACHE BOOL "aaa" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "a" FORCE)
set(ENABLE_EXTERNAL_LIBS ${WITH_OGG} CACHE BOOL "come on" FORCE)
set(ENABLE_MPEG OFF CACHE BOOL "come on" FORCE)
set(ENABLE_MPEG ${WITH_MPEG} CACHE BOOL "come on" FORCE)
add_subdirectory(extern/libsndfile-modified EXCLUDE_FROM_ALL)
list(APPEND DEPENDENCIES_LIBRARIES sndfile)
message(STATUS "Using vendored libsndfile")

View file

@ -1 +1,57 @@
# tildearrow: CMake port of Autotools build thingy.
# ported from Makefile.am
cmake_minimum_required(VERSION 3.0...3.20)
project(lame)
include(GNUInstallDirs)
set(LAME_DEFINES STDC_HEADERS HAVE_STRCHR HAVE_MEMCPY HAVE_CONFIG_H)
# mpglib
add_library(libmpgdecoder STATIC
mpglib/common.c
mpglib/dct64_i386.c
mpglib/decode_i386.c
mpglib/interface.c
mpglib/layer1.c
mpglib/layer2.c
mpglib/layer3.c
mpglib/tabinit.c
)
target_compile_definitions(libmpgdecoder PRIVATE ${LAME_DEFINES})
target_include_directories(libmpgdecoder PRIVATE config_ta include libmp3lame)
# libmp3lame
add_library(mp3lame STATIC
libmp3lame/VbrTag.c
libmp3lame/bitstream.c
libmp3lame/encoder.c
libmp3lame/fft.c
libmp3lame/gain_analysis.c
libmp3lame/id3tag.c
libmp3lame/lame.c
libmp3lame/newmdct.c
libmp3lame/presets.c
libmp3lame/psymodel.c
libmp3lame/quantize.c
libmp3lame/quantize_pvt.c
libmp3lame/reservoir.c
libmp3lame/set_get.c
libmp3lame/tables.c
libmp3lame/takehiro.c
libmp3lame/util.c
libmp3lame/vbrquantize.c
libmp3lame/version.c
libmp3lame/mpglib_interface.c
include/lame/lame.h
)
target_compile_definitions(mp3lame PRIVATE ${LAME_DEFINES})
target_include_directories(mp3lame PRIVATE config_ta include)
add_library(mp3lame::mp3lame ALIAS mp3lame)

7
extern/lame/MODIFIED.md vendored Normal file
View file

@ -0,0 +1,7 @@
# Modification Disclaimer
certain files have been modified to suit Furnace's needs, such as disabling integration with specific libraries, disabling certain options which are not necessary (such as doc generation) or allowing libsndfile to link against this library.
changes are preceded by "tildearrow".
- tildearrow

266
extern/lame/config_ta/config.h vendored Normal file
View file

@ -0,0 +1,266 @@
/* config.h.in. Generated from configure.in by autoheader. */
// tildearrow: manually written.
#ifndef LAME_CONFIG_H
#define LAME_CONFIG_H
typedef float ieee754_float32_t;
/* debug define */
#undef ABORTFP
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* alot of debug output */
#undef DEBUG
/* allow to compute a more accurate replaygain value */
#undef DECODE_ON_THE_FLY
/* double is faster than float on Alpha */
#undef FLOAT
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* we link against libefence */
#undef HAVE_EFENCE
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <linux/soundcard.h> header file. */
#undef HAVE_LINUX_SOUNDCARD_H
/* Define to 1 if the type `long double' works and has more range or precision
than `double'. */
#undef HAVE_LONG_DOUBLE
/* Define to 1 if the type `long double' works and has more range or precision
than `double'. */
#undef HAVE_LONG_DOUBLE_WIDER
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* build with mpglib support */
#undef HAVE_MPGLIB
/* have nasm */
#undef HAVE_NASM
/* Define to 1 if you have the <ncurses/termcap.h> header file. */
#undef HAVE_NCURSES_TERMCAP_H
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the <sys/soundcard.h> header file. */
#undef HAVE_SYS_SOUNDCARD_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* have termcap */
#undef HAVE_TERMCAP
/* Define to 1 if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if SSE intrinsics work. */
#undef HAVE_XMMINTRIN_H
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* requested by Frank, seems to be temporary needed for a smooth transition */
#undef LAME_LIBRARY_BUILD
/* set to 1 if you have libsndfile */
#undef LIBSNDFILE
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* use MMX version of choose_table */
#undef MMX_choose_table
/* build without hooks for analyzer */
#undef NOANALYSIS
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* IEEE754 compatible machine */
#undef TAKEHIRO_IEEE754_HACK
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* faster log implementation with less but enough precission */
#undef USE_FAST_LOG
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define if using the dmalloc debugging malloc package */
#undef WITH_DMALLOC
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* we're on DEC Alpha */
#undef __DECALPHA__
/* work around a glibc bug */
#undef __NO_MATH_INLINES
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
#endif /* LAME_CONFIG_H */

5
extern/lame/include/lame/README.md vendored Normal file
View file

@ -0,0 +1,5 @@
# MODIFIED
for vendored build.
- tildearrow

1342
extern/lame/include/lame/lame.h vendored Normal file

File diff suppressed because it is too large Load diff

0
extern/lame/libmp3lame/CMakeLists.txt vendored Normal file
View file

7
extern/mpg123/MODIFIED.md vendored Normal file
View file

@ -0,0 +1,7 @@
# Modification Disclaimer
certain files have been modified to suit Furnace's needs, such as disabling integration with specific libraries, disabling certain options which are not necessary (such as doc generation) or allowing libsndfile to link against this library.
changes are preceded by "tildearrow".
- tildearrow

View file

@ -20,10 +20,10 @@ include(GNUInstallDirs)
set(PACKAGE_VERSION ${PROJECT_VERSION})
add_subdirectory("src")
install(
EXPORT targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
NAMESPACE MPG123::)
#install(
# EXPORT targets
# DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
# NAMESPACE MPG123::)
configure_package_config_file(
mpg123-config.cmake.in mpg123-config.cmake

View file

@ -54,7 +54,13 @@ sf_count_t SFWrapper::ioGetSize() {
}
sf_count_t SFWrapper::ioSeek(sf_count_t offset, int whence) {
return fseek(f,offset,whence);
printf("SFWrapper: SEEK!\n");
fseek(f,offset,whence);
long ret=ftell(f);
if (ret<0) {
return -1;
}
return ret;
}
sf_count_t SFWrapper::ioRead(void* ptr, sf_count_t count) {

View file

@ -8082,11 +8082,15 @@ bool FurnaceGUI::init() {
if (strcmp(f.extension,"dmc")==0) continue;
if (strcmp(f.extension,"brr")==0) continue;
// special treatment for Ogg
// special treatment for Ogg and MPEG
if (strcmp(f.extension,"oga")==0) {
audioLoadFormats.push_back(f.name);
audioLoadFormats.push_back("*.ogg *.oga *.opus");
compatFormats+="*.ogg *.oga *.opus";
compatFormats+="*.ogg *.oga *.opus ";
} else if (strcmp(f.extension,"m1a")==0) {
audioLoadFormats.push_back(f.name);
audioLoadFormats.push_back("*.m1a *.mp1 *.mp2 *.mp3");
compatFormats+="*.m1a *.mp1 *.mp2 *.mp3 ";
} else {
audioLoadFormats.push_back(f.name);
audioLoadFormats.push_back(fmt::sprintf("*.%s",f.extension));