rbcdio 0.03 → 0.04

Sign up to get free protection for your applications and to get access to all the features.
data/configure.ac CHANGED
@@ -18,7 +18,7 @@
18
18
  ## Note: the version number (the 2nd parameter in AC_INIT)
19
19
  ## is picked up inside the Python debugger script.
20
20
 
21
- AC_INIT([rbcdio],[0.03],[libcdio-rubycdio-devel@gnu.org])
21
+ AC_INIT([rbcdio],[0.04],[libcdio-rubycdio-devel@gnu.org])
22
22
 
23
23
  AC_REVISION([$Id: configure.ac,v 1.8 2008/09/22 20:26:24 rocky Exp $])dnl
24
24
 
data/example/README CHANGED
@@ -7,11 +7,15 @@ libcdio supports Disc Images as well as a realCD-ROM, a CDRWIN
7
7
  (BIN/CUE), cdrdao (TOC) or Nero NRG disc image can be played as
8
8
  well. Run --help to get a list of options
9
9
 
10
- == cdchagne.rb
10
+ == cdchange.rb
11
11
 
12
12
  A program to test if a CD has been changed since the last
13
13
  change test.
14
14
 
15
+ == cdtext.rb
16
+
17
+ A Program to show using cdtext. Similar to examples/cdtext.c from libcdio.
18
+
15
19
  == device.rb
16
20
 
17
21
  A program to show drive capabilities. Various drives on various OS/s
@@ -48,5 +52,3 @@ A program to show using ISO9660::IFS to extract a file.
48
52
 
49
53
  A program to list track numbers and logical sector numbers of a
50
54
  Compact Disc.
51
-
52
- $Id: README,v 1.4 2007/10/13 23:00:18 rocky Exp $
data/example/audio.rb CHANGED
File without changes
data/example/cd-read.rb CHANGED
File without changes
data/example/cdchange.rb CHANGED
File without changes
data/example/cdtext.rb ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env ruby
2
+ """Program to show cdtext, similar to examples/cdtext.c"""
3
+ #
4
+ # Copyright (C) 2006, 2008, 2009 Rocky Bernstein <rocky@gnu.org>
5
+ #
6
+ # This program is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ # require 'rubygems'; require 'ruby-debug'; Debugger.start
20
+
21
+ mypath = File.dirname(__FILE__)
22
+
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
+ end
29
+ require "cdio"
30
+
31
+ def print_cdtext_track_info(device, track, message)
32
+ print message
33
+ t = device.track(track)
34
+ cdt = t.cdtext()
35
+
36
+ for i in 0.upto(Rubycdio::MAX_CDTEXT_FIELDS) do
37
+ value = cdt.get(i)
38
+ # value can be empty but exist, compared to NULL values
39
+ if value.nil?
40
+ puts "\t%s: %s" % [Rubycdio::cdtext_field2str(i), value]
41
+ end
42
+ end
43
+ end
44
+
45
+ if ARGV[0]
46
+ begin
47
+ drive_name = sys.argv[1]
48
+ d = Cdio::Device(sys.argv[1])
49
+ rescue IOError
50
+ puts "Problem opening CD-ROM: %s" % drive_name
51
+ exit 1
52
+ end
53
+ else
54
+ begin
55
+ d = Cdio::Device.new(nil, Rubycdio::DRIVER_UNKNOWN)
56
+ drive_name = d.device()
57
+ rescue IOError
58
+ puts "Problem finding a CD-ROM"
59
+ exit 1
60
+ end
61
+ end
62
+
63
+ i_tracks = d.num_tracks()
64
+ t = d.first_track()
65
+ i_first_track = t.track
66
+
67
+ print_cdtext_track_info(d, 0, 'CD-Text for Disc:')
68
+ for i in i_first_track.upto(i_tracks + i_first_track) do
69
+ print_cdtext_track_info(d, i, 'CD-Text for Track %d:' % i)
70
+ end
data/example/device.rb CHANGED
File without changes
data/example/drives.rb CHANGED
@@ -1,62 +1,60 @@
1
1
  #!/usr/bin/env ruby
2
- # $Id: drives.rb,v 1.9 2007/10/13 23:25:41 rocky Exp $
2
+ # $Id: drives.rb,v 1.11 2008/11/30 15:47:05 rocky Exp $
3
3
  #
4
- # Program to read CD blocks. See read-cd from the libcdio distribution
5
- # for a more complete program.
4
+ # Program to list CD drives and analyze the media type in them
6
5
 
6
+ # Copyright (C) 2006, 2007, 2008 Rocky Bernstein <rocky@gnu.org>
7
7
  #
8
- # Copyright (C) 2006, 2007 Rocky Bernstein <rocky@gnu.org>
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 3 of the License, or
11
+ # (at your option) any later version.
9
12
  #
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
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.
23
17
  #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+
24
21
  mypath = File.dirname(__FILE__)
25
22
  if(File::exists?(mypath + "/../lib/cdio.rb"))
26
- $: << File.dirname(__FILE__) + '/../lib'
27
23
  $: << File.dirname(__FILE__) + '/../ext/cdio'
24
+ $: << File.dirname(__FILE__) + '/../lib'
28
25
  else
29
26
  require 'rubygems'
30
27
  end
31
28
  require "cdio"
32
29
 
33
30
  def print_drive_class(msg, bitmask, any)
34
- cd_drives = Cdio::devices_with_cap(bitmask, any)
35
-
36
- puts "%s..." % msg
37
- for drive in cd_drives
38
- puts "Drive %s" % drive
39
- end
40
- puts "-----"
31
+ cd_drives = Rubycdio::get_devices_with_cap(bitmask, any)
32
+
33
+ puts "%s..." % msg
34
+ for drive in cd_drives
35
+ puts "Drive %s" % drive
36
+ end if cd_drives
37
+ puts "-----"
41
38
  end
42
39
 
43
40
  cd_drives = Cdio::devices(Rubycdio::DRIVER_DEVICE)
44
41
  if not cd_drives
45
- puts "No CD-ROM drives found"
42
+ puts "No CD-ROM drives found"
46
43
  exit
47
44
  end
48
45
  for drive in cd_drives
49
- puts "Drive %s" % drive
46
+ puts "Drive %s" % drive
50
47
  end
51
48
 
52
49
  puts "-----"
53
50
 
54
- print_drive_class("All CD-ROM drives (again)", Rubycdio::FS_MATCH_ALL, false);
55
- print_drive_class("All CD-DA drives...", Rubycdio::FS_AUDIO, false);
56
- print_drive_class("All drives with ISO 9660...", Rubycdio::FS_ISO_9660, false);
51
+ print_drive_class("All CD-ROM drives (again)", Rubycdio::FS_MATCH_ALL, false)
52
+ print_drive_class("All CD-DA drives...", Rubycdio::FS_AUDIO, false)
53
+ print_drive_class("All drives with ISO 9660...", Rubycdio::FS_ISO_9660, false)
57
54
  print_drive_class("VCD drives...",
58
- (Rubycdio::FS_ANAL_SVCD|Rubycdio::FS_ANAL_CVD|
59
- Rubycdio::FS_ANAL_VIDEOCD|Rubycdio::FS_UNKNOWN), true);
55
+ (Rubycdio::FS_ANAL_SVCD | Rubycdio::FS_ANAL_CVD |
56
+ Rubycdio::FS_ANAL_VIDEOCD | Rubycdio::FS_UNKNOWN),
57
+ true);
60
58
 
61
59
 
62
60
 
data/example/eject.rb CHANGED
File without changes
data/example/iso1.rb CHANGED
File without changes
data/example/iso2.rb CHANGED
File without changes
data/example/iso3.rb CHANGED
File without changes
data/example/tracks.rb CHANGED
File without changes
data/ext/cdio/Makefile CHANGED
@@ -4,60 +4,83 @@ SHELL = /bin/sh
4
4
  #### Start of system configuration section. ####
5
5
 
6
6
  srcdir = .
7
- topdir = /usr/lib/ruby/1.8/i486-linux
8
- hdrdir = $(topdir)
9
- VPATH = $(srcdir):$(topdir):$(hdrdir)
7
+ topdir = /usr/local/include/ruby-1.9.1
8
+ hdrdir = /usr/local/include/ruby-1.9.1
9
+ arch_hdrdir = /usr/local/include/ruby-1.9.1/$(arch)
10
+ VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
10
11
  prefix = $(DESTDIR)/usr/local
12
+ rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
11
13
  exec_prefix = $(prefix)
12
- sitedir = $(DESTDIR)/usr/local/lib/site_ruby
13
- rubylibdir = $(libdir)/ruby/$(ruby_version)
14
- docdir = $(datarootdir)/doc/$(PACKAGE)
15
- dvidir = $(docdir)
16
- datarootdir = $(prefix)/share
17
- archdir = $(rubylibdir)/$(arch)
18
- sbindir = $(exec_prefix)/sbin
19
- psdir = $(docdir)
14
+ vendorhdrdir = $(rubyhdrdir)/vendor_ruby
15
+ sitehdrdir = $(rubyhdrdir)/site_ruby
16
+ rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version)
17
+ vendordir = $(rubylibprefix)/vendor_ruby
18
+ sitedir = $(rubylibprefix)/site_ruby
19
+ mandir = $(datarootdir)/man
20
20
  localedir = $(datarootdir)/locale
21
+ libdir = $(exec_prefix)/lib
22
+ psdir = $(docdir)
23
+ pdfdir = $(docdir)
24
+ dvidir = $(docdir)
21
25
  htmldir = $(docdir)
22
- datadir = $(datarootdir)
26
+ infodir = $(datarootdir)/info
27
+ docdir = $(datarootdir)/doc/$(PACKAGE)
28
+ oldincludedir = $(DESTDIR)/usr/include
23
29
  includedir = $(prefix)/include
24
- infodir = $(prefix)/share/info
25
- sysconfdir = $(DESTDIR)/etc
26
- mandir = $(prefix)/share/man
27
- libdir = $(exec_prefix)/lib
30
+ localstatedir = $(prefix)/var
28
31
  sharedstatedir = $(prefix)/com
29
- oldincludedir = $(DESTDIR)/usr/include
30
- pdfdir = $(docdir)
31
- sitearchdir = $(sitelibdir)/$(sitearch)
32
+ sysconfdir = $(prefix)/etc
33
+ datadir = $(datarootdir)
34
+ datarootdir = $(prefix)/share
35
+ libexecdir = $(exec_prefix)/libexec
36
+ sbindir = $(exec_prefix)/sbin
32
37
  bindir = $(exec_prefix)/bin
33
- localstatedir = $(DESTDIR)/var
38
+ rubylibdir = $(libdir)/$(ruby_install_name)/$(ruby_version)
39
+ archdir = $(rubylibdir)/$(arch)
34
40
  sitelibdir = $(sitedir)/$(ruby_version)
35
- libexecdir = $(prefix)/lib/ruby1.8
41
+ sitearchdir = $(sitelibdir)/$(sitearch)
42
+ vendorlibdir = $(vendordir)/$(ruby_version)
43
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
36
44
 
37
- CC = cc
38
- LIBRUBY = $(LIBRUBY_SO)
45
+ CC = gcc
46
+ CXX = g++
47
+ LIBRUBY = $(LIBRUBY_A)
39
48
  LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
40
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
41
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
49
+ LIBRUBYARG_SHARED = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
50
+ LIBRUBYARG_STATIC = -Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
51
+ OUTFLAG = -o
52
+ COUTFLAG = -o
42
53
 
43
54
  RUBY_EXTCONF_H =
44
- CFLAGS = -fPIC -fno-strict-aliasing -g -g -O2 -fPIC
45
- INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
46
- CPPFLAGS =
47
- CXXFLAGS = $(CFLAGS)
48
- DLDFLAGS = -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic
55
+ cflags = $(optflags) $(debugflags) $(warnflags)
56
+ optflags = -O3
57
+ debugflags = -g
58
+ warnflags = -Wall -Wno-unused-parameter -Wno-parentheses -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings
59
+ CFLAGS = -fPIC $(cflags)
60
+ INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
61
+ DEFS =
62
+ CPPFLAGS = $(DEFS) $(cppflags)
63
+ CXXFLAGS = $(CFLAGS) $(cxxflags)
64
+ ldflags = -L. -rdynamic -Wl,-export-dynamic
65
+ dldflags =
66
+ archflag =
67
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
49
68
  LDSHARED = $(CC) -shared
69
+ LDSHAREDXX = $(CXX) -shared
50
70
  AR = ar
51
71
  EXEEXT =
52
72
 
53
- RUBY_INSTALL_NAME = ruby1.8
54
- RUBY_SO_NAME = ruby1.8
55
- arch = i486-linux
56
- sitearch = i486-linux
57
- ruby_version = 1.8
58
- ruby = /usr/bin/ruby1.8
73
+ RUBY_BASE_NAME = ruby
74
+ RUBY_INSTALL_NAME = ruby
75
+ RUBY_SO_NAME = ruby
76
+ arch = x86_64-linux
77
+ sitearch = $(arch)
78
+ ruby_version = 1.9.1
79
+ ruby = /usr/local/bin/ruby
59
80
  RUBY = $(ruby)
60
81
  RM = rm -f
82
+ RM_RF = $(RUBY) -run -e rm -- -rf
83
+ RMDIRS = $(RUBY) -run -e rmdir -- -p
61
84
  MAKEDIRS = mkdir -p
62
85
  INSTALL = /usr/bin/install -c
63
86
  INSTALL_PROG = $(INSTALL) -m 0755
@@ -69,17 +92,18 @@ COPY = cp
69
92
  preload =
70
93
 
71
94
  libpath = . $(libdir)
72
- LIBPATH = -L"." -L"$(libdir)"
95
+ LIBPATH = -L. -L$(libdir) -Wl,-R$(libdir)
73
96
  DEFFILE =
74
97
 
75
98
  CLEANFILES = mkmf.log
76
99
  DISTCLEANFILES =
100
+ DISTCLEANDIRS =
77
101
 
78
102
  extout =
79
103
  extout_prefix =
80
104
  target_prefix =
81
105
  LOCAL_LIBS = -L/usr/local/lib -lcdio -lm
82
- LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lcrypt -lm -lc
106
+ LIBS = -lpthread -lrt -ldl -lcrypt -lm -lc
83
107
  SRCS = rubycdio_wrap.c
84
108
  OBJS = rubycdio_wrap.o
85
109
  TARGET = rubycdio
@@ -87,30 +111,42 @@ DLLIB = $(TARGET).so
87
111
  EXTSTATIC =
88
112
  STATIC_LIB =
89
113
 
114
+ BINDIR = $(bindir)
90
115
  RUBYCOMMONDIR = $(sitedir)$(target_prefix)
91
116
  RUBYLIBDIR = $(sitelibdir)$(target_prefix)
92
117
  RUBYARCHDIR = $(sitearchdir)$(target_prefix)
118
+ HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
119
+ ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
93
120
 
94
121
  TARGET_SO = $(DLLIB)
95
- CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
96
- CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
97
-
98
- all: $(DLLIB)
99
- static: $(STATIC_LIB)
100
-
101
- clean:
122
+ CLEANLIBS = $(TARGET).so
123
+ CLEANOBJS = *.o *.bak
124
+
125
+ all: $(DLLIB)
126
+ static: $(STATIC_LIB)
127
+ .PHONY: all install static install-so install-rb
128
+ .PHONY: clean clean-so clean-rb
129
+
130
+ clean-rb-default::
131
+ clean-rb::
132
+ clean-so::
133
+ clean: clean-so clean-rb-default clean-rb
102
134
  @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
103
135
 
104
- distclean: clean
136
+ distclean-rb-default::
137
+ distclean-rb::
138
+ distclean-so::
139
+ distclean: clean distclean-so distclean-rb-default distclean-rb
105
140
  @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
106
141
  @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
142
+ @-$(RMDIRS) $(DISTCLEANDIRS)
107
143
 
108
- realclean: distclean
144
+ realclean: distclean
109
145
  install: install-so install-rb
110
146
 
111
147
  install-so: $(RUBYARCHDIR)
112
148
  install-so: $(RUBYARCHDIR)/$(DLLIB)
113
- $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
149
+ $(RUBYARCHDIR)/$(DLLIB): $(RUBYARCHDIR) $(DLLIB)
114
150
  $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
115
151
  install-rb: pre-install-rb install-rb-default
116
152
  install-rb-default: pre-install-rb-default
@@ -126,24 +162,24 @@ site-install-rb: install-rb
126
162
  .SUFFIXES: .c .m .cc .cxx .cpp .C .o
127
163
 
128
164
  .cc.o:
129
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
165
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
130
166
 
131
167
  .cxx.o:
132
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
168
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
133
169
 
134
170
  .cpp.o:
135
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
171
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
136
172
 
137
173
  .C.o:
138
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
174
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
139
175
 
140
176
  .c.o:
141
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
177
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
142
178
 
143
- $(DLLIB): $(OBJS)
144
- @-$(RM) $@
179
+ $(DLLIB): $(OBJS) Makefile
180
+ @-$(RM) $(@)
145
181
  $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
146
182
 
147
183
 
148
184
 
149
- $(OBJS): ruby.h defines.h
185
+ $(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h