Changeset 148

Show
Ignore:
Timestamp:
06/04/2007 23:57:42 (18 months ago)
Author:
why
Message:
  • Rakefile: install the shared lib into a platform-specific directory. (an old one: see #15)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Rakefile

    r133 r148  
    1212PKG = "#{NAME}-#{VERS}" 
    1313BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}" 
    14 CLEAN.include ["ext/hpricot_scan/#{BIN}", "lib/#{BIN}", 'ext/hpricot_scan/Makefile',  
     14ARCHLIB = "lib/#{::Config::CONFIG['arch']}" 
     15CLEAN.include ["ext/hpricot_scan/#{BIN}", "lib/**/#{BIN}", 'ext/hpricot_scan/Makefile',  
    1516               '**/.*.sw?', '*.gem', '.config'] 
    1617RDOC_OPTS = ['--quiet', '--title', 'The Hpricot Reference', '--main', 'README', '--inline-source'] 
     
    3334    s.homepage = 'http://code.whytheluckystiff.net/hpricot/' 
    3435    s.files = PKG_FILES 
    35     s.require_path = "lib" 
     36    s.require_paths = [ARCHLIB, "lib"]  
    3637    s.extensions = FileList["ext/**/extconf.rb"].to_a 
    3738    s.bindir = "bin" 
     
    4950desc "Run all the tests" 
    5051Rake::TestTask.new do |t| 
    51     t.libs << "test" 
     52    t.libs << "test" << ARCHLIB 
    5253    t.test_files = FileList['test/test_*.rb'] 
    5354    t.verbose = true 
     
    8485desc "Compiles the Ruby extension" 
    8586task :compile => [:hpricot_scan] do 
    86   if Dir.glob(File.join("lib","hpricot_scan.*")).length == 0 
     87  if Dir.glob(File.join(ARCHLIB,"hpricot_scan.*")).length == 0 
    8788    STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 
    8889    STDERR.puts "Gem actually failed to build.  Your system is" 
     
    105106    sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') 
    106107  end 
    107   cp ext_so, "lib" 
     108  mkdir_p ARCHLIB 
     109  cp ext_so, ARCHLIB 
    108110end 
    109111 
     
    127129Win32Spec = SPEC.dup 
    128130Win32Spec.platform = Gem::Platform::WIN32 
    129 Win32Spec.files = PKG_FILES + ['lib/hpricot_scan.so'] 
     131Win32Spec.files = PKG_FILES + ["#{ARCHLIB}/hpricot_scan.so"] 
    130132Win32Spec.extensions = [] 
    131133   
     
    142144  cp "extras/mingw-rbconfig.rb", "#{WIN32_PKG_DIR}/ext/hpricot_scan/rbconfig.rb" 
    143145  sh "cd #{WIN32_PKG_DIR}/ext/hpricot_scan/ && ruby -I. extconf.rb && make" 
    144   mv "#{WIN32_PKG_DIR}/ext/hpricot_scan/hpricot_scan.so", "#{WIN32_PKG_DIR}/lib" 
     146  mv "#{WIN32_PKG_DIR}/ext/hpricot_scan/hpricot_scan.so", "#{WIN32_PKG_DIR}/#{ARCHLIB}" 
    145147end 
    146148 
     
    171173JRubySpec = SPEC.dup 
    172174JRubySpec.platform = 'jruby' 
    173 JRubySpec.files = PKG_FILES + ['lib/hpricot_scan.jar'] 
     175JRubySpec.files = PKG_FILES + ["#{ARCHLIB}/hpricot_scan.jar"] 
    174176JRubySpec.extensions = [] 
    175177 
     
    185187file "hpricot_scan_jruby" => [JRUBY_PKG_DIR] do 
    186188  Dir.chdir("#{JRUBY_PKG_DIR}/ext/hpricot_scan", &compile_java) 
    187   mv "#{JRUBY_PKG_DIR}/ext/hpricot_scan/hpricot_scan.jar", "#{JRUBY_PKG_DIR}/lib" 
     189  mv "#{JRUBY_PKG_DIR}/ext/hpricot_scan/hpricot_scan.jar", "#{JRUBY_PKG_DIR}/#{ARCHLIB}" 
    188190end 
    189191