Stefan Hagen writes:
> Stuart Henderson wrote:
>> On 2021/07/03 15:43, Nam Nguyen wrote:
>>> - Since maintaining this many patches is clunky, should we consider
>>> mirroring the latest git checkout?
>>
>> I don't have any feel for what shape the upstream code is in, though
>> that is often safer than taking a big set of patches and hoping that
>> they don't rely on something else that was committed but not picked up
>> in the patches.. Other OS must have this problem too, it would be really
>> helpful if there was a newer release that everyone could move to, rather
>> than separately wrangling patches.
>
> Hmm, upstream considers git master the "best version":
>
> https://sourceforge.net/p/sox/mailman/message/37254884/
>
> What about mirroring the latest git checkout at the start of the OpenBSD
> release cycle, so it's tested well over the next months?
>
> Best Regards,
> Stefan
Here is a diff implementing sdk@'s suggestion to mirror git. This leaves
the port in a better state security-wise and can hold us over until the
next sox release.
This diff:
- mirrors git checkout as a release tarball
- bumps library minor to 4.1 because of addition of symbols
- removes iconv from WANTLIB and LIB_DEPENDS as reported by make
port-lib-depends-check
- renames CONFIGURE_ARGS
- compile extras target during do-test
- removes upstreamed patches
Release tarball
---------------
I prepared a release tarball from a checkout:
install groff for tbl and nroff
install autoconf-archive, autoconf and automake
edit src/Makefile.am append "libsox.sym" to EXTRA_DIST (needed to avoid
compilation error)
edit configure.ac: 14.4.3git --> 14.4.2pl20210509
$ AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.16 autoreconf-2.69 -i
$ ./configure
$ gmake dist
Minor bump
----------
Minor increased because check_sym reports new lsx_* symbols. According
to the top of ${WRKSRC}/src/sox.h, "lsx_" or "LSX_" are internal use,
but bump it anyways due their visibility. (sox_* are part of the public
interface.)
check_sym: https://namtsui.com/public/sox_sym.txt
Also, datatypes changed in ${WRKSRC}/src/sox.h.
See:
https://sourceforge.net/p/sox/code/ci/3518bcd92416e7cf71ee9a863695a518f3de4e52/
/usr/src/sys/sys/types.h
/usr/src/sys/sys/stdint.h
/usr/src/sys/arch/i386/include/_types.h
/usr/src/sys/sys/limits.h
Based on this, the only difficult one was long --> long long.
-#if LONG_MAX==9223372036854775807 && LONG_MIN==(-9223372036854775807-1)
-typedef long sox_int64_t;
-#elif defined(_MSC_VER)
-typedef __int64 sox_int64_t;
-#else
-typedef long long sox_int64_t;
-#endif
+typedef int64_t sox_int64_t;
>From this I read sox_int64_t's type definition before --> after:
amd64: long --> long long
i386: long long --> long long
Conclusion: Types changed in a compatible way because it goes from a
smaller to bigger datatype, so no need to major bump. sox_uint64_t also
falls under this.
do-test
-------
This gets printed during the wav <--> voc test.
./.libs/sox FAIL sox: `intermediate.voc' premature EOF: Inappropriate ioctl for
device
ok channels=2 "u8 in wav" <--> "voc".
I debugged it a bit, and it doesn't seem like a problem. The point of
the test is to do the following:
$ doas -u _pbuild ./.libs/sox -RD -r 8000 -c 2 -n -e unsigned -b 8 input.wav
synth 23493's' sin 300-3300 noise trapezium
$ doas -u _pbuild ./.libs/sox -RD -r 8000 -c 2 -e unsigned -b 8 input.wav
intermediate.voc
$ doas -u _pbuild ./.libs/sox -RD -r 8000 -c 2 intermediate.voc -e unsigned -b
8 output.wav
cmp eventually shows that input.wav and the produced output.wav are the
same, and the unit test still passes with an ok. I debugged a bit but it
gracefully recovers from EOF while reading intermediate.voc. The error
message gets printed at sox.c:473 inside sox_read_wide.
opus
----
make port-lib-depends still wants to remove opus from WANTLIB, which is
new behavior. I do not know why. However, it is probably just fine to
leave it in for clarity. sox uses opusfile, which depends on opus
anyways.
Testing
-------
I successfully tested some consumers:
multimedia/imagination
mlt
mlt7
audio/pacpl
Feedback and tests are welcome. OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/sox/Makefile,v
retrieving revision 1.72
diff -u -p -u -p -r1.72 Makefile
--- Makefile 12 Jul 2019 20:43:41 -0000 1.72
+++ Makefile 29 Oct 2021 05:00:23 -0000
@@ -4,9 +4,9 @@ BROKEN-hppa = bend.c:155:12: internal co
COMMENT= Sound eXchange, the Swiss Army knife of audio manipulation
-DISTNAME= sox-14.4.2
-REVISION= 5
-SHARED_LIBS += sox 4.0 # 3.0
+V= 14.4.2pl20210509
+DISTNAME= sox-${V}
+SHARED_LIBS += sox 4.1 # 3.0
CATEGORIES= audio
HOMEPAGE= http://sox.sourceforge.net/
@@ -19,9 +19,9 @@ WANTLIB += c m z sndio
WANTLIB += FLAC gsm mad id3tag mp3lame ogg
WANTLIB += sndfile vorbis vorbisenc vorbisfile
WANTLIB += opus opusfile twolame wavpack
-WANTLIB += iconv png
+WANTLIB += png
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=sox/}
+MASTER_SITES= https://namtsui.com/source/
# see CONFIGURE_ARGS below
LIB_DEPENDS= \
@@ -37,13 +37,11 @@ LIB_DEPENDS= \
audio/opusfile \
audio/twolame \
audio/wavpack \
- converters/libiconv \
graphics/png
CONFIGURE_STYLE=gnu
CONFIGURE_ARGS= --datarootdir=${LOCALBASE} \
--enable-largefile \
- --disable-silent-libtool \
--disable-openmp \
--enable-symlinks \
--without-libltdl \
@@ -51,14 +49,14 @@ CONFIGURE_ARGS= --datarootdir=${LOCALBAS
# Sound drivers
CONFIGURE_ARGS+= \
- --without-ao \
- --without-oss \
- --without-alsa \
- --without-coreaudio \
- --without-pulseaudio \
- --without-waveaudio \
- --without-sunaudio \
- --with-sndio
+ --disable-ao \
+ --disable-oss \
+ --disable-alsa \
+ --disable-coreaudio \
+ --disable-pulseaudio \
+ --disable-waveaudio \
+ --disable-sunaudio \
+ --enable-sndio
# Additional file formats
CONFIGURE_ARGS+= \
@@ -69,22 +67,23 @@ CONFIGURE_ARGS+= \
--with-id3tag \
--with-lame \
--with-twolame \
- --with-oggvorbis \
- --with-opus \
- --with-flac \
- --without-amrwb \
- --without-amrnb \
- --with-wavpack \
- --with-sndfile \
- --with-mp3 \
- --with-gsm \
- --with-lpc10
+ --enable-formats=no \
+ --enable-flac \
+ --enable-gsm \
+ --enable-lpc10 \
+ --enable-mp3 \
+ --enable-oggvorbis \
+ --enable-opus \
+ --enable-sndfile \
+ --enable-wavpack
CONFIGURE_ENV= \
CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
do-test:
+ @cd ${WRKSRC}/src && env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \
+ -f ${MAKE_FILE} extras
@cd ${WRKSRC}/src && ./tests.sh && ./testall.sh
# Attempt to avoid SIGILL in gcc.
Index: distinfo
===================================================================
RCS file: /cvs/ports/audio/sox/distinfo,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 distinfo
--- distinfo 18 Mar 2015 13:13:08 -0000 1.14
+++ distinfo 29 Oct 2021 05:00:23 -0000
@@ -1,2 +1,2 @@
-SHA256 (sox-14.4.2.tar.gz) = tF9ZhkP/vY42P/JNYRZszsSDb+ptOIiIG431Pju1X2w=
-SIZE (sox-14.4.2.tar.gz) = 1134299
+SHA256 (sox-14.4.2pl20210509.tar.gz) =
AojNoMs4eRcSDgWHrglM7az83dK9lTuWwnoxw/QGEnY=
+SIZE (sox-14.4.2pl20210509.tar.gz) = 1013607
Index: patches/patch-src_formats_c
===================================================================
RCS file: /cvs/ports/audio/sox/patches/patch-src_formats_c,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 patch-src_formats_c
--- patches/patch-src_formats_c 18 Mar 2015 13:13:08 -0000 1.6
+++ patches/patch-src_formats_c 29 Oct 2021 05:00:23 -0000
@@ -1,7 +1,8 @@
$OpenBSD: patch-src_formats_c,v 1.6 2015/03/18 13:13:08 naddy Exp $
---- src/formats.c.orig Mon Oct 27 03:55:50 2014
-+++ src/formats.c Tue Feb 24 17:07:28 2015
-@@ -353,7 +353,7 @@ static int sox_checkformat(sox_format_t * ft)
+Index: src/formats.c
+--- src/formats.c.orig
++++ src/formats.c
+@@ -360,7 +360,7 @@ static int sox_checkformat(sox_format_t * ft)
return SOX_SUCCESS;
}
@@ -10,7 +11,7 @@ $OpenBSD: patch-src_formats_c,v 1.6 2015
{
return !(
strncasecmp(text, "http:" , (size_t)5) &&
-@@ -390,7 +390,7 @@ static FILE * xfopen(char const * identifier, char con
+@@ -442,7 +442,7 @@ static FILE * xfopen(char const * identifier, char con
else if (is_url(identifier)) {
FILE * f = NULL;
#ifdef HAVE_POPEN
Index: patches/patch-src_sndio_c
===================================================================
RCS file: patches/patch-src_sndio_c
diff -N patches/patch-src_sndio_c
--- patches/patch-src_sndio_c 21 Sep 2016 11:40:14 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
-$OpenBSD: patch-src_sndio_c,v 1.1 2016/09/21 11:40:14 ratchov Exp $
---- src/sndio.c.orig Mon Jan 30 04:01:44 2012
-+++ src/sndio.c Tue Feb 9 23:23:00 2016
-@@ -113,8 +113,6 @@ static int startany(sox_format_t *ft, unsigned mode)
- else
- reqpar.rchan = ft->signal.channels;
- }
-- if (ft->signal.precision > 0)
-- reqpar.bits = ft->signal.precision;
- switch (ft->encoding.encoding) {
- case SOX_ENCODING_SIGN2:
- reqpar.sig = 1;
-@@ -127,6 +125,12 @@ static int startany(sox_format_t *ft, unsigned mode)
- }
- if (ft->encoding.bits_per_sample > 0)
- reqpar.bits = ft->encoding.bits_per_sample;
-+ else if (ft->signal.precision > 0)
-+ reqpar.bits = ft->signal.precision;
-+ else
-+ reqpar.bits = SOX_DEFAULT_PRECISION;
-+ reqpar.bps = (reqpar.bits + 7) / 8;
-+ reqpar.msb = 1;
- if (ft->encoding.reverse_bytes != sox_option_default) {
- reqpar.le = SIO_LE_NATIVE;
- if (ft->encoding.reverse_bytes)
Index: patches/patch-src_sox_h
===================================================================
RCS file: patches/patch-src_sox_h
diff -N patches/patch-src_sox_h
--- patches/patch-src_sox_h 22 Sep 2016 19:58:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-src_sox_h,v 1.1 2016/09/22 19:58:22 sthen Exp $
---- src/sox.h.orig Mon Oct 6 03:02:30 2014
-+++ src/sox.h Tue Sep 20 11:14:30 2016
-@@ -44,7 +44,7 @@ Plugins API:
- Attribute required on all functions exported by libSoX and on all function
- pointer types used by the libSoX API.
- */
--#ifdef __GNUC__
-+#if defined(__GNUC__) && defined(__i386)
- #define LSX_API __attribute__ ((cdecl)) /* libSoX function */
- #elif _MSC_VER
- #define LSX_API __cdecl /* libSoX function */
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/audio/sox/pkg/PLIST,v
retrieving revision 1.9
diff -u -p -u -p -r1.9 PLIST
--- pkg/PLIST 18 Mar 2015 13:13:08 -0000 1.9
+++ pkg/PLIST 29 Oct 2021 05:00:23 -0000
@@ -7,7 +7,7 @@ bin/rec
@bin bin/sox
bin/soxi
include/sox.h
-lib/libsox.a
+@static-lib lib/libsox.a
lib/libsox.la
@lib lib/libsox.so.${LIBsox_VERSION}
lib/pkgconfig/sox.pc