Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 182 lines (149 sloc) 4.971 kb
993e938 @robinst Initial import.
authored
1
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
2 begin
3 require 'rubygems'
4 require 'rake/gempackagetask'
5 rescue Exception
6 nil
7 end
8
e99f84c @robinst Use rake-compiler for compiling the extension
authored
9 begin
10 require 'rake/extensiontask'
11 rescue LoadError
ed09f32 @robinst Don't warn when there's no rake/extensiontask
authored
12 # Compiling of extension will have to be done manually.
e99f84c @robinst Use rake-compiler for compiling the extension
authored
13 end
14
8d75317 @robinst Cleaned up Rakefile and tests.
authored
15 require 'rake/testtask'
993e938 @robinst Initial import.
authored
16 require 'rake/rdoctask'
30e7134 @robinst Use Ruby code instead of wget to download id3lib
authored
17 require 'open-uri'
8d75317 @robinst Cleaned up Rakefile and tests.
authored
18
19
bcb679e @robinst * Normal release now also includes "development" files in ext.
authored
20 FILES_COMMON = FileList[
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
21 'lib/**/*.rb',
22 'test/test_*.rb',
23 'test/data/*.mp3',
24 'test/data/cover.jpg',
25 'Rakefile',
bcb679e @robinst * Normal release now also includes "development" files in ext.
authored
26 '*.rb'
27 ]
28
d55d02d @robinst Merged r99:107 (INSTALL) from trunk, right this time.
authored
29 FILES_DOC = FileList[
fe6485a @robinst Rename README to README.rdoc
authored
30 'README.rdoc', 'INSTALL', 'TODO', 'CHANGES'
d55d02d @robinst Merged r99:107 (INSTALL) from trunk, right this time.
authored
31 ]
32
bcb679e @robinst * Normal release now also includes "development" files in ext.
authored
33 FILES_EXT = FileList[
e99f84c @robinst Use rake-compiler for compiling the extension
authored
34 'ext/id3lib_api/*.{rb,cxx,i}',
35 'ext/id3lib_api/Rakefile'
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
36 ]
993e938 @robinst Initial import.
authored
37
38
8d75317 @robinst Cleaned up Rakefile and tests.
authored
39 Rake::TestTask.new do |t|
4bb93fe @robinst Fixed extension library path for running tests
authored
40 t.libs = ['lib', 'ext/id3lib_api']
8d75317 @robinst Cleaned up Rakefile and tests.
authored
41 t.test_files = FileList['test/test_*.rb']
42 t.verbose = true
43 end
44
45
fe6485a @robinst Rename README to README.rdoc
authored
46 RDOC_OPTS = ['--inline-source', '--line-numbers', '--main', 'README.rdoc']
993e938 @robinst Initial import.
authored
47
48 desc "Generate RDOC documentation."
49 Rake::RDocTask.new :rdoc do |rdoc|
50 rdoc.rdoc_dir = 'doc'
51 rdoc.title = 'id3lib-ruby'
8d75317 @robinst Cleaned up Rakefile and tests.
authored
52 rdoc.options = RDOC_OPTS
d55d02d @robinst Merged r99:107 (INSTALL) from trunk, right this time.
authored
53 rdoc.rdoc_files.include(FILES_DOC)
993e938 @robinst Initial import.
authored
54 rdoc.rdoc_files.include('lib/**/*.rb')
55 end
56 task :doc => [:rdoc]
57
58
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
59 if defined? Gem
e99f84c @robinst Use rake-compiler for compiling the extension
authored
60
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
61 spec = Gem::Specification.new do |s|
62 s.name = 'id3lib-ruby'
760b15f @robinst New VERSION constant in id3lib.rb, Rakefile extracts it for building gem...
authored
63 s.version = File.read('lib/id3lib.rb')[/VERSION = '(.*)'/, 1]
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
64 s.summary =
65 'id3lib-ruby provides a Ruby interface to the id3lib C++ library for ' +
ce95072 @robinst README, Rakefile: Remove reference to pyid3lib and mention MP3 audio fil...
authored
66 'easily editing ID3 tags (v1 and v2) of MP3 audio files.'
fe6485a @robinst Rename README to README.rdoc
authored
67 s.description = File.read('README.rdoc')
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
68 s.requirements << 'id3lib C++ library'
bcb679e @robinst * Normal release now also includes "development" files in ext.
authored
69 s.files = FILES_COMMON + FILES_EXT
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
70 s.test_files = FileList['test/test_*.rb']
e99f84c @robinst Use rake-compiler for compiling the extension
authored
71 s.extensions << 'ext/id3lib_api/extconf.rb'
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
72 s.has_rdoc = true
d55d02d @robinst Merged r99:107 (INSTALL) from trunk, right this time.
authored
73 s.extra_rdoc_files = FILES_DOC
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
74 s.rdoc_options = RDOC_OPTS
75 s.author = 'Robin Stocker'
3e0edd3 @robinst Changed e-mail address to robinstocker@rubyforge.org.
authored
76 s.email = 'robinstocker@rubyforge.org'
ec316b3 @robinst Rakefile doesn't depend on Rubygems anymore, the other tasks can be run
authored
77 s.homepage = 'http://id3lib-ruby.rubyforge.org'
78 s.rubyforge_project = "id3lib-ruby"
79 end
80
81 Rake::GemPackageTask.new(spec) do |pkg|
82 pkg.need_tar_gz = true
83 pkg.need_zip = true
84 end
73af22f @robinst * Added ext/mswin32 and extended Rakefile for generating mswin32 binary ...
authored
85
e99f84c @robinst Use rake-compiler for compiling the extension
authored
86 if defined? Rake::ExtensionTask
87
88 host = 'i586-mingw32msvc'
c284acd @robinst Changed platform for mswin32 gem to x86-mswin32-60
authored
89 plat = 'x86-mswin32-60'
079c31d @robinst Use 'i386-mswin32' for ext.cross_platform
authored
90 tmp = "#{Dir.pwd}/tmp/#{plat}"
e99f84c @robinst Use rake-compiler for compiling the extension
authored
91 cflags = "'-Os -DID3LIB_LINKOPTION=1'"
3d58087 @robinst Also download and compile id3lib on MinGW OCI
authored
92 config_options = ["--with-opt-dir=#{tmp}", "--with-cflags=#{cflags}"]
93970c0 @robinst Correct download URL for id3lib source
authored
93 id3lib_version = '3.8.3'
94 id3lib = "id3lib-#{id3lib_version}"
95 id3lib_url = "http://downloads.sourceforge.net/project/" +
96 "id3lib/id3lib/#{id3lib_version}/#{id3lib}.tar.gz"
e0810d3 @robinst Moved cross compilation code into main Rakefile
authored
97 patches = FileList["#{Dir.pwd}/ext/mswin32/patches/*patch"]
e99f84c @robinst Use rake-compiler for compiling the extension
authored
98
99 Rake::ExtensionTask.new('id3lib_api', spec) do |ext|
100 ext.cross_compile = true
079c31d @robinst Use 'i386-mswin32' for ext.cross_platform
authored
101 ext.cross_platform = plat
3d58087 @robinst Also download and compile id3lib on MinGW OCI
authored
102 ext.cross_config_options.concat(config_options)
103 if RUBY_PLATFORM =~ /mingw/
104 ext.config_options.concat(config_options)
105 end
e99f84c @robinst Use rake-compiler for compiling the extension
authored
106 end
107
3d58087 @robinst Also download and compile id3lib on MinGW OCI
authored
108 task :cross => [:id3lib] do
e99f84c @robinst Use rake-compiler for compiling the extension
authored
109 # Mkmf just uses "g++" as C++ compiler, despite what's in rbconfig.rb.
110 # So, we need to hack around it by setting CXX to the cross compiler.
111 ENV["CXX"] = "#{host}-g++"
112 end
113
3d58087 @robinst Also download and compile id3lib on MinGW OCI
authored
114 # Linking to the DLLs provided by id3lib.sf.net doesn't seem to work on
115 # Windows, so we download and compile it automatically (the same as when
116 # cross compiling).
117 if RUBY_PLATFORM =~ /mingw/
118 Rake::Task[:compile].prerequisites.unshift(:id3lib)
119 end
120
121 task :id3lib => ["#{tmp}/lib/libid3.a"]
122
e0810d3 @robinst Moved cross compilation code into main Rakefile
authored
123 file "#{tmp}/lib/libid3.a" => ["#{tmp}/#{id3lib}/config.log"] do
124 chdir "#{tmp}/#{id3lib}" do
125 env = "CFLAGS=#{cflags} CXXFLAGS=#{cflags}"
e6091f4 @robinst Explicitly call sh to execute the configure script
authored
126 sh "sh configure --host=#{host} --prefix=#{tmp} #{env}"
734ecae @robinst Split "make && make install" into two commands
authored
127 sh "make"
128 sh "make install"
e99f84c @robinst Use rake-compiler for compiling the extension
authored
129 end
130 end
131
e0810d3 @robinst Moved cross compilation code into main Rakefile
authored
132 file "#{tmp}/#{id3lib}/config.log" => ["#{tmp}/#{id3lib}.tar.gz"] do
133 chdir tmp do
134 sh "tar xzf #{id3lib}.tar.gz"
135 patches.each do |patch|
136 sh "patch -p0 < #{patch}"
137 end
138 end
139 end
140
30e7134 @robinst Use Ruby code instead of wget to download id3lib
authored
141 file "#{tmp}/#{id3lib}.tar.gz" => [tmp] do |t|
142 puts "Downloading #{id3lib_url}"
143 data = open(id3lib_url).read()
144 break if data == nil
e0810d3 @robinst Moved cross compilation code into main Rakefile
authored
145 chdir tmp do
30e7134 @robinst Use Ruby code instead of wget to download id3lib
authored
146 open(File.basename(t.name), 'wb') do |f|
147 f.write(data)
148 end
e0810d3 @robinst Moved cross compilation code into main Rakefile
authored
149 end
150 end
151
152 directory tmp
153
e99f84c @robinst Use rake-compiler for compiling the extension
authored
154 end # defined? Rake::ExtensionTask
73af22f @robinst * Added ext/mswin32 and extended Rakefile for generating mswin32 binary ...
authored
155
156 end # defined? Gem
993e938 @robinst Initial import.
authored
157
158
159 task :web => [:web_doc] do
ce7f456 @robinst Improved the web site a bit.
authored
160 puts "# Now execute the following:"
be8e6fd @robinst Rakefile: Merged r74 and r90 from trunk.
authored
161 puts "scp web/index.html web/logo.png web/red.css robinstocker@rubyforge.org:/var/www/gforge-projects/id3lib-ruby/"
db1e059 @robinst * Destination path for web/doc upload was false, corrected.
authored
162 puts "scp -r web/doc robinstocker@rubyforge.org:/var/www/gforge-projects/id3lib-ruby/"
993e938 @robinst Initial import.
authored
163 end
164
62b5c88 @robinst * Rakefile: release 0.4.1
authored
165 desc "Generate RDOC documentation for web."
993e938 @robinst Initial import.
authored
166 Rake::RDocTask.new :web_doc do |rdoc|
167 rdoc.rdoc_dir = 'web/doc'
168 rdoc.title = 'id3lib-ruby'
609cb29 @robinst * RDoc output now shows source code inline.
authored
169 rdoc.options = RDOC_OPTS.clone
170 rdoc.options << '--main' << 'ID3Lib::Tag'
d55d02d @robinst Merged r99:107 (INSTALL) from trunk, right this time.
authored
171 rdoc.rdoc_files.include(FILES_DOC)
993e938 @robinst Initial import.
authored
172 rdoc.rdoc_files.include('lib/**/*.rb')
173 end
8d75317 @robinst Cleaned up Rakefile and tests.
authored
174
be8e6fd @robinst Rakefile: Merged r74 and r90 from trunk.
authored
175 desc "Generate syntax-highlighted HTML of usage.rb."
8d75317 @robinst Cleaned up Rakefile and tests.
authored
176 task :usage_html do
177 require 'syntax/convertors/html'
178 convertor = Syntax::Convertors::HTML.for_syntax('ruby')
179 html = convertor.convert(File.read('usage.rb'))
180 puts html
181 end
Something went wrong with that request. Please try again.