Skip to content
This repository
Newer
Older
100644 306 lines (253 sloc) 8.961 kb
e7f98b6c »
2008-07-14 initial checkin
1 # -*- ruby -*-
2
cde87f23 »
2008-11-08 Revert "fixing segfaults. no more weakrefs"
3 require 'rubygems'
18a5f563 »
2009-06-16 refactoring and upgrading us to hoe 2.1.0
4 gem 'hoe', '>= 2.1.0'
0c124487 »
2009-02-27 removing vendored hoe
5 require 'hoe'
9246422c »
2008-09-17 adding tokenizer and parser
6
2c3f4332 »
2009-06-16 more rakefile cleanup
7 windows = RUBY_PLATFORM =~ /(mswin|mingw)/i
8 java = RUBY_PLATFORM =~ /java/
06f7a607 »
2008-11-07 vendoring hoe
9
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
10 GENERATED_PARSER = "lib/nokogiri/css/generated_parser.rb"
9246422c »
2008-09-17 adding tokenizer and parser
11 GENERATED_TOKENIZER = "lib/nokogiri/css/generated_tokenizer.rb"
e7f98b6c »
2008-07-14 initial checkin
12
96df1268 »
2010-03-31 Switch code from Sergio's version to pmahoney's version. New code doe…
13 EXTERNAL_JAVA_LIBRARIES = %w{isorelax jing nekohtml nekodtd xercesImpl}.map{|x| "lib/#{x}.jar"}
2cf94af1 »
2009-05-31 Trying to solve the problem with BasicLibraryService
14 JAVA_EXT = "lib/nokogiri/nokogiri.jar"
38c60287 »
2008-12-03 Add basics for building nokogiri_java.jar extension to Rakefile.
15 JRUBY_HOME = Config::CONFIG['prefix']
9246422c »
2008-09-17 adding tokenizer and parser
16
7d9488c6 »
2009-12-14 Comment out nokogiri/version
17 #require 'nokogiri/version'
85b1f6d7 »
2008-09-11 starting the move to C
18
cfc1419e »
2009-06-22 removing valgrind tasks in favor of a hoe plugin
19 # Make sure hoe-debugging is installed
20 Hoe.plugin :debugging
21
18a5f563 »
2009-06-16 refactoring and upgrading us to hoe 2.1.0
22 HOE = Hoe.spec 'nokogiri' do
23 developer('Aaron Patterson', 'aaronp@rubyforge.org')
24 developer('Mike Dalessio', 'mike.dalessio@gmail.com')
25 self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
26 self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
27 self.extra_rdoc_files = FileList['*.rdoc']
28 self.clean_globs = [
db2b3db4 »
2009-05-09 cleaning up some warnings, moving dylib under lib
29 'lib/nokogiri/*.{o,so,bundle,a,log,dll}',
5648c6bb »
2009-09-06 clean up fat binary cross compile stuff
30 'lib/nokogiri/nokogiri.rb',
31 'lib/nokogiri/1.{8,9}',
06f7a607 »
2008-11-07 vendoring hoe
32 GENERATED_PARSER,
33 GENERATED_TOKENIZER,
34 'cross',
35 ]
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
36
2c3f4332 »
2009-06-16 more rakefile cleanup
37 %w{ racc rexical rake-compiler }.each do |dep|
6f7b649d »
2009-08-17 fixing hoe warnings
38 self.extra_dev_deps << [dep, '>= 0']
2c3f4332 »
2009-06-16 more rakefile cleanup
39 end
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
40
18a5f563 »
2009-06-16 refactoring and upgrading us to hoe 2.1.0
41 self.spec_extras = { :extensions => ["ext/nokogiri/extconf.rb"] }
08450f39 »
2008-08-19 auto generating the IDL interface
42 end
43
94e09cf8 »
2009-10-04 adding a task for generating the website documentation
44 task :ws_docs do
45 title = "#{HOE.name}-#{HOE.version} Documentation"
541cbebe »
2009-08-12 making NodeSet more consistent with Set, adding NodeSet#| closes #119
46
94e09cf8 »
2009-10-04 adding a task for generating the website documentation
47 options = []
48 options << "--main=#{HOE.readme_file}"
49 options << '--format=activerecord'
50 options << '--threads=1'
51 options << "--title=#{title.inspect}"
541cbebe »
2009-08-12 making NodeSet more consistent with Set, adding NodeSet#| closes #119
52
94e09cf8 »
2009-10-04 adding a task for generating the website documentation
53 options += HOE.spec.require_paths
54 options += HOE.spec.extra_rdoc_files
55 require 'rdoc/rdoc'
56 ENV['RAILS_ROOT'] ||= File.expand_path(File.join('..', 'nokogiri_ws'))
57 RDoc::RDoc.new.document options
541cbebe »
2009-08-12 making NodeSet more consistent with Set, adding NodeSet#| closes #119
58 end
59
17aff7bf »
2009-04-24 tweaking Rakefile to not blow up when running tasks on JRuby
60 unless java
61 gem 'rake-compiler', '>= 0.4.1'
62 require "rake/extensiontask"
63
fb709d62 »
2009-05-07 adding fat binary awesomeness
64 RET = Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
2dd18529 »
2009-05-24 making fat binaries easy with nokogiri
65 ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
66
17aff7bf »
2009-04-24 tweaking Rakefile to not blow up when running tasks on JRuby
67 ext.config_options << ENV['EXTOPTS']
68 cross_dir = File.join(File.dirname(__FILE__), 'tmp', 'cross')
69 ext.cross_compile = true
30d4db78 »
2009-06-22 terrorist version bump
70 ext.cross_platform = 'i386-mingw32'
17aff7bf »
2009-04-24 tweaking Rakefile to not blow up when running tasks on JRuby
71 ext.cross_config_options <<
72 "--with-iconv-dir=#{File.join(cross_dir, 'iconv')}"
73 ext.cross_config_options <<
74 "--with-xml2-dir=#{File.join(cross_dir, 'libxml2')}"
75 ext.cross_config_options <<
76 "--with-xslt-dir=#{File.join(cross_dir, 'libxslt')}"
77 end
78
ced0a566 »
2009-07-26 cleaning up fat binary stuff
79 file 'lib/nokogiri/nokogiri.rb' do
2dd18529 »
2009-05-24 making fat binaries easy with nokogiri
80 File.open("lib/#{HOE.name}/#{HOE.name}.rb", 'wb') do |f|
81 f.write <<-eoruby
93200a37 »
2009-05-30 fixing generated file and adding dlls to the spec
82 require "#{HOE.name}/\#{RUBY_VERSION.sub(/\\.\\d+$/, '')}/#{HOE.name}"
2dd18529 »
2009-05-24 making fat binaries easy with nokogiri
83 eoruby
84 end
fb709d62 »
2009-05-07 adding fat binary awesomeness
85 end
ced0a566 »
2009-07-26 cleaning up fat binary stuff
86
87 namespace :cross do
88 task :file_list do
0fe204b1 »
2009-07-28 updating spef files to include so file
89 HOE.spec.platform = 'x86-mingw32'
ced0a566 »
2009-07-26 cleaning up fat binary stuff
90 HOE.spec.extensions = []
91 HOE.spec.files += Dir["lib/#{HOE.name}/#{HOE.name}.rb"]
0fe204b1 »
2009-07-28 updating spef files to include so file
92 HOE.spec.files += Dir["lib/#{HOE.name}/1.{8,9}/#{HOE.name}.so"]
ced0a566 »
2009-07-26 cleaning up fat binary stuff
93 HOE.spec.files += Dir["ext/nokogiri/*.dll"]
94 end
95 end
96
30d4db78 »
2009-06-22 terrorist version bump
97 CLOBBER.include("lib/nokogiri/nokogiri.{so,dylib,rb,bundle}")
2dd18529 »
2009-05-24 making fat binaries easy with nokogiri
98 CLOBBER.include("lib/nokogiri/1.{8,9}")
70ad0067 »
2009-08-11 adding DLLs to JRuby gem. closes #112
99 CLOBBER.include("ext/nokogiri/*.dll")
56438602 »
2009-02-03 Add 'rake libxml:version', because I'm lazy.
100 end
101
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
102 namespace :java do
103
104 desc "Removes all generated during compilation .class files."
105 task :clean_classes do
1d31a29c »
2009-07-12 Started to extract methods to XmlNodeMethod class and subclasses.
106 (FileList['ext/java/nokogiri/internals/*.class'] + FileList['ext/java/nokogiri/*.class'] + FileList['ext/java/*.class']).to_a.each do |file|
4297b197 »
2009-04-30 NokogiriJavaService compiles. jruby:clean added.
107 File.delete file
108 end
109 end
6da099fe »
2009-06-23 Having problems with native_write_to
110
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
111 desc "Removes the generated .jar"
6da099fe »
2009-06-23 Having problems with native_write_to
112 task :clean_jar do
113 FileList['lib/nokogiri/*.jar'].each{|f| File.delete f }
114 end
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
115
116 desc "Same as java:clean_classes and java:clean_jar"
117 task :clean_all => ["java:clean_classes", "java:clean_jar"]
118
119 desc "Build a gem targetted for JRuby"
120 task :gem => ['java:spec'] do
121 system "gem build nokogiri.gemspec"
122 FileUtils.mkdir_p "pkg"
123 FileUtils.mv Dir.glob("nokogiri*-java.gem"), "pkg"
124 end
125
126 task :spec => [GENERATED_PARSER, GENERATED_TOKENIZER, :build] do
127 File.open("#{HOE.name}.gemspec", 'w') do |f|
128 HOE.spec.platform = 'java'
129 HOE.spec.files += [GENERATED_PARSER, GENERATED_TOKENIZER, JAVA_EXT] + EXTERNAL_JAVA_LIBRARIES
130 HOE.spec.extensions = []
131 f.write(HOE.spec.to_ruby)
132 end
133 end
134
135 task :spec => ['gem:dev:spec']
136
137 desc "Build external library"
138 task :build_external do
139 Dir.chdir('ext/java') do
140 LIB_DIR = '../../lib'
96df1268 »
2010-03-31 Switch code from Sergio's version to pmahoney's version. New code doe…
141 CLASSPATH = "#{JRUBY_HOME}/lib/jruby.jar:#{LIB_DIR}/nekohtml.jar:#{LIB_DIR}/nekodtd.jar:#{LIB_DIR}/xercesImpl.jar:#{LIB_DIR}/isorelax.jar:#{LIB_DIR}/jing.jar"
df9b64b6 »
2010-02-27 Add debugging info when making java class files.
142 sh "javac -g -cp #{CLASSPATH} nokogiri/*.java nokogiri/internals/*.java"
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
143 sh "jar cf ../../#{JAVA_EXT} nokogiri/*.class nokogiri/internals/*.class"
144 end
145 end
146
147 task :build => ["java:clean_jar", "java:build_external", "java:clean_classes"]
4297b197 »
2009-04-30 NokogiriJavaService compiles. jruby:clean added.
148 end
149
c40736ac »
2008-08-25 bumping version and adding a gem spec task
150 namespace :gem do
35cace6b »
2008-10-29 fixing up win32 build, adding a few methods to dtd
151 namespace :dev do
92a3c398 »
2009-09-15 making the dev spec depend on the generated parser and tokenizer
152 task :spec => [ GENERATED_PARSER, GENERATED_TOKENIZER ] do
35cace6b »
2008-10-29 fixing up win32 build, adding a few methods to dtd
153 File.open("#{HOE.name}.gemspec", 'w') do |f|
154 HOE.spec.version = "#{HOE.version}.#{Time.now.strftime("%Y%m%d%H%M%S")}"
155 f.write(HOE.spec.to_ruby)
156 end
157 end
158 end
159
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
160 desc "Build a gem targetted for JRuby (FFI version)"
f7cfa24a »
2009-05-16 added rake task "gem:jruby"
161 task :jruby => ['gem:jruby:spec'] do
162 system "gem build nokogiri.gemspec"
163 FileUtils.mkdir_p "pkg"
164 FileUtils.mv Dir.glob("nokogiri*-java.gem"), "pkg"
165 end
166
66fea0e7 »
2008-11-06 adding a java platform
167 namespace :jruby do
2cf94af1 »
2009-05-31 Trying to solve the problem with BasicLibraryService
168 task :spec => [GENERATED_PARSER, GENERATED_TOKENIZER] do
66fea0e7 »
2008-11-06 adding a java platform
169 File.open("#{HOE.name}.gemspec", 'w') do |f|
91d22074 »
2009-01-14 fixing platform for java nokogiri
170 HOE.spec.platform = 'java'
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
171 HOE.spec.files << GENERATED_PARSER
172 HOE.spec.files << GENERATED_TOKENIZER
173 HOE.spec.files += Dir["ext/nokogiri/*.dll"]
66fea0e7 »
2008-11-06 adding a java platform
174 HOE.spec.extensions = []
175 f.write(HOE.spec.to_ruby)
176 end
177 end
178 end
179
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
180
35cace6b »
2008-10-29 fixing up win32 build, adding a few methods to dtd
181 task :spec => ['gem:dev:spec']
c40736ac »
2008-08-25 bumping version and adding a gem spec task
182 end
08450f39 »
2008-08-19 auto generating the IDL interface
183
9246422c »
2008-09-17 adding tokenizer and parser
184 file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
66fea0e7 »
2008-11-06 adding a java platform
185 begin
da6292db »
2008-11-26 Make development dependencies easier to install.
186 racc = `which racc`.strip
187 racc = "#{::Config::CONFIG['bindir']}/racc" if racc.empty?
cbe03a97 »
2009-06-05 no more module_evals in the generated css parser
188 sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
66fea0e7 »
2008-11-06 adding a java platform
189 rescue
eee94657 »
2009-01-08 refactoring valgrind test
190 abort "need racc, sudo gem install racc"
e1e97514 »
2008-10-31 extconf should not check for frex and racc
191 end
9246422c »
2008-09-17 adding tokenizer and parser
192 end
193
194 file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
66fea0e7 »
2008-11-06 adding a java platform
195 begin
c504ee50 »
2009-06-05 nokogiri depends on rex instead of frex now o.O!
196 sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
66fea0e7 »
2008-11-06 adding a java platform
197 rescue
b00ee527 »
2009-06-07 changing rex to rexical. ugh
198 abort "need rexical, sudo gem install rexical"
85b1f6d7 »
2008-09-11 starting the move to C
199 end
200 end
201
a9fc64a3 »
2009-05-05 Added pointer_id.
202 #task :build => [JAVA_EXT, GENERATED_PARSER, GENERATED_TOKENIZER]
131df0d6 »
2008-10-15 adding tasks to build cross compiled nokogiri
203
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
204 libs = %w{
205 iconv-1.9.2.win32
206 zlib-1.2.3.win32
207 libxml2-2.7.3.win32
208 libxslt-1.1.24.win32
209 }
210
70ad0067 »
2009-08-11 adding DLLs to JRuby gem. closes #112
211 lib_dlls = {
212 'iconv-1.9.2.win32' => 'iconv.dll',
213 'zlib-1.2.3.win32' => 'zlib1.dll',
214 'libxml2-2.7.3.win32' => 'libxml2.dll',
215 'libxslt-1.1.24.win32' => 'libxslt.dll',
216 }
217
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
218 libs.each do |lib|
70ad0067 »
2009-08-11 adding DLLs to JRuby gem. closes #112
219 libname = lib.split('-').first
220
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
221 file "tmp/stash/#{lib}.zip" do |t|
222 puts "downloading #{lib}"
223 FileUtils.mkdir_p('tmp/stash')
acddc4a8 »
2009-04-25 adding an rdoc test and adding lots of rdoc. closes #21
224 Dir.chdir('tmp/stash') do
1760fc41 »
2009-05-06 get the windows cross compile files from xmlsoft
225 url = "ftp://ftp.xmlsoft.org/libxml2/win32/#{lib}.zip"
35cace6b »
2008-10-29 fixing up win32 build, adding a few methods to dtd
226 system("wget #{url} || curl -O #{url}")
94cd698b »
2008-10-17 using a separate 'stash' directory for storing .zip and .tar.gz files…
227 end
228 end
ced0a566 »
2009-07-26 cleaning up fat binary stuff
229
70ad0067 »
2009-08-11 adding DLLs to JRuby gem. closes #112
230 file "tmp/cross/#{libname}" => ["tmp/stash/#{lib}.zip"] do |t|
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
231 puts "unzipping #{lib}.zip"
232 FileUtils.mkdir_p('tmp/cross')
233 Dir.chdir('tmp/cross') do
234 sh "unzip ../stash/#{lib}.zip"
235 sh "cp #{lib}/bin/* #{lib}/lib" # put DLL in lib, so dirconfig works
236 sh "mv #{lib} #{lib.split('-').first}"
237 sh "touch #{lib.split('-').first}"
131df0d6 »
2008-10-15 adding tasks to build cross compiled nokogiri
238 end
239 end
ced0a566 »
2009-07-26 cleaning up fat binary stuff
240
70ad0067 »
2009-08-11 adding DLLs to JRuby gem. closes #112
241 file "ext/nokogiri/#{lib_dlls[lib]}" => "tmp/cross/#{libname}" do |t|
242 Dir.chdir('tmp/cross') do
243 sh "cp #{libname}/bin/*.dll ../../ext/nokogiri/"
244 end
245 end
246
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
247 if Rake::Task.task_defined?(:cross)
70ad0067 »
2009-08-11 adding DLLs to JRuby gem. closes #112
248 Rake::Task[:cross].prerequisites << "ext/nokogiri/#{lib_dlls[lib]}"
ced0a566 »
2009-07-26 cleaning up fat binary stuff
249 Rake::Task[:cross].prerequisites << "lib/nokogiri/nokogiri.rb"
250 Rake::Task[:cross].prerequisites << "cross:file_list"
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
251 end
5f88ee6d »
2009-08-17 Modify Rakefile. Pure Java is now under java namespace.
252 Rake::Task['gem:jruby:spec'].prerequisites << "ext/nokogiri/#{lib_dlls[lib]}"
131df0d6 »
2008-10-15 adding tasks to build cross compiled nokogiri
253 end
254
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
255 require 'tasks/test'
256
4f61acea »
2008-10-21 putting gdb and valgrind rake tasks under 'test' namespace
257 desc "set environment variables to build and/or test with debug options"
258 task :debug do
259 ENV['NOKOGIRI_DEBUG'] = "true"
260 ENV['CFLAGS'] ||= ""
261 ENV['CFLAGS'] += " -DDEBUG"
262 end
263
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
264 # required_ruby_version
1e32e9e5 »
2008-10-21 rake task to run tests with aggressive garbage collection
265
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
266 # Only do this on unix, since we can't build on windows
1ce6b428 »
2009-05-20 don't compile before tests if NOKOGIRI_FFI is set.
267 unless windows || java || ENV['NOKOGIRI_FFI']
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
268 [:compile, :check_manifest].each do |task_name|
269 Rake::Task[task_name].prerequisites << GENERATED_PARSER
270 Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
1e32e9e5 »
2008-10-21 rake task to run tests with aggressive garbage collection
271 end
c6cea3ce »
2008-11-30 fixing up rdoc and adding an rdoc test
272
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
273 Rake::Task[:test].prerequisites << :compile
68967c74 »
2009-06-26 better check for hoe-debugging
274 if Hoe.plugins.include?(:debugging)
7a43e2e9 »
2009-06-26 ensuring rake will run even if hoe-debugging isn't installed
275 ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
276 Rake::Task["test:#{task_name}"].prerequisites << :compile
277 end
fd9b7731 »
2009-04-09 switching nokogiri to rake-compiler
278 end
19245c57 »
2009-06-15 generating parser and tokenizer for jruby builds
279 else
280 [:test, :check_manifest].each do |task_name|
281 if Rake::Task[task_name]
282 Rake::Task[task_name].prerequisites << GENERATED_PARSER
283 Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
284 end
c6cea3ce »
2008-11-30 fixing up rdoc and adding an rdoc test
285 end
10b09f8e »
2008-10-21 added rake task to run test suite in gdb
286 end
287
da6292db »
2008-11-26 Make development dependencies easier to install.
288 namespace :install do
c504ee50 »
2009-06-05 nokogiri depends on rex instead of frex now o.O!
289 desc "Install rex and racc for development"
b00ee527 »
2009-06-07 changing rex to rexical. ugh
290 task :deps => %w(rexical racc)
da6292db »
2008-11-26 Make development dependencies easier to install.
291
a191ba0d »
2009-02-27 cleaning up rakefile
292 task :racc do |t|
293 sh "sudo gem install racc"
da6292db »
2008-11-26 Make development dependencies easier to install.
294 end
295
b00ee527 »
2009-06-07 changing rex to rexical. ugh
296 task :rexical do
297 sh "sudo gem install rexical"
da6292db »
2008-11-26 Make development dependencies easier to install.
298 end
299 end
10b09f8e »
2008-10-21 added rake task to run test suite in gdb
300
05d25381 »
2009-10-31 generating the tokenizer and parser for rip on install
301 namespace :rip do
302 task :install => [GENERATED_TOKENIZER, GENERATED_PARSER]
303 end
304
e7f98b6c »
2008-07-14 initial checkin
305 # vim: syntax=Ruby
Something went wrong with that request. Please try again.