1 # Cross-compiling setup for Intel Edison (poky linux) platform
2 # Get SDK from here: https://software.intel.com/en-us/iot/hardware/edison/downloads
3 # REMEMBER to check and update the SDK root in the constant POKY_EDISON_PATH
5 MRuby::Build.new do |conf|
8 conf.cc.defines = %w(ENABLE_READLINE)
11 #lightweight regular expression
12 conf.gem :github => "pbosetti/mruby-hs-regexp", :branch => "master"
16 # Define cross build settings
17 MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
22 POKY_EDISON_PATH = '/opt/poky-edison/1.7.2'
24 POKY_EDISON_SYSROOT = "#{POKY_EDISON_PATH}/sysroots/core2-32-poky-linux"
25 POKY_EDISON_X86_PATH = "#{POKY_EDISON_PATH}/sysroots/i386-pokysdk-darwin"
26 POKY_EDISON_BIN_PATH = "#{POKY_EDISON_X86_PATH}/usr/bin/i586-poky-linux"
30 cc.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-gcc"
31 cc.include_paths << ["#{POKY_EDISON_SYSROOT}/usr/include", "#{POKY_EDISON_X86_PATH}/usr/include"]
32 cc.flags = %w(-m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer)
33 cc.flags << %w(-O2 -pipe -g -feliminate-unused-debug-types)
34 cc.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
35 cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
36 cc.defines = %w(ENABLE_READLINE)
40 cxx.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-g++"
41 cxx.include_paths = conf.cc.include_paths.dup
42 cxx.include_paths << ["#{POKY_EDISON_SYSROOT}/usr/include/c++/4.9.1"]
43 cxx.flags = conf.cc.flags.dup
44 cxx.defines = conf.cc.defines.dup
45 cxx.compile_options = conf.cc.compile_options.dup
48 conf.archiver do |archiver|
49 archiver.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-ar"
50 archiver.archive_options = 'rcs %{outfile} %{objs}'
53 conf.linker do |linker|
54 linker.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-g++"
55 linker.flags = %w(-m32 -march=i586)
56 linker.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
57 linker.flags << %w(-O1)
58 linker.libraries = %w(m pthread)
61 #do not build executable test
62 conf.build_mrbtest_lib_only
66 #lightweight regular expression
67 conf.gem :github => "pbosetti/mruby-hs-regexp", :branch => "master"