summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoritohy <itohy@pkgsrc.org>2000-01-19 08:03:00 +0000
committeritohy <itohy@pkgsrc.org>2000-01-19 08:03:00 +0000
commit03fef19591e5682e08b62963fbe4aec360b14d36 (patch)
tree52e81050c889053884deae5bb60da2b8cdbd355a
parent85439348bd177f8cbaf557309257e97be90e290c (diff)
downloadpkgsrc-03fef19591e5682e08b62963fbe4aec360b14d36.tar.gz
An attempt to port cdparanoia-III-alpha9.7.
CD-DA extraction tool with excessive data corrections, such as jitter, loss of data, etc. This will soon be obsoleted by cdparanoia IV, I hope.... Most SCSI/ATAPI CD-ROM drives should work fine. However, the ATAPI stuff is totally untested, and if it happened to work, it was a miracle. :-) Currently, - the feature to search for CD-ROM device is not implemented and the -g option is required, - the libraries are not installed.
-rw-r--r--audio/cdparanoia/Makefile19
-rw-r--r--audio/cdparanoia/files/md53
-rw-r--r--audio/cdparanoia/files/patch-sum15
-rw-r--r--audio/cdparanoia/patches/patch-aa19
-rw-r--r--audio/cdparanoia/patches/patch-ab56
-rw-r--r--audio/cdparanoia/patches/patch-ac75
-rw-r--r--audio/cdparanoia/patches/patch-ad39
-rw-r--r--audio/cdparanoia/patches/patch-ae122
-rw-r--r--audio/cdparanoia/patches/patch-ba21
-rw-r--r--audio/cdparanoia/patches/patch-ca22
-rw-r--r--audio/cdparanoia/patches/patch-cb37
-rw-r--r--audio/cdparanoia/patches/patch-cc15
-rw-r--r--audio/cdparanoia/patches/patch-cd89
-rw-r--r--audio/cdparanoia/patches/patch-ce111
-rw-r--r--audio/cdparanoia/patches/patch-cf190
-rw-r--r--audio/cdparanoia/patches/patch-cg187
-rw-r--r--audio/cdparanoia/pkg/COMMENT1
-rw-r--r--audio/cdparanoia/pkg/DESCR15
-rw-r--r--audio/cdparanoia/pkg/PLIST3
19 files changed, 1039 insertions, 0 deletions
diff --git a/audio/cdparanoia/Makefile b/audio/cdparanoia/Makefile
new file mode 100644
index 00000000000..1d94414ddc8
--- /dev/null
+++ b/audio/cdparanoia/Makefile
@@ -0,0 +1,19 @@
+# $NetBSD: Makefile,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+DISTNAME= cdparanoia-III-alpha9.7
+PKGNAME= cdparanoia-3.a9.7
+CATEGORIES= audio
+MASTER_SITES= http://www.xiph.org/paranoia/download/
+EXTRACT_SUFX= .src.tgz
+
+MAINTAINER= packages@netbsd.org
+HOMEPAGE= http://www.xiph.org/paranoia/
+
+GNU_CONFIGURE= YES
+ALL_TARGET= static
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/cdparanoia ${PREFIX}/bin
+ ${INSTALL_MAN} ${WRKSRC}/cdparanoia.1 ${PREFIX}/man/man1
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/audio/cdparanoia/files/md5 b/audio/cdparanoia/files/md5
new file mode 100644
index 00000000000..b782bb6ff13
--- /dev/null
+++ b/audio/cdparanoia/files/md5
@@ -0,0 +1,3 @@
+$NetBSD: md5,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+MD5 (cdparanoia-III-alpha9.7.src.tgz) = 0820b2b52b721745f926c913c0a2653f
diff --git a/audio/cdparanoia/files/patch-sum b/audio/cdparanoia/files/patch-sum
new file mode 100644
index 00000000000..21692a8279f
--- /dev/null
+++ b/audio/cdparanoia/files/patch-sum
@@ -0,0 +1,15 @@
+$NetBSD: patch-sum,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+MD5 (patch-aa) = 598f4761b68407f819fa9b8c67ba627c
+MD5 (patch-ab) = c3ef67eeb817732c2f29c11dd7048ba4
+MD5 (patch-ac) = 3bcd421fb561a7b5abdf217f7b264f90
+MD5 (patch-ad) = 6ae48f279ad64674500eb41983221d61
+MD5 (patch-ae) = 8ade64b6451e4aa2814640655f777904
+MD5 (patch-ba) = 316c91a58bd361d96d86910ace6ba66a
+MD5 (patch-ca) = b5e83a7b1dfd50a0e0e969f563220ea1
+MD5 (patch-cb) = 60d5539a6bdd1ec81bb1cd4bb9f6dbbd
+MD5 (patch-cc) = c0832f9360f73d77988a1cf48e6b3457
+MD5 (patch-cd) = ab3d1eaaa4706c77a0e4795f20759c8c
+MD5 (patch-ce) = 6f15e3f28c38a0058428c5f5981029ad
+MD5 (patch-cf) = 021d133eafbefb81ffdcbe06f6805842
+MD5 (patch-cg) = 9a673c9509aea8b11122ba22896dcc22
diff --git a/audio/cdparanoia/patches/patch-aa b/audio/cdparanoia/patches/patch-aa
new file mode 100644
index 00000000000..11fd1fa5340
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-aa
@@ -0,0 +1,19 @@
+$NetBSD: patch-aa,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- configure.in.orig Mon Aug 16 07:29:43 1999
++++ configure.in Mon Jan 17 23:05:41 2000
+@@ -63,11 +63,14 @@
+ AC_CHECK_HEADERS(linux/sbpcd.h, SBPCD_H="-DSBPCD_H='1' ")
+ AC_CHECK_HEADERS(linux/ucdrom.h, UCDROM_H="-DUCDROM_H='1' ")
+
++AC_CHECK_FUNCS(getopt_long, GETOPT_LONG="-DGETOPT_LONG='1' ")
++
+ AC_PROG_MAKE_SET
+ AC_C_CONST
+
+ AC_SUBST(SBPCD_H)
+ AC_SUBST(UCDROM_H)
++AC_SUBST(GETOPT_LONG)
+ AC_SUBST(TYPESIZES)
+ AC_SUBST(OPT)
+ AC_SUBST(DEBUG)
diff --git a/audio/cdparanoia/patches/patch-ab b/audio/cdparanoia/patches/patch-ab
new file mode 100644
index 00000000000..e20bf652c80
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ab
@@ -0,0 +1,56 @@
+$NetBSD: patch-ab,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- Makefile.in.orig Tue Dec 14 17:42:14 1999
++++ Makefile.in Mon Jan 17 23:32:22 2000
+@@ -8,7 +8,7 @@
+ srcdir=@srcdir@
+
+ @SET_MAKE@
+-FLAGS=@TYPESIZES@ @CFLAGS@
++FLAGS=@GETOPT_LONG@ @TYPESIZES@ @CFLAGS@
+ OPT=@OPT@ $(FLAGS)
+ DEBUG=@DEBUG@ $(FLAGS)
+ CC=@CC@
+@@ -27,29 +27,27 @@
+
+ OFILES = main.o report.o header.o buffering_write.o
+
+-export STATIC
+-export VERSION
++STLIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a -lm
++STLIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a
+
+-ifeq ($(STATIC),TRUE)
+- LIBS = interface/libcdda_interface.a paranoia/libcdda_paranoia.a \
+- -static -lm
+- LIBDEP = interface/libcdda_interface.a paranoia/libcdda_paranoia.a
+-else
+- LIBS = -lcdda_interface -lcdda_paranoia -lm
+- LIBDEP = interface/libcdda_interface.so paranoia/libcdda_paranoia.so
+-endif
++SHLIBS = -lcdda_interface -lcdda_paranoia -lm
++SHLIBDEP = interface/libcdda_interface.so paranoia/libcdda_paranoia.so
+
+
+-all:
++all:
+ cd interface && $(MAKE) all
+ cd paranoia && $(MAKE) all
+- $(MAKE) cdparanoia CFLAGS="$(OPT)"
+- strip cdparanoia
++ $(MAKE) cdparanoia CFLAGS="$(OPT)" LIBS="$(SHLIBS)" LIBDEP="$(SHLIBDEP)"
+
+-debug:
++static:
++ cd interface && $(MAKE) lib
++ cd paranoia && $(MAKE) lib
++ $(MAKE) cdparanoia CFLAGS="$(OPT)" LIBS="$(STLIBS)" LIBDEP="$(STLIBDEP)"
++
++debug:
+ cd interface && $(MAKE) debug
+ cd paranoia && $(MAKE) debug
+- $(MAKE) cdparanoia CFLAGS="$(DEBUG)" STATIC=TRUE
++ $(MAKE) cdparanoia CFLAGS="$(DEBUG)" LIBS="$(STLIBS)" LIBDEP="$(STLIBDEP)"
+
+ test:
+ cd interface && $(MAKE) all
diff --git a/audio/cdparanoia/patches/patch-ac b/audio/cdparanoia/patches/patch-ac
new file mode 100644
index 00000000000..6d6b5373375
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ac
@@ -0,0 +1,75 @@
+$NetBSD: patch-ac,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- configure.orig Mon Aug 16 07:29:42 1999
++++ configure Mon Jan 17 23:05:54 2000
+@@ -1272,6 +1272,62 @@
+ done
+
+
++for ac_func in getopt_long
++do
++echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
++echo "configure:1356: checking for $ac_func" >&5
++if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++else
++ cat > conftest.$ac_ext <<EOF
++#line 1361 "configure"
++#include "confdefs.h"
++/* System header to define __stub macros and hopefully few prototypes,
++ which can conflict with char $ac_func(); below. */
++#include <assert.h>
++/* Override any gcc2 internal prototype to avoid an error. */
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char $ac_func();
++
++int main() {
++
++/* The GNU C library defines this for functions which it implements
++ to always fail with ENOSYS. Some functions are actually named
++ something starting with __ and the normal name is an alias. */
++#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
++choke me
++#else
++$ac_func();
++#endif
++
++; return 0; }
++EOF
++if { (eval echo configure:1384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
++ rm -rf conftest*
++ eval "ac_cv_func_$ac_func=yes"
++else
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ eval "ac_cv_func_$ac_func=no"
++fi
++rm -f conftest*
++fi
++
++if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
++ echo "$ac_t""yes" 1>&6
++ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
++ cat >> confdefs.h <<EOF
++#define $ac_tr_func 1
++EOF
++ GETOPT_LONG="-DGETOPT_LONG='1' "
++else
++ echo "$ac_t""no" 1>&6
++fi
++done
++
++
+ echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+ echo "configure:1277: checking whether ${MAKE-make} sets \${MAKE}" >&5
+ set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+@@ -1537,6 +1593,7 @@
+ s%@SET_MAKE@%$SET_MAKE%g
+ s%@SBPCD_H@%$SBPCD_H%g
+ s%@UCDROM_H@%$UCDROM_H%g
++s%@GETOPT_LONG@%$GETOPT_LONG%g
+ s%@TYPESIZES@%$TYPESIZES%g
+ s%@OPT@%$OPT%g
+ s%@DEBUG@%$DEBUG%g
diff --git a/audio/cdparanoia/patches/patch-ad b/audio/cdparanoia/patches/patch-ad
new file mode 100644
index 00000000000..89b7dab1010
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ad
@@ -0,0 +1,39 @@
+$NetBSD: patch-ad,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- utils.h.orig Sat Oct 9 04:18:21 1999
++++ utils.h Sun Jan 16 19:05:14 2000
+@@ -1,5 +1,10 @@
+ #include <stdlib.h>
++#ifdef __linux__
+ #include <endian.h>
++#endif
++#ifdef __NetBSD__
++#include <sys/endian.h>
++#endif
+ #include <stdio.h>
+ #include <errno.h>
+ #include <string.h>
+@@ -19,15 +24,23 @@
+ }
+
+ static inline size32 swap32(size32 x){
++#ifdef __NetBSD__
++ return bswap32(x);
++#else
+ return((((unsigned size32)x & 0x000000ffU) << 24) |
+ (((unsigned size32)x & 0x0000ff00U) << 8) |
+ (((unsigned size32)x & 0x00ff0000U) >> 8) |
+ (((unsigned size32)x & 0xff000000U) >> 24));
++#endif
+ }
+
+ static inline size16 swap16(size16 x){
++#ifdef __NetBSD__
++ return bswap16(x);
++#else
+ return((((unsigned size16)x & 0x00ffU) << 8) |
+ (((unsigned size16)x & 0xff00U) >> 8));
++#endif
+ }
+
+ #if BYTE_ORDER == LITTLE_ENDIAN
diff --git a/audio/cdparanoia/patches/patch-ae b/audio/cdparanoia/patches/patch-ae
new file mode 100644
index 00000000000..73f38458759
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ae
@@ -0,0 +1,122 @@
+$NetBSD: patch-ae,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- main.c.orig Tue Dec 14 17:18:44 1999
++++ main.c Mon Jan 17 23:12:58 2000
+@@ -49,7 +49,9 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <fcntl.h>
++#ifdef __linux__
+ #include <getopt.h>
++#endif
+ #include <errno.h>
+ #include <math.h>
+ #include <sys/time.h>
+@@ -231,6 +233,7 @@
+ " cdparanoia [options] <span> [outfile]\n\n"
+
+ "OPTIONS:\n"
++#ifdef GETOPT_LONG
+ " -v --verbose : extra verbose operation\n"
+ " -q --quiet : quiet operation\n"
+ " -e --stderr-progress : force output of progress information to\n"
+@@ -274,6 +277,46 @@
+ " -Z --disable-paranoia : disable all paranoia checking\n"
+ " -Y --disable-extra-paranoia : only do cdda2wav-style overlap checking\n"
+ " -X --abort-on-skip : abort on imperfect reads/skips\n\n"
++#else
++" -v : extra verbose operation\n"
++" -q : quiet operation\n"
++" -e : force output of progress information to\n"
++" stderr (for wrapper scripts)\n"
++" -V : print version info and quit\n"
++" -Q : autosense drive, query disc and quit\n"
++" -B : 'batch' mode (saves each track to a seperate file.\n"
++" -s : do an exhaustive search for drive\n"
++" -h : print help\n\n"
++
++" -p : output raw 16 bit PCM in host byte order\n"
++" -r : output raw 16 bit little-endian PCM\n"
++" -R : output raw 16 bit big-endian PCM\n"
++" -w : output as WAV file (default)\n"
++" -f : output as AIFF file\n"
++" -a : output as AIFF-C file\n"
++" -i <file> : output human readable ripping info to file\n\n"
++
++" -c : force treating drive as little endian\n"
++" -C : force treating drive as big endian\n"
++" -n <n> : force default number of sectors in read to n sectors\n"
++" -o <n> : force minimum overlap search during\n"
++" verification to n sectors\n"
++" -d <dev> : use specified device; disallow autosense\n"
++" -g <dev> : use specified generic scsi device\n"
++" -S <n> : read from device at specified speed\n"
++" -t <n> : Add <n> sectors to the values reported\n"
++" when addressing tracks. May be negative\n"
++" -T : Assume that the beginning offset of\n"
++" track 1 as reported in the TOC will be\n"
++" addressed as LBA 0. Necessary for some\n"
++" Toshiba drives to get track boundaries\n"
++" correct\n"
++" -z : never accept any less than perfect\n"
++" data reconstruction (don't allow 'V's)\n"
++" -Z : disable all paranoia checking\n"
++" -Y : only do cdda2wav-style overlap checking\n"
++" -X : abort on imperfect reads/skips\n\n"
++#endif
+
+ "OUTPUT SMILIES:\n"
+ " :-) Normal operation, low/no jitter\n"
+@@ -374,7 +417,7 @@
+ int graph=30;
+ char buffer[256];
+ static long c_sector=0,v_sector=0;
+- static char dispcache[30]=" ";
++ static char dispcache[30 + 1]=" ";
+ static int last=0;
+ static long lasttime=0;
+ long sector,osector=0;
+@@ -585,6 +628,7 @@
+
+ const char *optstring = "escCn:o:d:g:S:prRwafvqVQhZzYXWBi:Tt:";
+
++#ifdef GETOPT_LONG
+ struct option options [] = {
+ {"stderr-progress",no_argument,NULL,'e'},
+ {"search-for-drive",no_argument,NULL,'s'},
+@@ -618,6 +662,7 @@
+
+ {NULL,0,NULL,0}
+ };
++#endif
+
+ long blocking_write(int outf, char *buffer, long num){
+ long words=0,temp;
+@@ -668,7 +713,12 @@
+
+ atexit(cleanup);
+
+- while((c=getopt_long(argc,argv,optstring,options,&long_option_index))!=EOF){
++#ifdef GETOPT_LONG
++ while((c=getopt_long(argc,argv,optstring,options,&long_option_index))!=EOF)
++#else
++ while((c=getopt(argc,argv,optstring))!=EOF)
++#endif
++ {
+ switch(c){
+ case 'B':
+ batch=1;
+@@ -797,6 +847,13 @@
+ report(VERSION);
+
+ /* Query the cdrom/disc; we may need to override some settings */
++
++#ifndef __linux__ /* XXX */
++ if (!force_generic_device)
++ errx(1, "-g option is currently required by NetBSD version");
++ if (!force_cdrom_device)
++ force_cdrom_device=copystring(force_generic_device);
++#endif
+
+ if(force_generic_device)
+ d=cdda_identify_scsi(force_generic_device,force_cdrom_device,verbose,NULL);
diff --git a/audio/cdparanoia/patches/patch-ba b/audio/cdparanoia/patches/patch-ba
new file mode 100644
index 00000000000..08f3d2a0209
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ba
@@ -0,0 +1,21 @@
+$NetBSD: patch-ba,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- paranoia/Makefile.in.orig Tue Dec 14 13:28:04 1999
++++ paranoia/Makefile.in Mon Jan 17 23:26:01 2000
+@@ -22,7 +22,6 @@
+ #TFILES = isort.t gap.t p_block.t paranoia.t
+
+ LIBS = ../interface/libcdda_interface.a -lm
+-export VERSION
+
+ all: lib slib
+
+@@ -34,7 +33,7 @@
+
+ slib:
+ $(MAKE) lessmessy
+- $(MAKE) libcdda_paranoia.so CFLAGS="$(OPT) -fpic"
++ $(MAKE) libcdda_paranoia.so VERSION=$(VERSION) CFLAGS="$(OPT) -fpic"
+
+ #test: $(TFILES)
+ #
diff --git a/audio/cdparanoia/patches/patch-ca b/audio/cdparanoia/patches/patch-ca
new file mode 100644
index 00000000000..445a9515182
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ca
@@ -0,0 +1,22 @@
+$NetBSD: patch-ca,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/Makefile.in.orig Tue Dec 14 13:27:59 1999
++++ interface/Makefile.in Mon Jan 17 23:26:00 2000
+@@ -21,8 +21,6 @@
+ OFILES = scan_devices.o common_interface.o cooked_interface.o interface.o\
+ scsi_interface.o smallft.o toc.o test_interface.o
+
+-export VERSION
+-
+ all: lib slib
+
+ debug:
+@@ -33,7 +31,7 @@
+
+ slib:
+ $(MAKE) lessmessy
+- $(MAKE) libcdda_interface.so CFLAGS="$(OPT) -fpic"
++ $(MAKE) libcdda_interface.so VERSION=$(VERSION) CFLAGS="$(OPT) -fpic"
+ [ -e libcdda_interface.so.0 ] || ln -s libcdda_interface.so libcdda_interface.so.0
+
+ test:
diff --git a/audio/cdparanoia/patches/patch-cb b/audio/cdparanoia/patches/patch-cb
new file mode 100644
index 00000000000..2df56a59ceb
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-cb
@@ -0,0 +1,37 @@
+$NetBSD: patch-cb,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/low_interface.h.orig Thu Dec 2 16:19:53 1999
++++ interface/low_interface.h Sun Jan 16 18:48:11 2000
+@@ -25,6 +25,7 @@
+ #include <sys/time.h>
+ #include <sys/types.h>
+
++#ifdef __linux__
+ #include <linux/major.h>
+ #include <linux/version.h>
+
+@@ -48,13 +49,24 @@
+
+ #include <linux/cdrom.h>
+ #include <linux/major.h>
++#endif
++
++#ifdef __NetBSD__
++#include <sys/scsiio.h>
++#include <sys/cdio.h>
++#endif
+
+ #include "cdda_interface.h"
+
+ #define MAX_RETRIES 8
+ #define MAX_BIG_BUFF_SIZE 65536
+ #define MIN_BIG_BUFF_SIZE 4096
++#ifdef __linux__
+ #define SG_OFF sizeof(struct sg_header)
++#endif
++#ifdef __NetBSD__
++#define SG_OFF sizeof(scsireq_t)
++#endif
+
+ #ifndef SG_EMULATED_HOST
+ /* old kernel version; the check for the ioctl is still runtime, this
diff --git a/audio/cdparanoia/patches/patch-cc b/audio/cdparanoia/patches/patch-cc
new file mode 100644
index 00000000000..26418fc7ddb
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-cc
@@ -0,0 +1,15 @@
+$NetBSD: patch-cc,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/utils.h.orig Mon Aug 16 07:13:44 1999
++++ interface/utils.h Sat Jan 15 19:51:10 2000
+@@ -1,4 +1,10 @@
++#ifdef __linux__
+ #include <endian.h>
++#endif
++#ifdef __NetBSD__
++#include <sys/endian.h>
++#include <err.h> /* XXX */
++#endif
+ #include <stdio.h>
+ #include <errno.h>
+ #include <string.h>
diff --git a/audio/cdparanoia/patches/patch-cd b/audio/cdparanoia/patches/patch-cd
new file mode 100644
index 00000000000..535ab0a98a8
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-cd
@@ -0,0 +1,89 @@
+$NetBSD: patch-cd,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/common_interface.c.orig Tue Dec 14 13:28:00 1999
++++ interface/common_interface.c Sat Jan 15 16:55:18 2000
+@@ -13,19 +13,29 @@
+ #include "utils.h"
+ #include "smallft.h"
+
++#ifdef __linux__
+ #include <linux/hdreg.h>
++#endif
+
+ /* Test for presence of a cdrom by pinging with the 'CDROMVOLREAD' ioctl() */
+ int ioctl_ping_cdrom(int fd){
++#ifdef __linux__
+ struct cdrom_volctrl volctl;
+ if (ioctl(fd, CDROMVOLREAD, &volctl))
+ return(1); /* failure */
++#endif
++#ifdef __NetBSD__
++ struct ioc_vol volctl;
++ if (ioctl(fd, CDIOCGETVOL, &volctl))
++ return(1); /* failure */
++#endif
+
+ return(0);
+ /* success! */
+ }
+
+
++#ifdef __linux__
+ /* 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 +56,7 @@
+ free(id);
+ return(ret);
+ }
++#endif
+
+ int data_bigendianp(cdrom_drive *d){
+ float lsb_votes=0;
+@@ -171,7 +182,9 @@
+ knows the leasoud/leadin size. */
+
+ int FixupTOC(cdrom_drive *d,int tracks){
++#ifdef __linux__
+ struct cdrom_multisession ms_str;
++#endif
+ int j;
+
+ /* First off, make sure the 'starting sector' is >=0 */
+@@ -209,13 +222,24 @@
+ CDROM device, not the generic device. */
+
+ if (d->ioctl_fd != -1) {
++#ifdef __linux__
+ int result;
+
+ ms_str.addr_format = CDROM_LBA;
+ result = ioctl(d->ioctl_fd, CDROMMULTISESSION, &ms_str);
+ if (result == -1) return -1;
++# define ms_addr (ms_str.addr.lba)
++#endif
++
++#ifdef __NetBSD__
++ int ms_addr;
++
++ ms_addr = 0; /* last session */
++ if (ioctl(d->ioctl_fd, CDIOREADMSADDR, &ms_addr) == -1)
++ return -1;
++#endif
+
+- if (ms_str.addr.lba > 100) {
++ if (ms_addr > 100) {
+
+ /* This is an odd little piece of code --Monty */
+
+@@ -223,8 +247,8 @@
+ /* adjust end of last audio track to be in the first session */
+ 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 > ms_str.addr.lba - 11400)
+- d->disc_toc[j].dwStartSector = ms_str.addr.lba - 11400;
++ if (d->disc_toc[j].dwStartSector > ms_addr - 11400)
++ d->disc_toc[j].dwStartSector = ms_addr - 11400;
+ break;
+ }
+ }
diff --git a/audio/cdparanoia/patches/patch-ce b/audio/cdparanoia/patches/patch-ce
new file mode 100644
index 00000000000..de11aaf47db
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-ce
@@ -0,0 +1,111 @@
+$NetBSD: patch-ce,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/cooked_interface.c.orig Wed Aug 18 15:54:32 1999
++++ interface/cooked_interface.c Mon Jan 17 23:43:14 2000
+@@ -13,6 +13,7 @@
+ static int cooked_readtoc (cdrom_drive *d){
+ int i;
+ int tracks;
++#ifdef __linux__
+ struct cdrom_tochdr hdr;
+ struct cdrom_tocentry entry;
+
+@@ -52,6 +53,45 @@
+ d->disc_toc[i].dwStartSector = entry.cdte_addr.lba;
+
+ tracks=hdr.cdth_trk1+1;
++#endif
++
++#ifdef __NetBSD__
++ struct ioc_read_toc_entry hdr;
++ struct cd_toc_entry entries[MAXTRK + 1]; /* + 1 for leadout */
++
++ hdr.address_format = CD_LBA_FORMAT;
++ hdr.starting_track = 1;
++ hdr.data_len = sizeof entries;
++ hdr.data = entries;
++ memset(entries, 0, sizeof entries);
++
++ /* get all TOC entries at once */
++#ifndef CDIOREADTOCENTRIES
++#define CDIOREADTOCENTRIES CDIOREADTOCENTRYS
++#endif
++ if(ioctl(d->ioctl_fd, CDIOREADTOCENTRIES, &hdr))
++ switch(errno){
++ case EPERM:
++ cderror(d,"102: Permision denied on cdrom (ioctl) device\n");
++ return(-102);
++ default:
++ cderror(d,"004: Unable to read table of contents header\n");
++ return(-4);
++ }
++
++ for(i = 0; i < MAXTRK + 1; i++) {
++ d->disc_toc[i].bFlags = (entries[i].addr_type << 4) | (entries[i].control & 0x0f);
++ d->disc_toc[i].bTrack = entries[i].track;
++ d->disc_toc[i].dwStartSector = entries[i].addr.lba;
++ if (entries[i].track == 0) {
++ cderror(d,"005: Unable to read table of contents entry\n");
++ return(-5);
++ }
++ if (entries[i].track >= 100)
++ break; /* leadout */
++ }
++ tracks = i;
++#endif
+ d->cd_extra=FixupTOC(d,tracks);
+ return(--tracks); /* without lead-out */
+ }
+@@ -60,10 +100,15 @@
+ /* Set operating speed */
+ static int cooked_setspeed(cdrom_drive *d, int speed)
+ {
++#ifdef __linux__
+ if(d->ioctl_fd!=-1)
+ return ioctl(d->ioctl_fd, CDROM_SELECT_SPEED, speed);
+ else
+ return 0;
++#endif
++#ifdef __NetBSD__
++ errx(1, "cooked_setspeed: not implemented");
++#endif
+ }
+
+
+@@ -72,6 +117,7 @@
+ */
+
+ static long cooked_read (cdrom_drive *d, void *p, long begin, long sectors){
++#ifdef __linux__
+ int retry_count,err;
+ struct cdrom_read_audio arg;
+ char *buffer=(char *)p;
+@@ -127,6 +173,10 @@
+ } while (err);
+
+ return(sectors);
++#endif
++#ifdef __NetBSD__
++ errx(1, "cooked_read: not implemented");
++#endif
+ }
+
+ /* hook */
+@@ -191,6 +241,7 @@
+
+ /* set function pointers to use the ioctl routines */
+ int cooked_init_drive (cdrom_drive *d){
++#ifdef __linux__
+ int ret;
+
+ switch(d->drive_type){
+@@ -255,5 +306,9 @@
+ if((ret=verify_read_command(d)))return(ret);
+ d->error_retry=1;
+ return(0);
++#endif
++#ifdef __NetBSD__
++ errx(1, "cooked_init_drive: not implemented");
++#endif
+ }
+
diff --git a/audio/cdparanoia/patches/patch-cf b/audio/cdparanoia/patches/patch-cf
new file mode 100644
index 00000000000..1737f9111aa
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-cf
@@ -0,0 +1,190 @@
+$NetBSD: patch-cf,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/scan_devices.c.orig Tue Dec 14 16:30:23 1999
++++ interface/scan_devices.c Sat Jan 15 20:09:29 2000
+@@ -17,6 +17,8 @@
+ #include "common_interface.h"
+ #include "utils.h"
+
++#ifdef __linux__
++
+ #define MAX_DEV_LEN 20 /* Safe because strings only come from below */
+ /* must be absolute paths! */
+ static char *scsi_cdrom_prefixes[3]={"/dev/scd","/dev/sr",NULL};
+@@ -28,10 +30,12 @@
+ /* "/dev/aztcd", timeout is too long */
+ "/dev/cm206cd",
+ "/dev/gscd","/dev/optcd",NULL};
++#endif
+
+ /* Functions here look for a cdrom drive; full init of a drive type
+ happens in interface.c */
+
++#ifdef __linux__
+ cdrom_drive *cdda_find_a_cdrom(int messagedest,char **messages){
+ /* Brute force... */
+
+@@ -78,6 +82,16 @@
+ }
+ return(NULL);
+ }
++#endif /* __linux__ */
++
++#ifdef __NetBSD__
++
++cdrom_drive *cdda_find_a_cdrom(int messagedest,char **messages)
++{
++ errx(1, "cdda_find_a_cdrom: not implemented");
++ /* NOTREACHED */
++}
++#endif /* __NetBSD__ */
+
+ cdrom_drive *cdda_identify(const char *device, int messagedest,char **messages){
+ struct stat st;
+@@ -143,6 +157,7 @@
+ cdrom_drive *cdda_identify_cooked(const char *dev, int messagedest,
+ char **messages){
+
++#ifdef __linux__
+ cdrom_drive *d=NULL;
+ struct stat st;
+ int fd=-1;
+@@ -270,6 +285,12 @@
+ idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",description);
+
+ return(d);
++#endif
++
++#ifdef __NetBSD__
++ /* no kernel support for CD-DA */
++ return NULL;
++#endif
+ }
+
+ struct sg_id {
+@@ -289,12 +310,18 @@
+
+ /* Even *this* isn't as simple as it bloody well should be :-P */
+ static int get_scsi_id(int fd, scsiid *id){
++#ifdef __linux__
+ struct sg_id argid;
++#endif
++#ifdef __NetBSD__
++ struct scsi_addr argid;
++#endif
+ int busarg;
+
+ /* get the host/id/lun */
+
+ if(fd==-1)return(-1);
++#ifdef __linux__
+ if(ioctl(fd,SCSI_IOCTL_GET_IDLUN,&argid))return(-1);
+ id->bus=argid.l2; /* for now */
+ id->id=argid.l1&0xff;
+@@ -302,6 +329,13 @@
+
+ if(ioctl(fd,SCSI_IOCTL_GET_BUS_NUMBER,&busarg)==0)
+ id->bus=busarg;
++#endif
++#ifdef __NetBSD__
++ if(ioctl(fd,SCIOCIDENTIFY,&argid))return(-1);
++ id->bus=argid.addr.scsi.scbus;
++ id->id=argid.addr.scsi.target;
++ id->lun=argid.addr.scsi.lun;
++#endif
+
+ return(0);
+ }
+@@ -410,6 +444,7 @@
+ generic_device);
+ return(NULL);
+ }
++#ifdef __linux__
+ if((int)(g_st.st_rdev>>8)!=SCSI_GENERIC_MAJOR){
+ if((int)(g_st.st_rdev>>8)!=SCSI_CDROM_MAJOR){
+ idmessage(messagedest,messages,"\t\t%s is not a SCSI device",
+@@ -421,6 +456,7 @@
+ ioctl_device=temp;
+ }
+ }
++#endif
+ }
+ if(ioctl_device){
+ if(stat(ioctl_device,&i_st)){
+@@ -428,6 +464,7 @@
+ ioctl_device);
+ return(NULL);
+ }
++#ifdef __linux__
+ if((int)(i_st.st_rdev>>8)!=SCSI_CDROM_MAJOR){
+ if((int)(i_st.st_rdev>>8)!=SCSI_GENERIC_MAJOR){
+ idmessage(messagedest,messages,"\t\t%s is not a SCSI device",
+@@ -439,6 +476,7 @@
+ ioctl_device=temp;
+ }
+ }
++#endif
+ }
+
+ /* we need to resolve any symlinks for the lookup code to work */
+@@ -455,6 +493,7 @@
+ }
+
+ if(!generic_device || !ioctl_device){
++#ifdef __linux__
+ if(generic_device){
+ ioctl_device=scsi_match(generic_device,scsi_cdrom_prefixes,O_RDWR,
+ O_RDONLY|O_NONBLOCK,
+@@ -468,6 +507,9 @@
+ if(!generic_device)
+ goto cdda_identify_scsi_fail;
+ }
++#else
++ goto cdda_identify_scsi_fail;
++#endif
+ }
+
+ idmessage(messagedest,messages,"\t\tgeneric device: %s",generic_device);
+@@ -504,6 +546,7 @@
+
+ type=(int)(i_st.st_rdev>>8);
+
++#ifdef __linux__
+ if(type==SCSI_CDROM_MAJOR){
+ if (!S_ISBLK(i_st.st_mode)) {
+ idmessage(messagedest,messages,"\t\tSCSI CDROM device %s not a "
+@@ -515,8 +558,10 @@
+ "major number",ioctl_device);
+ goto cdda_identify_scsi_fail;
+ }
++#endif
+ }
+
++#ifdef __linux__
+ if((int)(g_st.st_rdev>>8)==SCSI_GENERIC_MAJOR){
+ if (!S_ISCHR(g_st.st_mode)) {
+ idmessage(messagedest,messages,"\t\tGeneric SCSI device %s not a "
+@@ -528,6 +573,7 @@
+ "major number",generic_device);
+ goto cdda_identify_scsi_fail;
+ }
++#endif
+
+ d=calloc(1,sizeof(cdrom_drive));
+
+@@ -564,6 +610,15 @@
+
+ /* It would seem some TOSHIBA CDROM gets things wrong */
+
++#ifndef TYPE_DISK
++#define TYPE_DISK 0 /* direct */
++#endif
++#ifndef TYPE_WORM
++#define TYPE_WORM 4 /* write once, read many */
++#endif
++#ifndef TYPE_ROM
++#define TYPE_ROM 5 /* CD-ROM */
++#endif
+ if (!strncmp (p + 8, "TOSHIBA", 7) &&
+ !strncmp (p + 16, "CD-ROM", 6) &&
+ p[0] == TYPE_DISK) {
diff --git a/audio/cdparanoia/patches/patch-cg b/audio/cdparanoia/patches/patch-cg
new file mode 100644
index 00000000000..8fc7441d687
--- /dev/null
+++ b/audio/cdparanoia/patches/patch-cg
@@ -0,0 +1,187 @@
+$NetBSD: patch-cg,v 1.1.1.1 2000/01/19 08:03:00 itohy Exp $
+
+--- interface/scsi_interface.c.orig Tue Dec 14 13:28:03 1999
++++ interface/scsi_interface.c Tue Jan 18 08:33:33 2000
+@@ -32,6 +32,7 @@
+ #endif
+
+ static int look_for_dougg(cdrom_drive *d){
++#ifdef __linux__
+ /* are we using the new SG driver by Doug Gilbert? If so, our memory
+ strategy will be different. */
+ int reserved,table;
+@@ -78,6 +79,9 @@
+ }
+
+ return(1);
++#else
++ return(0);
++#endif
+ }
+
+ static void find_bloody_big_buff_size(cdrom_drive *d){
+@@ -142,6 +146,7 @@
+
+ }
+
++#ifdef __linux__
+ static void clear_garbage(cdrom_drive *d){
+ fd_set fdset;
+ struct timeval tv;
+@@ -172,20 +177,28 @@
+ flag=1;
+ }
+ }
++#endif
+
+ /* process a complete scsi command. */
+ static int handle_scsi_cmd(cdrom_drive *d,
+ unsigned int cmd_len,
+ unsigned int in_size,
+ unsigned int out_size,
+- unsigned char bytefill,
++ unsigned int bfill,
+ int bytecheck){
++ unsigned char bytefill = bfill;
+ int status = 0;
++#ifdef __linux__
+ struct sg_header *sg_hd=(struct sg_header *)d->sg;
+ long writebytes=SG_OFF+cmd_len+in_size;
++#endif
++#ifdef __NetBSD__
++ scsireq_t *sreq = (scsireq_t *)d->sg;
++#endif
+
+ /* generic scsi device services */
+
++#ifdef __linux__
+ /* clear out any possibly preexisting garbage */
+ clear_garbage(d);
+
+@@ -291,11 +304,53 @@
+ if(errno==0)errno=EIO;
+ return(TR_EREAD);
+ }
++#endif /* __linux__ */
++
++#ifdef __NetBSD__
++ if (in_size && out_size) {
++ warnx("handle_scsi_cmd: in and out is not supported");
++ abort();
++ }
++ memset(sreq, 0, sizeof(scsireq_t));
++ sreq->cmdlen = cmd_len;
++ memcpy(sreq->cmd, d->sg_buffer, cmd_len);
++ if (in_size) {
++ sreq->flags = SCCMD_WRITE;
++ sreq->databuf = d->sg_buffer + cmd_len;
++ sreq->datalen = out_size;
++ }
++ if (out_size) {
++ sreq->flags = SCCMD_READ;
++ sreq->databuf = d->sg_buffer;
++ sreq->datalen = out_size;
++ if(bytecheck)
++ memset(d->sg_buffer, bytefill, out_size);
++ }
++ sreq->senselen = SENSEBUFLEN;
++ sreq->timeout = 10000; /* 10s */
+
+- if(sg_hd->sense_buffer[0]){
++ status = ioctl(d->cdda_fd, SCIOCCOMMAND, (void *) sreq);
++ if (status < 0)
++ return(TR_ILLEGAL);
++#endif
++
++#ifdef __linux__
++ if(sg_hd->sense_buffer[0])
++#endif
++#ifdef __NetBSD__
++ if (sreq->sense[0])
++#endif
++ {
++#ifdef __linux__
+ char key=sg_hd->sense_buffer[2]&0xf;
+ char ASC=sg_hd->sense_buffer[12];
+ char ASCQ=sg_hd->sense_buffer[13];
++#endif
++#ifdef __NetBSD__
++ char key = sreq->sense[2]&0xf;
++ char ASC = sreq->sense[12];
++ char ASCQ = sreq->sense[13];
++#endif
+ switch(key){
+ case 0:
+ if(errno==0)errno=EIO;
+@@ -333,9 +388,20 @@
+ commands still get through. Perhaps no data comes back even
+ though the target reports success? */
+
+- if(bytecheck && in_size+cmd_len<out_size){
++#ifdef __linux__
++ if(bytecheck && in_size+cmd_len<out_size)
++#endif
++#ifdef __NetBSD__
++ if(bytecheck && out_size)
++#endif
++ {
+ long i,flag=0;
++#ifdef __linux__
+ for(i=in_size;i<out_size;i++)
++#endif
++#ifdef __NetBSD__
++ for(i=0;i<out_size;i++)
++#endif
+ if(d->sg_buffer[i]!=bytefill){
+ flag=1;
+ break;
+@@ -840,16 +906,29 @@
+ 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;
++#endif
++#ifdef __NetBSD__
++ scsireq_t *sreq=(scsireq_t *)d->sg;
++#endif
+ char b[256];
+
+ sprintf(b,"scsi_read error: sector=%ld length=%ld retry=%d\n",
+ begin,sectors,retry_count);
+ cdmessage(d,b);
+ 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)(sg_hd->sense_buffer[13])
++#endif
++#ifdef __NetBSD__
++ (int)(sreq->sense[2]&0xf),
++ (int)(sreq->sense[12]),
++ (int)(sreq->sense[13])
++#endif
++ );
+ cdmessage(d,b);
+ sprintf(b," Transport error: %s\n",strerror_tr[err]);
+ cdmessage(d,b);
+@@ -859,9 +938,17 @@
+ 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",
++#ifdef __linux__
+ (int)(sg_hd->sense_buffer[2]&0xf),
+ (int)(sg_hd->sense_buffer[12]),
+- (int)(sg_hd->sense_buffer[13]));
++ (int)(sg_hd->sense_buffer[13])
++#endif
++#ifdef __NetBSD__
++ (int)(sreq->sense[2]&0xf),
++ (int)(sreq->sense[12]),
++ (int)(sreq->sense[13])
++#endif
++ );
+ fprintf(stderr," Transport error: %s\n",strerror_tr[err]);
+ fprintf(stderr," System error: %s\n",strerror(errno));
+ }
diff --git a/audio/cdparanoia/pkg/COMMENT b/audio/cdparanoia/pkg/COMMENT
new file mode 100644
index 00000000000..66260ea1af6
--- /dev/null
+++ b/audio/cdparanoia/pkg/COMMENT
@@ -0,0 +1 @@
+CDDA reading utility with extra data verification features
diff --git a/audio/cdparanoia/pkg/DESCR b/audio/cdparanoia/pkg/DESCR
new file mode 100644
index 00000000000..175cf551b48
--- /dev/null
+++ b/audio/cdparanoia/pkg/DESCR
@@ -0,0 +1,15 @@
+Cdparanoia retrieves audio tracks from CDDA capable CDROM drives.
+The data can be saved to a file or directed to standard output
+in WAV, AIFF, AIFF-C or raw format. Most ATAPI, SCSI and several
+proprietary CDROM drive makes are supported; cdparanoia can
+determine if the target drive is CDDA capable.
+
+In addition to simple reading, cdparanoia adds extra-robust
+data verification, synchronization, error handling and scratch
+reconstruction capability.
+
+Note on NetBSD pkg:
+ This is only a trial and incomplete.
+
+ Currently, the feature to search for CD-ROM device is
+ not implemented and the -g option is required.
diff --git a/audio/cdparanoia/pkg/PLIST b/audio/cdparanoia/pkg/PLIST
new file mode 100644
index 00000000000..7b53490c249
--- /dev/null
+++ b/audio/cdparanoia/pkg/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2000/01/19 08:03:01 itohy Exp $
+bin/cdparanoia
+man/man1/cdparanoia.1