* Add a mkrf monkeypatch so BSD build flags are generated correctly.
* Fix typos!
--- a/LICENSE Mon Aug 18 06:25:08 2008 +0000
+++ b/LICENSE Tue Oct 14 16:11:19 2008 +0000
@@ -1,4 +1,4 @@
-Copyright (c) 2008, Michae Granger and Mahlon Smith
+Copyright (c) 2008, Michael Granger and Mahlon Smith
All rights reserved.
Redistribution and use in source and binary forms, with or without
--- a/Rakefile Mon Aug 18 06:25:08 2008 +0000
+++ b/Rakefile Tue Oct 14 16:11:19 2008 +0000
@@ -7,7 +7,7 @@
# Copyright (c) 2008 The FaerieMUD Consortium
#
# Authors:
-# * Michae Granger and Mahlon Smith <ged@FaerieMUD.org, mahlon@martini.nu>
+# * Michael Granger and Mahlon Smith <ged@FaerieMUD.org, mahlon@martini.nu>
#
BEGIN {
@@ -65,6 +65,7 @@
EXTRA_PKGFILES = []
EXTRA_PKGFILES += Pathname.glob( BASEDIR + 'examples/*.{c,rb}' ).delete_if {|item| item =~ /\.svn/ }
+EXTRA_PKGFILES.concat Pathname.glob( BASEDIR + 'misc/monkeypatches.rb' ).delete_if {|item| item =~ /\.svn/ }
RELEASE_FILES = TEXT_FILES +
SPEC_FILES +
@@ -151,7 +152,7 @@
simultaneously. It includes a Ruby binding to the FreeBSD jail(2) functions.
EOD
- gem.authors = 'Michae Granger and Mahlon Smith'
+ gem.authors = 'Michael Granger and Mahlon Smith'
gem.email = 'ged@FaerieMUD.org, mahlon@martini.nu'
gem.homepage = 'http://deveiate.org/projects/Jparallel/'
gem.rubyforge_project = RUBYFORGE_PROJECT
--- a/ext/bsdjail.c Mon Aug 18 06:25:08 2008 +0000
+++ b/ext/bsdjail.c Tue Oct 14 16:11:19 2008 +0000
@@ -1,9 +1,10 @@
/*
- * dict.c - Ruby LinkParser - Dict Class
+ * bsdjail.c - Ruby jparallel
* $Id$
*
* Authors:
* * Michael Granger <ged@FaerieMUD.org>
+ * * Mahlon E. Smith <mahlon@martini.nu>
*
* Copyright (c) 2006 The FaerieMUD Consortium.
*
--- a/misc/monkeypatches.rb Mon Aug 18 06:25:08 2008 +0000
+++ b/misc/monkeypatches.rb Tue Oct 14 16:11:19 2008 +0000
@@ -66,7 +66,83 @@
module Mkrf
class Availability
- # No-op the stupid squashing of output
+
+ # Create a new Availability instance.
+ #
+ # Valid keys for the options hash include:
+ # * <tt>:loaded_libs</tt> -- libraries to load by default
+ # * <tt>:library_paths</tt> -- libraries paths to include by default
+ # * <tt>:headers</tt> -- headers to load by default
+ # * <tt>:compiler</tt> -- which compiler to use when determining availability
+ # * <tt>:includes</tt> -- directories that should be searched for include files
+ def initialize(options = {})
+ @loaded_libs = options[:loaded_libs] || []
+ @loaded_libs.flatten!
+
+ @library_paths = [(options[:library_paths] || [])].flatten
+ # Not sure what COMMON_HEADERS looks like when populated
+ @headers = options[:headers] || [] # Config::CONFIG["COMMON_HEADERS"]
+ @compiler = options[:compiler] || Config::CONFIG["CC"]
+ @includes = [(options[:includes] || DEFAULT_INCLUDES)].flatten
+ @logger = Logger.new('mkrf.log')
+ @defines = []
+ end
+
+
+ def can_link?( function_body )
+ silence_command_line do
+ create_source(function_body)
+ cmd = link_command()
+ @logger.debug "Running link command: #{cmd}"
+ system( cmd )
+ end
+ ensure
+ FileUtils.rm_f TEMP_SOURCE_FILE
+ FileUtils.rm_f TEMP_EXECUTABLE
+ end
+
+
+ # Add the LIBRUBYARG_SHARED setting to the library paths for non-windows boxen. This is
+ # necessary if Ruby is installed in a directory that isn't in the default library
+ # search path (e.g., on FreeBSD where Ruby is /usr/local/bin/ruby).
+ def library_paths_compile_string
+ if RUBY_PLATFORM =~ /mswin/
+ @library_paths.collect {|l| "/libpath:#{l}"}.join(' ')
+ else
+ Config::CONFIG['LIBRUBYARG_SHARED'] + @library_paths.collect {|l| "-L#{l}"}.join(' ')
+ end
+ end
+
+
+ # Separate includes with a newline instead of a literal '\n'
+ def header_include_string
+ @headers.collect {|header| "#include <#{header}>"}.join( "\n" )
+ end
+
+
+ # Log the created source to the logfile
+ def create_source( src )
+ @logger.debug "Creating source file:\n#{src}"
+ File.open( TEMP_SOURCE_FILE, "w+" ) do |f|
+ f.write( src )
+ end
+ end
+
+ # Prepend the LIBS string directly to the @loaded_libs, as not all arguments in
+ # it
+ def library_compile_string
+ added_libs = nil
+ if RUBY_PLATFORM =~ /mswin/
+ added_libs = @loaded_libs.join(' ')
+ else
+ added_libs = @loaded_libs.collect {|l| "-l#{l}"}.join(' ')
+ end
+
+ return Config::CONFIG["LIBS"] + ' ' + added_libs
+ end
+
+
+ # Redirect to the mkrf log instead of /dev/null
def silence_stream( stream )
old_stream = stream.dup
stream.reopen( @logger.instance_variable_get(:@logdev).dev )