Sha256: 71db0883c4549c1c7fec4b5c13f9e274278d516be82ee4ea1c2629d0de933e73

Contents?: true

Size: 1.23 KB

Versions: 31

Compression:

Stored size: 1.23 KB

Contents

# We can't use Ruby's standard build procedures
# on Windows because the Ruby executable is
# built with VC++ while here we want to build
# with MingW.  So just roll our own...

require 'rake/clean'
require 'rbconfig'

RUBY_INCLUDE_DIR = Config::CONFIG["archdir"]
RUBY_BIN_DIR = Config::CONFIG["bindir"]
RUBY_LIB_DIR = Config::CONFIG["libdir"]
RUBY_SHARED_LIB = Config::CONFIG["LIBRUBY"]
RUBY_SHARED_DLL = RUBY_SHARED_LIB.gsub(/lib$/, 'dll')

EXTENSION_NAME = "libxml_ruby.#{Config::CONFIG["DLEXT"]}"
# MingW insists the import library is .dll.a
EXTENSION_LIB_NAME = "libxml_ruby.dll.a"

CLEAN.include('*.o')
CLOBBER.include(EXTENSION_NAME)
CLOBBER.include(EXTENSION_LIB_NAME)

task :default => "libxml"

SRC = FileList['../libxml/*.c']
OBJ = SRC.collect do |file_name|
  File.basename(file_name).ext('o')
end

SRC.each do |srcfile|
  objfile = File.basename(srcfile).ext('o')
  file objfile => srcfile do
    command = "gcc -c -O2 -Wall -o #{objfile} -I/usr/local/include #{srcfile} -I#{RUBY_INCLUDE_DIR}"
    sh "sh -c '#{command}'" 
  end
end

file "libxml" => OBJ do
  command = "gcc -shared -o #{EXTENSION_NAME} -Wl,--out-implib,#{EXTENSION_LIB_NAME} -L/usr/local/lib #{OBJ} -lxml2 #{RUBY_BIN_DIR}/#{RUBY_SHARED_DLL}" 
  sh "sh -c '#{command}'" 
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
coupa-libxml-ruby-1.1.4 ext/mingw/build.rake
libxml-ruby-0.9.3-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.2-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.2 ext/mingw/build.rake
libxml-ruby-0.9.1 ext/mingw/build.rake
libxml-ruby-0.9.1-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.0-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.0 ext/mingw/build.rake
libxml-ruby-0.9.5-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.3 ext/mingw/build.rake
libxml-ruby-0.9.4-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.5 ext/mingw/build.rake
libxml-ruby-0.9.4 ext/mingw/build.rake
libxml-ruby-0.9.6 ext/mingw/build.rake
libxml-ruby-0.9.6-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.7-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.7 ext/mingw/build.rake
libxml-ruby-0.9.8 ext/mingw/build.rake
libxml-ruby-0.9.8-x86-mswin32-60 ext/mingw/build.rake
libxml-ruby-0.9.9-x86-mswin32-60 ext/mingw/build.rake