Skip to content
This repository
Newer
Older
100644 215 lines (176 sloc) 7.502 kb
e7f98b6c » tenderlove
2008-07-14 initial checkin
1 # -*- ruby -*-
cde87f23 » tenderlove
2008-11-08 Revert "fixing segfaults. no more weakrefs"
2 require 'rubygems'
9246422c » tenderlove
2008-09-17 adding tokenizer and parser
3
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
4 gem 'hoe'
5 require 'hoe'
6 Hoe.plugin :debugging
7 Hoe.plugin :git
8 Hoe.plugin :gemspec
9 Hoe.plugin :bundler
10 Hoe.add_include_dirs '.' # for ruby 1.9.2
06f7a607 » tenderlove
2008-11-07 vendoring hoe
11
702affbd » tenderlove
2010-12-08 parser has-a tokenizer
12 GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
13 GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
14 CROSS_DIR = File.join(File.dirname(__FILE__), 'ports')
e7f98b6c » tenderlove
2008-07-14 initial checkin
15
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
16 def java?
17 !! (RUBY_PLATFORM =~ /java/)
18 end
19
a46cc4e5 » flavorjones
2012-11-26 Getting string encoding to work properly in my magic lucid virtualbox…
20 ENV['LANG'] = "en_US.UTF-8" # UBUNTU 10.04, Y U NO DEFAULT TO UTF-8?
21
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
22 require 'tasks/nokogiri.org'
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
23
18a5f563 » tenderlove
2009-06-16 refactoring and upgrading us to hoe 2.1.0
24 HOE = Hoe.spec 'nokogiri' do
8cdda052 » flavorjones
2011-05-24 Rakefile cleanup. Add Yoko to the gemspec's developer list.
25 developer 'Aaron Patterson', 'aaronp@rubyforge.org'
26 developer 'Mike Dalessio', 'mike.dalessio@gmail.com'
27 developer 'Yoko Harada', 'yokolet@gmail.com'
b292bbf6 » flavorjones
2012-06-08 Tim Elliott is a nokogiri-code member!
28 developer 'Tim Elliott', 'tle@holymonkey.com'
8cdda052 » flavorjones
2011-05-24 Rakefile cleanup. Add Yoko to the gemspec's developer list.
29
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
30 self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
31 self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
32
33 self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
34
35 self.clean_globs += [
fb54cef3 » flavorjones
2011-06-20 Adding gemspec to clean_globs
36 'nokogiri.gemspec',
f3291578 » flavorjones
2012-02-28 Ignore build artifacts and de-dupe Hoe.clean_globs
37 'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
5648c6bb » tenderlove
2009-09-06 clean up fat binary cross compile stuff
38 'lib/nokogiri/1.{8,9}',
5c5e1b5c » flavorjones
2012-06-12 Temporarily, let's commit the generated parser and tokenizer code, so…
39 # GENERATED_PARSER,
40 # GENERATED_TOKENIZER
06f7a607 » tenderlove
2008-11-07 vendoring hoe
41 ]
fd9b7731 » tenderlove
2009-04-09 switching nokogiri to rake-compiler
42
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
43 self.extra_dev_deps += [
7ef23cb7 » flavorjones
2011-11-13 Updating dev dependencies to include rdoc.
44 ["hoe-bundler", ">= 1.1"],
c73b2560 » flavorjones
2012-02-19 Updating hoe-debugging version.
45 ["hoe-debugging", ">= 1.0.3"],
7ef23cb7 » flavorjones
2011-11-13 Updating dev dependencies to include rdoc.
46 ["hoe-gemspec", ">= 1.0"],
47 ["hoe-git", ">= 1.4"],
48 ["mini_portile", ">= 0.2.2"],
49 ["minitest", "~> 2.2.2"],
4e64e0fd » flavorjones
2012-06-08 Include rake as a dev dependency, so we can use bundler with travis-ci.
50 ["rake", ">= 0.9"],
68ee05f0 » jvshahid
2012-07-23 we don't need the if guard for jruby anymore, since the Gemfile const…
51 ["rake-compiler", "= 0.8.0"],
52 ["racc", ">= 1.4.6"],
53 ["rexical", ">= 1.0.5"]
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
54 ]
fd9b7731 » tenderlove
2009-04-09 switching nokogiri to rake-compiler
55
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
56 if java?
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
57 self.spec_extras = { :platform => 'java' }
58 else
c3736e3a » tenderlove
2011-04-06 requiring ruby >= 1.8.7
59 self.spec_extras = {
60 :extensions => ["ext/nokogiri/extconf.rb"],
61 :required_ruby_version => '>= 1.8.7'
62 }
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
63 end
d9d1d90d » flavorjones
2010-04-02 telling hoe we're using minitest
64
65 self.testlib = :minitest
08450f39 » tenderlove
2008-08-19 auto generating the IDL interface
66 end
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
67
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
68 # ----------------------------------------
08450f39 » tenderlove
2008-08-19 auto generating the IDL interface
69
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
70 if java?
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
71 # TODO: clean this section up.
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
72 require "rake/javaextensiontask"
73 Rake::JavaExtensionTask.new("nokogiri", HOE.spec) do |ext|
46513f9c » tenderlove
2011-01-27 removing unused codes
74 jruby_home = RbConfig::CONFIG['prefix']
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
75 ext.ext_dir = 'ext/java'
e1423a09 » tenderlove
2011-01-28 specify the lib_dir
76 ext.lib_dir = 'lib/nokogiri'
e7e69482 » drbrain
2011-01-31 Shorten long lines
77 jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
78 ext.classpath = jars.map { |x| File.expand_path x }.join ':'
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
79 end
fe678a1c » drbrain
2011-01-31 Work around rake not understanding platforms, allows Nokogiri to buil…
80
81 gem_build_path = File.join 'pkg', HOE.spec.full_name
82
89056e7c » flavorjones
2011-04-07 removing code that was working around an old rake bug. (nod to @tmm1)
83 task gem_build_path => [:compile] do
8cdda052 » flavorjones
2011-05-24 Rakefile cleanup. Add Yoko to the gemspec's developer list.
84 cp 'lib/nokogiri/nokogiri.jar', File.join(gem_build_path, 'lib', 'nokogiri')
449619da » tenderlove
2011-01-27 making sure nokogiri jar is in the packaged gem. THANKS ERIC!!
85 HOE.spec.files += ['lib/nokogiri/nokogiri.jar']
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
86 end
87 else
4338f17c » yokolet
2011-07-27 Tweak for a platform that doesn't have MinGW installed.
88 mingw_available = true
89 begin
90 require 'tasks/cross_compile'
91 rescue
92 mingw_available = false
93 end
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
94 require "rake/extensiontask"
245c09fe » flavorjones
2011-07-01 Omitting java and jar files from the non-jruby gems. Also working aro…
95
96 HOE.spec.files.reject! { |f| f =~ %r{\.(java|jar)$} }
97
3c11e293 » tenderlove
2011-01-27 partial switch to rake-compiler
98 Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
2dd18529 » tenderlove
2009-05-24 making fat binaries easy with nokogiri
99 ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
17aff7bf » flavorjones
2009-04-24 tweaking Rakefile to not blow up when running tasks on JRuby
100 ext.config_options << ENV['EXTOPTS']
4338f17c » yokolet
2011-07-27 Tweak for a platform that doesn't have MinGW installed.
101 if mingw_available
102 ext.cross_compile = true
103 ext.cross_platform = ["x86-mswin32-60", "x86-mingw32"]
104 ext.cross_config_options << "--with-xml2-include=#{File.join($recipes[:libxml2].path, 'include', 'libxml2')}"
105 ext.cross_config_options << "--with-xml2-lib=#{File.join($recipes[:libxml2].path, 'lib')}"
106 ext.cross_config_options << "--with-iconv-dir=#{$recipes[:libiconv].path}"
107 ext.cross_config_options << "--with-xslt-dir=#{$recipes[:libxslt].path}"
108 ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
109 end
17aff7bf » flavorjones
2009-04-24 tweaking Rakefile to not blow up when running tasks on JRuby
110 end
56438602 » jbarnette
2009-02-03 Add 'rake libxml:version', because I'm lazy.
111 end
112
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
113 # ----------------------------------------
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
114
fb54cef3 » flavorjones
2011-06-20 Adding gemspec to clean_globs
115 desc "Generate css/parser.rb and css/tokenizer.rex"
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
116 task 'generate' => [GENERATED_PARSER, GENERATED_TOKENIZER]
117 task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
08450f39 » tenderlove
2008-08-19 auto generating the IDL interface
118
ae80ec13 » jvshahid
2012-07-23 modify the bundler:gemfile task to add the ':platform => :ruby' const…
119 # This is a big hack to make sure that the racc and rexical
120 # dependencies in the Gemfile are constrainted to ruby platforms
121 # (i.e. MRI and Rubinius). There's no way to do that through hoe,
122 # and any solution will require changing hoe and hoe-bundler.
42298266 » flavorjones
2012-10-16 README. Closes #777
123 old_gemfile_task = Rake::Task['bundler:gemfile'] rescue nil
ae80ec13 » jvshahid
2012-07-23 modify the bundler:gemfile task to add the ':platform => :ruby' const…
124 task 'bundler:gemfile' do
42298266 » flavorjones
2012-10-16 README. Closes #777
125 old_gemfile_task.invoke if old_gemfile_task
ae80ec13 » jvshahid
2012-07-23 modify the bundler:gemfile task to add the ':platform => :ruby' const…
126
127 lines = File.open('Gemfile', 'r') { |f| f.readlines }.map do |line|
128 line =~ /racc|rexical/ ? "#{line.strip}, :platform => :ruby" : line
129 end
130 File.open('Gemfile', 'w') { |f| lines.each { |line| f.puts line } }
131 end
132
9246422c » tenderlove
2008-09-17 adding tokenizer and parser
133 file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
07108030 » tenderlove
2011-01-27 switch to RbConfig
134 racc = RbConfig::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
135 racc = "#{::RbConfig::CONFIG['bindir']}/racc" if racc.empty?
753836b1 » yokolet
2011-08-09 Changes to a better way to find racc command when rvm gemset is used.…
136 racc = %x{command -v racc}.strip if racc.empty?
00666018 » tenderlove
2011-01-24 check_deps ensures that these gems are installed
137 sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
9246422c » tenderlove
2008-09-17 adding tokenizer and parser
138 end
139
140 file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
00666018 » tenderlove
2011-01-24 check_deps ensures that these gems are installed
141 sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
85b1f6d7 » tenderlove
2008-09-11 starting the move to C
142 end
143
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
144 [:compile, :check_manifest].each do |task_name|
145 Rake::Task[task_name].prerequisites << GENERATED_PARSER
146 Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
1b2d8e54 » flavorjones
2010-06-14 let's be a bit more forgiving of people without the mingw toolchain.
147 end
fd9b7731 » tenderlove
2009-04-09 switching nokogiri to rake-compiler
148
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
149 # ----------------------------------------
150
4f61acea » flavorjones
2008-10-21 putting gdb and valgrind rake tasks under 'test' namespace
151 desc "set environment variables to build and/or test with debug options"
152 task :debug do
153 ENV['NOKOGIRI_DEBUG'] = "true"
154 ENV['CFLAGS'] ||= ""
155 ENV['CFLAGS'] += " -DDEBUG"
156 end
157
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
158 require 'tasks/test'
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
159
7272ba18 » jvshahid
2012-06-17 Turn on remote debugging if we're running the tests in jruby and DEBU…
160 task :java_debug do
161 ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if java? && ENV['JAVA_DEBUG']
162 end
163
c9fc9c30 » jvshahid
2012-06-22 Add test_18 and test_19 when running in JRuby.
164 if java?
165 task :test_18 => :test
166 task :test_19 do
167 ENV['JRUBY_OPTS'] = "--1.9"
168 Rake::Task["test"].invoke
169 end
170 end
171
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
172 Rake::Task[:test].prerequisites << :compile
7272ba18 » jvshahid
2012-06-17 Turn on remote debugging if we're running the tests in jruby and DEBU…
173 Rake::Task[:test].prerequisites << :java_debug
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
174 Rake::Task[:test].prerequisites << :check_extra_deps unless java?
c9fc9c30 » jvshahid
2012-06-22 Add test_18 and test_19 when running in JRuby.
175
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
176 if Hoe.plugins.include?(:debugging)
177 ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
178 Rake::Task["test:#{task_name}"].prerequisites << :compile
1e32e9e5 » flavorjones
2008-10-21 rake task to run tests with aggressive garbage collection
179 end
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
180 end
181
182 # ----------------------------------------
c6cea3ce » tenderlove
2008-11-30 fixing up rdoc and adding an rdoc test
183
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
184 desc "build a windows gem without all the ceremony."
245c09fe » flavorjones
2011-07-01 Omitting java and jar files from the non-jruby gems. Also working aro…
185 task "gem:windows" => "gem" do
2c9c7448 » flavorjones
2012-07-08 build changes and comments
186 # TODO: 1.8.7-p358, 1.9.3-p194
d8a78245 » flavorjones
2012-02-28 More tweaking on the windows cross-compilation rake task.
187 cross_rubies = ["1.8.7-p330", "1.9.2-p136"]
188 ruby_cc_version = cross_rubies.collect { |_| _.split("-").first }.join(":") # e.g., "1.8.7:1.9.2"
189 rake_compiler_config_path = "#{ENV['HOME']}/.rake-compiler/config.yml"
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
190
d8a78245 » flavorjones
2012-02-28 More tweaking on the windows cross-compilation rake task.
191 unless File.exists? rake_compiler_config_path
192 raise "rake-compiler has not installed any cross rubies. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{cross_rubies.first}'"
193 end
194 rake_compiler_config = YAML.load_file(rake_compiler_config_path)
195
196 # check that rake-compiler config contains the right patchlevels. see #279 for background,
197 # and http://blog.mmediasys.com/2011/01/22/rake-compiler-updated-list-of-supported-ruby-versions-for-cross-compilation/
198 # for more up-to-date docs.
199 cross_rubies.each do |version|
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
200 majmin, patchlevel = version.split("-")
201 rbconfig = "rbconfig-#{majmin}"
202 unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
203 raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
7a43e2e9 » flavorjones
2009-06-26 ensuring rake will run even if hoe-debugging isn't installed
204 end
fd9b7731 » tenderlove
2009-04-09 switching nokogiri to rake-compiler
205 end
10b09f8e » flavorjones
2008-10-21 added rake task to run test suite in gdb
206
d8a78245 » flavorjones
2012-02-28 More tweaking on the windows cross-compilation rake task.
207 # verify that --export-all is in the 1.9 rbconfig. see #279,#374,#375.
208 rbconfig_19 = rake_compiler_config["rbconfig-1.9.2"]
209 raise "rbconfig #{rbconfig_19} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_19).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
210
211 pkg_config_path = [:libxslt, :libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
d8a78245 » flavorjones
2012-02-28 More tweaking on the windows cross-compilation rake task.
212 sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=#{ruby_cc_version} rake cross native gem") || raise("build failed!")
c7efec65 » flavorjones
2011-06-21 Converted to mini_portile for cross-compiling libraries.
213 end
505e91ac » flavorjones
2011-06-20 Started cleaning up Rakefile.
214
e7f98b6c » tenderlove
2008-07-14 initial checkin
215 # vim: syntax=Ruby
Something went wrong with that request. Please try again.