audio/rawrec: Fix port issues

- Makefile WWW link bad - fix it

 - Clean portlint nit

 - Change patches to avoid REINPLACE_CMD

 - Initialize sigaction structures better

 - Remove commenting out of pthread_attr_scope stuff since FreeBSD
   supports that now

Should be no functional change

PR:		277461
Approved by:	antonfb@hesiod.org (maintainer)
This commit is contained in:
Craig Leres 2024-03-03 15:33:26 -08:00
parent 29dc7d8bc6
commit b087fefc9c
10 changed files with 71 additions and 133 deletions

View file

@ -1,33 +1,35 @@
PORTNAME= rawrec PORTNAME= rawrec
PORTVERSION= 0.9.991 PORTVERSION= 0.9.991
PORTREVISION= 1 PORTREVISION= 2
CATEGORIES= audio CATEGORIES= audio
MASTER_SITES= SUNSITE/apps/sound/recorders \ MASTER_SITES= SUNSITE/apps/sound/recorders \
SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION} SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}
MAINTAINER= antonfb@hesiod.org MAINTAINER= antonfb@hesiod.org
COMMENT= Utility to record and playback raw audio data COMMENT= Utility to record and playback raw audio data
WWW= http://rawrec.sourceforge.net/ WWW= https://sourceforge.net/projects/rawrec/
LICENSE= GPLv2+ LICENSE= GPLv2+
LICENSE_FILE= ${WRKDIR}/${DISTNAME}/copyright LICENSE_FILE= ${WRKDIR}/${DISTNAME}/copyright
USES= gmake
WRKSRC= ${WRKDIR}/${DISTNAME}/src WRKSRC= ${WRKDIR}/${DISTNAME}/src
USES= gmake MAKE_ARGS= CC="${CC}" \
MAKE_ARGS= CC="${CC}" CFLAGS="${CPPFLAGS} ${CFLAGS}" \ CFLAGS="${CPPFLAGS} ${CFLAGS}" \
LDFLAGS="${LDFLAGS} -lm -lpthread" LDFLAGS="${LDFLAGS} -lm -lpthread"
PLIST_FILES= bin/rawplay bin/rawrec share/man/man1/rawplay.1.gz share/man/man1/rawrec.1.gz PLIST_FILES= bin/rawplay \
bin/rawrec \
post-patch: share/man/man1/rawplay.1.gz \
@${FIND} ${WRKSRC} -name '*.[ch]' | ${XARGS} ${REINPLACE_CMD} -e \ share/man/man1/rawrec.1.gz
's|<linux/soundcard.h>|<sys/soundcard.h>|g'
do-install: do-install:
${INSTALL_PROGRAM} ${WRKSRC}/rawrec ${STAGEDIR}${PREFIX}/bin ${INSTALL_PROGRAM} ${WRKSRC}/rawrec ${STAGEDIR}${PREFIX}/bin
${LN} -sf rawrec ${STAGEDIR}${PREFIX}/bin/rawplay ${LN} -sf rawrec ${STAGEDIR}${PREFIX}/bin/rawplay
${INSTALL_MAN} ${WRKSRC}/../docs/user/rawrec.1 ${STAGEDIR}${PREFIX}/share/man/man1 ${INSTALL_MAN} ${WRKSRC}/../docs/user/rawrec.1 \
${STAGEDIR}${PREFIX}/share/man/man1
${LN} -sf rawrec.1 ${STAGEDIR}${PREFIX}/share/man/man1/rawplay.1 ${LN} -sf rawrec.1 ${STAGEDIR}${PREFIX}/share/man/man1/rawplay.1
.include <bsd.port.mk> .include <bsd.port.mk>

View file

@ -0,0 +1,11 @@
--- audio_init.c.orig 2006-01-05 17:36:27 UTC
+++ audio_init.c
@@ -20,7 +20,7 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <linux/soundcard.h>
+#include <sys/soundcard.h>
#include "rawrec.h"

View file

@ -0,0 +1,11 @@
--- get_au_blksz.c.orig 2006-01-05 17:36:27 UTC
+++ get_au_blksz.c
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <linux/soundcard.h>
+#include <sys/soundcard.h>
#include "rawrec.h"

View file

@ -0,0 +1,11 @@
--- get_format_code.c.orig 2006-01-05 17:36:27 UTC
+++ get_format_code.c
@@ -7,7 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <linux/soundcard.h>
+#include <sys/soundcard.h>
#include "rawrec.h"

View file

@ -1,23 +1,11 @@
--- main.c.orig 2006-01-22 02:40:17 UTC --- main.c.orig 2006-01-22 02:40:17 UTC
+++ main.c +++ main.c
@@ -14,6 +14,12 @@ @@ -119,6 +119,8 @@ int main(int argc, char *argv[])
#include "rawrec.h"
+size_t strnlen (const char *string, size_t maxlen)
+{
+ const char *end = memchr (string, '\0', maxlen);
+ return end ? (size_t) (end - string) : maxlen;
+}
+
int main(int argc, char *argv[])
{
/* Action for ignoring signals we don't want to deal with. */
@@ -118,6 +124,7 @@ int main(int argc, char *argv[])
strncpy(cnst_dflt_format, "s16_le", (size_t) (MAX_FORMAT_STRING_LENGTH + 1));
/* at the moment, this application goes with the default for most signals */ /* at the moment, this application goes with the default for most signals */
+ ignorer_act.sa_flags = 0;
ignorer_act.sa_handler = SIG_IGN; ignorer_act.sa_handler = SIG_IGN;
+ ignorer_act.sa_flags = 0;
+ sigemptyset(&ignorer_act.sa_mask);
/* because I'm unclear on how SIGIO is supposed to work, it's not /* because I'm unclear on how SIGIO is supposed to work, it's not
applicable here, and I'm paranoid */ applicable here, and I'm paranoid */
if ( sigaction(SIGIO, &ignorer_act, NULL) == -1 )

View file

@ -1,49 +0,0 @@
--- play.c.orig 2006-01-22 02:40:17 UTC
+++ play.c
@@ -54,7 +54,6 @@ void play(parameters_stt *clp) /* pneumo
int rtn; /* For return values of pthread fctns. */
/* Maximum priority of FIFO thread. Should always be initialized
elsewhere before use. */
- int fifo_max_prio = 0;
void *au_th_ret; /* Audio thread return pointer. */
void *fd_th_ret; /* File thread return pointer. */
sigset_t all_sigs; /* Full set of all signals. */
@@ -263,6 +262,10 @@ void play(parameters_stt *clp) /* pneumo
PTHREAD_CREATE_JOINABLE)) ) {
err_die("BUG: pthread_attr_setdetachstate failed: %s\n", strerror(rtn));
}
+
+/* This is ugly, but FreeBSD defines _POSIX_THREAD_PRIORITY_SCHEDULING
+ but it does not support PTHREAD_SCOPE_SYSTEM
+
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != -1 \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != 0
@@ -282,6 +285,8 @@ void play(parameters_stt *clp) /* pneumo
err_die("BUG: pthread_attr_setscope failed: %s\n", strerror(rtn));
}
#endif
+*/
+
if ( (rtn = pthread_attr_init(&move_fd_attr)) )
err_die("BUG: pthread_attr_init failed: %s\n", strerror(rtn));
if ( (rtn = pthread_attr_setdetachstate(&move_fd_attr,
@@ -289,6 +294,9 @@ void play(parameters_stt *clp) /* pneumo
err_die("BUG: pthread_attr_setdetachstate failed: %s\n", strerror(rtn));
}
+/* This is ugly, but FreeBSD defines _POSIX_THREAD_PRIORITY_SCHEDULING
+ but it does not support PTHREAD_SCOPE_SYSTEM
+
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != -1 \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != 0
@@ -306,7 +314,7 @@ void play(parameters_stt *clp) /* pneumo
err_die("BUG: pthread_attr_setscope failed: %s\n", strerror(rtn));
}
#endif
-
+*/
/* Getting ugly. Here we install a handler (which sets a global
flag which the threads can poll in order to do graceful
death). */

View file

@ -1,47 +0,0 @@
--- record.c.orig 2006-01-22 02:40:17 UTC
+++ record.c
@@ -43,7 +43,6 @@ void record(parameters_stt *clp)
int rtn; /* For return values of pthread fctns. */
/* Maximum priority of FIFO thread. Should always be rinitialized
elsewhere before use. */
- int fifo_max_prio = 0;
void *au_th_ret; /* Audio thread return pointer. */
void *fd_th_ret; /* File thread return pointer. */
sigset_t all_sigs; /* Full set of all signals. */
@@ -183,6 +182,10 @@ void record(parameters_stt *clp)
PTHREAD_CREATE_JOINABLE)) ) {
err_die("BUG: pthread_attr_setdetachstate failed: %s\n", strerror(rtn));
}
+
+/* This is ugly, but FreeBSD defines _POSIX_THREAD_PRIORITY_SCHEDULING
+ but it does not support PTHREAD_SCOPE_SYSTEM
+
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != -1 \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != 0
@@ -202,12 +205,17 @@ void record(parameters_stt *clp)
err_die("BUG: pthread_attr_setscope failed: %s\n", strerror(rtn));
}
#endif
+*/
if ( (rtn = pthread_attr_init(&move_fd_attr)) )
err_die("BUG: pthread_attr_init failed: %s\n", strerror(rtn));
if ( (rtn = pthread_attr_setdetachstate(&move_fd_attr,
PTHREAD_CREATE_JOINABLE)) ) {
err_die("BUG: pthread_attr_setdetachstate failed: %s\n", strerror(rtn));
}
+
+/* This is ugly, but FreeBSD defines _POSIX_THREAD_PRIORITY_SCHEDULING
+ but it does not support PTHREAD_SCOPE_SYSTEM
+
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != -1 \
&& _POSIX_THREAD_PRIORITY_SCHEDULING != 0
@@ -225,6 +233,7 @@ void record(parameters_stt *clp)
err_die("BUG: pthread_attr_setscope failed: %s\n", strerror(rtn));
}
#endif
+*/
/* Getting ugly. Here we install a handler (which sets a global
flag which the threads can poll in order to do graceful

View file

@ -0,0 +1,11 @@
--- set_au_blksz.c.orig 2006-01-05 17:36:27 UTC
+++ set_au_blksz.c
@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <linux/soundcard.h>
+#include <sys/soundcard.h>
#include "rawrec.h"

View file

@ -1,11 +0,0 @@
--- sleep_on_option.c.orig 2006-01-05 17:36:27 UTC
+++ sleep_on_option.c
@@ -15,7 +15,7 @@ void sleep_on_option(double time, double
if ( time > samples / speed ) {
reqst.tv_sec = (time_t) floor(time);
- reqst.tv_nsec = (long) nearbyint((time - floor(time)) * 1000000);
+ reqst.tv_nsec = (long) rint((time - floor(time)) * 1000000);
} else {
reqst.tv_sec = (time_t) floor(samples / speed);
reqst.tv_nsec = (long) rint((samples / speed - floor(samples / speed))

View file

@ -0,0 +1,11 @@
--- test_dsp_params.c.orig 2006-01-05 17:36:27 UTC
+++ test_dsp_params.c
@@ -16,7 +16,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
-#include <linux/soundcard.h>
+#include <sys/soundcard.h>
#include "rawrec.h"