Sha256: bba1bfb35463872e084e10bd82794d3ebc4883b67fe249ce86cf64d97f6054ba

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 KB

Contents

#!/usr/bin/ruby
require 'fileutils'
require 'rake/testtask'
require 'rake/rdoctask'
pre_taglib="pre_taglib_"+PLATFORM
taglib_cxx="taglib_#{PLATFORM}.cxx"
extconf="rake_ext_conf.rb"
task :clean do |t|
	["*.cxx", pre_taglib, "*.def","*.exp","*.lib","*.pdb","*.obj","*.manifest","Makefile", "*.so","*.o", "taglib.cxx","*.log"].each{|glob|
		Dir.glob(glob) {|g| 
			FileUtils.rm(g)
		}
	}
	FileUtils.rm_rf("doxygen/xml")
end



task :default => [:compile, :test,:copy]


if(PLATFORM=~/mswin32/)
	task :compile => ["TagLib.so", :manifest]
else
	task :compile => ["TagLib.so"]
end

desc "Add manifest to TagLib.so"
task :manifest => ["TagLib.so", "Taglib.so.manifest"] do |t|
	system %(mt.exe -manifest TagLib.so.manifest -outputresource:TagLib.so;2)
end
task :docs => ["TagLib_doc.rb"] do |t|
    system %(rdoc -f html TagLib_doc.rb)
end

file "TagLib_doc.rb" => ["make_doc.rb","TagLib.so","doxygen"] do |t|
    system %(ruby make_doc.rb)
end

file "doxygen" => ["Doxyfile"] do |t|
    system %(doxygen)
end

task :test => ["TagLib.so"] do |t|
    system %(ruby "test.rb")
end
task :copy => [:test,  "TagLib_doc.rb", "TagLib.so"] do |t|
    FileUtils.cp extconf , "../ext/taglib/"
    FileUtils.cp taglib_cxx , "../ext/taglib/"+"taglib_#{PLATFORM}.source" 
    FileUtils.cp("test.rb","../test/test_taglib.rb")
    FileUtils.cp("TagLib_doc.rb", "../lib/")
    FileUtils.cp("TagLib.so", "../ext/taglib/")
end


file "TagLib.so" => [taglib_cxx, "Makefile"] do |t|
if(PLATFORM=~/mswin32/)
	system %(nmake)
else
	system %(make)
end
end

file "Makefile" => [extconf] do |t|
    system %(ruby #{extconf} )
end

file taglib_cxx => ["taglib.i", "process_cxx.rb"] do |t|
    puts "Actualizando swig"
    if
	!system %(swig -fvirtual -Wall -c++ -o #{pre_taglib} -ruby taglib.i)
	system %(rm *.o *.so *.cxx)
	exit 1
    end
    system %(ruby process_cxx.rb)
end

task :test_taglib => ["test_taglib.cxx"] do  |t|
    system %(gcc -c test_taglib.cxx)
    system %(gcc -o test_taglib test_taglib.o -ltag)
    system %(./test_taglib)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtaglib-0.3.0 swig/Rakefile