# HG changeset patch # User Michael Granger # Date 1227199382 0 # Node ID 7f6da371e2ce4953cf1cc0f14b440e364a747878 # Parent 0c24586f579a68cc03c7eaa05cc4fd684214fac8 * Converted from Mkrf-based build back to mkmf. * Updated the build system. diff -r 0c24586f579a -r 7f6da371e2ce README --- a/README Thu Oct 16 02:43:08 2008 +0000 +++ b/README Thu Nov 20 16:43:02 2008 +0000 @@ -5,8 +5,8 @@ This is shell that can be used to interact with multiple FreeBSD jail instances simultaneously. It includes a Ruby binding to the FreeBSD jail(2) functions. -In the meantime, you can check out the current development source with Subversion from the -following URL: +It's still under development, but in the meantime, you can check out the +current development source with Subversion from the following URL: svn://deveiate.org/jparallel/trunk diff -r 0c24586f579a -r 7f6da371e2ce Rakefile --- a/Rakefile Thu Oct 16 02:43:08 2008 +0000 +++ b/Rakefile Thu Nov 20 16:43:02 2008 +0000 @@ -45,11 +45,21 @@ PROJECT_NAME = 'jparallel' PKG_NAME = PROJECT_NAME.downcase PKG_SUMMARY = 'A "parallel jail shell" written in Ruby' + VERSION_FILE = LIBDIR + 'jparallel.rb' -PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*'(\d+\.\d+\.\d+)'/, 1 ] +if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL'] + PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev +elsif VERSION_FILE.exist? + PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] +else + PKG_VERSION = '0.0.0' +end + PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}" GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem" +EXTCONF = EXTDIR + 'extconf.rb' + ARTIFACTS_DIR = Pathname.new( ENV['CC_BUILD_ARTIFACTS'] || 'artifacts' ) TEXT_FILES = %w( Rakefile ChangeLog README LICENSE ).collect {|filename| BASEDIR + filename } @@ -124,7 +134,7 @@ '-SHN', '-i', '.', '-m', 'README', - '-W', 'http://deveiate.org/projects/Jparallel//browser/trunk/' + '-W', 'http://deveiate.org/projects/jParallel//browser/trunk/' ] # Release constants @@ -180,14 +190,17 @@ gem.authors = 'Michael Granger and Mahlon Smith' gem.email = 'ged@FaerieMUD.org, mahlon@martini.nu' - gem.homepage = 'http://deveiate.org/projects/Jparallel/' + gem.homepage = 'http://deveiate.org/projects/jParallel/' gem.rubyforge_project = RUBYFORGE_PROJECT gem.has_rdoc = true gem.rdoc_options = RDOC_OPTIONS gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s - + + if EXTCONF.exist? + gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s + end gem.files = RELEASE_FILES. collect {|f| f.relative_path_from(BASEDIR).to_s } @@ -272,7 +285,7 @@ desc "Cruisecontrol build" task :cruise => [:clean, 'spec:quiet', :package] do |task| raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty? - artifact_dir = ARTIFACTS_DIR.cleanpath + artifact_dir = ARTIFACTS_DIR.cleanpath + ENV['CC_BUILD_LABEL'] artifact_dir.mkpath coverage = BASEDIR + 'coverage' diff -r 0c24586f579a -r 7f6da371e2ce Rakefile.local --- a/Rakefile.local Thu Oct 16 02:43:08 2008 +0000 +++ b/Rakefile.local Thu Nov 20 16:43:02 2008 +0000 @@ -1,89 +1,62 @@ +#!rake + #!rake -begin - require 'mkrf' -rescue LoadError => err - unless Object.const_defined?( :Gem ) - require 'rubygems' - retry - end - - fail "You need to have the mkrf library installed to build this." -end - - # C extension constants -EXT_RAKEFILE = EXTDIR + 'Rakefile' -EXT_SO = EXTDIR + "redleaf_ext.#{CONFIG['DLEXT']}" - -ADDITIONAL_INCLUDE_DIRS = %w[ - /usr/local/include - /opt/include - /opt/local/include -] - -# Additional (auto-generated) spec constants -SPEC_RAKEFILE = SPECDIR + 'Rakefile' +EXT_MAKEFILE = EXTDIR + 'Makefile' +EXT_SOURCES = FileList[ EXTDIR + '*.c' ] +EXT_SO = EXTDIR + "bsdjail.#{CONFIG['DLEXT']}" ##################################################################### ### T A S K S ##################################################################### -# task :local => [ :build, :build_specs ] -task :local => [ :build ] -task :spec => [ :build ] +# Make both the default task and the spec task depend on building the extension +task :local => :build +task :spec => :build +namespace :spec do + task :doc => [ :build ] + task :quiet => [ :build ] + task :html => [ :build ] + task :text => [ :build ] +end -desc "Make the Rakefile for the C extension" -file EXT_RAKEFILE.to_s => FileList[ 'Rakefile', EXTDIR + '*.c' ] do - require 'misc/monkeypatches' # Fix Mkrf's output - +desc "Make the Makefile for the C extension" +file EXT_MAKEFILE.to_s => EXT_SOURCES do log "Configuring bsdjail C extension" - Dir.chdir( EXTDIR ) do - Mkrf::Generator.new( 'bsdjail', FileList['*.c'] ) do |gen| - trace "Setting CFLAGS" - gen.cflags << ' -Wall' - gen.cflags << ' -DDEBUG' - - # Make sure we have the ODE library and header available - trace "checking for sys/param.h" - gen.include_header( "sys/param.h" ) or - fail "Can't find the sys/param.h header." - - trace "checking for sys/jail.h" - gen.include_header( "sys/jail.h" ) or - fail "Can't find the sys/jail.h header." - - gen.include_library( "c", "jail_attach" ) or - fail "Can't find jail_attach in the stdlib." - end + in_subdirectory( EXTDIR ) do + ruby 'extconf.rb' end end -CLOBBER.include( EXTDIR + 'mkrf.log' ) - +CLOBBER.include( EXTDIR + 'mkmf.log', EXT_SO ) desc "Build the C extension" -task :build => EXT_RAKEFILE.to_s do - Dir.chdir( EXTDIR ) do - sh 'rake' +task :build => [ EXT_MAKEFILE.to_s, *EXT_SOURCES ] do + in_subdirectory( EXTDIR ) do + sh 'make' end end +desc "Rebuild the C extension" +task :rebuild => [ :clean, :build ] + + task :clean do - if EXT_RAKEFILE.exist? - Dir.chdir( EXTDIR ) do - sh 'rake', 'clean' + if EXT_MAKEFILE.exist? + in_subdirectory( EXTDIR ) do + sh 'make clean' end end end task :clobber do - if EXT_RAKEFILE.exist? - Dir.chdir( EXTDIR ) do - sh 'rake', 'clobber' + if EXT_MAKEFILE.exist? + in_subdirectory( EXTDIR ) do + sh 'make distclean' end end end -CLOBBER.include( EXT_RAKEFILE ) +CLOBBER.include( EXT_MAKEFILE ) diff -r 0c24586f579a -r 7f6da371e2ce ext/extconf.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ext/extconf.rb Thu Nov 20 16:43:02 2008 +0000 @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +require 'mkmf' +require 'fileutils' + +ADDITIONAL_LIBRARY_DIRS = %w[ + /usr/local/lib + /opt/lib + /opt/local/lib +] +ADDITIONAL_INCLUDE_DIRS = %w[ + /usr/local/include + /opt/include + /opt/local/include +] + +$CFLAGS << ' -Wall' << ' -ggdb' << ' -DDEBUG' + +def fail( *messages ) + $stderr.puts( *messages ) + exit( 1 ) +end + + +dir_config( 'bsdjail' ) + +have_header( "sys/param.h" ) or fail "Can't find the sys/param.h header." +have_header( "sys/jail.h" ) or fail "Can't find the sys/jail.h header." + +have_func( "jail_attach" ) or fail "Can't find jail_attach in the stdlib." + +create_makefile( 'bsdjail' ) + diff -r 0c24586f579a -r 7f6da371e2ce project.yml --- a/project.yml Thu Oct 16 02:43:08 2008 +0000 +++ b/project.yml Thu Nov 20 16:43:02 2008 +0000 @@ -7,7 +7,7 @@ simultaneously. It includes a Ruby binding to the FreeBSD jail(2) functions. rubyforge_group: deveiate author_name: Michael Granger and Mahlon Smith -project_homepage: http://deveiate.org/projects/Jparallel/ +project_homepage: http://deveiate.org/projects/jParallel/ project_dependencies: {} project_summary: A "parallel jail shell" written in Ruby