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
|
---|
4 |
|
---|
5 | MRuby::Build.new do |conf|
|
---|
6 | toolchain :gcc
|
---|
7 | conf.gembox 'default'
|
---|
8 | conf.cc.defines = %w(ENABLE_READLINE)
|
---|
9 | conf.gembox 'default'
|
---|
10 |
|
---|
11 | #lightweight regular expression
|
---|
12 | conf.gem :github => "pbosetti/mruby-hs-regexp", :branch => "master"
|
---|
13 |
|
---|
14 | end
|
---|
15 |
|
---|
16 | # Define cross build settings
|
---|
17 | MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
|
---|
18 | toolchain :gcc
|
---|
19 |
|
---|
20 | # Mac OS X
|
---|
21 | #
|
---|
22 | POKY_EDISON_PATH = '/opt/poky-edison/1.7.2'
|
---|
23 |
|
---|
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"
|
---|
27 |
|
---|
28 |
|
---|
29 | conf.cc do |cc|
|
---|
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)
|
---|
37 | end
|
---|
38 |
|
---|
39 | conf.cxx do |cxx|
|
---|
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
|
---|
46 | end
|
---|
47 |
|
---|
48 | conf.archiver do |archiver|
|
---|
49 | archiver.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-ar"
|
---|
50 | archiver.archive_options = 'rcs %{outfile} %{objs}'
|
---|
51 | end
|
---|
52 |
|
---|
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)
|
---|
59 | end
|
---|
60 |
|
---|
61 | #do not build executable test
|
---|
62 | conf.build_mrbtest_lib_only
|
---|
63 |
|
---|
64 | conf.gembox 'default'
|
---|
65 |
|
---|
66 | #lightweight regular expression
|
---|
67 | conf.gem :github => "pbosetti/mruby-hs-regexp", :branch => "master"
|
---|
68 |
|
---|
69 | end
|
---|