Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jul 2024 06:27:27 GMT
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: d0b1d9ec7320 - main - audio/cdparanoia: the port had been updated to version III-10.2
Message-ID:  <202407040627.4646RRsW076207@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d0b1d9ec73207ca2400394af1db811ddcf3d2759

commit d0b1d9ec73207ca2400394af1db811ddcf3d2759
Author:     Tobias Rehbein <tobias.rehbein@web.de>
AuthorDate: 2024-07-04 06:24:52 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2024-07-04 06:24:52 +0000

    audio/cdparanoia: the port had been updated to version III-10.2
    
    - GC no longer useful post-patch target and GNU_CONFIGURE_MANPREFIX
    - Replace stripping in post-install with proper BSD_INSTALL_* calls
    
    PR:     200925
---
 audio/cdparanoia/Makefile                          |  17 +-
 audio/cdparanoia/distinfo                          |   5 +-
 audio/cdparanoia/files/patch-Makefile.in           |  20 +-
 audio/cdparanoia/files/patch-configure             |  15 -
 audio/cdparanoia/files/patch-interface_Makefile.in |  24 +-
 .../files/patch-interface_cdda__interface.h        |  22 +-
 .../files/patch-interface_common__interface.c      |  35 ++-
 audio/cdparanoia/files/patch-interface_interface.c |  36 ++-
 .../files/patch-interface_low__interface.h         |  14 +-
 .../files/patch-interface_scan__devices.c          |  70 +++--
 .../files/patch-interface_scsi__interface.c        | 238 +++++++++-------
 audio/cdparanoia/files/patch-main.c                |  15 +
 audio/cdparanoia/files/patch-paranoia_overlap.c    |  20 ++
 audio/cdparanoia/files/patch-upstream-r15314       | 312 +++++++++++++++++++++
 audio/cdparanoia/files/patch-upstream-r15337       |  31 ++
 audio/cdparanoia/files/patch-version.h             |  17 --
 audio/cdparanoia/pkg-plist                         |   4 +-
 17 files changed, 643 insertions(+), 252 deletions(-)

diff --git a/audio/cdparanoia/Makefile b/audio/cdparanoia/Makefile
index a4ffafa2b436..f839e511f9a6 100644
--- a/audio/cdparanoia/Makefile
+++ b/audio/cdparanoia/Makefile
@@ -1,9 +1,8 @@
 PORTNAME=	cdparanoia
-PORTVERSION=	3.9.8
-PORTREVISION=	10
+PORTVERSION=	3.10.2
 CATEGORIES=	audio sysutils
-MASTER_SITES=	http://www.xiph.org/paranoia/download/
-DISTNAME=	${PORTNAME}-${PORTVERSION:C/^3\./III-alpha/}
+MASTER_SITES=	http://downloads.xiph.org/releases/cdparanoia/
+DISTNAME=	${PORTNAME}-${PORTVERSION:S/^3./III-/}
 EXTRACT_SUFX=	.src.tgz
 
 MAINTAINER=	danfe@FreeBSD.org
@@ -11,18 +10,10 @@ COMMENT=	CDDA extraction tool (also known as ripper)
 WWW=		https://www.xiph.org/paranoia/
 
 LICENSE=	GPLv2
-LICENSE_FILE=	${WRKSRC}/GPL
+LICENSE_FILE=	${WRKSRC}/COPYING-GPL
 
 USES=		gmake
 GNU_CONFIGURE=	yes
-GNU_CONFIGURE_MANPREFIX=	${PREFIX}/share
 USE_LDCONFIG=	yes
 
-post-patch:
-	@${REINPLACE_CMD} -e 's/\(^ *default:\)/\1break;/' \
-		${WRKSRC}/interface/utils.h
-
-post-install:
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libcdda_*.so
-
 .include <bsd.port.mk>
diff --git a/audio/cdparanoia/distinfo b/audio/cdparanoia/distinfo
index 9ceea7f991e6..b7ca0666f4cd 100644
--- a/audio/cdparanoia/distinfo
+++ b/audio/cdparanoia/distinfo
@@ -1,2 +1,3 @@
-SHA256 (cdparanoia-III-alpha9.8.src.tgz) = 1b79fae1aedc692f87d1344410f5c6b666961afccdc78bc5c4c257c450dfa008
-SIZE (cdparanoia-III-alpha9.8.src.tgz) = 116591
+TIMESTAMP = 1221168964
+SHA256 (cdparanoia-III-10.2.src.tgz) = 005db45ef4ee017f5c32ec124f913a0546e77014266c6a1c50df902a55fe64df
+SIZE (cdparanoia-III-10.2.src.tgz) = 183236
diff --git a/audio/cdparanoia/files/patch-Makefile.in b/audio/cdparanoia/files/patch-Makefile.in
index 4137b02ec1aa..a56f00918e26 100644
--- a/audio/cdparanoia/files/patch-Makefile.in
+++ b/audio/cdparanoia/files/patch-Makefile.in
@@ -1,4 +1,4 @@
---- Makefile.in.orig	2001-03-27 22:46:58 UTC
+--- Makefile.in.orig	2019-07-25 21:55:03 UTC
 +++ Makefile.in
 @@ -8,7 +8,7 @@ VPATH=@srcdir@
  srcdir=@srcdir@
@@ -7,23 +7,23 @@
 -FLAGS=@TYPESIZES@ @CFLAGS@
 +FLAGS=@TYPESIZES@ @CPPFLAGS@ @CFLAGS@ -I./interface
  OPT=@OPT@ $(FLAGS)
- DEBUG=@DEBUG@ $(FLAGS)
+ DEBUG=@DEBUG@
  CC=@CC@
 @@ -32,7 +32,7 @@ export VERSION
  
  ifeq ($(STATIC),TRUE)
  	LIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a \
--		-static -lm
-+		-lm -lcam
+-		-static -lm -lrt
++		-lm -lrt -lcam
  	LIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a
  else
- 	LIBS = -lcdda_interface -lcdda_paranoia -lm
-@@ -64,28 +64,27 @@ slib:
+ 	LIBS = -lcdda_interface -lcdda_paranoia -lm -lrt
+@@ -63,28 +63,27 @@ slib:
  	cd paranoia && $(MAKE) slib
  
  install:
 -	$(INSTALL) -d -m 0755 $(BINDIR)
--	$(INSTALL) -m 0755 $(srcdir)/cdparanoia $(BINDIR)
+-	$(INSTALL) -m 755 $(srcdir)/cdparanoia $(BINDIR)
 -	$(INSTALL) -d -m 0755 $(MANDIR)
 -	$(INSTALL) -d -m 0755 $(MANDIR)/man1
 -	$(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(MANDIR)/man1
@@ -37,17 +37,17 @@
 -	$(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(LIBDIR)
 -	$(INSTALL) -m 0644 $(srcdir)/utils.h $(INCLUDEDIR)
 +	$(INSTALL) -d -m 0755 $(DESTDIR)$(BINDIR)
-+	$(INSTALL) -m 0755 $(srcdir)/cdparanoia $(DESTDIR)$(BINDIR)
++	$(BSD_INSTALL_PROGRAM) $(srcdir)/cdparanoia $(DESTDIR)$(BINDIR)
 +	$(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)
 +	$(INSTALL) -d -m 0755 $(DESTDIR)$(MANDIR)/man1
 +	$(INSTALL) -m 0644 $(srcdir)/cdparanoia.1 $(DESTDIR)$(MANDIR)/man1
 +	$(INSTALL) -d -m 0755 $(DESTDIR)$(INCLUDEDIR)
 +	$(INSTALL) -m 0644 $(srcdir)/paranoia/cdda_paranoia.h $(DESTDIR)$(INCLUDEDIR)
 +	$(INSTALL) -d -m 0755 $(DESTDIR)$(LIBDIR)
-+	$(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(DESTDIR)$(LIBDIR)
++	$(BSD_INSTALL_LIB) $(srcdir)/paranoia/libcdda_paranoia.so.0.$(VERSION) $(DESTDIR)$(LIBDIR)
 +	$(INSTALL) -m 0644 $(srcdir)/paranoia/libcdda_paranoia.a $(DESTDIR)$(LIBDIR)
 +	$(INSTALL) -m 0644 $(srcdir)/interface/cdda_interface.h $(DESTDIR)$(INCLUDEDIR)
-+	$(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(DESTDIR)$(LIBDIR)
++	$(BSD_INSTALL_LIB) $(srcdir)/interface/libcdda_interface.so.0.$(VERSION) $(DESTDIR)$(LIBDIR)
 +	$(INSTALL) -m 0644 $(srcdir)/interface/libcdda_interface.a $(DESTDIR)$(LIBDIR)
  	ln -fs libcdda_interface.so.0.$(VERSION) \
 -		$(LIBDIR)/libcdda_interface.so.0
diff --git a/audio/cdparanoia/files/patch-configure b/audio/cdparanoia/files/patch-configure
deleted file mode 100644
index 8bbd2f313ccf..000000000000
--- a/audio/cdparanoia/files/patch-configure
+++ /dev/null
@@ -1,15 +0,0 @@
-Index: configure
-===================================================================
-RCS file: /home/cvs/cdparanoia/configure,v
-retrieving revision 1.1.1.1
-retrieving revision 1.2
---- configure.orig	2000-04-15 15:13:01 UTC
-+++ configure
-@@ -1084,7 +1084,6 @@ EOF
- fi
- 
- 
--CFLAGS=""
- 
- TYPESIZES="" 
- 
diff --git a/audio/cdparanoia/files/patch-interface_Makefile.in b/audio/cdparanoia/files/patch-interface_Makefile.in
index fc54350e5acd..8111c1d30a03 100644
--- a/audio/cdparanoia/files/patch-interface_Makefile.in
+++ b/audio/cdparanoia/files/patch-interface_Makefile.in
@@ -3,25 +3,25 @@ Index: interface/Makefile.in
 RCS file: /home/cvs/cdparanoia/interface/Makefile.in,v
 retrieving revision 1.1.1.1
 retrieving revision 1.3
---- interface/Makefile.in.orig	1999-12-14 04:27:59 UTC
+--- interface/Makefile.in.orig	2008-08-21 16:08:54 UTC
 +++ interface/Makefile.in
 @@ -9,13 +9,13 @@ srcdir=@srcdir@
  @SET_MAKE@
  FLAGS=@SBPCD_H@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@
  OPT=@OPT@ $(FLAGS)
--DEBUG=@DEBUG@ $(FLAGS) -DCDDA_TEST
+-DEBUG=@DEBUG@ -DCDDA_TEST
 +DEBUG=@DEBUG@ $(FLAGS)
  CC=@CC@
  LD=@CC@
  LDFLAGS=@LDFLAGS@ $(FLAGS)
  AR=@AR@
  RANLIB=@RANLIB@
--LIBS = -lm
-+LIBS = -lm -lcam
+-LIBS = -lm -lrt
++LIBS = -lm -lrt -lcam
  CPPFLAGS+=-D_REENTRANT
  
  OFILES = scan_devices.o	common_interface.o cooked_interface.o interface.o\
-@@ -23,19 +23,15 @@ OFILES = scan_devices.o	common_interface
+@@ -23,18 +23,14 @@ OFILES = scan_devices.o	common_interface.o cooked_inte
  
  export VERSION
  
@@ -38,19 +38,9 @@ retrieving revision 1.3
  	$(MAKE) lessmessy
  	$(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic" 
  	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0
- 
++
 +debug:
 +	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
-+
+ 
  test:	
  	$(MAKE) libcdda_interface.a CFLAGS="$(DEBUG)"
- 	$(CC) $(DEBUG) -c test.c
-@@ -46,7 +42,7 @@ libcdda_interface.a: 	$(OFILES)	
- 	$(RANLIB) libcdda_interface.a
- 
- libcdda_interface.so: 	$(OFILES)	
--	$(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES)
-+	$(CC) -fpic -shared -o libcdda_interface.so.0.$(VERSION) -Wl,-soname -Wl,libcdda_interface.so.0 $(OFILES) ${LIBS}
- 	[ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so.0
- 	[ -e libcdda_interface.so ] || ln -s libcdda_interface.so.0.$(VERSION) libcdda_interface.so
- 
diff --git a/audio/cdparanoia/files/patch-interface_cdda__interface.h b/audio/cdparanoia/files/patch-interface_cdda__interface.h
index 5a1e76b22cfa..d6a4a6ea3576 100644
--- a/audio/cdparanoia/files/patch-interface_cdda__interface.h
+++ b/audio/cdparanoia/files/patch-interface_cdda__interface.h
@@ -1,18 +1,20 @@
---- interface/cdda_interface.h.orig	2001-03-24 01:15:46 UTC
+--- interface/cdda_interface.h.orig	2008-09-11 10:43:52 UTC
 +++ interface/cdda_interface.h
-@@ -21,6 +21,11 @@
+@@ -21,6 +21,13 @@
  #include <sys/types.h>
  #include <signal.h>
  
 +#ifdef __FreeBSD__
 +#include <stdio.h>
 +#include <camlib.h>
++
++#define ENOMEDIUM 12345
 +#endif
 +
  #define MAXTRK 100
  
  typedef struct TOC {	/* structure of table of contents */
-@@ -47,13 +52,19 @@ typedef struct cdrom_drive{
+@@ -49,13 +56,19 @@ typedef struct cdrom_drive{
    int opened; /* This struct may just represent a candidate for opening */
  
    char *cdda_device_name;
@@ -34,17 +36,3 @@
    int interface;
    int bigendianp;
    int nsectors;
-@@ -83,9 +94,13 @@ typedef struct cdrom_drive{
-   int is_mmc;
- 
-   /* SCSI command buffer and offset pointers */
-+#ifdef Linux
-   unsigned char *sg;
-   unsigned char *sg_buffer;
-   unsigned char inqbytes[4];
-+#elif defined(__FreeBSD__)
-+  unsigned char *sg_buffer;
-+#endif
- 
-   /* Scsi parameters and state */
-   unsigned char density;
diff --git a/audio/cdparanoia/files/patch-interface_common__interface.c b/audio/cdparanoia/files/patch-interface_common__interface.c
index f631f86bae78..a086db6c417e 100644
--- a/audio/cdparanoia/files/patch-interface_common__interface.c
+++ b/audio/cdparanoia/files/patch-interface_common__interface.c
@@ -3,29 +3,35 @@ Index: interface/common_interface.c
 RCS file: /home/cvs/cdparanoia/interface/common_interface.c,v
 retrieving revision 1.1.1.1
 retrieving revision 1.5
---- interface/common_interface.c.orig	2000-04-19 22:41:04 UTC
+--- interface/common_interface.c.orig	2008-08-21 16:08:54 UTC
 +++ interface/common_interface.c
-@@ -13,12 +13,19 @@
+@@ -13,15 +13,25 @@
  #include "utils.h"
  #include "smallft.h"
  
 +#ifdef Linux
  #include <linux/hdreg.h>
++#elif defined(__FreeBSD__)
++#include <sys/cdio.h>
 +#endif
  
  /* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */
+ /* Also test using CDROM_GET_CAPABILITY (if available) as some newer DVDROMs will
+    reject CDROMVOLREAD ioctl for god-knows-what reason */
  int ioctl_ping_cdrom(int fd){
 +#ifdef Linux
    struct cdrom_volctrl volctl;
-   if (ioctl(fd, CDROMVOLREAD, &volctl)) 
+   if (ioctl(fd, CDROMVOLREAD, &volctl) &&
+       ioctl(fd, CDROM_GET_CAPABILITY, NULL)<0)
 +#elif defined(__FreeBSD__)
 +  struct ioc_vol volctl;
-+  if (ioctl(fd, CDIOCGETVOL, &volctl))
++  if (ioctl(fd, CDIOCGETVOL, &volctl) &&
++     (ioctl(fd, CDIOCCAPABILITY, NULL)<0))
 +#endif
      return(1); /* failure */
  
    return(0);
-@@ -26,6 +33,7 @@ int ioctl_ping_cdrom(int fd){
+@@ -29,6 +39,7 @@ int ioctl_ping_cdrom(int fd){
  }
  
  
@@ -33,7 +39,7 @@ retrieving revision 1.5
  /* Use the ioctl thingy above ping the cdrom; this will get model info */
  char *atapi_drive_info(int fd){
    /* Work around the fact that the struct grew without warning in
-@@ -46,6 +54,7 @@ char *atapi_drive_info(int fd){
+@@ -49,6 +60,7 @@ char *atapi_drive_info(int fd){
    free(id);
    return(ret);
  }
@@ -41,8 +47,8 @@ retrieving revision 1.5
  
  int data_bigendianp(cdrom_drive *d){
    float lsb_votes=0;
-@@ -171,7 +180,9 @@ int data_bigendianp(cdrom_drive *d){
-    knows the leasoud/leadin size. */
+@@ -174,7 +186,9 @@ int data_bigendianp(cdrom_drive *d){
+    knows the leadout/leadin size. */
  
  int FixupTOC(cdrom_drive *d,int tracks){
 +#ifdef Linux
@@ -51,7 +57,7 @@ retrieving revision 1.5
    int j;
    
    /* First off, make sure the 'starting sector' is >=0 */
-@@ -208,6 +219,8 @@ int FixupTOC(cdrom_drive *d,int tracks){
+@@ -211,6 +225,8 @@ int FixupTOC(cdrom_drive *d,int tracks){
    /* For a scsi device, the ioctl must go to the specialized SCSI
       CDROM device, not the generic device. */
  
@@ -60,10 +66,19 @@ retrieving revision 1.5
    if (d->ioctl_fd != -1) {
      int result;
  
-@@ -231,6 +244,7 @@ int FixupTOC(cdrom_drive *d,int tracks){
+@@ -235,6 +251,16 @@ int FixupTOC(cdrom_drive *d,int tracks){
        return 1;
      }
    }
++#elif defined(__FreeBSD__)
++    for (j = tracks-1; j >= 0; j--) {
++      if (j > 0 && !IS_AUDIO(d,j) && IS_AUDIO(d,j-1)) {
++        if ((d->disc_toc[j].dwStartSector > d->disc_toc[j].dwStartSector - 11400) &&
++            (d->disc_toc[j].dwStartSector - 11400 > d->disc_toc[j-1].dwStartSector))
++          d->disc_toc[j].dwStartSector = d->disc_toc[j].dwStartSector - 11400;
++        break;
++      }
++    }
 +#endif
    return 0;
  }
diff --git a/audio/cdparanoia/files/patch-interface_interface.c b/audio/cdparanoia/files/patch-interface_interface.c
index 3b8a43d48496..033d5753a564 100644
--- a/audio/cdparanoia/files/patch-interface_interface.c
+++ b/audio/cdparanoia/files/patch-interface_interface.c
@@ -1,6 +1,6 @@
---- interface/interface.c.orig	2000-04-19 22:41:04 UTC
+--- interface/interface.c.orig	2008-09-11 10:43:52 UTC
 +++ interface/interface.c
-@@ -30,11 +30,24 @@ int cdda_close(cdrom_drive *d){
+@@ -35,10 +35,17 @@ int cdda_close(cdrom_drive *d){
  
      _clean_messages(d);
      if(d->cdda_device_name)free(d->cdda_device_name);
@@ -9,19 +9,25 @@
      if(d->drive_model)free(d->drive_model);
      if(d->cdda_fd!=-1)close(d->cdda_fd);
      if(d->ioctl_fd!=-1 && d->ioctl_fd!=d->cdda_fd)close(d->ioctl_fd);
-     if(d->sg)free(d->sg);
 +#elif defined(__FreeBSD__)
-+    if (d->drive_model)
-+	    free(d->drive_model);
-+    if (d->ccb)
-+	    cam_freeccb(d->ccb);
-+    if (d->dev)
-+	    cam_close_device(d->dev);
-+    if (d->sg_buffer)
-+	    free(d->sg_buffer);
-+    if (d->ioctl_fd != -1)
-+	    close(d->ioctl_fd);
++    if(d->drive_model)free(d->drive_model);
++    if(d->ccb)cam_freeccb(d->ccb);
++    if(d->dev)cam_close_device(d->dev);
++    if(d->ioctl_fd != -1)close(d->ioctl_fd);
 +#endif
-     
-     free(d);
+     if(d->private){
+       if(d->private->sg_hd)free(d->private->sg_hd);
+       free(d->private);
+@@ -127,7 +134,12 @@ long cdda_read_timed(cdrom_drive *d, void *buffer, lon
+ 	}
+       }	
+     }
++#ifdef Linux
+     if(ms)*ms=d->private->last_milliseconds;
++#elif defined(__FreeBSD__)
++    if(ms)
++      *ms = (d->private == NULL) ? 0 : d->private->last_milliseconds;
++#endif
+     return(sectors);
    }
+   
diff --git a/audio/cdparanoia/files/patch-interface_low__interface.h b/audio/cdparanoia/files/patch-interface_low__interface.h
index 4d8f491e4455..607db2429372 100644
--- a/audio/cdparanoia/files/patch-interface_low__interface.h
+++ b/audio/cdparanoia/files/patch-interface_low__interface.h
@@ -3,9 +3,9 @@ Index: interface/low_interface.h
 RCS file: /home/cvs/cdparanoia/interface/low_interface.h,v
 retrieving revision 1.1.1.1
 retrieving revision 1.3
---- interface/low_interface.h.orig	2001-03-26 06:12:11 UTC
+--- interface/low_interface.h.orig	2008-09-11 10:43:52 UTC
 +++ interface/low_interface.h
-@@ -25,6 +25,8 @@
+@@ -26,6 +26,8 @@
  #include <sys/time.h>
  #include <sys/types.h>
  
@@ -14,7 +14,7 @@ retrieving revision 1.3
  #include <linux/major.h>
  #include <linux/version.h>
  
-@@ -48,12 +50,27 @@
+@@ -54,6 +56,17 @@
  #include <linux/cdrom.h>
  #include <linux/major.h>
  
@@ -24,12 +24,15 @@ retrieving revision 1.3
 +#include <sys/cdrio.h>
 +
 +#include <cam/scsi/scsi_message.h>
++#include <cam/scsi/scsi_sg.h>
 +#include <camlib.h>
 +
 +#endif
 +
  #include "cdda_interface.h"
  
+ #ifndef SG_EMULATED_HOST
+@@ -107,10 +120,17 @@ struct cdda_private_data {
  #define MAX_RETRIES 8
  #define MAX_BIG_BUFF_SIZE 65536
  #define MIN_BIG_BUFF_SIZE 4096
@@ -40,11 +43,6 @@ retrieving revision 1.3
 +#define SG_OFF (0)
 +#endif
  
- #ifndef SG_EMULATED_HOST
- /* old kernel version; the check for the ioctl is still runtime, this
-@@ -64,7 +81,9 @@
- #endif
- 
  extern int  cooked_init_drive (cdrom_drive *d);
 +#ifdef Linux
  extern unsigned char *scsi_inquiry (cdrom_drive *d);
diff --git a/audio/cdparanoia/files/patch-interface_scan__devices.c b/audio/cdparanoia/files/patch-interface_scan__devices.c
index ce83179151b5..5e728437b8f8 100644
--- a/audio/cdparanoia/files/patch-interface_scan__devices.c
+++ b/audio/cdparanoia/files/patch-interface_scan__devices.c
@@ -1,15 +1,15 @@
---- interface/scan_devices.c.orig	2001-03-26 05:44:01 UTC
+--- interface/scan_devices.c.orig	2008-08-26 09:55:22 UTC
 +++ interface/scan_devices.c
 @@ -1,6 +1,8 @@
  /******************************************************************
-  * CopyPolicy: GNU Public License 2 applies
-  * Copyright (C) 1998 Monty xiphmont@mit.edu
+  * CopyPolicy: GNU Lesser General Public License 2.1 applies
+  * Copyright (C) 1998-2008 Monty xiphmont@mit.edu
 + * FreeBSD porting (c) 2003
 + * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
   * 
   * Autoscan for or verify presence of a cdrom device
   * 
-@@ -21,6 +23,8 @@
+@@ -24,6 +26,8 @@
  
  #define MAX_DEV_LEN 20 /* Safe because strings only come from below */
  /* must be absolute paths! */
@@ -18,7 +18,7 @@
  static char *scsi_cdrom_prefixes[]={
    "/dev/scd",
    "/dev/sr",
-@@ -49,6 +53,17 @@ static char *cdrom_devices[]={
+@@ -52,6 +56,17 @@ static char *cdrom_devices[]={
    "/dev/cm206cd",
    "/dev/gscd",
    "/dev/optcd",NULL};
@@ -36,7 +36,17 @@
  
  /* Functions here look for a cdrom drive; full init of a drive type
     happens in interface.c */
-@@ -75,10 +90,12 @@ cdrom_drive *cdda_find_a_cdrom(int messa
+@@ -61,6 +76,9 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **
+   
+   int i=0;
+   cdrom_drive *d;
++#if defined(__FreeBSD__)
++  struct passwd *pwent;
++#endif
+ 
+   while(cdrom_devices[i]!=NULL){
+ 
+@@ -78,10 +96,12 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **
  	if((d=cdda_identify(buffer,messagedest,messages)))
  	  return(d);
  	idmessage(messagedest,messages,"",NULL);
@@ -49,22 +59,29 @@
        }
      }else{
        /* Name.  Go for it. */
-@@ -117,8 +134,14 @@ cdrom_drive *cdda_identify(const char *d
+@@ -92,9 +112,21 @@ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **
+     }
+     i++;
    }
- #endif
- 
-+#ifdef Linux	/* is order of checks important? */
-   d=cdda_identify_cooked(device,messagedest,messages);
-   if(!d)d=cdda_identify_scsi(device,NULL,messagedest,messages);
++
++#if Linux
+   idmessage(messagedest,messages,
+ 	    "\n\nNo cdrom drives accessible to %s found.\n",
+ 	    cuserid(NULL));
 +#elif defined(__FreeBSD__)
-+  d = cdda_identify_scsi(device, NULL, messagedest, messages);
-+  if (d == NULL)
-+	  d = cdda_identify_cooked(device, messagedest, messages);
++  pwent = getpwuid(geteuid());
++  if (pwent == NULL)
++    idmessage(messagedest,messages,
++	      "\n\nNo accessible cdrom drives found.\n", NULL);
++  else
++    idmessage(messagedest,messages,
++	      "\n\nNo cdrom drives accessible to %s found.\n",
++	      pwent->pw_name);
 +#endif
+   return(NULL);
+ }
  
- #ifdef CDDA_TEST
-   if(!d)d=cdda_identify_test(device,messagedest,messages);
-@@ -143,6 +166,7 @@ char *test_resolve_symlink(const char *f
+@@ -145,6 +179,7 @@ char *test_resolve_symlink(const char *file,int messag
  
  }
  
@@ -72,7 +89,7 @@
  cdrom_drive *cdda_identify_cooked(const char *dev, int messagedest,
  				  char **messages){
  
-@@ -275,6 +299,61 @@ cdrom_drive *cdda_identify_cooked(const 
+@@ -274,6 +309,61 @@ cdrom_drive *cdda_identify_cooked(const char *dev, int
    return(d);
  }
  
@@ -134,7 +151,7 @@
  struct  sg_id {
    long    l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */
    long    l2; /* Unique id */
-@@ -390,6 +469,7 @@ matchfail:
+@@ -400,6 +490,7 @@ matchfail:
    if(dev!=-1)close(dev);
    return(NULL);
  }
@@ -142,7 +159,7 @@
  
  void strscat(char *a,char *b,int n){
    int i;
-@@ -401,6 +481,7 @@ void strscat(char *a,char *b,int n){
+@@ -411,6 +502,7 @@ void strscat(char *a,char *b,int n){
    strcat(a," ");
  }
  
@@ -150,14 +167,14 @@
  /* At this point, we're going to punt compatability before SG2, and
     allow only SG2 and SG3 */
  static int verify_SG_version(cdrom_drive *d,int messagedest,
-@@ -653,6 +734,89 @@ cdda_identify_scsi_fail:
-   if(g_fd!=-1)close(g_fd);
+@@ -780,6 +872,90 @@ cdda_identify_scsi_fail:
+   }
    return(NULL);
  }
 +#elif defined(__FreeBSD__)
 +
-+cdrom_drive *cdda_identify_scsi(const char *device,
-+    const char *dummy,
++cdrom_drive *cdda_identify_scsi(const char *dummy,
++    const char *device,
 +    int messagedest,
 +    char **messages)
 +{
@@ -209,7 +226,8 @@
 +	d->lun = d->dev->target_lun;
 +	d->interface = GENERIC_SCSI;
 +
-+	if ((d->sg_buffer = malloc(MAX_BIG_BUFF_SIZE)) == NULL) {
++	d->private=calloc(1,sizeof(*d->private));
++	if ((d->private->sg_buffer=(unsigned char *)(d->private->sg_hd=malloc(MAX_BIG_BUFF_SIZE))) == NULL) {
 +		idperror(messagedest, messages, "Could not allocate buffer memory", NULL);
 +		goto cdda_identify_scsi_fail;
 +	}
diff --git a/audio/cdparanoia/files/patch-interface_scsi__interface.c b/audio/cdparanoia/files/patch-interface_scsi__interface.c
index 15fe0300e0d7..a1bff608f9d5 100644
--- a/audio/cdparanoia/files/patch-interface_scsi__interface.c
+++ b/audio/cdparanoia/files/patch-interface_scsi__interface.c
@@ -1,117 +1,117 @@
---- interface/scsi_interface.c.orig	2001-03-24 01:15:46 UTC
+--- interface/scsi_interface.c.orig	2019-07-25 21:55:03 UTC
 +++ interface/scsi_interface.c
 @@ -3,6 +3,8 @@
   * Original interface.c Copyright (C) 1994-1997 
   *            Eissfeldt heiko@colossus.escape.de
-  * Current blenderization Copyright (C) 1998-1999 Monty xiphmont@mit.edu
+  * Current incarnation Copyright (C) 1998-2008 Monty xiphmont@mit.edu
 + * FreeBSD porting (c) 2003
 + * 	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
   * 
   * Generic SCSI interface specific code.
   *
-@@ -23,6 +25,7 @@ static void tweak_SG_buffer(cdrom_drive 
-   int table,reserved;
+@@ -36,6 +38,7 @@ static void tweak_SG_buffer(cdrom_drive *d) {
+   int table, reserved, cur, err;
    char buffer[256];
  
 +#ifdef Linux
-   /* maximum transfer size? */
-   if(ioctl(d->cdda_fd,SG_GET_RESERVED_SIZE,&reserved)){
-     /* Up, guess not. */
-@@ -59,8 +62,17 @@ static void tweak_SG_buffer(cdrom_drive 
-     cdmessage(d,"\tCouldn't disable command queue!  Continuing anyway...\n");
-   }
- 
-+#elif defined(__FreeBSD__)
-+  d->nsectors = 26;		/* FreeBSD only supports 64K I/O transfer size */
-+  d->bigbuff = d->nsectors * CD_FRAMESIZE_RAW;
-+  
-+  sprintf(buffer,"\tSetting default read size to %d sectors (%d bytes).\n\n",
-+      d->nsectors,d->nsectors*CD_FRAMESIZE_RAW);
-+  cdmessage(d,buffer);
+   /* SG_SET_RESERVED_SIZE doesn't actually allocate or reserve anything.
+    * what it _does_ do is give you an error if you ask for a value
+    * larger than q->max_sectors (the length of the device's bio request
+@@ -54,6 +57,10 @@ static void tweak_SG_buffer(cdrom_drive *d) {
+      implement working sg lists with SG_IO devices, so who knows... */
+   if (ioctl(d->cdda_fd, SG_GET_SG_TABLESIZE, &table) < 0)
+     table=1;
++#else
++  reserved = 26 * CD_FRAMESIZE_RAW;	/* FreeBSD only supports 64K I/O transfer size */
++  table = 1;
 +#endif
- }
  
-+#ifdef Linux
- static void reset_scsi(cdrom_drive *d){
-   int arg;
-   d->enable_cdda(d,0);
-@@ -74,6 +86,30 @@ static void reset_scsi(cdrom_drive *d){
-   d->enable_cdda(d,1);
+   sprintf(buffer,"\tDMA scatter/gather table entries: %d\n\t"
+ 	  "table entry size: %d bytes\n\t"
+@@ -93,6 +100,7 @@ static void tweak_SG_buffer(cdrom_drive *d) {
+   cdmessage(d,buffer);
  }
  
-+#elif defined(__FreeBSD__)
-+static void reset_scsi(cdrom_drive *d) {
-+	d->enable_cdda(d,0);
-+
-+	d->ccb->ccb_h.func_code = XPT_RESET_DEV;
-+	d->ccb->ccb_h.timeout = 5000;
-+
-+	cdmessage(d, "sending SCSI reset... ");
-+	if (cam_send_ccb(d->dev, d->ccb)) {
-+		cdmessage(d, "error sending XPT_RESET_DEV CCB");
-+	} else {
-+	
-+		if (((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ||
-+		    ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))
-+			cdmessage(d,"OK\n");
-+		else
-+			cdmessage(d,"FAILED\n");
-+	}
-+
-+	d->enable_cdda(d,1);
-+}
-+#endif
-+
 +#ifdef Linux
  static void clear_garbage(cdrom_drive *d){
    fd_set fdset;
    struct timeval tv;
-@@ -104,8 +140,10 @@ static void clear_garbage(cdrom_drive *d
+@@ -123,6 +131,7 @@ static void clear_garbage(cdrom_drive *d){
      flag=1;
    }
  }
 +#endif
  
+ static int check_sbp_error(const unsigned char status,
+ 			   const unsigned char *sbp) {
+@@ -172,6 +181,7 @@ static int check_sbp_error(const unsigned char status,
+   return 0;
+ }
+ 
++#ifdef Linux
  /* process a complete scsi command. */
+ static int sg2_handle_scsi_cmd(cdrom_drive *d,
+ 			       unsigned char *cmd,
+@@ -332,7 +342,9 @@ static int sg2_handle_scsi_cmd(cdrom_drive *d,
+   }
+   return(0);
+ }
++#endif
+ 
++#ifdef Linux
+ static int sgio_handle_scsi_cmd(cdrom_drive *d,
+ 				unsigned char *cmd,
+ 				unsigned int cmd_len, 
+@@ -417,7 +429,9 @@ static int sgio_handle_scsi_cmd(cdrom_drive *d,
+   errno = 0;
+   return 0;
+ }
++#endif
+ 
 +#ifdef Linux
  static int handle_scsi_cmd(cdrom_drive *d,
+ 			   unsigned char *cmd,
  			   unsigned int cmd_len, 
- 			   unsigned int in_size, 
-@@ -284,6 +322,95 @@ static int handle_scsi_cmd(cdrom_drive *
-   return(0);
+@@ -433,6 +447,117 @@ static int handle_scsi_cmd(cdrom_drive *d,
+ 
  }
  
 +#elif defined(__FreeBSD__)
 +static int handle_scsi_cmd(cdrom_drive *d,
-+			   unsigned int cmd_len, 
-+			   unsigned int out_size, 
++			   unsigned char *cmd,
++			   unsigned int cmd_len,
 +			   unsigned int in_size,
++			   unsigned int out_size,
 +			   unsigned char bytefill,
-+			   int bytecheck) {
++			   int bytecheck,
++			   unsigned char *sense){
 +	int result;
 +	int error_code, sense_key, asc, ascq;
 +	
 +	bzero(&d->ccb->csio, sizeof(d->ccb->csio));
 +
-+	memcpy(d->ccb->csio.cdb_io.cdb_bytes, d->sg_buffer, cmd_len);
++	memcpy(d->ccb->csio.cdb_io.cdb_bytes, cmd, cmd_len);
 +
-+	if (bytecheck && out_size == 0)
-+		memset(d->sg_buffer, bytefill, in_size);
++	if (bytecheck && in_size == 0)
++		memset(d->private->sg_buffer, bytefill, out_size);
 +
 +	cam_fill_csio(&d->ccb->csio,
 +	    /* retries */ 0,
 +	    /* cbfcnp */ NULL,
-+	    /* flags */ CAM_DEV_QFRZDIS | (out_size ? CAM_DIR_OUT : CAM_DIR_IN),
++	    /* flags */ CAM_DEV_QFRZDIS | (in_size ? CAM_DIR_OUT : CAM_DIR_IN),
 +	    /* tag_action */ MSG_SIMPLE_Q_TAG,
-+	    /* data_ptr */ out_size ? d->sg_buffer + cmd_len : d->sg_buffer,
++	    /* data_ptr */ in_size ? cmd + cmd_len : d->private->sg_buffer,
 +	    /* dxfer_len */ out_size ? out_size : in_size,
 +	    /* sense_len */ SSD_FULL_SIZE,
 +	    /* cdb_len */ cmd_len,
 +	    /* timeout */ 60000);	/* XXX */
 +
++	struct timespec tv1, tv2;
++	int tret1=clock_gettime(d->private->clock,&tv1);
 +	if ((result = cam_send_ccb(d->dev, d->ccb)) < 0 ||
 +	    (d->ccb->ccb_h.status & CAM_STATUS_MASK) == 0 /* hack? */)
 +		return TR_EREAD;
++	int tret2=clock_gettime(d->private->clock,&tv2);
 +
 +	if ((d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP &&
 +	    (d->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_SCSI_STATUS_ERROR) {
@@ -121,7 +121,7 @@
 +		return TR_UNKNOWN;
 +	}
 +
-+	if (d->ccb->csio.dxfer_len != in_size) {
++	if (d->ccb->csio.dxfer_len != out_size) {
 +		errno = EIO;
 +		return TR_EREAD;
 +	}
@@ -165,21 +165,72 @@
 +		break;
 +	}
 +
++	if(bytecheck && out_size){
++		long i, flag=0;
++		for(i=in_size;i<out_size;i++)
++			if(d->private->sg_buffer[i]!=bytefill){
++				flag=1;
++				break;
++			}
++		if(!flag){
++			errno=EINVAL;
++			return(TR_ILLEGAL);
++		}
++	}
++
++	if(tret1<0 || tret2<0)
++		d->private->last_milliseconds=-1;
++	else
++		d->private->last_milliseconds = (tv2.tv_sec-tv1.tv_sec)*1000. + (tv2.tv_nsec-tv1.tv_nsec)/1000000.;
++
 +	return 0;
 +}
 +#endif
 +
-+
- /* Group 1 (10b) command */
+ static int test_unit_ready(cdrom_drive *d){
+   unsigned char sense[SG_MAX_SENSE];
+   unsigned char key, ASC, ASCQ;
+@@ -453,6 +581,7 @@ static int test_unit_ready(cdrom_drive *d){
+   return 1;
+ }
  
- static int mode_sense_atapi(cdrom_drive *d,int size,int page){ 
-@@ -833,30 +960,37 @@ static long scsi_read_map (cdrom_drive *
-   while(1) {
-     if((err=map(d,(p?buffer:NULL),begin,sectors))){
-       if(d->report_all){
 +#ifdef Linux
- 	struct sg_header *sg_hd=(struct sg_header *)d->sg;
+ static void reset_scsi(cdrom_drive *d){
+   int arg,tries=0;
+   d->enable_cdda(d,0);
+@@ -472,6 +601,27 @@ static void reset_scsi(cdrom_drive *d){
+   d->enable_cdda(d,1);
+ }
+ 
 +#elif defined(__FreeBSD__)
++static void reset_scsi(cdrom_drive *d) {
++	d->enable_cdda(d,0);
++
++	d->ccb->ccb_h.func_code = XPT_RESET_DEV;
++	d->ccb->ccb_h.timeout = 5000;
++
++	cdmessage(d, "sending SCSI reset... ");
++	if (cam_send_ccb(d->dev, d->ccb)) {
++		cdmessage(d, "error sending XPT_RESET_DEV CCB");
++	} else {
++		if (((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ||
++		    ((d->ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_BDR_SENT))
++			cdmessage(d,"OK\n");
++		else
++			cdmessage(d,"FAILED\n");
++	}
++	d->enable_cdda(d,1);
++}
++#endif
++
+ static int mode_sense_atapi(cdrom_drive *d,int size,int page){ 
+   unsigned char sense[SG_MAX_SENSE];
+   unsigned char cmd[10]= {0x5A,   /* MODE_SENSE */
+@@ -1074,29 +1226,35 @@ static long scsi_read_map (cdrom_drive *d, void *p, lo
+ 
+     if((err=map(d,(p?buffer:NULL),begin,sectors,sense))){
+       if(d->report_all){
++#ifdef __FreeBSD__
 +	int error_code, sense_key, asc, ascq;
 +#endif
  	char b[256];
@@ -194,9 +245,9 @@
 +#endif
  	sprintf(b,"                 Sense key: %x ASC: %x ASCQ: %x\n",
 +#ifdef Linux
- 		(int)(sg_hd->sense_buffer[2]&0xf),
- 		(int)(sg_hd->sense_buffer[12]),
- 		(int)(sg_hd->sense_buffer[13]));
+ 		(int)(sense[2]&0xf),
+ 		(int)(sense[12]),
+ 		(int)(sense[13]));
 +#elif defined(__FreeBSD__)
 +		sense_key, asc, ascq);
 +#endif
@@ -212,23 +263,23 @@
 -	fprintf(stderr,"scsi_read error: sector=%ld length=%ld retry=%d\n",
 -		begin,sectors,retry_count);
 -	fprintf(stderr,"                 Sense key: %x ASC: %x ASCQ: %x\n",
--		(int)(sg_hd->sense_buffer[2]&0xf),
--		(int)(sg_hd->sense_buffer[12]),
--		(int)(sg_hd->sense_buffer[13]));
+-		(int)(sense[2]&0xf),
+-		(int)(sense[12]),
+-		(int)(sense[13]));
 -	fprintf(stderr,"                 Transport error: %s\n",strerror_tr[err]);
 -	fprintf(stderr,"                 System error: %s\n",strerror(errno));
        }
- 
-       if(!d->error_retry)return(-7);
-@@ -1307,6 +1441,7 @@ static void check_fua_bit(cdrom_drive *d
-   return;
+       
+       switch(errno){
+@@ -1583,6 +1741,7 @@ static void check_cache(cdrom_drive *d){
+   }
  }
  
 +#ifdef Linux
  static int check_atapi(cdrom_drive *d){
    int atapiret=-1;
-   int fd = d->cdda_fd; /* this is the correct fd (not ioctl_fd), as the 
-@@ -1333,6 +1468,53 @@ static int check_atapi(cdrom_drive *d){
+   int fd = d->cdda_fd; /* check the device we'll actually be using to read */
+@@ -1614,6 +1773,53 @@ static int check_atapi(cdrom_drive *d){
    }
  }  
  
@@ -280,34 +331,21 @@
 +#endif
 +
  static int check_mmc(cdrom_drive *d){
-   char *b;
+   unsigned char *b;
    cdmessage(d,"\nChecking for MMC style command set...\n");
-@@ -1379,6 +1561,7 @@ static void check_exceptions(cdrom_drive
+@@ -1660,6 +1866,7 @@ static void check_exceptions(cdrom_drive *d,exception 
    }
  }
  
 +#ifdef Linux
  /* request vendor brand and model */
  unsigned char *scsi_inquiry(cdrom_drive *d){
-   memcpy(d->sg_buffer,(char[]){ 0x12,0,0,0,56,0},6);
-@@ -1389,6 +1572,7 @@ unsigned char *scsi_inquiry(cdrom_drive 
+   unsigned char sense[SG_MAX_SENSE];
+@@ -1671,6 +1878,7 @@ unsigned char *scsi_inquiry(cdrom_drive *d){
    }
-   return (d->sg_buffer);
+   return (d->private->sg_buffer);
  }
 +#endif
  
- 
  int scsi_init_drive(cdrom_drive *d){
-@@ -1458,8 +1642,12 @@ int scsi_init_drive(cdrom_drive *d){
-   check_fua_bit(d);
- 
-   d->error_retry=1;
-+#ifdef Linux
-   d->sg=realloc(d->sg,d->nsectors*CD_FRAMESIZE_RAW + SG_OFF + 128);
-   d->sg_buffer=d->sg+SG_OFF;
-+#elif defined(__FreeBSD__)
-+  d->sg_buffer = realloc(d->sg_buffer, d->nsectors * CD_FRAMESIZE_RAW);
-+#endif
-   d->report_all=1;
-   return(0);
- }
+   int ret;
diff --git a/audio/cdparanoia/files/patch-main.c b/audio/cdparanoia/files/patch-main.c
new file mode 100644
index 000000000000..f34b292b307b
--- /dev/null
+++ b/audio/cdparanoia/files/patch-main.c
@@ -0,0 +1,15 @@
+--- main.c.orig	2019-07-23 18:12:13 UTC
++++ main.c
+@@ -588,10 +588,10 @@ static void callback(long inpos, int function){
*** 432 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407040627.4646RRsW076207>