1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

signed fastthread using unreleased echoe (for extensions)

git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@591 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
evanweaver 2007-09-23 01:18:19 +00:00
parent e4e25dfebd
commit a4bf087d51
4 changed files with 30 additions and 168 deletions

View file

@ -0,0 +1,3 @@
v1.0.1. Signed gem.

View file

@ -0,0 +1,9 @@
test/test_queue.rb
test/test_mutex.rb
test/test_condvar.rb
test/test_all.rb
setup.rb
Manifest
ext/fastthread/fastthread.c
ext/fastthread/extconf.rb
CHANGELOG

View file

@ -1,58 +1,25 @@
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/gempackagetask'
require 'tools/rakehelp'
GEM_VERSION="1.0"
require 'echoe'
setup_extension('fastthread', 'fastthread')
Echoe.new("fastthread") do |p|
p.project = "mongrel"
p.author = "MenTaLguY <mental@rydia.net>"
p.summary = "Optimized replacement for thread.rb primitives"
p.extensions = "ext/fastthread/extconf.rb"
p.clean_pattern = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log', "ext/fastthread/*.{bundle,so,obj,pdb,lib,def,exp}", "ext/fastthread/Makefile", "pkg", "lib/*.bundle", "*.gem", ".config"]
desc "Compiles native extensions"
task :compile => [:fastthread]
p.need_tar_gz = false
p.need_tgz = true
p.certificate_chain = ['/Users/eweaver/p/configuration/gem_certificates/mongrel/mongrel-public_cert.pem',
'/Users/eweaver/p/configuration/gem_certificates/evan_weaver-mongrel-public_cert.pem']
p.require_signed = true
task :default => [:compile, :test]
Rake::TestTask.new do |task|
task.libs << 'test'
task.test_files = Dir.glob( 'test/test*.rb' )
task.verbose = true
end
gemspec = Gem::Specification.new do |gemspec|
gemspec.name = "fastthread"
gemspec.version = GEM_VERSION
gemspec.author = "MenTaLguY <mental@rydia.net>"
gemspec.summary = "Optimized replacement for thread.rb primitives"
gemspec.test_file = 'test/test_all.rb'
gemspec.files = %w( Rakefile setup.rb ) +
Dir.glob( 'test/*.rb' ) +
Dir.glob( 'ext/**/*.{c,rb}' ) +
Dir.glob( 'tools/*.rb' )
gemspec.require_path = 'lib'
if RUBY_PLATFORM.match("win32")
gemspec.platform = Gem::Platform::WIN32
gemspec.files += ['lib/fastthread.so']
else
gemspec.platform = Gem::Platform::RUBY
gemspec.extensions = Dir.glob( 'ext/**/extconf.rb' )
p.eval = proc do
if RUBY_PLATFORM.match("win32")
platform = Gem::Platform::WIN32
files += ['lib/fastthread.so']
task :package => [:clean, :compile]
end
end
end
task :package => [:clean, :compile, :test]
Rake::GemPackageTask.new( gemspec ) do |task|
task.gem_spec = gemspec
task.need_tar = true
end
setup_clean ["ext/fastthread/*.{bundle,so,obj,pdb,lib,def,exp}", "ext/fastthread/Makefile", "pkg", "lib/*.bundle", "*.gem", ".config"]
task :install => [:default, :package] do
sh %{ sudo gem install pkg/fastthread-#{GEM_VERSION}.gem }
end
task :uninstall do
sh %{ sudo gem uninstall fastthread }
end

View file

@ -1,117 +0,0 @@
def make(makedir)
Dir.chdir(makedir) do
sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
end
end
def extconf(dir)
Dir.chdir(dir) do ruby "extconf.rb" end
end
def setup_tests
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/test*.rb']
t.verbose = true
end
end
def setup_clean otherfiles
files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
CLEAN.include(files)
end
def setup_rdoc files
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.add(files)
end
end
def setup_extension(dir, extension)
ext = "ext/#{dir}"
ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
ext_files = FileList[
"#{ext}/*.c",
"#{ext}/*.h",
"#{ext}/extconf.rb",
"#{ext}/Makefile",
"lib"
]
task "lib" do
directory "lib"
end
desc "Builds just the #{extension} extension"
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
extconf "#{ext}"
end
file ext_so => ext_files do
make "#{ext}"
cp ext_so, "lib"
end
end
def base_gem_spec(pkg_name, pkg_version)
rm_rf "test/coverage"
pkg_version = pkg_version
pkg_name = pkg_name
pkg_file_name = "#{pkg_name}-#{pkg_version}"
Gem::Specification.new do |s|
s.name = pkg_name
s.version = pkg_version
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = [ "README" ]
s.files = %w(COPYING LICENSE README Rakefile) +
Dir.glob("{bin,doc/rdoc,test}/**/*") +
Dir.glob("ext/**/*.{h,c,rb,rl}") +
Dir.glob("{examples,tools,lib}/**/*.rb")
s.require_path = "lib"
s.extensions = FileList["ext/**/extconf.rb"].to_a
s.bindir = "bin"
end
end
def setup_gem(pkg_name, pkg_version)
spec = base_gem_spec(pkg_name, pkg_version)
yield spec if block_given?
Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
end
end
def sub_project(project, *targets)
targets.each do |target|
Dir.chdir "projects/#{project}" do
sh %{rake --trace #{target.to_s} }
end
end
end
# Conditional require rcov/rcovtask if present
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.test_files = FileList['test/test*.rb']
t.rcov_opts << "-x /usr"
t.output_dir = "test/coverage"
end
rescue Object
end