Advertisement
fuzzywolf

buildconfig mruby

Feb 1st, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.25 KB | None | 0 0
  1. MRuby::Build.new do |conf|
  2.   # load specific toolchain settings
  3.   toolchain :gcc
  4. end
  5.  
  6.  
  7. MRuby::CrossBuild.new('arm-none-eabi') do |conf|
  8.   toolchain_prefix = '/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-'
  9.  
  10.   #Generate binaries
  11.    conf.bins = %w(mrbc mruby mirb)
  12.  
  13.   #C compiler settings
  14.    conf.cc do |cc|
  15.      cc.command = ENV['CC'] || toolchain_prefix + 'gcc'
  16.      cc.flags = [ENV['CFLAGS'] || %w()]
  17.      cc.include_paths = [toolchain_prefix  + "../include" , "#{root}/include"]
  18.      cc.defines = %w(DISABLE_GEMS)
  19.      cc.option_include_path = '-I%s'
  20.      cc.option_define = '-D%s'
  21.      cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
  22.    end
  23.  
  24.   #Linker settings
  25.    conf.linker do |linker|
  26.      linker.command = ENV['LD'] || toolchain_prefix + 'ld'
  27.      linker.flags = [ENV['LDFLAGS'] || []]
  28.      linker.flags_before_libraries = []
  29.      linker.libraries = %w()
  30.      linker.flags_after_libraries = []
  31.      linker.library_paths = []
  32.      linker.option_library = '-l%s'
  33.      linker.option_library_path = '-L%s'
  34.      linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
  35.    end
  36.  
  37.   #Archiver settings
  38.    conf.archiver do |archiver|
  39.      archiver.command = ENV['AR'] || toolchain_prefix + 'ar'
  40.      archiver.archive_options = 'rs %{outfile} %{objs}'
  41.    end
  42.  
  43.   #Parser generator settings
  44.    conf.yacc do |yacc|
  45.      yacc.command = ENV['YACC'] || 'bison'
  46.      yacc.compile_options = '-o %{outfile} %{infile}'
  47.    end
  48.  
  49.   #gperf settings
  50.    conf.gperf do |gperf|
  51.      gperf.command ='gperf'
  52.      gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
  53.    end
  54.  
  55.   #file extensions
  56.    conf.exts do |exts|
  57.      exts.object = '.o'
  58.      exts.executable = '' # '.exe' if Windows
  59.      exts.library = '.a'
  60.    end
  61.  
  62.   #file separetor
  63.    conf.file_separator = '/'
  64. end
  65. #Define cross build settings
  66.  MRuby::CrossBuild.new('arm-none-eabi') do |conf|
  67.    
  68.    conf.cc.flags << %w(-std=gnu99  -mthumb -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -nostdlib)
  69.    conf.linker.flags << %w(-T "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld")
  70.    
  71.    conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
  72.  end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement