From ce07e3c8f090e6b8f54d89531d429ff479c76b04 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 15 Oct 2016 16:19:22 +0200 Subject: [PATCH] port of libsndfile http://www.mega-nerd.com/libsndfile/ Ref #47 --- lib/import/import-libsndfile.mk | 3 + lib/mk/alac.mk | 18 ++ lib/mk/g72x.mk | 13 ++ lib/mk/gsm10.mk | 16 ++ lib/mk/libsndfile.mk | 26 +++ ports/libsndfile.hash | 1 + ports/libsndfile.port | 21 ++ src/lib/libsndfile/config.h | 327 ++++++++++++++++++++++++++++++++ 8 files changed, 425 insertions(+) create mode 100644 lib/import/import-libsndfile.mk create mode 100644 lib/mk/alac.mk create mode 100644 lib/mk/g72x.mk create mode 100644 lib/mk/gsm10.mk create mode 100644 lib/mk/libsndfile.mk create mode 100644 ports/libsndfile.hash create mode 100644 ports/libsndfile.port create mode 100644 src/lib/libsndfile/config.h diff --git a/lib/import/import-libsndfile.mk b/lib/import/import-libsndfile.mk new file mode 100644 index 0000000..3db9b5c --- /dev/null +++ b/lib/import/import-libsndfile.mk @@ -0,0 +1,3 @@ +SNDFILE_PORT_DIR := $(call select_from_ports,libsndfile) + +INC_DIR += $(SNDFILE_PORT_DIR)/include/libsndfile diff --git a/lib/mk/alac.mk b/lib/mk/alac.mk new file mode 100644 index 0000000..5b2fbe2 --- /dev/null +++ b/lib/mk/alac.mk @@ -0,0 +1,18 @@ +include $(REP_DIR)/lib/import/import-libsndfile.mk + +SNDFILE_SRC_DIR := $(SNDFILE_PORT_DIR)/src/lib/libsndfile/src + +LIBS = libc + +CC_C_OPT += -std=c11 + +ALAC_SOURCES = \ + ALAC/ALACBitUtilities.c ALAC/ag_dec.c \ + ALAC/ag_enc.c ALAC/dp_dec.c ALAC/dp_enc.c ALAC/matrix_dec.c \ + ALAC/matrix_enc.c ALAC/alac_decoder.c ALAC/alac_encoder.c + +SRC_C := $(notdir $(ALAC_SOURCES)) + +INC_DIR += $(SNDFILE_SRC_DIR) $(REP_DIR)/src/lib/libsndfile + +vpath %.c $(SNDFILE_SRC_DIR)/ALAC diff --git a/lib/mk/g72x.mk b/lib/mk/g72x.mk new file mode 100644 index 0000000..b44f984 --- /dev/null +++ b/lib/mk/g72x.mk @@ -0,0 +1,13 @@ +include $(REP_DIR)/lib/import/import-libsndfile.mk + +SNDFILE_SRC_DIR := $(SNDFILE_PORT_DIR)/src/lib/libsndfile/src + +LIBS = libc + +G72x_SOURCES = \ + G72x/g721.c G72x/g723_16.c G72x/g723_24.c G72x/g723_40.c G72x/g72x.c + +SRC_C := $(notdir $(G72x_SOURCES)) + +vpath %.c $(SNDFILE_SRC_DIR)/G72x + diff --git a/lib/mk/gsm10.mk b/lib/mk/gsm10.mk new file mode 100644 index 0000000..3a21d2b --- /dev/null +++ b/lib/mk/gsm10.mk @@ -0,0 +1,16 @@ +include $(REP_DIR)/lib/import/import-libsndfile.mk + +SNDFILE_SRC_DIR := $(SNDFILE_PORT_DIR)/src/lib/libsndfile/src + +LIBS = libc + +GSM610_SOURCES = \ + GSM610/add.c GSM610/code.c GSM610/decode.c GSM610/gsm_create.c \ + GSM610/gsm_decode.c GSM610/gsm_destroy.c GSM610/gsm_encode.c \ + GSM610/gsm_option.c GSM610/long_term.c GSM610/lpc.c GSM610/preprocess.c \ + GSM610/rpe.c GSM610/short_term.c GSM610/table.c + +SRC_C := $(notdir $(GSM610_SOURCES)) + +vpath %.c $(SNDFILE_SRC_DIR)/GSM610 + diff --git a/lib/mk/libsndfile.mk b/lib/mk/libsndfile.mk new file mode 100644 index 0000000..cfaa70c --- /dev/null +++ b/lib/mk/libsndfile.mk @@ -0,0 +1,26 @@ +include $(REP_DIR)/lib/import/import-libsndfile.mk + +SNDFILE_SRC_DIR := $(SNDFILE_PORT_DIR)/src/lib/libsndfile/src + +LIBS = gsm10 g72x alac libogg libvorbis libFLAC libc + +COMMON = \ + common.c file_io.c command.c pcm.c ulaw.c alaw.c float32.c \ + double64.c ima_adpcm.c ms_adpcm.c gsm610.c dwvw.c vox_adpcm.c \ + interleave.c strings.c dither.c cart.c broadcast.c audio_detect.c \ + ima_oki_adpcm.c alac.c chunk.c ogg.c chanmap.c \ + windows.c id3.c + +FILESPECIFIC = \ + sndfile.c aiff.c au.c avr.c caf.c dwd.c flac.c g72x.c htk.c ircam.c \ + macos.c mat4.c mat5.c nist.c paf.c pvf.c raw.c rx2.c sd2.c \ + sds.c svx.c txw.c voc.c wve.c w64.c wavlike.c wav.c xi.c mpc2k.c rf64.c \ + ogg_vorbis.c ogg_speex.c ogg_pcm.c ogg_opus.c + +SRC_C := $(COMMON) $(FILESPECIFIC) + +INC_DIR += $(SNDFILE_SRC_DIR) $(REP_DIR)/src/lib/libsndfile + +vpath %.c $(SNDFILE_SRC_DIR) + +SHARED_LIB = yes diff --git a/ports/libsndfile.hash b/ports/libsndfile.hash new file mode 100644 index 0000000..fdf7303 --- /dev/null +++ b/ports/libsndfile.hash @@ -0,0 +1 @@ +41341b932e218ac50339c0c840644f8d6d2f7a18 diff --git a/ports/libsndfile.port b/ports/libsndfile.port new file mode 100644 index 0000000..74e2c32 --- /dev/null +++ b/ports/libsndfile.port @@ -0,0 +1,21 @@ +LICENSE := GPLv3 +VERSION := 1.0.27 +DOWNLOADS := libsndfile.archive + +URL(libsndfile) := http://www.mega-nerd.com/libsndfile/files/libsndfile-$(VERSION).tar.gz +SHA(libsndfile) := e112d4937352d1722b06911b00c79e9bce15095c +DIR(libsndfile) := src/lib/libsndfile + +_dirs: include/libsndfile/sndfile.h + +include/libsndfile/sndfile.h: src/lib/libsndfile/src/sndfile.h.in + @$(MSG_GENERATE)$@ + $(VERBOSE) mkdir -p include/libsndfile + $(VERBOSE) sed \ + -e 's/@TYPEOF_SF_COUNT_T@/long long/'\ + -e 's/@SF_COUNT_MAX@/0x7FFFFFFFFFFFFFFFLL/' \ + $< > $@ + +src/lib/libsndfile/src/sndfile.h.in: $(DOWNLOADS) + +# see ../src/lib/libsndfile/config.h diff --git a/src/lib/libsndfile/config.h b/src/lib/libsndfile/config.h new file mode 100644 index 0000000..1054a3f --- /dev/null +++ b/src/lib/libsndfile/config.h @@ -0,0 +1,327 @@ +/* src/config.h. Generated from config.h.in by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Set to 1 if the compile is GNU GCC. */ +#define COMPILER_IS_GCC 1 + +/* Target processor clips on negative float to int conversion. */ +#define CPU_CLIPS_NEGATIVE 0 + +/* Target processor clips on positive float to int conversion. */ +#define CPU_CLIPS_POSITIVE 0 + +/* Target processor is big endian. */ +#define CPU_IS_BIG_ENDIAN 0 + +/* Target processor is little endian. */ +#define CPU_IS_LITTLE_ENDIAN 1 + +/* Set to 1 to enable experimental code. */ +#define ENABLE_EXPERIMENTAL_CODE 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_ALSA_ASOUNDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_BYTESWAP_H 1 + +/* Define to 1 if you have the `calloc' function. */ +#define HAVE_CALLOC 1 + +/* Define to 1 if you have the `ceil' function. */ +#define HAVE_CEIL 1 + +/* Set to 1 if S_IRGRP is defined. */ +#define HAVE_DECL_S_IRGRP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ENDIAN_H 1 + +/* Will be set to 1 if flac, ogg and vorbis are available. */ +#define HAVE_EXTERNAL_XIPH_LIBS 1 + +/* Define to 1 if you have the `floor' function. */ +#define HAVE_FLOOR 1 + +/* Define to 1 if you have the `fmod' function. */ +#define HAVE_FMOD 1 + +/* Define to 1 if you have the `free' function. */ +#define HAVE_FREE 1 + +/* Define to 1 if you have the `fstat' function. */ +#define HAVE_FSTAT 1 + +/* Define to 1 if you have the `fstat64' function. */ +#define HAVE_FSTAT64 1 + +/* Define to 1 if you have the `fsync' function. */ +#define HAVE_FSYNC 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `gmtime' function. */ +#define HAVE_GMTIME 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime' function. */ +#define HAVE_LOCALTIME 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define if you have C99's lrint function. */ +#define HAVE_LRINT 1 + +/* Define if you have C99's lrintf function. */ +#define HAVE_LRINTF 1 + +/* Define to 1 if you have the `lround' function. */ +#define HAVE_LROUND 1 + +/* Define to 1 if you have the `lseek' function. */ +#define HAVE_LSEEK 1 + +/* Define to 1 if you have the `lseek64' function. */ +#define HAVE_LSEEK64 1 + +/* Define to 1 if you have the `malloc' function. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the `open' function. */ +#define HAVE_OPEN 1 + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + +/* Define to 1 if you have the `read' function. */ +#define HAVE_READ 1 + +/* Define to 1 if you have the `realloc' function. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Set to 1 if is available. */ +#define HAVE_SNDIO_H 0 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Set to 1 if you have libsqlite3. */ +#define HAVE_SQLITE3 1 + +/* Define to 1 if the system has the type `ssize_t'. */ +#define HAVE_SSIZE_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `waitpid' function. */ +#define HAVE_WAITPID 1 + +/* Define to 1 if you have the `write' function. */ +#define HAVE_WRITE 1 + +/* The host triplet of the compiled binary. */ +#define HOST_TRIPLET "x86_64-pc-linux-gnu" + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* The darwin version, no-zero is valid */ +#define OSX_DARWIN_VERSION 0 + +/* Set to 1 if compiling for OpenBSD */ +#define OS_IS_OPENBSD 0 + +/* Set to 1 if compiling for Win32 */ +#define OS_IS_WIN32 0 + +/* Name of package */ +#define PACKAGE "libsndfile" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "sndfile@mega-nerd.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libsndfile" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libsndfile 1.0.27" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libsndfile" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://www.mega-nerd.com/libsndfile/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.0.27" + +/* Set to maximum allowed value of sf_count_t type. */ +#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `int64_t', as computed by sizeof. */ +#define SIZEOF_INT64_T 8 + +/* The size of `loff_t', as computed by sizeof. */ +#define SIZEOF_LOFF_T 8 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `off64_t', as computed by sizeof. */ +#define SIZEOF_OFF64_T 8 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* Set to sizeof (long) if unknown. */ +#define SIZEOF_SF_COUNT_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `ssize_t', as computed by sizeof. */ +#define SIZEOF_SSIZE_T 8 + +/* The size of `void*', as computed by sizeof. */ +#define SIZEOF_VOIDP 8 + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Set to long if unknown. */ +#define TYPEOF_SF_COUNT_T int64_t + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Set to 1 to use the native windows API */ +#define USE_WINDOWS_API 0 + +/* Version number of package */ +#define VERSION "1.0.27" + +/* Set to 1 if windows DLL is being built. */ +#define WIN32_TARGET_DLL 0 + +/* Target processor is big endian. */ +#define WORDS_BIGENDIAN 0 + +/* 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 */ + +/* Set to 1 to use C99 printf/snprintf in MinGW. */ +/* #undef __USE_MINGW_ANSI_STDIO */