rbcdio 0.01

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/AUTHORS +1 -0
  2. data/COPYING +340 -0
  3. data/ChangeLog +315 -0
  4. data/INSTALL +236 -0
  5. data/Makefile.am +163 -0
  6. data/Makefile.in +557 -0
  7. data/NEWS +5 -0
  8. data/README +75 -0
  9. data/Rakefile +234 -0
  10. data/THANKS +3 -0
  11. data/VERSION +1 -0
  12. data/VERSION.in +1 -0
  13. data/config.guess +1473 -0
  14. data/config.sub +1576 -0
  15. data/configure +4802 -0
  16. data/configure.ac +158 -0
  17. data/data/copying.iso +0 -0
  18. data/data/isofs-m1.bin +0 -0
  19. data/data/isofs-m1.cue +3 -0
  20. data/doc/created.rid +1 -0
  21. data/doc/fr_class_index.html +42 -0
  22. data/doc/fr_file_index.html +40 -0
  23. data/doc/fr_method_index.html +133 -0
  24. data/doc/index.html +24 -0
  25. data/doc/rdoc-style.css +208 -0
  26. data/example/COPYING +340 -0
  27. data/example/README +47 -0
  28. data/example/audio.rb +186 -0
  29. data/example/cd-read.rb +167 -0
  30. data/example/copying +340 -0
  31. data/example/device.rb +91 -0
  32. data/example/drivers.rb +63 -0
  33. data/example/drives.rb +63 -0
  34. data/example/eject.rb +69 -0
  35. data/example/iso1.rb +89 -0
  36. data/example/iso2.rb +106 -0
  37. data/example/iso3.rb +111 -0
  38. data/example/tracks.rb +83 -0
  39. data/ext/cdio/Makefile +139 -0
  40. data/ext/cdio/extconf.rb +9 -0
  41. data/ext/cdio/rubycdio_wrap.c +3410 -0
  42. data/ext/iso9660/Makefile +139 -0
  43. data/ext/iso9660/extconf.rb +10 -0
  44. data/ext/iso9660/rubyiso9660_wrap.c +3005 -0
  45. data/install-sh +323 -0
  46. data/lib/Makefile +7 -0
  47. data/lib/cdio.rb +1000 -0
  48. data/lib/iso9660.rb +566 -0
  49. data/missing +360 -0
  50. data/rubycdio.m4 +14 -0
  51. data/swig/Makefile +7 -0
  52. data/swig/audio.swg +63 -0
  53. data/swig/compat.swg +104 -0
  54. data/swig/device.swg +513 -0
  55. data/swig/device_const.swg +144 -0
  56. data/swig/disc.swg +96 -0
  57. data/swig/read.swg +164 -0
  58. data/swig/rubycdio.swg +86 -0
  59. data/swig/rubyiso9660.swg +827 -0
  60. data/swig/track.swg +206 -0
  61. data/swig/types.swg +65 -0
  62. data/test/Makefile +7 -0
  63. data/test/Rakefile +8 -0
  64. data/test/cdda.bin +0 -0
  65. data/test/cdda.cue +7 -0
  66. data/test/cdda.toc +14 -0
  67. data/test/cdiotest.rb +228 -0
  68. data/test/isocopy.rb +394 -0
  69. data/test/isotest.rb +187 -0
  70. metadata +116 -0
data/example/drives.rb ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: drives.rb,v 1.8 2006/12/16 14:29:06 rocky Exp $
3
+ #
4
+ # Program to read CD blocks. See read-cd from the libcdio distribution
5
+ # for a more complete program.
6
+
7
+ #
8
+ # Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
9
+ #
10
+ # This program is free software; you can redistribute it and/or modify
11
+ # it under the terms of the GNU General Public License as published by
12
+ # the Free Software Foundation; either version 2 of the License, or
13
+ # (at your option) any later version.
14
+ #
15
+ # This program is distributed in the hope that it will be useful,
16
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ # GNU General Public License for more details.
19
+ #
20
+ # You should have received a copy of the GNU General Public License
21
+ # along with this program; if not, write to the Free Software
22
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
+ #
24
+ mypath = File.dirname(__FILE__)
25
+ if(File::exists?(mypath + "/../lib/cdio.rb"))
26
+ $: << File.dirname(__FILE__) + '/../lib'
27
+ $: << File.dirname(__FILE__) + '/../ext/cdio'
28
+ else
29
+ require 'rubygems'
30
+ require_gem "rbcdio"
31
+ end
32
+ require "cdio"
33
+
34
+ def print_drive_class(msg, bitmask, any)
35
+ cd_drives = Cdio::devices_with_cap(bitmask, any)
36
+
37
+ puts "%s..." % msg
38
+ for drive in cd_drives
39
+ puts "Drive %s" % drive
40
+ end
41
+ puts "-----"
42
+ end
43
+
44
+ cd_drives = Cdio::devices(Rubycdio::DRIVER_DEVICE)
45
+ if not cd_drives
46
+ puts "No CD-ROM drives found"
47
+ exit
48
+ end
49
+ for drive in cd_drives
50
+ puts "Drive %s" % drive
51
+ end
52
+
53
+ puts "-----"
54
+
55
+ print_drive_class("All CD-ROM drives (again)", Rubycdio::FS_MATCH_ALL, false);
56
+ print_drive_class("All CD-DA drives...", Rubycdio::FS_AUDIO, false);
57
+ print_drive_class("All drives with ISO 9660...", Rubycdio::FS_ISO_9660, false);
58
+ print_drive_class("VCD drives...",
59
+ (Rubycdio::FS_ANAL_SVCD|Rubycdio::FS_ANAL_CVD|
60
+ Rubycdio::FS_ANAL_VIDEOCD|Rubycdio::FS_UNKNOWN), true);
61
+
62
+
63
+
data/example/eject.rb ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: eject.rb,v 1.10 2006/12/16 13:24:48 rocky Exp $
3
+ #
4
+ # A program to eject and close CD-ROM drive
5
+
6
+ # Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ mypath = File.dirname(__FILE__)
23
+ if(File::exists?(mypath + "/../lib/cdio.rb"))
24
+ $: << File.dirname(__FILE__) + '/../lib'
25
+ $: << File.dirname(__FILE__) + '/../ext/cdio'
26
+ else
27
+ require 'rubygems'
28
+ require_gem "rbcdio"
29
+ end
30
+ require "cdio"
31
+
32
+ if ARGV.length() > 0
33
+ begin
34
+ drive_name=@ARGV[1]
35
+ d = Cdio::Device.new(drive_name)
36
+ rescue IOError
37
+ print "Problem opening CD-ROM: %s" % drive_name
38
+ exit 1
39
+ end
40
+ else
41
+ begin
42
+ d = Cdio::Device.new(nil, Rubycdio::DRIVER_UNKNOWN)
43
+ drive_name = d.device()
44
+ rescue IOError
45
+ print "Problem finding a CD-ROM"
46
+ exit 1
47
+ end
48
+ end
49
+
50
+ begin
51
+ puts "Sending eject to drive %s" % drive_name
52
+ d.eject_media()
53
+ begin
54
+ puts "Closing CD in drive %s" % drive_name
55
+ Cdio::close_tray(drive_name)
56
+ puts "Closed tray of CD-ROM drive %s" % drive_name
57
+ rescue Cdio::DeviceException
58
+ puts "Closing tray of CD-ROM drive %s failed" % drive_name
59
+ end
60
+
61
+ rescue Cdio::DriverUnsupportedError
62
+ puts "Eject not supported for %s" % drive_name
63
+ rescue Cdio::DeviceException
64
+ puts "Eject of CD-ROM drive %s failed" % drive_name
65
+ end
66
+
67
+
68
+
69
+
data/example/iso1.rb ADDED
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: iso1.rb,v 1.9 2006/12/16 13:24:48 rocky Exp $
3
+ #
4
+ # A simple program to show using libiso9660 to list files in a directory of
5
+ # an ISO-9660 image.
6
+ #
7
+ # If a single argument is given, it is used as the ISO 9660 image to
8
+ # use in the listing. Otherwise a compiled-in default ISO 9660 image
9
+ # name (that comes with the libcdio distribution) will be used.
10
+
11
+ # Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
12
+ #
13
+ # This program is free software; you can redistribute it and/or modify
14
+ # it under the terms of the GNU General Public License as published by
15
+ # the Free Software Foundation; either version 2 of the License, or
16
+ # (at your option) any later version.
17
+ #
18
+ # This program is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ # GNU General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU General Public License
24
+ # along with this program; if not, write to the Free Software
25
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
+
27
+ mypath = File.dirname(__FILE__)
28
+ if(File::exists?(mypath + "/../lib/cdio.rb"))
29
+ $: << File.dirname(__FILE__) + '/../lib'
30
+ $: << File.dirname(__FILE__) + '/../ext/cdio'
31
+ $: << File.dirname(__FILE__) + '/../ext/iso9660'
32
+ else
33
+ require 'rubygems'
34
+ require_gem "rbcdio"
35
+ end
36
+
37
+ require "iso9660"
38
+
39
+ # The default ISO 9660 image if none given
40
+ ISO9660_IMAGE_PATH="../data"
41
+ ISO9660_IMAGE=ISO9660_IMAGE_PATH + "/copying.iso"
42
+ if ARGV.length() > 1
43
+ iso_image_fname = sys.argv[1]
44
+ else
45
+ iso_image_fname = ISO9660_IMAGE
46
+ end
47
+
48
+ iso = ISO9660::IFS.new(iso_image_fname)
49
+
50
+ if not iso.open?()
51
+ puts "Sorry, couldn't open %s as an ISO-9660 image." % iso_image_fname
52
+ exit(1)
53
+ end
54
+
55
+ path = '/'
56
+
57
+ file_stats = iso.readdir(path)
58
+
59
+ id_str = iso.application_id()
60
+ if id_str then puts "Application ID: %s" % id_str end
61
+
62
+ id_str = iso.preparer_id()
63
+ if id_str then puts "Preparer ID: %s" % id_str end
64
+
65
+ id_str = iso.publisher_id()
66
+ if id_str then puts "Publisher ID: %s" % id_str end
67
+
68
+ id_str = iso.system_id()
69
+ if id_str then puts "System ID: %s" % id_str end
70
+
71
+ id_str = iso.volume_id()
72
+ if id_str then puts "Volume ID: %s" % id_str end
73
+
74
+ id_str = iso.volumeset_id()
75
+ if id_str then puts "Volumeset ID: %s" % id_str end
76
+
77
+ for stat in file_stats
78
+ filename = stat["filename"]
79
+ lsn = stat["lsn"]
80
+ size = stat["size"]
81
+ sec_size = stat["secsize"]
82
+ is_dir = stat["type"] == 2 ? 'd' : '-'
83
+ puts "%s [LSN %6d] %8d %s%s" % [is_dir, lsn, size, path,
84
+ ISO9660.name_translate(filename)]
85
+ end
86
+ iso.close()
87
+ exit(0)
88
+
89
+
data/example/iso2.rb ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: iso2.rb,v 1.7 2006/12/16 03:44:48 rocky Exp $
3
+ # A program to show using iso9660 to extract a file
4
+ # from an ISO-9660 image.
5
+ #
6
+ # If a single argument is given, it is used as the ISO 9660 image to
7
+ # use in the extraction. Otherwise a compiled in default ISO 9660
8
+ # image name (that comes with the libcdio distribution) will be used.
9
+
10
+ # Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
11
+ #
12
+ # This program is free software; you can redistribute it and/or modify
13
+ # it under the terms of the GNU General Public License as published by
14
+ # the Free Software Foundation; either version 2 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # This program is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU General Public License
23
+ # along with this program; if not, write to the Free Software
24
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
+
26
+ mypath = File.dirname(__FILE__)
27
+ if(File::exists?(mypath + "/../lib/cdio.rb"))
28
+ $: << File.dirname(__FILE__) + '/../lib'
29
+ $: << File.dirname(__FILE__) + '/../ext/cdio'
30
+ $: << File.dirname(__FILE__) + '/../ext/iso9660'
31
+ else
32
+ require 'rubygems'
33
+ require_gem "rbcdio"
34
+ end
35
+
36
+ require "iso9660"
37
+
38
+ # The default CD image if none given
39
+ cd_image_path = "../data"
40
+ cd_image_fname = cd_image_path + "/isofs-m1.cue"
41
+
42
+ # File to extract if none given.
43
+ iso9660_path="/"
44
+ local_filename="COPYING"
45
+
46
+ if ARGV.length() > 1
47
+ cd_image_fname = ARGV[0]
48
+ if ARGV.length() > 2
49
+ local_filename = ARGV[1]
50
+ if ARGV.length() > 3
51
+ puts "\nusage: %s [CD-ROM-or-image [filename]]\nExtracts filename from CD-ROM-or-image." % $0
52
+ exit(1)
53
+ end
54
+ end
55
+ end
56
+
57
+ begin
58
+ cd = ISO9660::FS::new(cd_image_fname)
59
+ rescue
60
+ puts "Sorry, couldn't open %s as a CD image." % cd_image_fname
61
+ exit(1)
62
+ end
63
+
64
+ statbuf = cd.stat(local_filename, false)
65
+
66
+ if not statbuf
67
+ puts "Could not get ISO-9660 file information for file %s in %s" %
68
+ [local_filename, cd_image_name]
69
+ cd.close()
70
+ exit(2)
71
+ end
72
+
73
+ o = open(local_filename, "w", 0664)
74
+ if not o
75
+ puts "Can't open %s for writing" % local_filename
76
+ end
77
+
78
+ # Copy the blocks from the ISO-9660 filesystem to the local filesystem.
79
+ blocks = (statbuf['size'].to_f / Rubycdio::ISO_BLOCKSIZE).ceil()
80
+ for i in 0 .. blocks - 1
81
+ lsn = statbuf['lsn'] + i
82
+ size, buf = cd.read_data_blocks(lsn)
83
+
84
+ if size < 0
85
+ puts "Error reading ISO 9660 file %s at LSN %d" % [
86
+ local_filename, lsn]
87
+ exit(4)
88
+ end
89
+
90
+ o.write(buf)
91
+ end
92
+
93
+ o.close()
94
+
95
+ # Make sure the file size has the exact same byte size. Without the
96
+ # truncate below, the file will a multiple of ISO_BLOCKSIZE.
97
+
98
+ f = File.new(local_filename, "r+")
99
+ f.truncate(statbuf['size'])
100
+ f.close()
101
+
102
+ puts "Extraction of file '%s' from %s successful." % [
103
+ local_filename, cd_image_fname]
104
+
105
+ cd.close()
106
+ exit(0)
data/example/iso3.rb ADDED
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: iso3.rb,v 1.7 2006/12/16 13:24:48 rocky Exp $
3
+ #
4
+ # A program to show using ISO9660::IFS to extract a file
5
+ # from an ISO-9660 image.
6
+ #
7
+ # If a single argument is given, it is used as the ISO 9660 image to
8
+ # use in the extraction. Otherwise a compiled in default ISO 9660
9
+ # image name (that comes with the libcdio distribution) will be used.
10
+
11
+ # Copyright (C) 2006 Rocky Bernstein <rocky@cpan.org>
12
+ #
13
+ # This program is free software; you can redistribute it and/or modify
14
+ # it under the terms of the GNU General Public License as published by
15
+ # the Free Software Foundation; either version 2 of the License, or
16
+ # (at your option) any later version.
17
+ #
18
+ # This program is distributed in the hope that it will be useful,
19
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ # GNU General Public License for more details.
22
+ #
23
+ # You should have received a copy of the GNU General Public License
24
+ # along with this program; if not, write to the Free Software
25
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
+
27
+ mypath = File.dirname(__FILE__)
28
+ if(File::exists?(mypath + "/../lib/cdio.rb"))
29
+ $: << File.dirname(__FILE__) + '/../lib'
30
+ $: << File.dirname(__FILE__) + '/../ext/cdio'
31
+ $: << File.dirname(__FILE__) + '/../ext/iso9660'
32
+ else
33
+ require 'rubygems'
34
+ require_gem "rbcdio"
35
+ end
36
+
37
+ require "iso9660"
38
+
39
+ # The default ISO 9660 image if none given
40
+ ISO9660_IMAGE_PATH="../data"
41
+ ISO9660_IMAGE=ISO9660_IMAGE_PATH + "/copying.iso"
42
+
43
+ # File to extract if none given.
44
+ local_filename="copying"
45
+
46
+ iso_image_fname = ISO9660_IMAGE
47
+
48
+ if ARGV.length() > 1
49
+ iso_image_fname = ARG[0]
50
+ if ARGV.length() > 2
51
+ local_filename = ARGV[1]
52
+ if ARGV.length() > 3
53
+ puts """
54
+ usage: %s [ISO9660-image.ISO [filename]]
55
+ Extracts filename from ISO9660-image.ISO.
56
+ """ % sys.argv[0]
57
+ exit(1)
58
+ end
59
+ end
60
+ end
61
+
62
+ iso = ISO9660::IFS::new(iso_image_fname)
63
+
64
+ if not iso.open?():
65
+ puts "Sorry, couldn't open %s as an ISO-9660 image." % iso_image_fname
66
+ exit(1)
67
+ end
68
+
69
+ statbuf = iso.stat(local_filename, true)
70
+
71
+ if not statbuf:
72
+ puts "Could not get ISO-9660 file information for file %s" % local_filename
73
+ iso.close()
74
+ exit(2)
75
+ end
76
+
77
+ o = open(local_filename, "w", 0664)
78
+ if not o
79
+ puts "Can't open %s for writing" % local_filename
80
+ end
81
+
82
+ # Copy the blocks from the ISO-9660 filesystem to the local filesystem.
83
+ blocks = (statbuf['size'].to_f / Rubycdio::ISO_BLOCKSIZE).ceil()
84
+
85
+ for i in 0 .. blocks - 1
86
+ lsn = statbuf['lsn'] + i
87
+ size, buf = iso.seek_read(lsn)
88
+
89
+ if size <= 0
90
+ puts "Error reading ISO 9660 file %s at LSN %d" % [
91
+ local_filename, lsn]
92
+ exit(4)
93
+ end
94
+
95
+ o.write(buf)
96
+ end
97
+
98
+ o.close()
99
+
100
+ # Make sure the file size has the exact same byte size. Without the
101
+ # truncate below, the file will a multiple of ISO_BLOCKSIZE.
102
+
103
+ f = File.new(local_filename, "r+")
104
+ f.truncate(statbuf['size'])
105
+ f.close()
106
+
107
+ puts "Extraction of file '%s' from %s successful." % [
108
+ local_filename, iso_image_fname]
109
+
110
+ iso.close()
111
+ exit(0)
data/example/tracks.rb ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: tracks.rb,v 1.10 2006/12/16 13:24:48 rocky Exp $
3
+ #
4
+ # A program to show CD information
5
+
6
+ # Copyright (C) 2006 Rocky Bernstein <rocky@gnu.org>
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation; either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # This program is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ mypath = File.dirname(__FILE__)
23
+ if(File::exists?(mypath + "/../lib/cdio.rb"))
24
+ $: << File.dirname(__FILE__) + '/../lib'
25
+ $: << File.dirname(__FILE__) + '/../ext/cdio'
26
+ else
27
+ require 'rubygems'
28
+ require_gem "rbcdio"
29
+ end
30
+ require "cdio"
31
+
32
+ if ARGV.length() > 0
33
+ begin
34
+ d = Cdio::Device.new(@ARGV[1])
35
+ rescue Cdio::IOError
36
+ puts "Problem opening CD-ROM: %s" % @ARGV[1]
37
+ exit(1)
38
+ end
39
+ else
40
+ begin
41
+ d = Cdio::Device.new("", Rubycdio::DRIVER_UNKNOWN)
42
+ rescue Cdio::IOError
43
+ puts "Problem finding a CD-ROM"
44
+ exit(1)
45
+ end
46
+ end
47
+
48
+ t = d.first_track()
49
+ if not t
50
+ puts "Problem getting first track"
51
+ exit(2)
52
+ end
53
+
54
+ first_track = t.track
55
+ num_tracks = d.num_tracks()
56
+ last_track = first_track+num_tracks-1
57
+
58
+ begin
59
+ last_session = d.last_session()
60
+ puts "CD-ROM %s has %d track(s) and %d session(s)." %
61
+ [d.device(), d.num_tracks(), last_session]
62
+ rescue Cdio::DriverUnsupportedError:
63
+ puts "CD-ROM %s has %d track(s). " % [d.device(), d.num_tracks()]
64
+ end
65
+
66
+ puts "Track format is %s." % d.disc_mode()
67
+
68
+ mcn = d.mcn()
69
+ if mcn
70
+ puts "Media Catalog Number: %s" % mcn
71
+ end
72
+
73
+ puts "%3s: %-6s %s" % ["#", "LSN", "Format"]
74
+ for i in first_track .. last_track
75
+ begin
76
+ t = d.track(i)
77
+ puts "%3d: %06u %-6s %s" % [t.track, t.lsn(), t.msf(), t.format()]
78
+ rescue TrackError
79
+ end
80
+ end
81
+
82
+ puts "%3X: %06u leadout" % [Rubycdio::CDROM_LEADOUT_TRACK, d.disc_last_lsn()]
83
+ d.close()
data/ext/cdio/Makefile ADDED
@@ -0,0 +1,139 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = /usr/lib/ruby/1.8/i586-linux
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ prefix = $(DESTDIR)/usr
11
+ exec_prefix = $(DESTDIR)/usr
12
+ sitedir = $(libdir)/ruby/site_ruby
13
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
14
+ archdir = $(rubylibdir)/$(arch)
15
+ sbindir = $(DESTDIR)/usr/sbin
16
+ datadir = $(DESTDIR)/usr/share
17
+ includedir = $(DESTDIR)/usr/include
18
+ infodir = $(DESTDIR)/usr/share/info
19
+ sysconfdir = $(DESTDIR)/etc
20
+ mandir = $(DESTDIR)/usr/share/man
21
+ libdir = $(DESTDIR)/usr/lib
22
+ sharedstatedir = $(DESTDIR)/usr/com
23
+ oldincludedir = $(DESTDIR)/usr/include
24
+ sitearchdir = $(sitelibdir)/$(sitearch)
25
+ bindir = $(DESTDIR)/usr/bin
26
+ localstatedir = $(DESTDIR)/var
27
+ sitelibdir = $(sitedir)/$(ruby_version)
28
+ libexecdir = $(DESTDIR)/usr/lib
29
+
30
+ CC = gcc
31
+ LIBRUBY = $(LIBRUBY_SO)
32
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
33
+ LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
34
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
35
+
36
+ CFLAGS = -fPIC -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -g -fno-strict-aliasing -fPIC
37
+ CPPFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
38
+ CXXFLAGS = $(CFLAGS)
39
+ DLDFLAGS =
40
+ LDSHARED = $(CC) -shared
41
+ AR = ar
42
+ EXEEXT =
43
+
44
+ RUBY_INSTALL_NAME = ruby
45
+ RUBY_SO_NAME = ruby
46
+ arch = i586-linux
47
+ sitearch = i586-linux
48
+ ruby_version = 1.8
49
+ ruby = /usr/bin/ruby
50
+ RUBY = $(ruby)
51
+ RM = rm -f
52
+ MAKEDIRS = mkdir -p
53
+ INSTALL = /usr/bin/install -c
54
+ INSTALL_PROG = $(INSTALL) -m 0755
55
+ INSTALL_DATA = $(INSTALL) -m 644
56
+ COPY = cp
57
+
58
+ #### End of system configuration section. ####
59
+
60
+ preload =
61
+
62
+ libpath = $(libdir)
63
+ LIBPATH = -L'$(libdir)' -Wl,-R'$(libdir)'
64
+ DEFFILE =
65
+
66
+ CLEANFILES =
67
+ DISTCLEANFILES =
68
+
69
+ extout =
70
+ extout_prefix =
71
+ target_prefix =
72
+ LOCAL_LIBS =
73
+ LIBS = $(LIBRUBYARG_SHARED) -lcdio -ldl -lcrypt -lm -lc
74
+ SRCS = rubycdio_wrap.c
75
+ OBJS = rubycdio_wrap.o
76
+ TARGET = rubycdio
77
+ DLLIB = $(TARGET).so
78
+ STATIC_LIB =
79
+
80
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
81
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
82
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
83
+
84
+ TARGET_SO = $(DLLIB)
85
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
86
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
87
+
88
+ all: $(DLLIB)
89
+ static: $(STATIC_LIB)
90
+
91
+ clean:
92
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
93
+
94
+ distclean: clean
95
+ @-$(RM) Makefile extconf.h conftest.* mkmf.log
96
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
97
+
98
+ realclean: distclean
99
+ install: install-so install-rb
100
+
101
+ install-so: $(RUBYARCHDIR)
102
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
103
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
104
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
105
+ install-rb: pre-install-rb install-rb-default
106
+ install-rb-default: pre-install-rb-default
107
+ pre-install-rb: Makefile
108
+ pre-install-rb-default: Makefile
109
+ $(RUBYARCHDIR):
110
+ $(MAKEDIRS) $@
111
+
112
+ site-install: site-install-so site-install-rb
113
+ site-install-so: install-so
114
+ site-install-rb: install-rb
115
+
116
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
117
+
118
+ .cc.o:
119
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
120
+
121
+ .cxx.o:
122
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
123
+
124
+ .cpp.o:
125
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
126
+
127
+ .C.o:
128
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
129
+
130
+ .c.o:
131
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
132
+
133
+ $(DLLIB): $(OBJS)
134
+ @-$(RM) $@
135
+ $(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
136
+
137
+
138
+
139
+ $(OBJS): ruby.h defines.h
@@ -0,0 +1,9 @@
1
+ require 'mkmf'
2
+ dir_config('rubycdio')
3
+ require "rbconfig"
4
+ if Config::CONFIG["host_os"] == "cygwin"
5
+ $libs = append_library($libs, "winmm")
6
+ $libs = append_library($libs, "m")
7
+ end
8
+ $libs = append_library($libs, "cdio")
9
+ create_makefile('rubycdio')