!1 Package init

Merge pull request !1 from openeuler-iSula/master
This commit is contained in:
openeuler-ci-bot 2019-12-17 20:39:56 +08:00 committed by Gitee
commit 211795838a
13 changed files with 608 additions and 0 deletions

52
binpatch.py Normal file
View File

@ -0,0 +1,52 @@
import sys
OLD_PATH = b"/usr/lib/sox\x00"
NEW_PATH = b"/var/tmp/sox\x00"
OUT_PATH = "/var/tmp/sox\n"
OLD64_PATH = b"/usr/lib64/sox\x00"
NEW64_PATH = b"/var/tmp/l/sox\x00"
OUT64_PATH = "/var/tmp/l/sox\n"
assert len(OLD_PATH) == len(NEW_PATH)
assert len(OLD64_PATH) == len(NEW64_PATH)
argv = sys.argv
wout = sys.stdout.write
werr = sys.stderr.write
bye = sys.exit
def p(m, *args):
werr(m % args)
def usage():
p("Usage: %s <path to libsox>\n", argv[0])
def error(et):
def ef():
p("%s: %r cannot be binary patched [%s]\n", argv[0], argv[1], et)
return ef
def check(c, p):
if not c:
p()
bye(1)
check(len(argv) == 2, usage)
s = b""
o = ""
with open(argv[1], 'rb') as f:
s = f.read()
if s.count(OLD_PATH) == 1:
check(s.count(OLD64_PATH) == 0, error("OLD64_PATH"))
s = s.replace(OLD_PATH, NEW_PATH)
o = OUT_PATH
elif s.count(OLD64_PATH) == 1:
check(s.count(OLD_PATH) == 0, error("OLD_PATH"))
s = s.replace(OLD64_PATH, NEW64_PATH)
o = OUT64_PATH
else:
check(False, error("OLD_PATH/OLD64_PATH"))
with open(argv[1], 'wb') as f:
f.write(s)
wout(o)

View File

@ -0,0 +1,49 @@
diff --git a/src/ao.c b/src/ao.c
index 4791d4e..3d6431d 100644
--- a/src/ao.c
+++ b/src/ao.c
@@ -34,9 +34,21 @@ typedef struct {
static int startwrite(sox_format_t * ft)
{
priv_t * ao = (priv_t *)ft->priv;
+ unsigned bytes_per_sample = (ft->encoding.bits_per_sample + 7) >> 3;
- ao->buf_size = sox_globals.bufsiz - (sox_globals.bufsiz % (ft->encoding.bits_per_sample >> 3));
- ao->buf_size *= (ft->encoding.bits_per_sample >> 3);
+ if (bytes_per_sample == 0)
+ {
+ lsx_fail("startwrite [ao driver]: Corrupted encoding data (bits per sample should not be zero)");
+ return SOX_EOF;
+ }
+
+ /* Since sox_sw_write_buf works with 16-bit samples, ensure there is an enough room */
+ if (bytes_per_sample < 2)
+ bytes_per_sample = 2;
+ /* Align the buffer size to the boundary divisible by bytes_per_sample */
+ ao->buf_size = sox_globals.bufsiz - (sox_globals.bufsiz % bytes_per_sample);
+ /* - add back possibly truncated bytes */
+ ao->buf_size += bytes_per_sample;
ao->buf = lsx_malloc(ao->buf_size);
if (!ao->buf)
@@ -90,12 +102,17 @@ static void sox_sw_write_buf(char *buf1, sox_sample_t const * buf2, size_t len,
static size_t write_samples(sox_format_t *ft, const sox_sample_t *buf, size_t len)
{
priv_t * ao = (priv_t *)ft->priv;
+ /* This will be always > 0 in the case the format handler is properly used */
+ unsigned bytes_per_sample = (ft->encoding.bits_per_sample + 7) >> 3;
uint_32 aobuf_size;
- if (len > ao->buf_size / (ft->encoding.bits_per_sample >> 3))
- len = ao->buf_size / (ft->encoding.bits_per_sample >> 3);
+ /* Normalize the number of samples */
+ if (bytes_per_sample < 2)
+ bytes_per_sample = 2;
+ if (len > ao->buf_size / bytes_per_sample)
+ len = ao->buf_size / bytes_per_sample;
- aobuf_size = (ft->encoding.bits_per_sample >> 3) * len;
+ aobuf_size = bytes_per_sample * len;
sox_sw_write_buf(ao->buf, buf, len, ft->encoding.reverse_bytes,
&(ft->clips));

View File

@ -0,0 +1,58 @@
--- a/src/wav.c
+++ b/src/wav.c
@@ -712,6 +712,11 @@
ft->signal.channels = wChannels;
else
lsx_report("User options overriding channels read in .wav header");
+
+ if (ft->signal.channels == 0) {
+ lsx_fail_errno(ft, SOX_EHDR, "Channel count is zero");
+ return SOX_EOF;
+ }
if (ft->signal.rate == 0 || ft->signal.rate == dwSamplesPerSecond)
ft->signal.rate = dwSamplesPerSecond;
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -73,6 +73,14 @@
size_t pos; /* Where next byte goes */
} priv_t;
+static int dictvalid(int n, int size, int left, int right)
+{
+ if (n > 0 && left < 0)
+ return 1;
+
+ return (unsigned)left < size && (unsigned)right < size;
+}
+
static int startread(sox_format_t * ft)
{
priv_t *p = (priv_t *) ft->priv;
@@ -150,6 +158,11 @@
lsx_debug("%d %d",
p->dictionary[i].dict_leftson,
p->dictionary[i].dict_rightson);
+ if (!dictvalid(i, dictsize, p->dictionary[i].dict_leftson,
+ p->dictionary[i].dict_rightson)) {
+ lsx_fail_errno(ft, SOX_EHDR, "Invalid dictionary");
+ return SOX_EOF;
+ }
}
rc = lsx_skipbytes(ft, (size_t) 1); /* skip pad byte */
if (rc)
--- a/src/wav.c
+++ b/src/wav.c
@@ -1381,6 +1381,12 @@
int bytespersample; /* (uncompressed) bytes per sample (per channel) */
long blocksWritten = 0;
sox_bool isExtensible = sox_false; /* WAVE_FORMAT_EXTENSIBLE? */
+
+ if (ft->signal.channels > UINT16_MAX) {
+ lsx_fail_errno(ft, SOX_EOF, "Too many channels (%u)",
+ ft->signal.channels);
+ return SOX_EOF;
+ }
dwSamplesPerSecond = ft->signal.rate;
wChannels = ft->signal.channels;

View File

@ -0,0 +1,86 @@
diff --git a/src/adpcm.c b/src/adpcm.c
index 2e13867..f64b7d5 100644
--- a/src/adpcm.c
+++ b/src/adpcm.c
@@ -71,6 +71,11 @@ const short lsx_ms_adpcm_i_coef[7][2] = {
{ 392,-232}
};
+extern void *lsx_ms_adpcm_alloc(unsigned chans)
+{
+ return lsx_malloc(chans * sizeof(MsState_t));
+}
+
static inline sox_sample_t AdpcmDecode(sox_sample_t c, MsState_t *state,
sox_sample_t sample1, sox_sample_t sample2)
{
@@ -102,6 +107,7 @@ static inline sox_sample_t AdpcmDecode(sox_sample_t c, MsState_t *state,
/* lsx_ms_adpcm_block_expand_i() outputs interleaved samples into one output buffer */
const char *lsx_ms_adpcm_block_expand_i(
+ void *priv,
unsigned chans, /* total channels */
int nCoef,
const short *coef,
@@ -113,7 +119,7 @@ const char *lsx_ms_adpcm_block_expand_i(
const unsigned char *ip;
unsigned ch;
const char *errmsg = NULL;
- MsState_t state[4]; /* One decompressor state for each channel */
+ MsState_t *state = priv; /* One decompressor state for each channel */
/* Read the four-byte header for each channel */
ip = ibuff;
diff --git a/src/adpcm.h b/src/adpcm.h
index af4d6f0..db5cc61 100644
--- a/src/adpcm.h
+++ b/src/adpcm.h
@@ -29,8 +29,11 @@
/* default coef sets */
extern const short lsx_ms_adpcm_i_coef[7][2];
+extern void *lsx_ms_adpcm_alloc(unsigned chans);
+
/* lsx_ms_adpcm_block_expand_i() outputs interleaved samples into one output buffer */
extern const char *lsx_ms_adpcm_block_expand_i(
+ void *priv,
unsigned chans, /* total channels */
int nCoef,
const short *coef,
diff --git a/src/wav.c b/src/wav.c
index 3e80e69..f7e72c2 100644
--- a/src/wav.c
+++ b/src/wav.c
@@ -82,6 +82,7 @@ typedef struct {
/* following used by *ADPCM wav files */
unsigned short nCoefs; /* ADPCM: number of coef sets */
short *lsx_ms_adpcm_i_coefs; /* ADPCM: coef sets */
+ void *ms_adpcm_data; /* Private data of adpcm decoder */
unsigned char *packet; /* Temporary buffer for packets */
short *samples; /* interleaved samples buffer */
short *samplePtr; /* Pointer to current sample */
@@ -175,7 +176,7 @@ static unsigned short AdpcmReadBlock(sox_format_t * ft)
}
}
- errmsg = lsx_ms_adpcm_block_expand_i(ft->signal.channels, wav->nCoefs, wav->lsx_ms_adpcm_i_coefs, wav->packet, wav->samples, samplesThisBlock);
+ errmsg = lsx_ms_adpcm_block_expand_i(wav->ms_adpcm_data, ft->signal.channels, wav->nCoefs, wav->lsx_ms_adpcm_i_coefs, wav->packet, wav->samples, samplesThisBlock);
if (errmsg)
lsx_warn("%s", errmsg);
@@ -786,6 +787,7 @@ static int startread(sox_format_t * ft)
/* nCoefs, lsx_ms_adpcm_i_coefs used by adpcm.c */
wav->lsx_ms_adpcm_i_coefs = lsx_malloc(wav->nCoefs * 2 * sizeof(short));
+ wav->ms_adpcm_data = lsx_ms_adpcm_alloc(wChannels);
{
int i, errct=0;
for (i=0; len>=2 && i < 2*wav->nCoefs; i++) {
@@ -1211,6 +1213,7 @@ static int stopread(sox_format_t * ft)
free(wav->packet);
free(wav->samples);
free(wav->lsx_ms_adpcm_i_coefs);
+ free(wav->ms_adpcm_data);
free(wav->comment);
wav->comment = NULL;

View File

@ -0,0 +1,25 @@
From ef3d8be0f80cbb650e4766b545d61e10d7a24c9e Mon Sep 17 00:00:00 2001
From: Mans Rullgard <mans@mansr.com>
Date: Sun, 5 Nov 2017 16:21:23 +0000
Subject: [PATCH] wav: ima_adpcm: fix buffer overflow on corrupt input
(CVE-2017-15370)
Add the same check bad block size as was done for MS adpcm in commit
f39c574b ("More checks for invalid MS ADPCM blocks").
---
src/wav.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/wav.c b/src/wav.c
index 5202556c..3e80e692 100644
--- a/src/wav.c
+++ b/src/wav.c
@@ -127,7 +127,7 @@ static unsigned short ImaAdpcmReadBlock(sox_format_t * ft)
/* work with partial blocks. Specs say it should be null */
/* padded but I guess this is better than trailing quiet. */
samplesThisBlock = lsx_ima_samples_in((size_t)0, (size_t)ft->signal.channels, bytesRead, (size_t) 0);
- if (samplesThisBlock == 0)
+ if (samplesThisBlock == 0 || samplesThisBlock > wav->samplesPerBlock)
{
lsx_warn("Premature EOF on .wav input file");
return 0;

View File

@ -0,0 +1,37 @@
From 818bdd0ccc1e5b6cae742c740c17fd414935cf39 Mon Sep 17 00:00:00 2001
From: Mans Rullgard <mans@mansr.com>
Date: Sun, 5 Nov 2017 15:57:48 +0000
Subject: [PATCH] flac: fix crash on corrupt metadata (CVE-2017-15371)
---
src/flac.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Index: sox/src/flac.c
===================================================================
--- sox.orig/src/flac.c
+++ sox/src/flac.c
@@ -119,9 +119,10 @@ static void decoder_metadata_callback(FL
p->total_samples = metadata->data.stream_info.total_samples;
}
else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+ const FLAC__StreamMetadata_VorbisComment *vc = &metadata->data.vorbis_comment;
size_t i;
- if (metadata->data.vorbis_comment.num_comments == 0)
+ if (vc->num_comments == 0)
return;
if (ft->oob.comments != NULL) {
@@ -129,8 +130,9 @@ static void decoder_metadata_callback(FL
return;
}
- for (i = 0; i < metadata->data.vorbis_comment.num_comments; ++i)
- sox_append_comment(&ft->oob.comments, (char const *) metadata->data.vorbis_comment.comments[i].entry);
+ for (i = 0; i < vc->num_comments; ++i)
+ if (vc->comments[i].entry)
+ sox_append_comment(&ft->oob.comments, (char const *) vc->comments[i].entry);
}
}

View File

@ -0,0 +1,20 @@
diff --git a/src/aiff.c b/src/aiff.c
index 240d2e1..11ddb54 100644
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -62,7 +62,6 @@ int lsx_aiffstartread(sox_format_t * ft)
size_t ssndsize = 0;
char *annotation;
char *author;
- char *comment = NULL;
char *copyright;
char *nametext;
@@ -270,6 +269,7 @@ int lsx_aiffstartread(sox_format_t * ft)
free(annotation);
}
else if (strncmp(buf, "COMT", (size_t)4) == 0) {
+ char *comment = NULL;
rc = commentChunk(&comment, "Comment:", ft);
if (rc) {
/* Fail already called in function */

View File

@ -0,0 +1,47 @@
From f4853a8119d22096fbe9fd076799a105e3b3abb7 Mon Sep 17 00:00:00 2001
From: Jiri Kucera <jkucera@redhat.com>
Date: Tue, 30 Jan 2018 00:29:19 +0100
Subject: [PATCH] Fixed FSF address
---
src/ladspa.h | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/ladspa.h b/src/ladspa.h
index 5c30a8a..299412b 100644
--- a/src/ladspa.h
+++ b/src/ladspa.h
@@ -3,21 +3,20 @@
Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
Stefan Westerfeld.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License
- as published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or (at
+ your option) any later version.
+
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA. */
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
+ General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef LADSPA_INCLUDED
#define LADSPA_INCLUDED

View File

@ -0,0 +1,44 @@
diff --git a/src/hcom.c b/src/hcom.c
index e76820e..fb8de99 100644
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -428,12 +428,19 @@ static int stopwrite(sox_format_t * ft)
{
priv_t *p = (priv_t *) ft->priv;
unsigned char *compressed_data = p->data;
- size_t compressed_len = p->pos;
+ int32_t compressed_len = (int32_t)p->pos;
int rc = SOX_SUCCESS;
+ if (p->pos >> 32 > 0)
+ lsx_warn(
+ "%s: possible data loss"
+ " (the size of data to be written has exceeded its limit)",
+ ft->filename
+ );
+
/* Compress it all at once */
if (compressed_len)
- compress(ft, &compressed_data, (int32_t *)&compressed_len);
+ compress(ft, &compressed_data, &compressed_len);
free(p->data);
/* Write the header */
@@ -447,7 +454,7 @@ static int stopwrite(sox_format_t * ft)
if (lsx_error(ft)) {
lsx_fail_errno(ft, errno, "write error in HCOM header");
rc = SOX_EOF;
- } else if (lsx_writebuf(ft, compressed_data, compressed_len) != compressed_len) {
+ } else if (lsx_writebuf(ft, compressed_data, (size_t) compressed_len) != (size_t) compressed_len) {
/* Write the compressed_data fork */
lsx_fail_errno(ft, errno, "can't write compressed HCOM data");
rc = SOX_EOF;
@@ -456,7 +463,7 @@ static int stopwrite(sox_format_t * ft)
if (rc == SOX_SUCCESS)
/* Pad the compressed_data fork to a multiple of 128 bytes */
- lsx_padbytes(ft, 128u - (compressed_len % 128));
+ lsx_padbytes(ft, (size_t) 128 - (compressed_len % 128));
return rc;
}

View File

@ -0,0 +1,23 @@
From 9c0842680a4a46ef64990d6c40de05aa30286d54 Mon Sep 17 00:00:00 2001
From: Jiri Kucera <jkucera@redhat.com>
Date: Thu, 25 Jan 2018 21:53:30 +0100
Subject: [PATCH] Added $(DESTDIR) in front of ${bindir} so proper sox binary
is invoked during tests
---
src/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 7cceaaf..caf9864 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -194,6 +194,6 @@ loc:
# would run the test suite, but an uninstalled libltdl build cannot
# currently load its formats and effects, so the checks would fail.
installcheck:
- $(srcdir)/tests.sh --bindir=${bindir} --builddir=${builddir} --srcdir=${srcdir}
- $(srcdir)/testall.sh --bindir=${bindir} --srcdir=${srcdir}
+ $(srcdir)/tests.sh --bindir=$(DESTDIR)${bindir} --builddir=${builddir} --srcdir=${srcdir}
+ $(srcdir)/testall.sh --bindir=$(DESTDIR)${bindir} --srcdir=${srcdir}

35
sox-14.4.2-lpc10.patch Normal file
View File

@ -0,0 +1,35 @@
diff -Naur sox-14.4.2.orig/configure.ac sox-14.4.2/configure.ac
--- sox-14.4.2.orig/configure.ac 2015-02-22 14:48:57.000000000 -0600
+++ sox-14.4.2/configure.ac 2015-11-06 11:48:26.179858149 -0600
@@ -471,8 +471,6 @@
AC_CHECK_LIB(lpc10, create_lpc10_encoder_state, LPC10_LIBS="$LPC10_LIBS -llpc10", found_liblpc10=no)
if test "$found_liblpc10" = yes; then
AC_DEFINE(EXTERNAL_LPC10, 1, [Define if you are using an external LPC10 library])
-else
- LIBLPC10_LIBADD=../lpc10/liblpc10.la
fi
AM_CONDITIONAL(EXTERNAL_LPC10, test x$found_liblpc10 = xyes)
AC_SUBST(LIBLPC10_LIBADD)
@@ -670,7 +668,7 @@
AM_CONDITIONAL(STATIC_LIBSOX_ONLY, test "$enable_shared" = "no" -a "$enable_static" = "yes")
dnl Generate output files.
-AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile lpc10/Makefile msvc9/Makefile msvc10/Makefile sox.pc)
+AC_CONFIG_FILES(Makefile src/Makefile libgsm/Makefile msvc9/Makefile msvc10/Makefile sox.pc)
AC_OUTPUT
if test "$using_gsm" != "no"; then
diff -Naur sox-14.4.2.orig/Makefile.am sox-14.4.2/Makefile.am
--- sox-14.4.2.orig/Makefile.am 2014-10-05 21:02:30.000000000 -0500
+++ sox-14.4.2/Makefile.am 2015-11-06 11:48:26.179858149 -0600
@@ -2,8 +2,8 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = lpc10 libgsm src
-DIST_SUBDIRS = lpc10 libgsm src msvc9 msvc10
+SUBDIRS = libgsm src
+DIST_SUBDIRS = libgsm src msvc9 msvc10
RM = rm -f

View File

@ -0,0 +1,12 @@
diff -Naur sox-14.4.2.orig/src/Makefile.am sox-14.4.2/src/Makefile.am
--- sox-14.4.2.orig/src/Makefile.am 2014-10-29 22:29:54.000000000 -0500
+++ sox-14.4.2/src/Makefile.am 2015-11-06 09:49:34.466595616 -0600
@@ -95,7 +95,7 @@
libsox_la_CFLAGS = @WARN_CFLAGS@
libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \
- -export-symbols-regex '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|fail_errno|filelength|find_(enum_(text|value)|file_extension)|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$'
+ -export-symbols-regex '^(sox_.*|lsx_(check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|flush|error|eof|fail_errno|filelength|find_(enum_(text|value)|file_extension)|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$'
if HAVE_WIN32_LTDL
libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h

120
sox.spec Normal file
View File

@ -0,0 +1,120 @@
Name: sox
Version: 14.4.2.0
Release: 25
Summary: A general purpose sound file conversion tool
License: GPLv2+ and LGPLv2+ and MIT
URL: http://sox.sourceforge.net/
Source0: https://github.com/i386x/sox-downstream/archive/sox-14.4.2.0.modified.tar.gz
Source1: binpatch.py
Patch0001: sox-14.4.2-lsx_symbols.patch
Patch0002: sox-14.4.2-lpc10.patch
Patch0003: sox-14.4.2-fsf_address_fix.patch
Patch1000: sox-14.4.2-bug_1500570_fix.patch
Patch1001: sox-14.4.2-bug_1500554_fix.patch
Patch1002: sox-14.4.2-bug_1500553_fix.patch
Patch1003: sox-14.4.2-bug_1510923_fix.patch
Patch1004: sox-14.4.2-hcom_stopwrite_big_endian_bug_fix.patch
Patch1005: sox-14.4.2-bug_1226675_fix.patch
Patch1006: sox-14.4.2-bug_1480678_fix.patch
Patch9000: sox-14.4.2-installcheck_fix.patch
BuildRequires: gcc, libvorbis-devel, alsa-lib-devel, libtool-ltdl-devel
BuildRequires: gsm-devel, wavpack-devel, ladspa-devel, libpng-devel
BuildRequires: flac-devel, libao-devel, libsndfile-devel, libid3tag-devel
BuildRequires: pulseaudio-libs-devel, opusfile-devel
BuildRequires: libtool, libmad-devel, lame-devel, twolame-devel
BuildRequires: python3, time, libsamplerate-devel, git
%description
SoX is a cross-platform (Windows, Linux, MacOS X, etc.) command line utility
that can convert various formats of computer audio files in to other formats.
It can also apply various effects to these sound files, and, as an added
bonus, SoX can play and record audio files on most platforms.
%package -n sox-devel
Summary: package of sox development file
Requires: sox = 14.4.2.0-25
Requires: pkgconfig
%description -n sox-devel
This package contains the library needed for compiling applications
which will use the SoX sound file format converter.
%package_help
%prep
%autosetup -n %{name}-downstream-%{name}-%{version}.modified -Sgit -p1
autoreconf -vfi
cp ${RPM_SOURCE_DIR}/binpatch.py binpatch.py
%build
CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
%configure --without-lpc10 --with-gsm --includedir=%{_includedir}/sox \
--disable-static --with-distro=Fedora --with-dyn-default
make V=1 %{?_smp_mflags}
%install
make install DESTDIR=$RPM_BUILD_ROOT
%delete_la_and_a
%check
libsox_so="${RPM_BUILD_ROOT}%{_libdir}/libsox.so"
[[ -L $libsox_so ]] && libsox_so=$(readlink -e $libsox_so) || :
[[ -z "$libsox_so" ]] && {
echo "Path to libsox.so cannot be resolved" >&2
exit 1
}
[[ -f "$libsox_so" ]] || {
echo "$libsox_so is not a file" >&2
exit 1
}
cp $libsox_so $libsox_so.orig
plugins_path=$(python3 binpatch.py $libsox_so)
[[ -z "$plugins_path" ]] && {
echo "$libsox_so cannot be patched" >&2
exit 1
}
mkdir -p $plugins_path
for l in ${RPM_BUILD_ROOT}%{_libdir}/sox/libsox_fmt_*.so; do
cp $l $plugins_path/$(basename $l)
done
PATH=${RPM_BUILD_ROOT}%{_bindir}:$PATH
export PATH
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}%{_libdir}:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
make installcheck DESTDIR=$RPM_BUILD_ROOT
[[ -d /var/tmp/l ]] && rm -rfd /var/tmp/l || :
[[ -d /var/tmp/sox ]] && rm -rfd /var/tmp/sox || :
rm $libsox_so
mv $libsox_so.orig $libsox_so
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%{!?_licensedir:%global license %doc}
%license COPYING
%doc AUTHORS ChangeLog README
%{_bindir}/play
%{_bindir}/rec
%{_bindir}/sox
%{_bindir}/soxi
%{_libdir}/libsox.so.*
%dir %{_libdir}/sox/
%{_libdir}/sox/libsox_fmt_*.so
%files -n sox-devel
%{_includedir}/sox
%{_libdir}/libsox.so
%{_libdir}/pkgconfig/sox.pc
%files help
%{_mandir}/man1/*
%{_mandir}/man7/*
%{_mandir}/man3/*
%changelog
* Mon Dec 9 2019 openEuler Buildteam <buildteam@openeuler.org> - 14.4.2.0-25
- Package init