You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/25 14:08:02 UTC

git commit: Misc fixes to Ruby build

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master e57c502a8 -> 157cad1bf


Misc fixes to Ruby build


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/157cad1b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/157cad1b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/157cad1b

Branch: refs/heads/master
Commit: 157cad1bf72ca44c8dee62f1f2a2d37d32eea00e
Parents: e57c502
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Jul 25 13:58:34 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Jul 25 13:58:34 2014 +0200

----------------------------------------------------------------------
 compiler/ruby/.gitignore               |  5 +++++
 compiler/ruby/Rakefile                 | 28 +++++-----------------------
 compiler/ruby/ext/Clownfish/CFC.c      |  2 +-
 compiler/ruby/ext/Clownfish/extconf.rb |  3 ++-
 runtime/ruby/.gitignore                |  6 ++++++
 runtime/ruby/Rakefile                  | 23 +++--------------------
 runtime/ruby/Rakefile.common           |  8 ++++++++
 runtime/ruby/ext/Clownfish.c           |  1 -
 8 files changed, 30 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/compiler/ruby/.gitignore
----------------------------------------------------------------------
diff --git a/compiler/ruby/.gitignore b/compiler/ruby/.gitignore
new file mode 100644
index 0000000..d5527e5
--- /dev/null
+++ b/compiler/ruby/.gitignore
@@ -0,0 +1,5 @@
+/Charmony.rb
+/charmonizer
+/charmony.h
+/ext/Clownfish/CFC.bundle
+/ext/Clownfish/Makefile

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/compiler/ruby/Rakefile
----------------------------------------------------------------------
diff --git a/compiler/ruby/Rakefile b/compiler/ruby/Rakefile
index 0811396..82771b8 100644
--- a/compiler/ruby/Rakefile
+++ b/compiler/ruby/Rakefile
@@ -35,18 +35,17 @@ CLOWNFISH_RUBY_DIR      = File.absolute_path('.')
 CLOWNFISH_INCLUDE_DIR   = File.join(CLOWNFISH_RUBY_DIR,'..','include')
 CLOWNFISH_RUNTIME       = File.join('..','..','runtime','ruby')
 CLOWNFISH_SRC_DIR       = File.join(CLOWNFISH_RUBY_DIR,'..','src')
-LEMON_SRC_DIR           = File.join('..','..','..','lemon')
+LEMON_SRC_DIR           = File.join('..','..','lemon')
 RUBY_EXT_CFC            = File.join('.','ext','Clownfish')
 
-
 desc "Build lemon"
-task :build_lemon => [:build_charmonizer_tests] do
+task :build_lemon do
   puts "Building lemon"
   run_make(LEMON_SRC_DIR,[])
 end
 
 desc "Build Clownfish"
-task :clownfish => [:parse_y_files] do
+task :clownfish => [:charmony, :parse_y_files] do
   Dir.glob(File.join(CLOWNFISH_SRC_DIR, '**', '*.c')).each do|c_file|
     obj_file = c_file.ext(rbconfig['OBJEXT'])
     next if uptodate?(obj_file, [c_file])
@@ -110,23 +109,6 @@ task :parse_y_files => [:build_lemon] do
   puts "Done."
 end
 
-desc "Building Charmonizer Tests"
-task :build_charmonizer_tests => [:charmony] do
-  puts "Building Charmonizer Tests"
-  flags = [
-    '-fno-common',
-    '-DFCRUBY',
-    '-fno-strict-aliasing',
-    '-pipe',
-    '-fstack-protector',
-    '-std=gnu99',
-    '-D_GNU_SOURCE',
-    '-I' + Dir.pwd
-  ].join(" ").gsub(/"/,'\"')
-
-  run_make( CHARMONIZER_ORIG_DIR, [ "DEFS=#{flags}", "tests"])
-end
-
 desc "Build and run charmonizer, creating charmony.h and charmony.rb"
 task :charmony do
   # Compile charmonizer executable.
@@ -148,7 +130,7 @@ task :charmony do
   # Prepare arguments to charmonizer.
   command = [
     CHARMONIZER_EXE_PATH,
-    '--cc=' + quotify(cc_command),
+    '--cc=' + cc_command,
     '--enable-c',
     '--enable-ruby',
     '--',
@@ -161,7 +143,7 @@ task :charmony do
   # Run charmonizer.
   puts command.join(" ")
   if !system(*command)
-    raise "Failed to run #{CHARMONIZER_EXE_PATH}: " + $?
+    raise "Failed to run #{CHARMONIZER_EXE_PATH}: " + $?.to_s
   end
 end
 CLEAN.include(CHARMONIZER_EXE_PATH)

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/compiler/ruby/ext/Clownfish/CFC.c
----------------------------------------------------------------------
diff --git a/compiler/ruby/ext/Clownfish/CFC.c b/compiler/ruby/ext/Clownfish/CFC.c
index 4910ebf..3ade99e 100644
--- a/compiler/ruby/ext/Clownfish/CFC.c
+++ b/compiler/ruby/ext/Clownfish/CFC.c
@@ -88,7 +88,7 @@ S_CFC_Binding_Ruby_Init(VALUE self_rb, VALUE params) {
     VALUE header     = rb_hash_aref(params, ID2SYM(rb_intern("header"))); 
     VALUE footer     = rb_hash_aref(params, ID2SYM(rb_intern("footer"))); 
 
-    parcel_obj = CFCParcel_new(StringValuePtr(parcel), NULL, NULL);
+    parcel_obj = CFCParcel_new(StringValuePtr(parcel), NULL, NULL, 0);
     Data_Get_Struct(hierarchy, CFCHierarchy, hierarchy_obj);
     Data_Get_Struct(self_rb, CFCRuby, self);
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/compiler/ruby/ext/Clownfish/extconf.rb
----------------------------------------------------------------------
diff --git a/compiler/ruby/ext/Clownfish/extconf.rb b/compiler/ruby/ext/Clownfish/extconf.rb
index e644bcb..3a751fa 100644
--- a/compiler/ruby/ext/Clownfish/extconf.rb
+++ b/compiler/ruby/ext/Clownfish/extconf.rb
@@ -16,10 +16,11 @@
 require 'mkmf'
 require 'rbconfig'
 
+CLOWNFISH_RUBY_DIR      = File.join('..','..')
 CLOWNFISH_INCLUDE_DIR   = File.join('..','..','..','include')
 CLOWNFISH_SRC_DIR       = File.join('..','..','..','src')
 CLOWNFISH_RUNTIME       = File.join('..','..','..','..','runtime','ruby')
-$CFLAGS = "-I#{CLOWNFISH_INCLUDE_DIR} -I#{CLOWNFISH_SRC_DIR} -I#{CLOWNFISH_RUNTIME}"
+$CFLAGS = "-I#{CLOWNFISH_RUBY_DIR} -I#{CLOWNFISH_INCLUDE_DIR} -I#{CLOWNFISH_SRC_DIR} -I#{CLOWNFISH_RUNTIME}"
 $objs = ['CFC.' + RbConfig::CONFIG['OBJEXT']]
 obj_glob = File.join(CLOWNFISH_SRC_DIR, '*.' + RbConfig::CONFIG['OBJEXT'])
 Dir.glob(obj_glob).each do|o|

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/runtime/ruby/.gitignore
----------------------------------------------------------------------
diff --git a/runtime/ruby/.gitignore b/runtime/ruby/.gitignore
new file mode 100644
index 0000000..17ff39b
--- /dev/null
+++ b/runtime/ruby/.gitignore
@@ -0,0 +1,6 @@
+/Charmony.rb
+/autogen/
+/charmonizer
+/charmony.h
+/lib/Bind.bundle
+/tmp/

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/runtime/ruby/Rakefile
----------------------------------------------------------------------
diff --git a/runtime/ruby/Rakefile b/runtime/ruby/Rakefile
index f9a821a..b82e733 100644
--- a/runtime/ruby/Rakefile
+++ b/runtime/ruby/Rakefile
@@ -43,7 +43,7 @@ Rake::ExtensionTask.new do |ext|
 end
 
 desc "Build Clownfish"
-task :build_clownfish => [:build_charmonizer_tests] do
+task :build_clownfish => [:charmony] do
   puts "Building Clownfish"
   old_dir = Dir.pwd
   chdir(CFC_DIR);
@@ -84,23 +84,6 @@ task :build_clownfish => [:build_charmonizer_tests] do
 
 end
 
-desc "Building Charmonizer Tests"
-task :build_charmonizer_tests => [:charmony] do
-  puts "Building Charmonizer Tests"
-  flags = [
-    '-fno-common',
-    '-DFCRUBY',
-    '-fno-strict-aliasing',
-    '-pipe',
-    '-fstack-protector',
-    '-std=gnu99',
-    '-D_GNU_SOURCE',
-    '-I' + Dir.pwd
-  ].join(" ").gsub(/"/,'\"')
-
-  run_make( CHARMONIZER_ORIG_DIR, [ "DEFS=#{flags}", "tests"])
-end
-
 desc "Build and run charmonizer, creating charmony.h and charmony.rb"
 task :charmony do
   # Compile charmonizer executable.
@@ -122,7 +105,7 @@ task :charmony do
   # Prepare arguments to charmonizer.
   command = [
     CHARMONIZER_EXE_PATH,
-    '--cc=' + quotify(cc_command),
+    '--cc=' + cc_command,
     '--enable-c',
     '--enable-ruby',
     '--',
@@ -135,7 +118,7 @@ task :charmony do
   # Run charmonizer.
   puts command.join(" ")
   if !system(*command)
-    raise "Failed to run #{CHARMONIZER_EXE_PATH}: " + $?
+    raise "Failed to run #{CHARMONIZER_EXE_PATH}: " + $?.to_s
   end
 end
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/runtime/ruby/Rakefile.common
----------------------------------------------------------------------
diff --git a/runtime/ruby/Rakefile.common b/runtime/ruby/Rakefile.common
index 28051eb..cca6c09 100644
--- a/runtime/ruby/Rakefile.common
+++ b/runtime/ruby/Rakefile.common
@@ -22,6 +22,10 @@ end
 def all_ccflags
   ccflags = '-DCFCRUBY '
   
+  if defined?(rbconfig["ARCH_FLAG"])
+    ccflags += rbconfig['ARCH_FLAG'] + ' '
+  end
+
   if defined?(rbconfig["CFLAGS"])
     ccflags += rbconfig['CFLAGS'] + ' '
   end
@@ -58,6 +62,10 @@ end
 def extra_ccflags 
   ccflags = '-DCFCRUBY '
   
+  if defined?(rbconfig["ARCH_FLAG"])
+    ccflags += rbconfig['ARCH_FLAG'] + ' '
+  end
+
   if defined?(rbconfig["CFLAGS"])
     ccflags += rbconfig['CFLAGS'] + ' '
   end

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/157cad1b/runtime/ruby/ext/Clownfish.c
----------------------------------------------------------------------
diff --git a/runtime/ruby/ext/Clownfish.c b/runtime/ruby/ext/Clownfish.c
index 72a703b..972d2db 100644
--- a/runtime/ruby/ext/Clownfish.c
+++ b/runtime/ruby/ext/Clownfish.c
@@ -16,7 +16,6 @@
 
 #include "ruby.h"
 
-#include "Clownfish/Host.h"
 #include "Clownfish/Util/Memory.h"
 #include "Clownfish/Util/StringHelper.h"
 #include "Clownfish/String.h"