Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/mruby-1.3.0
Files:
2 added
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/libmruby.rake

    r321 r331  
    66  file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libfile("#{build_dir}/lib/libmruby")] do |t|
    77    open(t.name, 'w') do |f|
    8       f.puts "MRUBY_CFLAGS = #{cc.all_flags.gsub('"', '\\"')}"
     8      f.puts "MRUBY_CFLAGS = #{cc.all_flags}"
    99
    1010      gem_flags = gems.map { |g| g.linker.flags }
    1111      gem_library_paths = gems.map { |g| g.linker.library_paths }
    12       f.puts "MRUBY_LDFLAGS = #{linker.all_flags(gem_library_paths, gem_flags).gsub('"', '\\"')} #{linker.option_library_path % "#{build_dir}/lib"}"
     12      f.puts "MRUBY_LDFLAGS = #{linker.all_flags(gem_library_paths, gem_flags)} #{linker.option_library_path % "#{build_dir}/lib"}"
    1313
    1414      gem_flags_before_libraries = gems.map { |g| g.linker.flags_before_libraries }
    15       f.puts "MRUBY_LDFLAGS_BEFORE_LIBS = #{[linker.flags_before_libraries, gem_flags_before_libraries].flatten.join(' ').gsub('"', '\\"')}"
     15      f.puts "MRUBY_LDFLAGS_BEFORE_LIBS = #{[linker.flags_before_libraries, gem_flags_before_libraries].flatten.join(' ')}"
    1616
    1717      gem_libraries = gems.map { |g| g.linker.libraries }
    18       f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries).gsub('"', '\\"')}"
     18      f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries)}"
     19
     20      f.puts "MRUBY_LIBMRUBY_PATH = #{libfile("#{build_dir}/lib/libmruby")}"
    1921    end
    2022  end
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/mrbgem_spec.rake

    r321 r331  
    22require 'forwardable'
    33require 'tsort'
     4require 'shellwords'
    45
    56module MRuby
     
    1819      alias mruby build
    1920      attr_accessor :build_config_initializer
     21      attr_accessor :mrblib_dir, :objs_dir
    2022
    2123      attr_accessor :version
     
    4547        @initializer = block
    4648        @version = "0.0.0"
     49        @mrblib_dir = "mrblib"
     50        @objs_dir = "src"
    4751        MRuby::Gem.current = self
    4852      end
     
    5559        @linker = LinkerConfig.new([], [], [], [], [])
    5660
    57         @rbfiles = Dir.glob("#{dir}/mrblib/**/*.rb").sort
    58         @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|
    5963          objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X"))
    6064        end
     
    8791
    8892        instance_eval(&@build_config_initializer) if @build_config_initializer
    89 
     93      end
     94
     95      def setup_compilers
    9096        compilers.each do |compiler|
    9197          compiler.define_rules build_dir, "#{dir}"
     
    122128      def test_rbireps
    123129        "#{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
    124145      end
    125146
     
    182203        print_gem_comment(f)
    183204        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?
    186207      end
    187208
     
    190211        f.puts %Q[#include <stdio.h>]
    191212        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?
    196217      end
    197218
     
    401422        @ary = tsort_dependencies gem_table.keys, gem_table, true
    402423
     424        each(&:setup_compilers)
     425
    403426        each do |g|
    404427          import_include_paths(g)
     
    414437          import_include_paths(dep_g)
    415438
     439          dep_g.export_include_paths.uniq!
    416440          g.compilers.each do |compiler|
    417441            compiler.include_paths += dep_g.export_include_paths
    418442            g.export_include_paths += dep_g.export_include_paths
     443            compiler.include_paths.uniq!
     444            g.export_include_paths.uniq!
    419445          end
    420446        end
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/mrbgems.rake

    r321 r331  
    3232        f.puts %Q[ */]
    3333        f.puts %Q[]
    34         f.puts %Q[#include "mruby.h"]
     34        f.puts %Q[#include <mruby.h>]
    3535        f.puts %Q[]
    3636        f.write gem_func_decls
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/mruby_build.rake

    r321 r331  
    8484        @gems, @libmruby = MRuby::Gem::List.new, []
    8585        @build_mrbtest_lib_only = false
     86        @cxx_exception_enabled = false
     87        @cxx_exception_disabled = false
    8688        @cxx_abi_enabled = false
    87         @cxx_exception_disabled = false
    8889        @enable_bintest = false
    8990        @enable_test = false
     
    111112
    112113    def disable_cxx_exception
     114      if @cxx_exception_enabled or @cxx_abi_enabled
     115        raise "cxx_exception already enabled"
     116      end
    113117      @cxx_exception_disabled = true
     118    end
     119
     120    def enable_cxx_exception
     121      return if @cxx_exception_enabled
     122      return if @cxx_abi_enabled
     123      if @cxx_exception_disabled
     124        raise "cxx_exception disabled"
     125      end
     126      @cxx_exception_enabled = true
     127      compilers.each { |c|
     128        c.defines += %w(MRB_ENABLE_CXX_EXCEPTION)
     129        c.flags << c.cxx_exception_flag
     130      }
     131      linker.command = cxx.command if toolchains.find { |v| v == 'gcc' }
     132    end
     133
     134    def cxx_exception_enabled?
     135      @cxx_exception_enabled
    114136    end
    115137
     
    119141
    120142    def enable_cxx_abi
    121       return if @cxx_exception_disabled or @cxx_abi_enabled
    122       compilers.each { |c| c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) }
     143      return if @cxx_abi_enabled
     144      if @cxx_exception_enabled
     145        raise "cxx_exception already enabled"
     146      end
     147      compilers.each { |c|
     148        c.defines += %w(MRB_ENABLE_CXX_EXCEPTION MRB_ENABLE_CXX_ABI)
     149        c.flags << c.cxx_compile_flag
     150      }
     151      compilers.each { |c| c.flags << c.cxx_compile_flag }
    123152      linker.command = cxx.command if toolchains.find { |v| v == 'gcc' }
    124153      @cxx_abi_enabled = true
     
    136165#define __STDC_LIMIT_MACROS
    137166
     167#ifndef MRB_ENABLE_CXX_ABI
    138168extern "C" {
     169#endif
    139170#include "#{src}"
     171#ifndef MRB_ENABLE_CXX_ABI
    140172}
    141 
    142 #{src == "#{MRUBY_ROOT}/src/error.c"? 'mrb_int mrb_jmpbuf::jmpbuf_id = 0;' : ''}
     173#endif
    143174EOS
    144175      end
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/mruby_build_commands.rake

    r321 r331  
    4343    attr_accessor :flags, :include_paths, :defines, :source_exts
    4444    attr_accessor :compile_options, :option_define, :option_include_path, :out_ext
     45    attr_accessor :cxx_compile_flag, :cxx_exception_flag
    4546
    4647    def initialize(build, source_exts=[])
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/mruby_build_gem.rake

    r321 r331  
    3939        Dir.glob("#{Gem.current.dir}/#{subdir}/*.{cpp,cxx,cc}")
    4040      end.flatten
    41       enable_cxx_abi unless cxx_srcs.empty?
     41      enable_cxx_exception unless cxx_srcs.empty?
    4242
    4343      Gem.current
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/android.rake

    r321 r331  
    11class MRuby::Toolchain::Android
    2   DEFAULT_ARCH = 'armeabi'
    3   DEFAULT_PLATFORM = 'android-14'
    4   DEFAULT_TOOLCHAIN = :gcc
     2
     3  DEFAULT_ARCH = 'armeabi' # TODO : Revise if arch should have a default
     4
     5  DEFAULT_TOOLCHAIN = :clang
     6
    57  DEFAULT_NDK_HOMES = %w{
     8    /usr/local/opt/android-sdk/ndk-bundle
    69    /usr/local/opt/android-ndk
     10    %LOCALAPPDATA%/Android/android-sdk/ndk-bundle
     11    %LOCALAPPDATA%/Android/android-ndk
     12    ~/Library/Android/sdk/ndk-bundle
     13    ~/Library/Android/ndk
    714  }
    8   TOOLCHAINS = [:gcc, :clang]
     15
     16  TOOLCHAINS = [:clang, :gcc]
     17
    918  ARCHITECTURES = %w{
    1019    armeabi armeabi-v7a arm64-v8a
     20    x86 x86_64
    1121    mips mips64
    12     x86 x86_64
    1322  }
    1423
     
    2231  end
    2332
     33  class PlatformDirNotFound < StandardError
     34    def message
     35        <<-EOM
     36Couldn't find Android NDK platform directories.
     37Set ANDROID_PLATFORM environment variable or set :platform parameter
     38        EOM
     39    end
     40  end
     41
    2442  attr_reader :params
    2543
    2644  def initialize(params)
    2745    @params = params
     46  end
     47
     48  def bin_gcc(command)
     49    command = command.to_s
     50
     51    command = case arch
     52      when /armeabi/    then 'arm-linux-androideabi-'
     53      when /arm64-v8a/  then 'aarch64-linux-android-'
     54      when /x86_64/     then 'x86_64-linux-android-'
     55      when /x86/        then 'i686-linux-android-'
     56      when /mips64/     then 'mips64el-linux-android-'
     57      when /mips/       then 'mipsel-linux-android-'
     58      end + command
     59
     60    gcc_toolchain_path.join('bin', command).to_s
     61  end
     62
     63  def bin(command)
     64    command = command.to_s
     65    toolchain_path.join('bin', command).to_s
    2866  end
    2967
     
    3169    @home_path ||= Pathname(
    3270      params[:ndk_home] ||
    33         ENV['ANDROID_NDK_HOME'] ||
    34         DEFAULT_NDK_HOMES.find{ |path| File.directory?(path) } ||
    35         raise(AndroidNDKHomeNotFound)
     71      ENV['ANDROID_NDK_HOME'] ||
     72      DEFAULT_NDK_HOMES.find { |path|
     73        path.gsub! '%LOCALAPPDATA%', ENV['LOCALAPPDATA'] || '%LOCALAPPDATA%'
     74        path.gsub! '\\', '/'
     75        path.gsub! '~', Dir.home || '~'
     76        File.directory?(path)
     77      } || raise(AndroidNDKHomeNotFound)
    3678    )
    3779  end
    3880
     81  def toolchain
     82    @toolchain ||= params.fetch(:toolchain){ DEFAULT_TOOLCHAIN }
     83  end
     84
     85  def toolchain_path
     86    @toolchain_path ||= case toolchain
     87      when :gcc
     88        gcc_toolchain_path
     89      when :clang
     90        home_path.join('toolchains', 'llvm' , 'prebuilt', host_platform)
     91      end
     92  end
     93
     94  def gcc_toolchain_path
     95    if @gcc_toolchain_path === nil then
     96      prefix = case arch
     97        when /armeabi/    then 'arm-linux-androideabi-'
     98        when /arm64-v8a/  then 'aarch64-linux-android-'
     99        when /x86_64/     then 'x86_64-'
     100        when /x86/        then 'x86-'
     101        when /mips64/     then 'mips64el-linux-android-'
     102        when /mips/       then 'mipsel-linux-android-'
     103        end
     104
     105      test = case arch
     106        when /armeabi/    then 'arm-linux-androideabi-*'
     107        when /arm64-v8a/  then 'aarch64-linux-android-*'
     108        when /x86_64/     then 'x86_64-*'
     109        when /x86/        then 'x86-*'
     110        when /mips64/     then 'mips64el-linux-android-*'
     111        when /mips/       then 'mipsel-linux-android-*'
     112        end
     113
     114      gcc_toolchain_version = Dir[home_path.join('toolchains', test)].map{|t| t.match(/-(\d+\.\d+)$/); $1.to_f }.max
     115      @gcc_toolchain_path = home_path.join('toolchains', prefix + gcc_toolchain_version.to_s, 'prebuilt', host_platform)
     116    end
     117    @gcc_toolchain_path
     118  end
     119
     120  def host_platform
     121    @host_platform ||= case RUBY_PLATFORM
     122      when /cygwin|mswin|mingw|bccwin|wince|emx/i
     123        path = home_path.join('toolchains', 'llvm' , 'prebuilt', 'windows*')
     124        Dir.glob(path.to_s){ |item|
     125          next if File.file?(item)
     126          path = Pathname(item)
     127          break
     128        }
     129        path.basename
     130      when /x86_64-darwin/i
     131        'darwin-x86_64'
     132      when /darwin/i
     133        'darwin-x86'
     134      when /x86_64-linux/i
     135        'linux-x86_64'
     136      when /linux/i
     137        'linux-x86'
     138      else
     139        raise NotImplementedError, "Unknown host platform (#{RUBY_PLATFORM})"
     140      end
     141  end
     142
    39143  def arch
    40     params.fetch(:arch){ DEFAULT_ARCH }
     144    @arch ||= (params[:arch] || ENV['ANDROID_ARCH'] || DEFAULT_ARCH).to_s
     145  end
     146
     147  def sysroot
     148    @sysroot ||= home_path.join('platforms', platform,
     149        case arch
     150        when /armeabi/    then 'arch-arm'
     151        when /arm64-v8a/  then 'arch-arm64'
     152        when /x86_64/     then 'arch-x86_64'
     153        when /x86/        then 'arch-x86'
     154        when /mips64/     then 'arch-mips64'
     155        when /mips/       then 'arch-mips'
     156        end
     157      ).to_s
    41158  end
    42159
    43160  def platform
    44     params.fetch(:platform){ DEFAULT_PLATFORM }
    45   end
    46 
    47   def toolchain
    48     params.fetch(:toolchain){ DEFAULT_TOOLCHAIN }
    49   end
    50 
    51   def toolchain_version
    52     params.fetch(:toolchain_version) do
    53       test = case toolchain
    54       when :gcc
    55         case arch
    56         when /armeabi/
    57           'arm-linux-androideabi-*'
    58         when /arm64/
    59           'aarch64-linux-android-*'
    60         when /mips64/
    61           'mips64el-linux-android-*'
    62         when /mips/
    63           'mipsel-linux-android-*'
    64         when /x86_64/
    65           'x86_64-*'
    66         when /x86/
    67           'x86-*'
     161    if @platform === nil then
     162      @platform = params[:platform] || ENV['ANDROID_PLATFORM'] || nil
     163      if @platform === nil
     164        Dir.glob(home_path.join('platforms/android-*').to_s){ |item|
     165          next if File.file?(item)
     166          if @platform === nil
     167            @platform = Integer(item.rpartition('-')[2])
     168          else
     169            platform = Integer(item.rpartition('-')[2])
     170            @platform = platform > @platform ? platform : @platform
     171          end
     172        }
     173        if @platform === nil
     174          raise(PlatformDirNotFound)
     175        else
     176          @platform = "android-#{@platform}"
    68177        end
    69       when :clang
    70         'llvm-*'
    71       end
    72 
    73       Dir[home_path.join('toolchains',test)].map{|t| t.match(/-(\d+\.\d+)$/); $1.to_f }.max
    74     end
    75   end
    76 
    77   def toolchain_path
    78     prefix = case toolchain
    79              when :clang then 'llvm-'
    80              when :gcc
    81                case arch
    82                when /armeabi/ then 'arm-linux-androideabi-'
    83                when /arm64/   then 'aarch64-linux-android-'
    84                when /x86_64/  then 'x86_64-'
    85                when /x86/     then 'x86-'
    86                when /mips64/  then 'mips64el-linux-android-'
    87                when /mips/    then 'mipsel-linux-android-'
    88                end
    89              end
    90     home_path.join('toolchains', prefix + toolchain_version.to_s, 'prebuilt', host_platform)
    91   end
    92 
    93   def sysroot
    94     path = case arch
    95            when /armeabi/ then 'arch-arm'
    96            when /arm64/   then 'arch-arm64'
    97            when /x86_64/  then 'arch-x86_64'
    98            when /x86/     then 'arch-x86'
    99            when /mips64/  then 'arch-mips64'
    100            when /mips/    then 'arch-mips'
    101            end
    102 
    103     home_path.join('platforms', platform, path).to_s
    104   end
    105 
    106   def bin(command)
    107     command = command.to_s
    108 
    109     if toolchain == :gcc
    110       command = case arch
    111                 when /armeabi/ then 'arm-linux-androideabi-'
    112                 when /arm64/   then 'aarch64-linux-android-'
    113                 when /x86_64/  then 'x86_64-linux-android-'
    114                 when /x86/     then 'i686-linux-android-'
    115                 when /mips64/  then 'mips64el-linux-android-'
    116                 when /mips/    then 'mipsel-linux-android-'
    117                 end + command
    118     end
    119 
    120     toolchain_path.join('bin',command).to_s
     178      end
     179    end
     180    if Integer(@platform.rpartition('-')[2]) < 21
     181      case arch
     182      when /arm64-v8a/, /x86_64/, /mips64/
     183        raise NotImplementedError, "Platform (#{@platform}) has no implementation for architecture (#{arch})"
     184      end
     185    end
     186    @platform
     187  end
     188
     189  def armeabi_v7a_mfpu
     190    @armeabi_v7a_mfpu ||= (params[:mfpu] || 'vfpv3-d16').to_s
     191  end
     192
     193  def armeabi_v7a_mfloat_abi
     194    @armeabi_v7a_mfloat_abi ||= (params[:mfloat_abi] || 'softfp').to_s
     195  end
     196
     197  def no_warn_mismatch
     198    if %W(soft softfp).include? armeabi_v7a_mfloat_abi
     199      ''
     200    else
     201      ',--no-warn-mismatch'
     202    end
    121203  end
    122204
    123205  def cc
    124206    case toolchain
    125     when :gcc   then bin(:gcc)
    126     when :clang then bin(:clang)
    127     end
     207    when :gcc then bin_gcc('gcc')
     208    when :clang then bin('clang')
     209    end
     210  end
     211
     212  def ar
     213    case toolchain
     214    when :gcc   then bin_gcc('ar')
     215    when :clang then bin_gcc('ar')
     216    end
     217  end
     218
     219  def ctarget
     220    flags = []
     221
     222    case toolchain
     223    when :gcc
     224      case arch
     225      when /armeabi-v7a/  then flags += %W(-march=armv7-a)
     226      when /armeabi/      then flags += %W(-march=armv5te)
     227      when /arm64-v8a/    then flags += %W(-march=armv8-a)
     228      when /x86_64/       then flags += %W(-march=x86-64)
     229      when /x86/          then flags += %W(-march=i686)
     230      when /mips64/       then flags += %W(-march=mips64r6)
     231      when /mips/         then flags += %W(-march=mips32)
     232      end
     233    when :clang
     234      case arch
     235      when /armeabi-v7a/  then flags += %W(-target armv7-none-linux-androideabi)
     236      when /armeabi/      then flags += %W(-target armv5te-none-linux-androideabi)
     237      when /arm64-v8a/    then flags += %W(-target aarch64-none-linux-android)
     238      when /x86_64/       then flags += %W(-target x86_64-none-linux-android)
     239      when /x86/          then flags += %W(-target i686-none-linux-android)
     240      when /mips64/       then flags += %W(-target mips64el-none-linux-android)
     241      when /mips/         then flags += %W(-target mipsel-none-linux-android)
     242      end
     243    end
     244
     245    case arch
     246    when /armeabi-v7a/  then flags += %W(-mfpu=#{armeabi_v7a_mfpu} -mfloat-abi=#{armeabi_v7a_mfloat_abi})
     247    when /armeabi/      then flags += %W(-mtune=xscale -msoft-float)
     248    when /arm64-v8a/    then flags += %W()
     249    when /x86_64/       then flags += %W()
     250    when /x86/          then flags += %W()
     251    when /mips64/       then flags += %W(-fmessage-length=0)
     252    when /mips/         then flags += %W(-fmessage-length=0)
     253    end
     254
     255    flags
    128256  end
    129257
     
    131259    flags = []
    132260
     261    flags += %W(-MMD -MP -D__android__ -DANDROID --sysroot="#{sysroot}")
     262    flags += ctarget
    133263    case toolchain
    134264    when :gcc
    135       flags += %W(-ffunction-sections -funwind-tables -no-canonical-prefixes)
    136       flags += %W(-D__android__ -mandroid --sysroot="#{sysroot}")
    137       case arch
    138       when /arm64/
    139         flags += %W(-fpic -fstack-protector-strong)
    140       when 'armeabi-v7a-hard'
    141         flags += %W(-fpic -fstack-protector-strong -march=armv7-a -mhard-float -D_NDK_MATH_NO_SOFTFP=1 -mfpu=vfpv3-d16)
    142       when 'armeabi-v7a'
    143         flags += %W(-fpic -fstack-protector-strong -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16)
    144       when /arm/
    145         flags += %W(-fpic -fstack-protector-strong -march=armv5te -mtune=xscale -msoft-float)
    146       when /mips/
    147         flags += %W(-fpic -fno-strict-aliasing -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers)
    148       when /x86/
    149         flags += %W(-fstack-protector-strong)
    150       end
    151265    when :clang
    152     end
     266      flags += %W(-gcc-toolchain "#{gcc_toolchain_path.to_s}" -Wno-invalid-command-line-argument -Wno-unused-command-line-argument)
     267    end
     268    flags += %W(-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes)
    153269
    154270    flags
    155   end
    156 
    157   def ld
    158     cc
    159271  end
    160272
    161273  def ldflags
    162274    flags = []
     275
     276    flags += %W(--sysroot="#{sysroot}")
     277
     278    flags
     279  end
     280
     281  def ldflags_before_libraries
     282    flags = []
     283
    163284    case toolchain
    164285    when :gcc
    165       flags += %W(-no-canonical-prefixes)
    166       flags += %W(-D__android__ -mandroid --sysroot="#{sysroot}")
    167       case arch
    168       when 'armeabi-v7a-hard'
    169         flags += %W(-march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-warn-mismatch -lm_hard)
    170       when 'armeabi-v7a'
    171         flags += %W(-march=armv7-a -Wl,--fix-cortex-a8)
    172       end
    173     end
    174    
     286      case arch
     287      when /armeabi-v7a/  then flags += %W(-Wl#{no_warn_mismatch})
     288      end
     289    when :clang
     290      flags += %W(-gcc-toolchain "#{gcc_toolchain_path.to_s}")
     291      case arch
     292      when /armeabi-v7a/  then flags += %W(-target armv7-none-linux-androideabi -Wl,--fix-cortex-a8#{no_warn_mismatch})
     293      when /armeabi/      then flags += %W(-target armv5te-none-linux-androideabi)
     294      when /arm64-v8a/    then flags += %W(-target aarch64-none-linux-android)
     295      when /x86_64/       then flags += %W(-target x86_64-none-linux-android)
     296      when /x86/          then flags += %W(-target i686-none-linux-android)
     297      when /mips64/       then flags += %W(-target mips64el-none-linux-android)
     298      when /mips/         then flags += %W(-target mipsel-none-linux-android)
     299      end
     300    end
     301    flags += %W(-no-canonical-prefixes)
     302
    175303    flags
    176304  end
    177 
    178   def ar
    179     case toolchain
    180     when :gcc   then bin(:ar)
    181     when :clang then bin('llvm-ar')
    182     end
    183   end
    184 
    185   def host_platform
    186     case RUBY_PLATFORM
    187     when /cygwin|mswin|mingw|bccwin|wince|emx/i
    188       'windows'
    189     when /x86_64-darwin/i
    190       'darwin-x86_64'
    191     when /darwin/i
    192       'darwin-x86'
    193     when /x86_64-linux/i
    194       'linux-x86_64'
    195     when /linux/i
    196       'linux-x86'
    197     else
    198       raise NotImplementedError, "Unknown host platform (#{RUBY_PLATFORM})"
    199     end
    200   end
    201305end
    202306
    203307MRuby::Toolchain.new(:android) do |conf, params|
    204   ndk = MRuby::Toolchain::Android.new(params)
    205 
    206   toolchain ndk.toolchain
     308  android = MRuby::Toolchain::Android.new(params)
     309
     310  toolchain android.toolchain
    207311
    208312  [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc|
    209     cc.command = ndk.cc
    210     cc.flags = ndk.cflags
    211   end
    212   conf.linker.command = ndk.ld
    213   conf.linker.flags = ndk.ldflags
    214   conf.archiver.command = ndk.ar
     313    cc.command = android.cc
     314    cc.flags = android.cflags
     315  end
     316
     317  conf.archiver.command = android.ar
     318  conf.linker.command = android.cc
     319  conf.linker.flags = android.ldflags
     320  conf.linker.flags_before_libraries = android.ldflags_before_libraries
    215321end
    216 
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/clang.rake

    r321 r331  
    1 MRuby::Toolchain.new(:clang) do |conf|
     1MRuby::Toolchain.new(:clang) do |conf, _params|
    22  toolchain :gcc
    33
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/gcc.rake

    r321 r331  
    1 MRuby::Toolchain.new(:gcc) do |conf|
     1MRuby::Toolchain.new(:gcc) do |conf, _params|
    22  [conf.cc, conf.objc, conf.asm].each do |cc|
    33    cc.command = ENV['CC'] || 'gcc'
     
    77    cc.option_define = '-D%s'
    88    cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
     9    cc.cxx_compile_flag = '-x c++ -std=c++03'
     10    cc.cxx_exception_flag = '-fexceptions'
    911  end
    1012
     
    1618    cxx.option_define = '-D%s'
    1719    cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
     20    cxx.cxx_compile_flag = '-x c++ -std=c++03'
     21    cxx.cxx_exception_flag = '-fexceptions'
    1822  end
    1923
  • EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/visualcpp.rake

    r321 r331  
    1 MRuby::Toolchain.new(:visualcpp) do |conf|
     1MRuby::Toolchain.new(:visualcpp) do |conf, _params|
    22  conf.cc do |cc|
    33    cc.command = ENV['CC'] || 'cl.exe'
    4     cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /utf-8 /W4 /GS /analyze- /Zc:wchar_t /ZI /Gm /Od /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /EHsc /DWIN32 /D_DEBUG /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS)]
    5     cc.flags << %w(/we4002 /we4003 /we4005 /we4007 /we4010 /we4013 /we4015 /we4020 /we4022 /we4024 /we4028 /we4029 /we4031 /we4033 /we4034 /we4042 /we4047 /we4048 /we4049 /we4056 /we4067 /we4074 /we4079 /we4083 /we4088 /we4089 /we4090 /we4091 /we4094 /we4096 /we4098 /we4099 /we4113 /we4133 /we4715 /we4716)
    6     cc.flags << %w(/wd4214 /wd4100 /wd4996)
    7     cc.flags << "/Fd\"#{conf.build_dir}\\vc140.pdb\""
    8     cc.flags << "/Fp\"%{outdir}\\%{outfilebase}.pch\""
     4    # C4013: implicit function declaration
     5    cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /utf-8 /D_CRT_SECURE_NO_WARNINGS)]
    96    cc.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING)
    107    cc.option_include_path = '/I%s'
    118    cc.option_define = '/D%s'
    129    cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
     10    cc.cxx_compile_flag = '/TP'
     11    cc.cxx_exception_flag = '/EHs'
    1312  end
    1413
    1514  conf.cxx do |cxx|
    1615    cxx.command = ENV['CXX'] || 'cl.exe'
    17     cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /utf-8 /nologo /W4 /GS /analyze- /Zc:wchar_t /ZI /Gm /Od /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /EHsc /DWIN32 /D_DEBUG /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS)]
    18     cxx.flags << %w(/we4002 /we4003 /we4005 /we4007 /we4010 /we4013 /we4015 /we4020 /we4022 /we4024 /we4028 /we4029 /we4031 /we4033 /we4034 /we4042 /we4047 /we4048 /we4049 /we4056 /we4067 /we4074 /we4079 /we4083 /we4088 /we4089 /we4090 /we4091 /we4094 /we4096 /we4098 /we4099 /we4113 /we4133 /we4715 /we4716)
    19     cxx.flags << %w(/wd4214 /wd4100 /wd4996)
    20     cxx.flags << "/Fd\"#{conf.build_dir}\\vc140.pdb\""
    21     cxx.flags << "/Fp\"%{outdir}\\%{outfilebase}.pch\""
     16    cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /utf-8 /D_CRT_SECURE_NO_WARNINGS)]
    2217    cxx.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING)
    2318    cxx.option_include_path = '/I%s'
    2419    cxx.option_define = '/D%s'
    2520    cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
     21    cxx.cxx_compile_flag = '/TP'
     22    cxx.cxx_exception_flag = '/EHs'
    2623  end
    2724
     
    6158
    6259  conf.file_separator = '\\'
     60
     61  if require 'open3'
     62    Open3.popen3 conf.cc.command do |_, _, e, _|
     63      if /Version (\d{2})\.\d{2}\.\d{5}/ =~ e.gets && $1.to_i <= 17
     64        m = "# VS2010/2012 support will be dropped after the next release! #"
     65        h = "#" * m.length
     66        puts h, m, h
     67      end
     68    end
     69  end
     70
    6371end
Note: See TracChangeset for help on using the changeset viewer.