diff options
author | drochner <drochner> | 2011-01-08 12:43:10 +0000 |
---|---|---|
committer | drochner <drochner> | 2011-01-08 12:43:10 +0000 |
commit | eb5e1e8f3793dcb0df7c1e3ba6d5a55b39587fde (patch) | |
tree | b64023f30278ce6555dcfcef4054ed84c892b9c8 /misc | |
parent | 1710145b7bd1b424881360d88b38e4588b2cac00 (diff) | |
download | pkgsrc-eb5e1e8f3793dcb0df7c1e3ba6d5a55b39587fde.tar.gz |
add Dragonfly support, from Tony Young per PR pkg/44345
Diffstat (limited to 'misc')
-rw-r--r-- | misc/mkcue/Makefile | 6 | ||||
-rw-r--r-- | misc/mkcue/distinfo | 3 | ||||
-rw-r--r-- | misc/mkcue/files/mb_dragonfly.cpp | 160 | ||||
-rw-r--r-- | misc/mkcue/files/mb_dragonfly.h | 56 | ||||
-rw-r--r-- | misc/mkcue/patches/patch-ab | 12 |
5 files changed, 235 insertions, 2 deletions
diff --git a/misc/mkcue/Makefile b/misc/mkcue/Makefile index abd3ac16d1b..e4af652649a 100644 --- a/misc/mkcue/Makefile +++ b/misc/mkcue/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.1.1 2009/07/27 19:35:00 drochner Exp $ +# $NetBSD: Makefile,v 1.2 2011/01/08 12:43:10 drochner Exp $ # DISTNAME= mkcue_1.orig @@ -19,4 +19,8 @@ MAKE_FILE= GNUmakefile PKG_DESTDIR_SUPPORT= user-destdir INSTALLATION_DIRS= bin +post-extract: + ${CP} ${FILESDIR}/mb_dragonfly.cpp ${WRKSRC}/osdep + ${CP} ${FILESDIR}/mb_dragonfly.h ${WRKSRC}/osdep + .include "../../mk/bsd.pkg.mk" diff --git a/misc/mkcue/distinfo b/misc/mkcue/distinfo index b0f3bdd023d..e335f7b00c0 100644 --- a/misc/mkcue/distinfo +++ b/misc/mkcue/distinfo @@ -1,6 +1,7 @@ -$NetBSD: distinfo,v 1.1.1.1 2009/07/27 19:35:00 drochner Exp $ +$NetBSD: distinfo,v 1.2 2011/01/08 12:43:10 drochner Exp $ SHA1 (mkcue_1.orig.tar.gz) = d9a69718ba3d862b589588bdf61796f755200f9d RMD160 (mkcue_1.orig.tar.gz) = 8462f803235d90fef3d4dd27a83a47ae895cd4b2 Size (mkcue_1.orig.tar.gz) = 80650 bytes SHA1 (patch-aa) = 54e894382ab940d522290b6d65503146149fd7e0 +SHA1 (patch-ab) = ac8ba060fff82d1597e189c0dde4db33f0cff871 diff --git a/misc/mkcue/files/mb_dragonfly.cpp b/misc/mkcue/files/mb_dragonfly.cpp new file mode 100644 index 00000000000..f43e044cc15 --- /dev/null +++ b/misc/mkcue/files/mb_dragonfly.cpp @@ -0,0 +1,160 @@ +/* -------------------------------------------------------------------------- + + MusicBrainz -- The Internet music metadatabase + + Copyright (C) 2000 Robert Kaye + Copyright (C) 1999 Marc E E van Woerkom + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +----------------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <assert.h> +#include <netinet/in.h> + +#include "mb.h" +#include "diskid.h" +#include "config.h" + + +MUSICBRAINZ_DEVICE DEFAULT_DEVICE = "/dev/cd0"; + + +int ReadTOCHeader(int fd, + int& first, + int& last) +{ + struct ioc_toc_header th; + + int ret = ioctl(fd, + CDIOREADTOCHEADER, + &th); + + if (!ret) + { + first = th.starting_track; + last = th.ending_track; + } + + return ret; +} + + +int ReadTOCEntry(int fd, + int track, + int& lba) +{ + struct ioc_read_toc_entry te; + + te.starting_track = (u_char) track; + te.address_format = CD_LBA_FORMAT; // experiment and cdio.h say + // lbas are given in network order! + + struct cd_toc_entry cte; + + te.data = &cte; + te.data_len = sizeof(cd_toc_entry); + + int ret = ioctl(fd, + CDIOREADTOCENTRYS, + &te); + + if (!ret) { + assert(te.address_format == CD_LBA_FORMAT); + + lba = ntohl(te.data->addr.lba); // network to host order (long) + } + + return ret; +} + + +bool DiskId::ReadTOC(MUSICBRAINZ_DEVICE device, + MUSICBRAINZ_CDINFO& cdinfo) +{ + int fd; + int first; + int last; + int lba; + int i; + + if (device == NULL) + { + device = DEFAULT_DEVICE; + } + + fd = open(device, O_RDONLY); + if (fd < 0) + { + char err[256]; + + sprintf(err, "Cannot open '%s'", device); + ReportError(err); + + return false; + } + + // Initialize cdinfo to all zeroes. + memset(&cdinfo, 0, sizeof(MUSICBRAINZ_CDINFO)); + + // Find the number of the first track (usually 1) and the last track. + if (ReadTOCHeader(fd, first, last)) + { + ReportError("Cannot read table of contents."); + close(fd); + return false; + } + + // Do some basic error checking. + if (last==0) + { + ReportError("This disk has no tracks."); + close(fd); + return false; + } + + + // Now, for every track, find out the block address where it starts. + for (i = first; i <= last; i++) + { + ReadTOCEntry(fd, i, lba); + cdinfo.FrameOffset[i] = lba + 150; + } + + + // Get the logical block address (lba) for the end of the audio data. + // The "LEADOUT" track is the track beyond the final audio track + // so we're looking for the block address of the LEADOUT track. + + int CDROM_LEADOUT = last + 1; + ReadTOCEntry(fd, CDROM_LEADOUT, lba); + cdinfo.FrameOffset[0] = lba + 150; + + cdinfo.FirstTrack = first; + cdinfo.LastTrack = last; + + close(fd); + + return true; +} diff --git a/misc/mkcue/files/mb_dragonfly.h b/misc/mkcue/files/mb_dragonfly.h new file mode 100644 index 00000000000..ea690c50d66 --- /dev/null +++ b/misc/mkcue/files/mb_dragonfly.h @@ -0,0 +1,56 @@ +/* -------------------------------------------------------------------------- + + MusicBrainz -- The Internet music metadatabase + + Copyright (C) 2000 Robert Kaye + Copyright (C) 1999 Marc E E van Woerkom + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +----------------------------------------------------------------------------*/ +#if !defined(_CDI_DRAGONFLY_H_) +#define _CDI_DRAGONFLY_H_ + + +#define OS "DragonFly" + + + +// +// DragonFly CD audio declarations +// + +#include <sys/cdio.h> + +typedef char* MUSICBRAINZ_DEVICE; + + + +// +// DragonFly specific prototypes +// + + +int ReadTOCHeader(int fd, + int& first, + int& last); + +int ReadTOCEntry(int fd, + int track, + int& lba); + + +#endif + diff --git a/misc/mkcue/patches/patch-ab b/misc/mkcue/patches/patch-ab new file mode 100644 index 00000000000..a3c9cab2756 --- /dev/null +++ b/misc/mkcue/patches/patch-ab @@ -0,0 +1,12 @@ +$NetBSD: patch-ab,v 1.1 2011/01/08 12:43:10 drochner Exp $ + +--- configure.orig 2011-01-08 20:02:27 +1300 ++++ configure 2011-01-08 19:58:18 +1300 +@@ -1387,6 +1387,7 @@ + *-os2_emx*) os=os2 ;; + *-solaris*) os=solaris; LIBS='-lsocket -lnsl' ;; + *-qnx*) os=qnx; LIBS='-lsocket' ;; ++ *-dragonfly*) os=dragonfly;; + *) echo "$as_me:$LINENO: result: WARNING: unknown system" >&5 + echo "${ECHO_T}WARNING: unknown system" >&6 ;; + esac |