Changeset 331 for EcnlProtoTool/trunk/mruby-1.3.0/tasks/mrbgem_spec.rake
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-1.3.0
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-1.3.0/tasks/mrbgem_spec.rake
r321 r331 2 2 require 'forwardable' 3 3 require 'tsort' 4 require 'shellwords' 4 5 5 6 module MRuby … … 18 19 alias mruby build 19 20 attr_accessor :build_config_initializer 21 attr_accessor :mrblib_dir, :objs_dir 20 22 21 23 attr_accessor :version … … 45 47 @initializer = block 46 48 @version = "0.0.0" 49 @mrblib_dir = "mrblib" 50 @objs_dir = "src" 47 51 MRuby::Gem.current = self 48 52 end … … 55 59 @linker = LinkerConfig.new([], [], [], [], []) 56 60 57 @rbfiles = Dir.glob("#{ dir}/mrblib/**/*.rb").sort58 @objs = Dir.glob("#{ dir}/src/*.{c,cpp,cxx,cc,m,asm,s,S}").map do |f|61 @rbfiles = Dir.glob("#{@dir}/#{@mrblib_dir}/**/*.rb").sort 62 @objs = Dir.glob("#{@dir}/#{@objs_dir}/*.{c,cpp,cxx,cc,m,asm,s,S}").map do |f| 59 63 objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X")) 60 64 end … … 87 91 88 92 instance_eval(&@build_config_initializer) if @build_config_initializer 89 93 end 94 95 def setup_compilers 90 96 compilers.each do |compiler| 91 97 compiler.define_rules build_dir, "#{dir}" … … 122 128 def test_rbireps 123 129 "#{build_dir}/gem_test.c" 130 end 131 132 def search_package(name, version_query=nil) 133 package_query = name 134 package_query += " #{version_query}" if version_query 135 _pp "PKG-CONFIG", package_query 136 escaped_package_query = Shellwords.escape(package_query) 137 if system("pkg-config --exists #{escaped_package_query}") 138 cc.flags += [`pkg-config --cflags #{escaped_package_query}`.strip] 139 cxx.flags += [`pkg-config --cflags #{escaped_package_query}`.strip] 140 linker.flags_before_libraries += [`pkg-config --libs #{escaped_package_query}`.strip] 141 true 142 else 143 false 144 end 124 145 end 125 146 … … 182 203 print_gem_comment(f) 183 204 f.puts %Q[#include <stdlib.h>] unless rbfiles.empty? 184 f.puts %Q[#include "mruby.h"]185 f.puts %Q[#include "mruby/irep.h"] unless rbfiles.empty?205 f.puts %Q[#include <mruby.h>] 206 f.puts %Q[#include <mruby/irep.h>] unless rbfiles.empty? 186 207 end 187 208 … … 190 211 f.puts %Q[#include <stdio.h>] 191 212 f.puts %Q[#include <stdlib.h>] 192 f.puts %Q[#include "mruby.h"]193 f.puts %Q[#include "mruby/irep.h"]194 f.puts %Q[#include "mruby/variable.h"]195 f.puts %Q[#include "mruby/hash.h"] unless test_args.empty?213 f.puts %Q[#include <mruby.h>] 214 f.puts %Q[#include <mruby/irep.h>] 215 f.puts %Q[#include <mruby/variable.h>] 216 f.puts %Q[#include <mruby/hash.h>] unless test_args.empty? 196 217 end 197 218 … … 401 422 @ary = tsort_dependencies gem_table.keys, gem_table, true 402 423 424 each(&:setup_compilers) 425 403 426 each do |g| 404 427 import_include_paths(g) … … 414 437 import_include_paths(dep_g) 415 438 439 dep_g.export_include_paths.uniq! 416 440 g.compilers.each do |compiler| 417 441 compiler.include_paths += dep_g.export_include_paths 418 442 g.export_include_paths += dep_g.export_include_paths 443 compiler.include_paths.uniq! 444 g.export_include_paths.uniq! 419 445 end 420 446 end
Note:
See TracChangeset
for help on using the changeset viewer.