Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MRuby::Build.new do |conf|
- # load specific toolchain settings
- toolchain :gcc
- end
- MRuby::CrossBuild.new('arm-none-eabi') do |conf|
- toolchain_prefix = '/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-'
- #Generate binaries
- conf.bins = %w(mrbc mruby mirb)
- #C compiler settings
- conf.cc do |cc|
- cc.command = ENV['CC'] || toolchain_prefix + 'gcc'
- cc.flags = [ENV['CFLAGS'] || %w()]
- cc.include_paths = [toolchain_prefix + "../include" , "#{root}/include"]
- cc.defines = %w(DISABLE_GEMS)
- cc.option_include_path = '-I%s'
- cc.option_define = '-D%s'
- cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
- end
- #Linker settings
- conf.linker do |linker|
- linker.command = ENV['LD'] || toolchain_prefix + 'ld'
- linker.flags = [ENV['LDFLAGS'] || []]
- linker.flags_before_libraries = []
- linker.libraries = %w()
- linker.flags_after_libraries = []
- linker.library_paths = []
- linker.option_library = '-l%s'
- linker.option_library_path = '-L%s'
- linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
- end
- #Archiver settings
- conf.archiver do |archiver|
- archiver.command = ENV['AR'] || toolchain_prefix + 'ar'
- archiver.archive_options = 'rs %{outfile} %{objs}'
- end
- #Parser generator settings
- conf.yacc do |yacc|
- yacc.command = ENV['YACC'] || 'bison'
- yacc.compile_options = '-o %{outfile} %{infile}'
- end
- #gperf settings
- conf.gperf do |gperf|
- gperf.command ='gperf'
- gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
- end
- #file extensions
- conf.exts do |exts|
- exts.object = '.o'
- exts.executable = '' # '.exe' if Windows
- exts.library = '.a'
- end
- #file separetor
- conf.file_separator = '/'
- end
- #Define cross build settings
- MRuby::CrossBuild.new('arm-none-eabi') do |conf|
- conf.cc.flags << %w(-std=gnu99 -mthumb -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -nostdlib)
- conf.linker.flags << %w(-T "/home/eugenio/gcc-arm-none-eabi-4_7-2012q4/share/gcc-arm-none-eabi/samples/ldscripts/mem.ld")
- conf.gem 'examples/mrbgems/c_and_ruby_extension_example'
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement