sox/sox.spec
2024-02-01 09:07:19 +08:00

154 lines
4.8 KiB
RPMSpec

Name: sox
Version: 14.4.2.0
Release: 30
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
# - upstream patch: https://sourceforge.net/p/sox/mailman/sox-devel/thread/20180426131552.29249-9-mans@mansr.com/#msg36303839
Patch1007: CVE-2017-18189.patch
# https://sources.debian.org/src/sox/14.4.2%252Bgit20190427-4/debian/patches/
Patch1008: CVE-2021-33844.patch
Patch1009: CVE-2023-32627.patch
# CVE-2021-23159 is the same as CVE-2023-34432,CVE-2023-34318,CVE-2021-23172
Patch1010: CVE-2021-23159.patch
# CVE-2021-3643 is the same as CVE-2021-23210
Patch1011: CVE-2021-3643.patch
# CVE-2022-31650 is the same as CVE-2023-26590
Patch1012: CVE-2022-31650.patch
Patch1013: CVE-2022-31651.patch
Patch1014: CVE-2021-40426.patch
# Tests:
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
%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: %{name} = %{version}-%{release}
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 -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=%{_vendor} --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
* Sun Dec 24 2023 liningjie <liningjie@xfusion.com> - 14.4.2.0-30
- DESC: apply CVE-2021-40426.patch
* Thu Dec 07 2023 yaqiangchen <chenyaqiang@huawei.com> - 14.4.2.0-29
- Fix CVE-2021-33844,CVE-2023-32627,CVE-2021-23159,CVE-2023-34432
- CVE-2023-34318,CVE-2021-23172,CVE-2021-3643,CVE-2021-23210
- CVE-2022-31650,CVE-2023-26590,CVE-2022-31651,CVE-2023-32627
- CVE-2017-18189
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 14.4.2.0-28
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git
* Fri Apr 3 2020 duyeyu <duyeyu@huawei.com> - 14.4.2.0-27
- Modify configure parameters
* Thu Mar 12 2020 Jiangping Hu <hujp1985@foxmail.com> - 14.4.2.0-26
- Fix a require of devel package
* Mon Dec 9 2019 openEuler Buildteam <buildteam@openeuler.org> - 14.4.2.0-25
- Package init