mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 01:49:53 +00:00
Fix broken ABI
Unfortunately ABI was broken when symbols files were removed in favour of new visibility control of exported functions. Visibility control with -fvisibility works fine, but symbol scripts had another feature - versioned symbols. And we lost it. Since we can not make our symbols to be versioned with the new approach, it's decided to return everything back. * CMake: Restore symbol files generation * CMake: Python is required to build shared libraries * Autotools: Restore symbol files generation Closes: https://github.com/erikd/libsndfile/issues/268
This commit is contained in:
parent
3fca78d4b3
commit
3d8399dfde
10
.gitignore
vendored
10
.gitignore
vendored
@ -96,15 +96,15 @@ regtest/sndfile-regtest
|
||||
sndfile.pc
|
||||
src/Ext
|
||||
src/G72x/g72x_test
|
||||
src/Symbols.darwin
|
||||
src/Symbols.gnu-binutils
|
||||
src/Symbols.os2
|
||||
src/Symbols.static
|
||||
Symbols.darwin
|
||||
Symbols.gnu-binutils
|
||||
Symbols.os2
|
||||
Symbols.static
|
||||
src/config.h
|
||||
src/config.h.in
|
||||
src/config.h.in~
|
||||
src/libsndfile.so*
|
||||
src/libsndfile*.def
|
||||
libsndfile*.def
|
||||
src/sndfile.h
|
||||
src/stamp-h1
|
||||
src/test_endswap.c
|
||||
|
@ -116,6 +116,12 @@ set_package_properties(SQLite3 PROPERTIES TYPE OPTIONAL
|
||||
URL "www.sqlite.org/"
|
||||
DESCRIPTION "light weight SQL database engine."
|
||||
PURPOSE "Enables regtest")
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set_package_properties(PythonInterp PROPERTIES TYPE REQUIRED
|
||||
URL "www.python.org/"
|
||||
DESCRIPTION "Python is a widely used high-level programming language."
|
||||
PURPOSE "Required to build shared libraries")
|
||||
endif()
|
||||
|
||||
feature_summary (WHAT ALL)
|
||||
|
||||
@ -344,12 +350,8 @@ if (BUILD_SHARED_LIBS)
|
||||
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/version-metadata.rc")
|
||||
configure_file(src/version-metadata.rc.in src/version-metadata.rc @ONLY)
|
||||
|
||||
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/${PACKAGE_NAME}.def")
|
||||
configure_file (src/libsndfile.def.in src/${PACKAGE_NAME}.def @ONLY)
|
||||
|
||||
list (APPEND libsndfile_SOURCES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/version-metadata.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/${PACKAGE_NAME}.def)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/version-metadata.rc)
|
||||
endif (WIN32)
|
||||
|
||||
add_library(${SNDFILE_SHARED_TARGET} SHARED ${libsndfile_SOURCES})
|
||||
@ -378,19 +380,61 @@ if (BUILD_SHARED_LIBS)
|
||||
endif (NOT DISABLE_EXTERNAL_LIBS)
|
||||
|
||||
set_target_properties (${SNDFILE_SHARED_TARGET} PROPERTIES
|
||||
DEFINE_SYMBOL SNDFILE_EXPORTS
|
||||
PUBLIC_HEADER "${libsndfile_PUBLIC_HEADERS}"
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
C_VISIBILITY_PRESET hidden)
|
||||
VERSION ${PROJECT_VERSION})
|
||||
|
||||
if (WIN32)
|
||||
set_target_properties(${SNDFILE_SHARED_TARGET} PROPERTIES
|
||||
ARCHIVE_OUTPUT_NAME "libsndfile-${PROJECT_VERSION_MAJOR}"
|
||||
PREFIX "lib"
|
||||
OUTPUT_NAME "sndfile-${PROJECT_VERSION_MAJOR}")
|
||||
else ()
|
||||
set_target_properties(${SNDFILE_SHARED_TARGET} PROPERTIES
|
||||
OUTPUT_NAME "sndfile")
|
||||
endif (WIN32)
|
||||
|
||||
# Symbol files generation
|
||||
|
||||
if (WIN32)
|
||||
set(SYMBOL_FILENAME "libsndfile-${PROJECT_VERSION_MAJOR}.def")
|
||||
set(SYMBOL_OS "win32")
|
||||
elseif((CMAKE_SYSTEM_NAME MATCHES "Darwin") OR (CMAKE_SYSTEM_NAME MATCHES "Rhapsody"))
|
||||
set(SYMBOL_FILENAME "Symbols.darwin")
|
||||
set(SYMBOL_OS "darwin")
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "OS2")
|
||||
set(SYMBOL_FILENAME "Symbols.os2")
|
||||
set(SYMBOL_OS "os2")
|
||||
elseif(UNIX)
|
||||
set(SYMBOL_FILENAME "Symbols.gnu-binutils")
|
||||
set(SYMBOL_OS "linux")
|
||||
endif()
|
||||
|
||||
if (DEFINED SYMBOL_OS)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src/create_symbols_file.py ${SYMBOL_OS} ${PROJECT_VERSION_MAJOR} > ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}
|
||||
COMMENT "Generating ${SYMBOL_FILENAME}...")
|
||||
|
||||
add_custom_target(GENFILES DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME})
|
||||
if (SYMBOL_OS MATCHES "win32")
|
||||
target_sources(${SNDFILE_SHARED_TARGET}
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME})
|
||||
elseif(SYMBOL_OS MATCHES "darwin")
|
||||
add_dependencies(${SNDFILE_SHARED_TARGET} GENFILES)
|
||||
set_property(TARGET ${SNDFILE_SHARED_TARGET} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,-exported_symbols_list -Wl,${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}")
|
||||
elseif(SYMBOL_OS MATCHES "os")
|
||||
add_dependencies(${SNDFILE_SHARED_TARGET} GENFILES)
|
||||
set_property(TARGET ${SNDFILE_SHARED_TARGET} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,-export-symbols ${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}")
|
||||
elseif(UNIX)
|
||||
add_dependencies(${SNDFILE_SHARED_TARGET} GENFILES)
|
||||
set_property(TARGET ${SNDFILE_SHARED_TARGET} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/src/${SYMBOL_FILENAME}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
EXTRA_DIST = add_cflags.m4 clip_mode.m4 endian.m4 \
|
||||
flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 extra_pkg.m4 visibility.m4
|
||||
flexible_array.m4 llrint.m4 lrint.m4 lrintf.m4 octave.m4 extra_pkg.m4
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
# visibility.m4 serial 5 (gettext-0.18.2)
|
||||
dnl Copyright (C) 2005, 2008, 2010-2017 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
dnl Tests whether the compiler supports the command-line option
|
||||
dnl -fvisibility=hidden and the function and variable attributes
|
||||
dnl __attribute__((__visibility__("hidden"))) and
|
||||
dnl __attribute__((__visibility__("default"))).
|
||||
dnl Does *not* test for __visibility__("protected") - which has tricky
|
||||
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
|
||||
dnl Mac OS X.
|
||||
dnl Does *not* test for __visibility__("internal") - which has processor
|
||||
dnl dependent semantics.
|
||||
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
|
||||
dnl "really only recommended for legacy code".
|
||||
dnl Set the variable CFLAG_VISIBILITY.
|
||||
dnl Defines and sets the variable HAVE_VISIBILITY.
|
||||
|
||||
AC_DEFUN([gl_VISIBILITY],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
CFLAG_VISIBILITY=
|
||||
HAVE_VISIBILITY=0
|
||||
if test -n "$GCC"; then
|
||||
dnl First, check whether -Werror can be added to the command line, or
|
||||
dnl whether it leads to an error because of some other option that the
|
||||
dnl user has put into $CC $CFLAGS $CPPFLAGS.
|
||||
AC_MSG_CHECKING([whether the -Werror option is usable])
|
||||
AC_CACHE_VAL([gl_cv_cc_vis_werror], [
|
||||
gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[]], [[]])],
|
||||
[gl_cv_cc_vis_werror=yes],
|
||||
[gl_cv_cc_vis_werror=no])
|
||||
CFLAGS="$gl_save_CFLAGS"])
|
||||
AC_MSG_RESULT([$gl_cv_cc_vis_werror])
|
||||
dnl Now check whether visibility declarations are supported.
|
||||
AC_MSG_CHECKING([for simple visibility declarations])
|
||||
AC_CACHE_VAL([gl_cv_cc_visibility], [
|
||||
gl_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fvisibility=hidden"
|
||||
dnl We use the option -Werror and a function dummyfunc, because on some
|
||||
dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
|
||||
dnl "visibility attribute not supported in this configuration; ignored"
|
||||
dnl at the first function definition in every compilation unit, and we
|
||||
dnl don't want to use the option in this case.
|
||||
if test $gl_cv_cc_vis_werror = yes; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
|
||||
extern __attribute__((__visibility__("default"))) int exportedvar;
|
||||
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
|
||||
extern __attribute__((__visibility__("default"))) int exportedfunc (void);
|
||||
void dummyfunc (void) {}
|
||||
]],
|
||||
[[]])],
|
||||
[gl_cv_cc_visibility=yes],
|
||||
[gl_cv_cc_visibility=no])
|
||||
CFLAGS="$gl_save_CFLAGS"])
|
||||
AC_MSG_RESULT([$gl_cv_cc_visibility])
|
||||
if test $gl_cv_cc_visibility = yes; then
|
||||
CFLAG_VISIBILITY="-fvisibility=hidden"
|
||||
HAVE_VISIBILITY=1
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CFLAG_VISIBILITY])
|
||||
AC_SUBST([HAVE_VISIBILITY])
|
||||
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
|
||||
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
|
||||
])
|
@ -239,3 +239,7 @@ elseif (NOT ENABLE_STATIC_RUNTIME)
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
endif (MINGW)
|
||||
endif (ENABLE_STATIC_RUNTIME)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
find_package(PythonInterp REQUIRED)
|
||||
endif()
|
||||
|
17
configure.ac
17
configure.ac
@ -85,8 +85,6 @@ else
|
||||
AM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
|
||||
[test "$build_os:$target_os:$host_os:$HAVE_WINE" = "linux-gnu:mingw32msvc:mingw32msvc:yes"])
|
||||
|
||||
gl_VISIBILITY
|
||||
|
||||
#====================================================================================
|
||||
# Couple of initializations here. Fill in real values later.
|
||||
|
||||
@ -542,13 +540,26 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
|
||||
# OS specific tweaks.
|
||||
case "$host_os" in
|
||||
darwin* | rhapsody*)
|
||||
# Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
|
||||
# System headers on these systems are broken.
|
||||
temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"`
|
||||
CFLAGS=$temp_CFLAGS
|
||||
SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
|
||||
;;
|
||||
linux*|kfreebsd*-gnu*|gnu*)
|
||||
SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.gnu-binutils"
|
||||
;;
|
||||
mingw*)
|
||||
SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(srcdir)/libsndfile.def"
|
||||
SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(srcdir)/libsndfile-1.def"
|
||||
win32_target_dll=1
|
||||
if test x"$enable_shared" = xno ; then
|
||||
win32_target_dll=0
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
SHLIB_VERSION_ARG="-Wl,-export-symbols \$(srcdir)/Symbols.os2"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
@ -8,10 +8,10 @@ nodist_include_HEADERS = sndfile.h
|
||||
|
||||
noinst_LTLIBRARIES = GSM610/libgsm.la G72x/libg72x.la ALAC/libalac.la libcommon.la
|
||||
|
||||
SYMBOL_FILES = libsndfile.def
|
||||
SYMBOL_FILES = Symbols.gnu-binutils Symbols.darwin libsndfile-1.def Symbols.os2 Symbols.static
|
||||
|
||||
EXTRA_DIST = sndfile.h.in config.h.in test_endswap.c test_endswap.tpl test_endswap.def \
|
||||
$(SYMBOL_FILES) binheader_writef_check.py \
|
||||
$(SYMBOL_FILES) create_symbols_file.py binheader_writef_check.py \
|
||||
GSM610/README GSM610/COPYRIGHT GSM610/ChangeLog \
|
||||
G72x/README G72x/README.original G72x/ChangeLog \
|
||||
make-static-lib-hidden-privates.sh \
|
||||
@ -34,8 +34,7 @@ else
|
||||
WIN_VERSION_FILE =
|
||||
endif
|
||||
|
||||
libsndfile_la_CFLAGS = $(CFLAG_VISIBILITY) $(EXTERNAL_XIPH_CFLAGS)
|
||||
libsndfile_la_CPPFLAGS = -DSNDFILE_EXPORTS
|
||||
libsndfile_la_CFLAGS = $(EXTERNAL_XIPH_CFLAGS)
|
||||
|
||||
#===============================================================================
|
||||
# MinGW requires -no-undefined if a DLL is to be built.
|
||||
@ -99,6 +98,26 @@ check :
|
||||
# Need this target to force building of test programs.
|
||||
checkprograms : $(check_PROGRAMS)
|
||||
|
||||
#======================================================================
|
||||
# Generate an OS specific Symbols files. This is done when the author
|
||||
# builds the distribution tarball. There should be not need for the
|
||||
# end user to create these files.
|
||||
|
||||
Symbols.gnu-binutils: create_symbols_file.py
|
||||
python $(srcdir)/create_symbols_file.py linux $(VERSION) > $@
|
||||
|
||||
Symbols.darwin: create_symbols_file.py
|
||||
python $(srcdir)/create_symbols_file.py darwin $(VERSION) > $@
|
||||
|
||||
libsndfile-1.def: create_symbols_file.py
|
||||
python $(srcdir)/create_symbols_file.py win32 $(VERSION) > $@
|
||||
|
||||
Symbols.os2: create_symbols_file.py
|
||||
python $(srcdir)/create_symbols_file.py os2 $(VERSION) > $@
|
||||
|
||||
Symbols.static: create_symbols_file.py
|
||||
python $(srcdir)/create_symbols_file.py static $(VERSION) > $@
|
||||
|
||||
#======================================================================
|
||||
# Building windows resource files (if needed).
|
||||
|
||||
|
11
src/common.h
11
src/common.h
@ -75,17 +75,6 @@
|
||||
# define WARN_UNUSED
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Visibility control
|
||||
*/
|
||||
|
||||
#if defined (SNDFILE_EXPORTS) && !defined (_WIN32)
|
||||
# define SNDFILE_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
# define SNDFILE_API
|
||||
#endif
|
||||
|
||||
|
||||
#define SF_BUFFER_LEN (8192)
|
||||
#define SF_FILENAME_LEN (1024)
|
||||
#define SF_SYSERR_LEN (256)
|
||||
|
182
src/create_symbols_file.py
Normal file
182
src/create_symbols_file.py
Normal file
@ -0,0 +1,182 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2003-2017 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the author nor the names of any contributors may be used
|
||||
# to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import re, sys
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# These are all of the public functions exported from libsndfile.
|
||||
#
|
||||
# Its important not to change the order they are listed in or
|
||||
# the ordinal values in the second column.
|
||||
|
||||
ALL_SYMBOLS = (
|
||||
( "sf_command", 1 ),
|
||||
( "sf_open", 2 ),
|
||||
( "sf_close", 3 ),
|
||||
( "sf_seek", 4 ),
|
||||
( "sf_error", 7 ),
|
||||
( "sf_perror", 8 ),
|
||||
( "sf_error_str", 9 ),
|
||||
( "sf_error_number", 10 ),
|
||||
( "sf_format_check", 11 ),
|
||||
( "sf_read_raw", 16 ),
|
||||
( "sf_readf_short", 17 ),
|
||||
( "sf_readf_int", 18 ),
|
||||
( "sf_readf_float", 19 ),
|
||||
( "sf_readf_double", 20 ),
|
||||
( "sf_read_short", 21 ),
|
||||
( "sf_read_int", 22 ),
|
||||
( "sf_read_float", 23 ),
|
||||
( "sf_read_double", 24 ),
|
||||
( "sf_write_raw", 32 ),
|
||||
( "sf_writef_short", 33 ),
|
||||
( "sf_writef_int", 34 ),
|
||||
( "sf_writef_float", 35 ),
|
||||
( "sf_writef_double", 36 ),
|
||||
( "sf_write_short", 37 ),
|
||||
( "sf_write_int", 38 ),
|
||||
( "sf_write_float", 39 ),
|
||||
( "sf_write_double", 40 ),
|
||||
( "sf_strerror", 50 ),
|
||||
( "sf_get_string", 60 ),
|
||||
( "sf_set_string", 61 ),
|
||||
( "sf_version_string", 68 ),
|
||||
( "sf_open_fd", 70 ),
|
||||
( "sf_wchar_open", 71 ),
|
||||
( "sf_open_virtual", 80 ),
|
||||
( "sf_write_sync", 90 ),
|
||||
( "sf_set_chunk", 100 ),
|
||||
( "sf_get_chunk_size", 101 ),
|
||||
( "sf_get_chunk_data", 102 ),
|
||||
( "sf_get_chunk_iterator", 103 ),
|
||||
( "sf_next_chunk_iterator", 104 ),
|
||||
( "sf_current_byterate", 110 )
|
||||
)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
def linux_symbols (progname, version):
|
||||
print ("# Auto-generated by %s\n" %progname)
|
||||
print ("libsndfile.so.%s" % version)
|
||||
print ("{")
|
||||
print (" global:")
|
||||
for name, ordinal in ALL_SYMBOLS:
|
||||
if name == "sf_wchar_open":
|
||||
continue
|
||||
print (" %s ;" % name)
|
||||
print (" local:")
|
||||
print (" * ;")
|
||||
print ("} ;")
|
||||
sys.stdout.write ("\n")
|
||||
return
|
||||
|
||||
def darwin_symbols (progname, version):
|
||||
print ("# Auto-generated by %s\n" %progname)
|
||||
for name, ordinal in ALL_SYMBOLS:
|
||||
if name == "sf_wchar_open":
|
||||
continue
|
||||
print ("_%s" % name)
|
||||
sys.stdout.write ("\n")
|
||||
return
|
||||
|
||||
def win32_symbols (progname, version, name):
|
||||
print ("; Auto-generated by %s\n" %progname)
|
||||
print ("LIBRARY %s-%s.dll" % (name, re.sub ("\..*", "", version)))
|
||||
print ("EXPORTS\n")
|
||||
for name, ordinal in ALL_SYMBOLS:
|
||||
print ("%-20s @%s" % (name, ordinal))
|
||||
sys.stdout.write ("\n")
|
||||
return
|
||||
|
||||
def os2_symbols (progname, version, name):
|
||||
print ("; Auto-generated by %s\n" %progname)
|
||||
print ("LIBRARY %s%s" % (name, re.sub ("\..*", "", version)))
|
||||
print ("INITINSTANCE TERMINSTANCE")
|
||||
print ("CODE PRELOAD MOVEABLE DISCARDABLE")
|
||||
print ("DATA PRELOAD MOVEABLE MULTIPLE NONSHARED")
|
||||
print ("EXPORTS\n")
|
||||
for name, ordinal in ALL_SYMBOLS:
|
||||
if name == "sf_wchar_open":
|
||||
continue
|
||||
print ("_%-20s @%s" % (name, ordinal))
|
||||
sys.stdout.write ("\n")
|
||||
return
|
||||
|
||||
def plain_symbols (progname, version, name):
|
||||
for name, ordinal in ALL_SYMBOLS:
|
||||
print (name)
|
||||
|
||||
def no_symbols (os_name):
|
||||
sys.stdout.write ("\n")
|
||||
print ("No known way of restricting exported symbols on '%s'." % os_name)
|
||||
print ("If you know a way, please contact the author.")
|
||||
sys.stdout.write ("\n")
|
||||
return
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
progname = re.sub (".*[\\/]", "", sys.argv [0])
|
||||
|
||||
if len (sys.argv) != 3:
|
||||
sys.stdout.write ("\n")
|
||||
print ("Usage : %s <target OS name> <libsndfile version>." % progname)
|
||||
sys.stdout.write ("\n")
|
||||
print (" Currently supported values for target OS are:")
|
||||
print (" linux")
|
||||
print (" darwin (ie MacOSX)")
|
||||
print (" win32 (ie wintendo)")
|
||||
print (" cygwin (Cygwin on wintendo)")
|
||||
print (" os2 (OS/2)")
|
||||
print (" plain (plain list of symbols)")
|
||||
sys.stdout.write ("\n")
|
||||
sys.exit (1)
|
||||
|
||||
os_name = sys.argv [1]
|
||||
version = re.sub ("\.[a-z0-9]+$", "", sys.argv [2])
|
||||
|
||||
if os_name == "linux" or os_name == "gnu" or os_name == "binutils":
|
||||
linux_symbols (progname, version)
|
||||
elif os_name == "darwin":
|
||||
darwin_symbols (progname, version)
|
||||
elif os_name == "win32":
|
||||
win32_symbols (progname, version, "libsndfile")
|
||||
elif os_name == "cygwin":
|
||||
win32_symbols (progname, version, "cygsndfile")
|
||||
elif os_name == "os2":
|
||||
os2_symbols (progname, version, "sndfile")
|
||||
elif os_name == "static":
|
||||
plain_symbols (progname, version, "")
|
||||
else:
|
||||
no_symbols (os_name)
|
||||
|
||||
sys.exit (0)
|
||||
|
@ -320,7 +320,6 @@ static char sf_syserr [SF_SYSERR_LEN] = { 0 } ;
|
||||
** Public functions.
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
SNDFILE*
|
||||
sf_open (const char *path, int mode, SF_INFO *sfinfo)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -351,7 +350,6 @@ sf_open (const char *path, int mode, SF_INFO *sfinfo)
|
||||
return psf_open_file (psf, sfinfo) ;
|
||||
} /* sf_open */
|
||||
|
||||
SNDFILE_API
|
||||
SNDFILE*
|
||||
sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -380,7 +378,6 @@ sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc)
|
||||
return psf_open_file (psf, sfinfo) ;
|
||||
} /* sf_open_fd */
|
||||
|
||||
SNDFILE_API
|
||||
SNDFILE*
|
||||
sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -420,7 +417,6 @@ sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user
|
||||
return psf_open_file (psf, sfinfo) ;
|
||||
} /* sf_open_virtual */
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_close (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -430,7 +426,6 @@ sf_close (SNDFILE *sndfile)
|
||||
return psf_close (psf) ;
|
||||
} /* sf_close */
|
||||
|
||||
SNDFILE_API
|
||||
void
|
||||
sf_write_sync (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -446,7 +441,6 @@ sf_write_sync (SNDFILE *sndfile)
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
const char*
|
||||
sf_error_number (int errnum)
|
||||
{ static const char *bad_errnum =
|
||||
@ -469,7 +463,6 @@ sf_error_number (int errnum)
|
||||
return bad_errnum ;
|
||||
} /* sf_error_number */
|
||||
|
||||
SNDFILE_API
|
||||
const char*
|
||||
sf_strerror (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf = NULL ;
|
||||
@ -498,7 +491,6 @@ sf_strerror (SNDFILE *sndfile)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_error (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -517,7 +509,6 @@ sf_error (SNDFILE *sndfile)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_perror (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -539,7 +530,6 @@ sf_perror (SNDFILE *sndfile)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_error_str (SNDFILE *sndfile, char *str, size_t maxlen)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -563,7 +553,6 @@ sf_error_str (SNDFILE *sndfile, char *str, size_t maxlen)
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_format_check (const SF_INFO *info)
|
||||
{ int subformat, endian ;
|
||||
@ -873,7 +862,6 @@ sf_format_check (const SF_INFO *info)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
const char *
|
||||
sf_version_string (void)
|
||||
{
|
||||
@ -888,7 +876,6 @@ sf_version_string (void)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
{ SF_PRIVATE *psf = (SF_PRIVATE *) sndfile ;
|
||||
@ -1389,7 +1376,6 @@ sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1508,7 +1494,6 @@ sf_seek (SNDFILE *sndfile, sf_count_t offset, int whence)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
const char*
|
||||
sf_get_string (SNDFILE *sndfile, int str_type)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1521,7 +1506,6 @@ sf_get_string (SNDFILE *sndfile, int str_type)
|
||||
return psf_get_string (psf, str_type) ;
|
||||
} /* sf_get_string */
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_set_string (SNDFILE *sndfile, int str_type, const char* str)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1534,7 +1518,6 @@ sf_set_string (SNDFILE *sndfile, int str_type, const char* str)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_current_byterate (SNDFILE *sndfile)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1579,7 +1562,6 @@ sf_current_byterate (SNDFILE *sndfile)
|
||||
/*==============================================================================
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1632,7 +1614,6 @@ sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1688,7 +1669,6 @@ sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_read_short */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1742,7 +1722,6 @@ sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1798,7 +1777,6 @@ sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_read_int */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1852,7 +1830,6 @@ sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1908,7 +1885,6 @@ sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_read_float */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -1962,7 +1938,6 @@ sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2018,7 +1993,6 @@ sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_read_double */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2072,7 +2046,6 @@ sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2132,7 +2105,6 @@ sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t len)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2190,7 +2162,6 @@ sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_write_short */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2246,7 +2217,6 @@ sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2304,7 +2274,6 @@ sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_write_int */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2360,7 +2329,6 @@ sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2418,7 +2386,6 @@ sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_write_float */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2474,7 +2441,6 @@ sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames)
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t len)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -2532,7 +2498,6 @@ sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t len)
|
||||
return count ;
|
||||
} /* sf_write_double */
|
||||
|
||||
SNDFILE_API
|
||||
sf_count_t
|
||||
sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -3276,7 +3241,6 @@ error_exit :
|
||||
** It doesn't work for W64 because W64 uses weird GUID style chunk markers.
|
||||
*/
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -3292,7 +3256,6 @@ sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info)
|
||||
return SFE_BAD_CHUNK_FORMAT ;
|
||||
} /* sf_set_chunk */
|
||||
|
||||
SNDFILE_API
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_get_chunk_iterator (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -3305,7 +3268,6 @@ sf_get_chunk_iterator (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info)
|
||||
return psf_get_chunk_iterator (psf, NULL) ;
|
||||
} /* sf_get_chunk_iterator */
|
||||
|
||||
SNDFILE_API
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_next_chunk_iterator (SF_CHUNK_ITERATOR * iterator)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -3319,7 +3281,6 @@ sf_next_chunk_iterator (SF_CHUNK_ITERATOR * iterator)
|
||||
return NULL ;
|
||||
} /* sf_get_chunk_iterator_next */
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_get_chunk_size (const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_info)
|
||||
{ SF_PRIVATE *psf ;
|
||||
@ -3337,7 +3298,6 @@ sf_get_chunk_size (const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_inf
|
||||
return 0 ;
|
||||
} /* sf_get_chunk_size */
|
||||
|
||||
SNDFILE_API
|
||||
int
|
||||
sf_get_chunk_data (const SF_CHUNK_ITERATOR * iterator, SF_CHUNK_INFO * chunk_info)
|
||||
{ SF_PRIVATE *psf ;
|
||||
|
@ -35,7 +35,6 @@ extern int sf_errno ;
|
||||
|
||||
static void copy_filename (SF_PRIVATE * psf, LPCWSTR wpath) ;
|
||||
|
||||
SNDFILE_API
|
||||
SNDFILE*
|
||||
sf_wchar_open (LPCWSTR wpath, int mode, SF_INFO *sfinfo)
|
||||
{ SF_PRIVATE *psf ;
|
||||
|
Loading…
Reference in New Issue
Block a user