Permalink
Browse files

Split C-API headers for 1.8/1.9.

  • Loading branch information...
brixen committed Jun 8, 2011
1 parent 23af0f7 commit 33c8f28490f4ff88c8ed4e83e1a85e47181c5f86
Showing with 1,954 additions and 66 deletions.
  1. +1 −1 Rakefile
  2. +1 −1 bin/rbx-build
  3. +20 −7 configure
  4. +1 −1 lib/mkmf.rb
  5. +10 −1 lib/rbconfig.rb
  6. +13 −3 rakelib/ext_helper.rb
  7. +3 −2 rakelib/extensions.rake
  8. +6 −4 spec/library/config/rbconfig_spec.rb
  9. +1 −0 vm/capi/18/include/config.h
  10. +20 −0 vm/capi/18/include/defines.h
  11. +1 −0 vm/capi/18/include/dl.h
  12. +1 −0 vm/capi/18/include/intern.h
  13. +1 −0 vm/capi/18/include/missing.h
  14. +1 −0 vm/capi/18/include/rbx_config.h
  15. +1 −0 vm/capi/18/include/rbxti.hpp
  16. +1 −0 vm/capi/18/include/re.h
  17. 0 vm/capi/{ → 18}/include/ruby.h
  18. +1 −0 vm/capi/18/include/rubyio.h
  19. +1 −0 vm/capi/18/include/rubysig.h
  20. +1 −0 vm/capi/18/include/st.h
  21. +1 −0 vm/capi/18/include/util.h
  22. +7 −0 vm/capi/{ → 18}/include/version.h
  23. +1 −0 vm/capi/19/include/config.h
  24. 0 vm/capi/{ → 19}/include/defines.h
  25. +1 −0 vm/capi/19/include/dl.h
  26. +1 −0 vm/capi/19/include/intern.h
  27. +1 −0 vm/capi/19/include/missing.h
  28. +1 −0 vm/capi/19/include/rbx_config.h
  29. +1 −0 vm/capi/19/include/rbxti.hpp
  30. +1 −0 vm/capi/19/include/re.h
  31. +1,773 −0 vm/capi/19/include/ruby.h
  32. 0 vm/capi/{ → 19}/include/ruby/encoding.h
  33. 0 vm/capi/{ → 19}/include/ruby/oniguruma.h
  34. +1 −0 vm/capi/19/include/rubyio.h
  35. +1 −0 vm/capi/19/include/rubysig.h
  36. +1 −0 vm/capi/19/include/st.h
  37. +1 −0 vm/capi/19/include/util.h
  38. +10 −0 vm/capi/19/include/version.h
  39. +1 −1 vm/capi/array.cpp
  40. +1 −1 vm/capi/bignum.cpp
  41. +1 −1 vm/capi/capi.cpp
  42. +1 −1 vm/capi/class.cpp
  43. +1 −1 vm/capi/data.cpp
  44. +3 −3 vm/capi/encoding.cpp
  45. +1 −1 vm/capi/exception.cpp
  46. +1 −1 vm/capi/float.cpp
  47. +1 −1 vm/capi/gc.cpp
  48. +1 −1 vm/capi/globals.cpp
  49. +1 −1 vm/capi/handle.cpp
  50. +1 −1 vm/capi/hash.cpp
  51. +0 −1 vm/capi/include/ruby/st.h
  52. +1 −1 vm/capi/io.cpp
  53. +1 −1 vm/capi/kernel.cpp
  54. +1 −1 vm/capi/marshal.cpp
  55. +1 −1 vm/capi/module.cpp
  56. +1 −1 vm/capi/numeric.cpp
  57. +1 −1 vm/capi/object.cpp
  58. +1 −1 vm/capi/proc.cpp
  59. +1 −1 vm/capi/range.cpp
  60. +1 −1 vm/capi/regexp.cpp
  61. +1 −14 vm/capi/string.cpp
  62. +33 −0 vm/capi/string19.cpp
  63. +1 −1 vm/capi/struct.cpp
  64. +1 −1 vm/capi/symbol.cpp
  65. +1 −1 vm/capi/thread.cpp
  66. +1 −1 vm/capi/time.cpp
  67. +1 −1 vm/capi/util.cpp
  68. +3 −1 vm/ontology.cpp
  69. +1 −1 vm/test/capi/test_constants.hpp
  70. +1 −1 vm/test/capi/test_handles.hpp
View
@@ -33,7 +33,7 @@ end
require config_rb
BUILD_CONFIG = Rubinius::BUILD_CONFIG
-unless BUILD_CONFIG[:config_version] == 130
+unless BUILD_CONFIG[:config_version] == 131
STDERR.puts "Your configuration is outdated, please run ./configure first"
exit 1
end
View
@@ -5,6 +5,6 @@ BASE_DIR=$(dirname $BIN_DIR)
export RBX_RUNTIME="$BASE_DIR/runtime"
export RBX_LIB="$BASE_DIR/lib"
-export RBX_CAPI_DIR="$BASE_DIR/vm/capi/include"
+export RBX_CAPI_DIR="$BASE_DIR/vm/capi/18/include"
exec $BIN_DIR/../vm/vm "$*"
View
@@ -86,7 +86,9 @@ class Configure
# File system paths
@bindir = root + "/bin"
- @includedir = root + "/vm/capi/include"
+ @include18dir = root + "/vm/capi/18/include"
+ @include19dir = root + "/vm/capi/19/include"
+ @include20dir = root + "/vm/capi/19/include"
@libdir = root
@runtime = @libdir + "/runtime"
@lib_path = @libdir + "/lib"
@@ -107,7 +109,7 @@ class Configure
@libversion = "2.0"
@version = "#{@libversion}.0dev"
@release_date = "yyyy-mm-dd"
- @config_version = 130
+ @config_version = 131
# TODO: add conditionals for platforms
if RbConfig::CONFIG["build_os"] =~ /darwin/
@@ -244,7 +246,9 @@ class Configure
end
@bindir = dir + "/bin"
- @includedir = dir + "/include"
+ @include18dir = dir + "/18/include"
+ @include19dir = dir + "/19/include"
+ @include20dir = dir + "/19/include"
@libdir = dir
@runtime = @libdir + "/runtime"
@lib_path = @libdir + "/lib"
@@ -263,7 +267,10 @@ class Configure
o.on "-I", "--includedir", "PATH", "Install Rubinius C-API include files in PATH" do |dir|
@install = true
- @includedir = expand dir
+ path = expand dir
+ @include18dir = path + "/18"
+ @include19dir = path + "/19"
+ @include20dir = path + "/20"
end
o.on "-L", "--libdir", "PATH", "Install Ruby library in PATH" do |dir|
@@ -939,7 +946,9 @@ module Rubinius
:runtime => "#{@runtime}",
:lib_path => "#{@lib_path}",
:ext_path => "#{@ext_path}",
- :includedir => "#{@includedir}",
+ :include18dir => "#{@include18dir}",
+ :include19dir => "#{@include19dir}",
+ :include20dir => "#{@include20dir}",
:mandir => "#{@mandir}",
:gemsdir => "#{@gemsdir}",
:sitedir => "#{@sitedir}",
@@ -976,7 +985,9 @@ end
#define RBX_RUNTIME "#{@runtime}"
#define RBX_LIB_PATH "#{@lib_path}"
#define RBX_EXT_PATH "#{@ext_path}"
-#define RBX_HDR_PATH "#{@includedir}"
+#define RBX_HDR18_PATH "#{@include18dir}"
+#define RBX_HDR19_PATH "#{@include19dir}"
+#define RBX_HDR20_PATH "#{@include20dir}"
#define RBX_SITE_PATH "#{@sitedir}"
#define RBX_VENDOR_PATH "#{@vendordir}"
#define RBX_VERSION "#{@version}"
@@ -1021,7 +1032,9 @@ end
#define RBX_RUNTIME "#{@runtime}"
#define RBX_LIB_PATH "#{@lib_path}"
#define RBX_EXT_PATH "#{@ext_path}"
-#define RBX_HDR_PATH "#{@includedir}"
+#define RBX_HDR18_PATH "#{@include18dir}"
+#define RBX_HDR19_PATH "#{@include19dir}"
+#define RBX_HDR20_PATH "#{@include20dir}"
#define RBX_SITE_PATH "#{@sitedir}"
#define RBX_VENDOR_PATH "#{@vendordir}"
#define RBX_VERSION "#{@version}"
View
@@ -131,7 +131,7 @@ def map_dir(dir, map = nil)
end
# ---------------------- Changed for Rubinius --------------------------------
-$topdir = ENV['RBX_CAPI_DIR'] || Rubinius::HDR_PATH
+$topdir = ENV['RBX_CAPI_DIR'] || RbConfig::CONFIG["rubyhdrdir"]
$top_srcdir = $topdir
$hdrdir = $topdir
View
@@ -41,7 +41,16 @@ module RbConfig
CONFIG["TEENY"] = teeny
CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
CONFIG["RUBY_SO_NAME"] = "rubinius-#{Rubinius::VERSION}"
- CONFIG["rubyhdrdir"] = "#{Rubinius::HDR_PATH}"
+
+ case
+ when Rubinius.ruby18?
+ CONFIG["rubyhdrdir"] = "#{Rubinius::HDR18_PATH}"
+ when Rubinius.ruby19?
+ CONFIG["rubyhdrdir"] = "#{Rubinius::HDR19_PATH}"
+ when Rubinius.ruby20?
+ CONFIG["rubyhdrdir"] = "#{Rubinius::HDR20_PATH}"
+ end
+
CONFIG["LIBS"] = ""
sitedir = Rubinius::SITE_PATH
View
@@ -115,10 +115,19 @@ def add_mri_capi
end
end
+def include18_dir
+ File.expand_path("../../vm/capi/18/include", __FILE__)
+end
+
+def include19_dir
+ File.expand_path("../../vm/capi/18/include", __FILE__)
+end
+
def add_rbx_capi
add_cflag "-ggdb3 -O2"
add_cxxflag "-ggdb3 -O2"
- add_include_dir File.expand_path("../../vm/capi/include", __FILE__)
+ add_include_dir include18_dir
+ add_include_dir include19_dir
end
# Setup some initial computed values
@@ -194,7 +203,8 @@ def init
#
def common_headers(*extra)
@common_headers ||= FileList[
- File.expand_path("../../vm/capi/include/*.h", __FILE__),
+ include18_dir + "/*.h",
+ include19_dir + "/*.h",
*extra
].existing
end
@@ -217,7 +227,7 @@ def dependency_file
def graph_dependencies(sources, directories=[])
directories = Array(directories)
- directories.concat [".", File.expand_path("../../vm/capi/include", __FILE__)]
+ directories.concat [".", include18_dir, include19_dir]
grapher = DependencyGrapher.new sources, directories
grapher.process
View
@@ -17,9 +17,11 @@ namespace :extensions do
desc "Clean all lib/ext files"
task :clean do
clean_extension("**")
+ rm_f FileList["lib/tooling/**/*.{o,#{$dlext}}"], :verbose => $verbose
# TODO: implement per extension cleaning. This hack is for
# openssl and dl, which use extconf.rb and create Makefile.
rm_f FileList["lib/ext/**/Makefile"], :verbose => $verbose
+ rm_f FileList["lib/tooling/**/Makefile"], :verbose => $verbose
rm_f FileList["lib/ext/dl/*.func"], :verbose => $verbose
end
end
@@ -43,11 +45,10 @@ def build_extconf(name, opts)
ENV["BUILD_RUBY"] = BUILD_CONFIG[:build_ruby]
unless File.directory? BUILD_CONFIG[:runtime]
- ENV["CFLAGS"] = "-Ivm/capi/include"
+ ENV["CFLAGS"] = "-I#{include18_dir} -I#{include19_dir}"
end
unless opts[:deps] and opts[:deps].all? { |n| File.exists? n }
- # unless File.exists?("Makefile") and File.exists?("extconf.h")
sh("#{rbx_build} extconf.rb #{redirect}", &fail_block)
end
@@ -72,14 +72,17 @@ def it_has_entries(name, entries)
ruby_version_is "1.8"..."1.9" do
it_has_entries 'RbConfig::CONFIG', "ruby_version" => "1.8"
+ it_has_entries 'RbConfig::CONFIG', "rubyhdrdir" => Rubinius::HDR18_PATH
end
ruby_version_is "1.9"..."2.0" do
it_has_entries 'RbConfig::CONFIG', "ruby_version" => "1.9"
+ it_has_entries 'RbConfig::CONFIG', "rubyhdrdir" => Rubinius::HDR19_PATH
end
ruby_version_is "2.0" do
it_has_entries 'RbConfig::CONFIG', "ruby_version" => "2.0"
+ it_has_entries 'RbConfig::CONFIG', "rubyhdrdir" => Rubinius::HDR19_PATH
end
end
@@ -113,18 +116,17 @@ def it_has_entries(name, entries)
"archdir" => "#{sitelibdir}/#{arch}",
"sitearchdir" => "#{sitelibdir}/#{arch}",
"sitedir" => "#{sitedir}",
- "rubyhdrdir" => "#{Rubinius::HDR_PATH}"
}
it_has_entries 'RbConfig::MAKEFILE_CONFIG', entries
end
-describe "RbConfig#ruby" do
-
+describe "RbConfig#ruby" do
+
RbConfig.respond_to?(:ruby).should eql(true)
rb_path = RbConfig.ruby
- rb_path.should be_kind_of(String)
+ rb_path.should be_kind_of(String)
# needs to be an executable
File.executable?(rb_path).should eql(true)
@@ -0,0 +1,20 @@
+/* Stub file provided for C extensions that expect it. All regular
+ * defines and prototypes are in ruby.h
+ */
+
+#define RUBY 1
+#define RUBINIUS 1
+
+#define HAVE_STDARG_PROTOTYPES 1
+
+/* These are defines directly related to MRI C-API symbols that the
+ * mkmf.rb discovery code (e.g. have_func("rb_str_set_len")) would
+ * attempt to find by linking against libruby. Rubinius does not
+ * have an appropriate lib to link against, so we are adding these
+ * explicit defines for now.
+ */
+#define HAVE_RB_STR_SET_LEN 1
+#define HAVE_RB_DEFINE_ALLOC_FUNC 1
+
+#define HAVE_RB_HASH_FOREACH 1
+#define HAVE_RB_HASH_ASET 1
View
View
File renamed without changes.
View
@@ -1,6 +1,13 @@
#ifndef RBX_CAPI_VERSION_H
#define RBX_CAPI_VERSION_H
+/* The origin. (copied from MRI 1.9.2p180) */
+#define RUBY_AUTHOR "Yukihiro Matsumoto"
+#define RUBY_BIRTH_YEAR 1993
+#define RUBY_BIRTH_MONTH 2
+#define RUBY_BIRTH_DAY 24
+/* end copy */
+
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 7
File renamed without changes.
View
View
Oops, something went wrong.

0 comments on commit 33c8f28

Please sign in to comment.