lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lo...@apache.org
Subject [lucy-commits] [7/8] git commit: refs/heads/master - Created Rakefile.common
Date Sun, 10 Feb 2013 07:54:06 GMT
Created Rakefile.common

* Includes shared routines that have build various dependencies
for clownfish


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

Branch: refs/heads/master
Commit: a41d80567553afea7cc62701a44078ba9ee5c68e
Parents: 881024e
Author: Logan Bell <loganbell@gmail.com>
Authored: Sat Feb 9 23:47:13 2013 -0800
Committer: Logan Bell <loganbell@gmail.com>
Committed: Sat Feb 9 23:47:13 2013 -0800

----------------------------------------------------------------------
 clownfish/compiler/src/CFCRuby.c       |   24 ++---
 clownfish/runtime/ruby/Rakefile        |  111 ++--------------------
 clownfish/runtime/ruby/Rakefile.common |  140 +++++++++++++++++++++++++++
 3 files changed, 158 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a41d8056/clownfish/compiler/src/CFCRuby.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCRuby.c b/clownfish/compiler/src/CFCRuby.c
index 89d111c..1f29e1a 100644
--- a/clownfish/compiler/src/CFCRuby.c
+++ b/clownfish/compiler/src/CFCRuby.c
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
+#include "charmony.h"
+
 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -78,20 +80,14 @@ CFCRuby_init(CFCRuby *self, CFCParcel *parcel, CFCHierarchy *hierarchy,
     const char *prefix   = CFCParcel_get_prefix(parcel);
     const char *inc_dest = CFCHierarchy_get_include_dest(hierarchy);
     const char *src_dest = CFCHierarchy_get_source_dest(hierarchy);
-    self->boot_h_file = CFCUtil_cat(CFCUtil_strdup(""), prefix, "boot.h",
-                                    NULL);
-    self->boot_c_file = CFCUtil_cat(CFCUtil_strdup(""), prefix, "boot.c",
-                                    NULL);
-    self->boot_h_path = CFCUtil_cat(CFCUtil_strdup(""), inc_dest,
-                                    CFCUTIL_PATH_SEP, self->boot_h_file,
-                                    NULL);
-    self->boot_c_path = CFCUtil_cat(CFCUtil_strdup(""), src_dest,
-                                    CFCUTIL_PATH_SEP, self->boot_c_file,
-                                    NULL);
-
-    self->boot_func
-        = CFCUtil_cat(CFCUtil_strdup(""), CFCParcel_get_prefix(parcel),
-                      boot_class, "_bootstrap", NULL);
+    self->boot_h_file = CFCUtil_sprintf("%sboot.h", prefix);
+    self->boot_c_file = CFCUtil_sprintf("%sboot.c", prefix);
+    self->boot_h_path = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", inc_dest,
+                                        self->boot_h_file);
+    self->boot_c_path = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", src_dest,
+                                        self->boot_c_file);
+    self->boot_func = CFCUtil_sprintf("%s%s_bootstrap", prefix, boot_class);
+
     for (int i = 0; self->boot_func[i] != 0; i++) {
         if (!isalnum(self->boot_func[i])) {
             self->boot_func[i] = '_';

http://git-wip-us.apache.org/repos/asf/lucy/blob/a41d8056/clownfish/runtime/ruby/Rakefile
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/Rakefile b/clownfish/runtime/ruby/Rakefile
index 2236733..712a60c 100644
--- a/clownfish/runtime/ruby/Rakefile
+++ b/clownfish/runtime/ruby/Rakefile
@@ -13,28 +13,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-require 'rbconfig'
 require 'rake/clean' 
 require 'rake/extensiontask'
-
-def rbconfig
-  RbConfig::CONFIG
-end
+import '../../runtime/ruby/Rakefile.common'
 
 def exe_path(*args)
   File.join(args).ext(RbConfig::CONFIG["EXEEXT"])
 end
 
-BASE_PATH = '..'
-CHARMONIZER_ORIG_DIR = File.absolute_path( File.join( BASE_PATH, '..', '..', 'charmonizer'
) )
-COMMON_SOURCE_DIR    = File.join(BASE_PATH, "common")
+BASE_PATH            = '..'
+CFC_BUILD            = File.join( CFC_DIR, 'Build' );
+CFC_DIR              = File.join( BASE_PATH, '..', 'compiler', 'ruby' );
 CHARMONIZER_C        = File.join(COMMON_SOURCE_DIR, 'charmonizer.c')
 CHARMONIZER_EXE_PATH = File.absolute_path(exe_path('charmonizer'))
+CHARMONIZER_ORIG_DIR = File.absolute_path( File.join( BASE_PATH, '..', '..', 'charmonizer'
) )
 CHARMONY_H_PATH      = 'charmony.h'
 CHARMONY_RB_PATH     = 'Charmony.rb'
+COMMON_SOURCE_DIR    = File.join(BASE_PATH, "common")
 CORE_SOURCE_DIR      = File.absolute_path( BASE_PATH, 'core' );
-CFC_DIR              = File.join( BASE_PATH, '..', 'compiler', 'ruby' );
-CFC_BUILD            = File.join( CFC_DIR, 'Build' );
 LIB_DIR              = 'lib';
 
 Rake::ExtensionTask.new do |ext|
@@ -99,7 +95,7 @@ task :build_charmonizer_tests => [:charmony] do
     '-I' + Dir.pwd
   ].join(" ").gsub(/"/,'\"')
 
-  run_make( :dir => CHARMONIZER_ORIG_DIR, :args => [ "DEFS=#{flags}", "tests"])
+  run_make( CHARMONIZER_ORIG_DIR, [ "DEFS=#{flags}", "tests"])
 end
 
 desc "Build and run charmonizer, creating charmony.h and charmony.rb"
@@ -139,6 +135,7 @@ task :charmony do
     raise "Failed to run #{CHARMONIZER_EXE_PATH}: " + $?
   end
 end
+
 CLEAN.include(CHARMONIZER_EXE_PATH)
 CLEAN.include(CHARMONY_H_PATH)
 CLEAN.include(CHARMONY_RB_PATH)
@@ -146,95 +143,3 @@ CLEAN.include(CHARMONY_RB_PATH)
 CLEAN.include("_charm*")
 
 task :default => [:build_clownfish]
-
-def cc_command
-  rbconfig["CC"]
-end
-
-def run_make(params = {})
-  command     = params[:args]
-  dir         = params[:dir]
-  current_dir = Dir.pwd
-  chdir(dir) if dir
-  command.unshift("CC=#{cc_command}")
-  if RUBY_PLATFORM =~ /(mswin|mingw)/i
-    if cc_command =~ /^cl\b/ 
-      command.unshift("-f", "Makefile.MSVC")
-    else
-      command.unshift("-f", "Makefile.MinGW")
-    end
-  end
-  command.unshift(make_command)
-  puts command.join(" ")
-  success = system(*command)
-  if !success
-    raise "Make failed"
-  end
-  chdir(current_dir) if dir
-end
-
-def make_command
-  command = rbconfig["make-prog"]
-  if !command
-    if RUBY_PLATFORM =~ /mswin/i
-      if cc_command =~ /^cl\b/
-        command = "nmake"
-      end
-    end
-  end
-  if !command
-    command = 'make'
-  end
-  return command
-end
-
-def all_ccflags
-  ccflags = '-DCFCRUBY '
-  
-  if defined?(rbconfig["CFLAGS"])
-    ccflags += rbconfig['CFLAGS'] + ' '
-  end
-
-  if ENV.has_key?('CFLAGS')
-    ccflags += ENV['CFLAGS']
-  end
-  
-  if ENV.has_key?('LUCY_VALGRIND')
-    ccflags += "-fno-inline-functions "
-  end
-  
-  # Compile as C++ under MSVC.  Turn off stupid warnings, too.
-  if cc_command =~ /^cl\b/ 
-    ccflags += '/TP -D_CRT_SECURE_NO_WARNINGS '
-  end
-  
-  # Blindly include GCC-specific flags even though we don't know that the
-  # compiler is GCC.
-  if ccflags !~ /-std=/
-    ccflags += "-std=gnu99 "
-  end
-  if ccflags !~ /-D_GNU_SOURCE/ 
-    ccflags += "-D_GNU_SOURCE "
-  end
-  
-  return ccflags
-end
-
-def quotify(string)
-  return '"' + string.gsub(/([\\\"])/,'\\\\\\1') + '"'
-end
-
-def autogen_header
-  "
-/***********************************************
-
- !!!! DO NOT EDIT !!!!
-
- This file was auto-generated by Rakefile.
-
- ***********************************************/
- "
-
-end
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/a41d8056/clownfish/runtime/ruby/Rakefile.common
----------------------------------------------------------------------
diff --git a/clownfish/runtime/ruby/Rakefile.common b/clownfish/runtime/ruby/Rakefile.common
new file mode 100644
index 0000000..28051eb
--- /dev/null
+++ b/clownfish/runtime/ruby/Rakefile.common
@@ -0,0 +1,140 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require 'rbconfig'
+
+def rbconfig
+  RbConfig::CONFIG
+end
+
+def all_ccflags
+  ccflags = '-DCFCRUBY '
+  
+  if defined?(rbconfig["CFLAGS"])
+    ccflags += rbconfig['CFLAGS'] + ' '
+  end
+
+  if ENV.has_key?('CFLAGS')
+    ccflags += ENV['CFLAGS']
+  end
+  
+  if ENV.has_key?('LUCY_VALGRIND')
+    ccflags += "-fno-inline-functions "
+  end
+  
+  # Compile as C++ under MSVC.  Turn off stupid warnings, too.
+  if cc_command =~ /^cl\b/ 
+    ccflags += '/TP -D_CRT_SECURE_NO_WARNINGS '
+  end
+  
+  # Blindly include GCC-specific flags even though we don't know that the
+  # compiler is GCC.
+  if ccflags !~ /-std=/
+    ccflags += "-std=gnu99 "
+  end
+  if ccflags !~ /-D_GNU_SOURCE/ 
+    ccflags += "-D_GNU_SOURCE "
+  end
+  
+  return ccflags
+end
+
+def cc_command
+  rbconfig["CC"]
+end
+
+def extra_ccflags 
+  ccflags = '-DCFCRUBY '
+  
+  if defined?(rbconfig["CFLAGS"])
+    ccflags += rbconfig['CFLAGS'] + ' '
+  end
+  
+  if ENV.has_key?('CFLAGS')
+    ccflags += ENV['CFLAGS']
+  end
+  
+  if ENV.has_key?('LUCY_VALGRIND')
+    ccflags += "-fno-inline-functions "
+  end
+  
+  # Compile as C++ under MSVC.  Turn off stupid warnings, too.
+  if cc_command =~ /^cl\b/ 
+    ccflags += '/TP -D_CRT_SECURE_NO_WARNINGS '
+  end
+  
+  # Blindly include GCC-specific flags even though we don't know that the
+  # compiler is GCC.
+  if ccflags !~ /-std=/
+    ccflags += "-std=gnu99 "
+  end
+  if ccflags !~ /-D_GNU_SOURCE/ 
+    ccflags += "-D_GNU_SOURCE "
+  end
+  
+  return ccflags
+end
+
+def make_command
+  command = rbconfig["make-prog"]
+  if !command
+    if RUBY_PLATFORM =~ /mswin/i
+      if cc_command =~ /^cl\b/
+        command = "nmake"
+      end
+    end
+  end
+  if !command
+    command = 'make'
+  end
+  return command
+end
+
+def run_make(dir, params)
+  current_dir = Dir.pwd
+  chdir(dir) if dir
+  command = params.clone
+  command.unshift("CC=#{cc_command}")
+  if RUBY_PLATFORM =~ /(mswin|mingw)/i
+    if cc_command =~ /^cl\b/ 
+      command.unshift("-f", "Makefile.MSVC")
+    else
+      command.unshift("-f", "Makefile.MinGW")
+    end
+  end
+  command.unshift(make_command)
+  success = system(*command)
+  if !success
+    raise "Make failed"
+  end
+  chdir(current_dir) if dir
+end
+
+def quotify(string)
+  return '"' + string.gsub(/([\\\"])/,'\\\\\\1') + '"'
+end
+
+def autogen_header
+  "
+/***********************************************
+
+ !!!! DO NOT EDIT !!!!
+
+ This file was auto-generated by Rakefile.
+
+ ***********************************************/
+ "
+
+end


Mime
View raw message