Here is a diff incorporating sthen@'s feedback and tj@'s feedback to add
a comment about mirroring.

Stuart Henderson writes:

> On 2021/10/28 22:36, Nam Nguyen wrote:
>> 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
>
> I would prefer it if those extra steps were done in the port, either as
> a "dist" target to generate the tar, or as steps in the normal build
> so that it can use an unmodified archive from git. Alternatively (less
> preferred but I would still be ok with it) with comments showing how
> to do it. Bsaically so that somebody else wanting to update it doesn't
> need to figure it out for themselves.

It has a new dist target copied from net/librenms. scp is sent to my
server, so that would have to be modified. GIT_V is also set to
14.4.3git. I use `make dist' instead of `gmake dist' and it still seems
to work.

I had to add some BUILD_DEPENDS for the dist target: autoconf, automake,
libtool, groff and autoconf-archive. I retain CONFIURE_STYLE=gnu.

> Could you remove that please - sox doesn't use libopus functions directly,
> only uses other libraries which call those functions. This changed because
> sox now uses -Wl,--as-needed.

`make port-lib-depends' wants to remove LIB_DEPENDS=audio/opus but I
kept it in for clarity. I removed WANTLIB opus.

>
>> -    --without-amrwb         \
>> -    --without-amrnb         \
>
>> +    --enable-formats=no     \
>
> Though --enable-formats=no stops it from building the amr format
> support, I think it would be better to disable it detecting it at all,
> i.e.
>
>       --without-opencore-amrnb \
>       --without-opencore-amrwb \

It complains about "configure: WARNING: unrecognized options:
--without-opencore-amrnb, --without-opencore-amrwb."

As intended, it still skips over the check because this used to be
printed but is no longer printed:

checking for opencore-amrnb/interf_dec.h... no
checking for opencore-amrwb/dec_if.h... no

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    30 Oct 2021 21:20:51 -0000
@@ -1,12 +1,12 @@
 # $OpenBSD: Makefile,v 1.72 2019/07/12 20:43:41 sthen Exp $
 
-BROKEN-hppa =  bend.c:155:12: internal compiler error: in 
expand_expr_addr_expr_1, at expr.c:7697
-
 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
+# see AC_INIT in ${WRKSRC}/configure.ac
+GIT_V=         14.4.3git
+DISTNAME=      sox-${V}
+SHARED_LIBS += sox 4.1 # 3.0
 
 CATEGORIES=    audio
 HOMEPAGE=      http://sox.sourceforge.net/
@@ -18,10 +18,15 @@ PERMIT_PACKAGE=     Yes
 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 += opusfile twolame wavpack
+WANTLIB += png
+
+GITWEB_URL=    https://sourceforge.net/code-snapshots/git
+GIT_COMMIT=    42b3557e13e0fe01a83465b672d89faddbe65f49
 
-MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=sox/}
+# mirror git checkout as tarball for latest fixes until new release.
+# see dist: target and `make dist' to generate tarball.
+MASTER_SITES=  https://namtsui.com/source/
 
 # see CONFIGURE_ARGS below
 LIB_DEPENDS=                   \
@@ -37,58 +42,81 @@ LIB_DEPENDS=                        \
        audio/opusfile          \
        audio/twolame           \
        audio/wavpack           \
-       converters/libiconv     \
        graphics/png
 
 CONFIGURE_STYLE=gnu
+
+AUTOCONF_VERSION=      2.69
+AUTOMAKE_VERSION=      1.16
+BUILD_DEPENDS=         ${MODGNU_AUTOCONF_DEPENDS} \
+                       ${MODGNU_AUTOMAKE_DEPENDS} \
+                       devel/libtool \
+                       textproc/groff \
+                       devel/autoconf-archive
+
 CONFIGURE_ARGS=        --datarootdir=${LOCALBASE}      \
-       --enable-largefile              \
-       --disable-silent-libtool        \
-       --disable-openmp                \
-       --enable-symlinks               \
-       --without-libltdl               \
+       --enable-largefile                      \
+       --enable-symlinks                       \
+       --without-libltdl                       \
+       --disable-openmp                        \
        --with-distro=OpenBSD
 
 # 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+=               \
-       --without-magic         \
-       --with-png              \
-       --without-ladspa        \
-       --with-mad              \
-       --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
+CONFIGURE_ARGS+=                       \
+       --with-id3tag                   \
+       --with-lame                     \
+       --with-mad                      \
+       --without-magic                 \
+       --without-opencore-amrnb        \
+       --without-opencore-amrwb        \
+       --with-png                      \
+       --with-twolame                  \
+       --disable-amrnb                 \
+       --disable-amrwb                 \
+       --enable-flac                   \
+       --enable-gsm                    \
+       --enable-lpc10                  \
+       --enable-mp3                    \
+       --enable-oggvorbis              \
+       --enable-opus                   \
+       --enable-sndfile                \
+       --enable-wavpack                \
+       --without-ladspa
 
 CONFIGURE_ENV= \
        CPPFLAGS="-I${LOCALBASE}/include" \
        LDFLAGS="-L${LOCALBASE}/lib"
 
+dist:
+       ftp -o /tmp/sox-code-${GIT_COMMIT}.zip \
+               ${GITWEB_URL}/s/so/sox/code.git/sox-code-${GIT_COMMIT}.zip; \
+       t=`mktemp -d /tmp/sox.XXXXXXXXXX`; \
+       f=$$t/sox-code-${GIT_COMMIT}/${DISTNAME}.tar.gz; \
+       cd $$t; \
+       unzip /tmp/sox-code-${GIT_COMMIT}.zip; \
+       cd sox-code-${GIT_COMMIT}; \
+       echo "EXTRA_DIST += libsox.sym" >> ./src/Makefile.am; \
+       sed -ie "s/${GIT_V}/${V}/g" ./configure.ac; \
+       env -i ${MAKE_ENV} autoreconf-${AUTOCONF_VERSION} -i && \
+       ./configure &&  \
+       ${MAKE_PROGRAM} dist; \
+       scp $$f train:source/; \
+       cd -; rm -rf $$t; rm -f /tmp/sox-code-${GIT_COMMIT}.zip;
+
 do-test:
+       @cd ${WRKSRC}/src && ${MAKE_PROGRAM} ${MAKE_FLAGS} \
+               -f ${MAKE_FILE} extras
        @cd ${WRKSRC}/src && ./tests.sh && ./testall.sh
-
-# Attempt to avoid SIGILL in gcc.
-MODULES+=      gcc4
-MODGCC4_ARCHS= hppa
 
 .include <bsd.port.mk>
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    30 Oct 2021 21:20:51 -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) = 
V/qDSH4yoxHteEaVT5P0qciuplLDRJt2Cs7WquyFiNk=
+SIZE (sox-14.4.2pl20210509.tar.gz) = 1013680
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 30 Oct 2021 21:20:51 -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   30 Oct 2021 21:20:51 -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

Reply via email to