On Thu, Jul 20, 2006 at 04:11:09AM +0900, why the lucky stiff wrote:
On Thu, Jul 20, 2006 at 03:18:05AM +0900, Justin B. wrote:
I can’t build it on Windows tho - I think my version of VC++ is incorrect.
Any chance we can get a precompiled binary? Plllleease? 
I’ll have binaries for Hpricot and Sandbox both out in August. They still lack
stability too much to warrant that kind of release. If someone else finds time
to compile and release their own gems, that would be a great relief!
Could you have a look at
http://eigenclass.org/misc/hpricot-0.3.0-mswin32.gem ?
I applied my standard cross-compilation treatment with MinGW.
Sandbox will follow if the above works and it’s OK by you.
FYI, here’s the patch to the Rakefile and related stuff I applied:
Thu Jul 20 00:04:00 CEST 2006 Mauricio F. [email protected]
- Rakefile, mingw-rbconfig.rb: added rubygems_win32 and related
targets.
Cross-compiles with MinGW.
diff -rN -u old-hpricot.mingw/Rakefile new-hpricot.mingw/Rakefile
— old-hpricot.mingw/Rakefile 2006-07-20 00:05:32.000000000 +0200
+++ new-hpricot.mingw/Rakefile 2006-07-20 00:05:32.000000000 +0200
@@ -8,6 +8,7 @@
NAME = “hpricot”
VERS = “0.3”
+PKG_REVISION = “.0”
CLEAN.include [‘ext/hpricot_scan/.{bundle,so,obj,pdb,lib,def,exp}’,
‘ext/hpricot_scan/Makefile’,
'**/..sw?’, ‘*.gem’, ‘.config’]
@@ -19,7 +20,7 @@
if Dir.glob(File.join(“lib”,“hpricot_scan.*”)).length == 0
STDERR.puts “!!!”
STDERR.puts “Gem actually failed to build. Your system is”
- STDERR.puts “NOT configured properly to build Mongrel.”
- STDERR.puts “NOT configured properly to build hpricot.”
STDERR.puts “!!!”
exit(1)
end
@@ -27,7 +28,7 @@
task :hpricot_scan => [:ragel]
desc “Packages up Hpricot.”
-task :package => [:clean]
+task :package => [:clean, :ragel]
desc “Run all the tests”
Rake::TestTask.new do |t|
@@ -39,7 +40,7 @@
spec =
Gem::Specification.new do |s|
s.name = NAME
@@ -49,12 +50,13 @@
s.email = ‘[email protected]’
s.homepage = ‘http://code.whytheluckystiff.net/hpricot/’
-
s.files = %w(COPYING README Rakefile mingw-rbconfig.rb) +
Dir.glob("{bin,doc,test,lib,extras}/**/*") +
-
Dir.glob("ext/**/*.{h,c,rb,rl}") +
-
%w[ext/hpricot_scan/hpricot_scan.c] # needed because it's
generated later
s.require_path = "lib"
desc “Generates the scanner code with Ragel.”
task :ragel do
- sh %{/usr/local/bin/ragel ext/hpricot_scan/hpricot_scan.rl |
/usr/local/bin/rlcodegen -G2 -o ext/hpricot_scan/hpricot_scan.c}
- sh %{ragel ext/hpricot_scan/hpricot_scan.rl | rlcodegen -G2 -o
ext/hpricot_scan/hpricot_scan.c}
end
+PKG_FILES = FileList[
- “test/**/*.{rb,html,xhtml}”,
- “lib/**/*.rb”,
- “ext/**/*.{c,rb,h,rl}”,
- “CHANGELOG”, “README”, “Rakefile”, “COPYING”,
- “mingw-rbconfig.rb”, “lib/hpricot_scan.so”]
-
+Win32Spec = Gem::Specification.new do |s|
- s.name = NAME
- s.version = VERS + PKG_REVISION
- s.platform = Gem::Platform::WIN32
- s.has_rdoc = false
- s.extra_rdoc_files = [“README”, “CHANGELOG”, “COPYING”]
- s.summary = “a swift, liberal HTML parser with a fantastic library”
- s.description = s.summary
- s.author = “why the lucky stiff”
- s.email = ‘[email protected]’
- s.homepage = ‘http://code.whytheluckystiff.net/hpricot/’
-
- s.files = PKG_FILES
-
- s.require_path = “lib”
-
#s.autorequire = “hpricot” # no no no this is tHe 3v1l
- s.extensions = []
- s.bindir = “bin”
+end
-
+WIN32_PKG_DIR = “hpricot-” + VERS + PKG_REVISION
+
+file WIN32_PKG_DIR => [:package] do
- sh “tar zxf pkg/#{WIN32_PKG_DIR}.tgz”
+end
-
+desc “Cross-compile the hpricot_scan extension for win32”
+file “hpricot_scan_win32” => [WIN32_PKG_DIR] do
- cp “mingw-rbconfig.rb”,
“#{WIN32_PKG_DIR}/ext/hpricot_scan/rbconfig.rb”
- sh “cd #{WIN32_PKG_DIR}/ext/hpricot_scan/ && ruby -I. extconf.rb &&
make”
- mv “#{WIN32_PKG_DIR}/ext/hpricot_scan/hpricot_scan.so”,
“#{WIN32_PKG_DIR}/lib”
+end
-
+desc “Build the binary RubyGems package for win32”
+task :rubygems_win32 => [“hpricot_scan_win32”] do
PKG_REVISION}-mswin32.gem"
+CLEAN.include WIN32_PKG_DIR
+
task :install do
sh %{rake package}
sh %{sudo gem install pkg/#{NAME}-#{VERS}}
diff -rN -u old-hpricot.mingw/mingw-rbconfig.rb
new-hpricot.mingw/mingw-rbconfig.rb
— old-hpricot.mingw/mingw-rbconfig.rb 1970-01-01 01:00:00.000000000
+0100
+++ new-hpricot.mingw/mingw-rbconfig.rb 2006-07-20 00:05:32.000000000
+0200
@@ -0,0 +1,174 @@
+
+# This rbconfig.rb corresponds to a Ruby installation for win32
cross-compiled
+# with mingw under i686-linux. It can be used to cross-compile
extensions for
+# win32 using said toolchain.
+#
+# This file assumes that a cross-compiled mingw32 build (compatible
with the
+# mswin32 builds) is installed under $HOME/ruby-mingw32.
+
+module Config
-
#RUBY_VERSION == “1.8.5” or
-
raise "ruby lib version (1.8.5) doesn’t match executable version
(#{RUBY_VERSION})"
+