summaryrefslogtreecommitdiffhomepage
path: root/build_config/IntelEdison.rb
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2020-10-19 15:03:22 +0900
committerKOBAYASHI Shuji <[email protected]>2020-10-19 15:03:22 +0900
commit81c21088196fd92d08c253efc2feb8dbead88acf (patch)
tree8429a165026b2335dd1d994fca790906e1721ce4 /build_config/IntelEdison.rb
parent27492e53a0440aee7c411d5e72b6f092cf85d6a1 (diff)
downloadmruby-81c21088196fd92d08c253efc2feb8dbead88acf.tar.gz
mruby-81c21088196fd92d08c253efc2feb8dbead88acf.zip
Revert `MRUBY_TARGET` mechanism; ref #5096
* In explanation of mruby, the expression `build_config.rb` is frequently used including official documents, so I think that it will not make sense if the file is no longer used. * The `MRUBY_TARGET` mechanism seems to have little improvement, so I don't think it should be changed to avoid unnecessary confusion. * `MRUBY_TARGET` and `MRuby.targets` represent somewhat different things, so using the same term "target" is a bit confusing. The mechanism that can be written short when using a file under `build_config` (renamed from `target`) directory remains (`build_config/${MRUBY_CONFIG}.rb` is used if the path specified in `MRUBY_CONFIG` doesn't exist).
Diffstat (limited to 'build_config/IntelEdison.rb')
-rw-r--r--build_config/IntelEdison.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/build_config/IntelEdison.rb b/build_config/IntelEdison.rb
new file mode 100644
index 000000000..a22f9cfd2
--- /dev/null
+++ b/build_config/IntelEdison.rb
@@ -0,0 +1,69 @@
+# Cross-compiling setup for Intel Edison (poky linux) platform
+# Get SDK from here: https://software.intel.com/en-us/iot/hardware/edison/downloads
+# REMEMBER to check and update the SDK root in the constant POKY_EDISON_PATH
+
+MRuby::Build.new do |conf|
+ toolchain :gcc
+ conf.gembox 'default'
+ conf.cc.defines = %w(ENABLE_READLINE)
+ conf.gembox 'default'
+
+ #lightweight regular expression
+ conf.gem :github => "pbosetti/mruby-hs-regexp", :branch => "master"
+
+end
+
+# Define cross build settings
+MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
+ toolchain :gcc
+
+ # Mac OS X
+ #
+ POKY_EDISON_PATH = '/opt/poky-edison/1.7.2'
+
+ POKY_EDISON_SYSROOT = "#{POKY_EDISON_PATH}/sysroots/core2-32-poky-linux"
+ POKY_EDISON_X86_PATH = "#{POKY_EDISON_PATH}/sysroots/i386-pokysdk-darwin"
+ POKY_EDISON_BIN_PATH = "#{POKY_EDISON_X86_PATH}/usr/bin/i586-poky-linux"
+
+
+ conf.cc do |cc|
+ cc.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-gcc"
+ cc.include_paths << ["#{POKY_EDISON_SYSROOT}/usr/include", "#{POKY_EDISON_X86_PATH}/usr/include"]
+ cc.flags = %w(-m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer)
+ cc.flags << %w(-O2 -pipe -g -feliminate-unused-debug-types)
+ cc.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
+ cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
+ cc.defines = %w(ENABLE_READLINE)
+ end
+
+ conf.cxx do |cxx|
+ cxx.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-g++"
+ cxx.include_paths = conf.cc.include_paths.dup
+ cxx.include_paths << ["#{POKY_EDISON_SYSROOT}/usr/include/c++/4.9.1"]
+ cxx.flags = conf.cc.flags.dup
+ cxx.defines = conf.cc.defines.dup
+ cxx.compile_options = conf.cc.compile_options.dup
+ end
+
+ conf.archiver do |archiver|
+ archiver.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-ar"
+ archiver.archive_options = 'rcs "%{outfile}" %{objs}'
+ end
+
+ conf.linker do |linker|
+ linker.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-g++"
+ linker.flags = %w(-m32 -march=i586)
+ linker.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
+ linker.flags << %w(-O1)
+ linker.libraries = %w(m pthread)
+ end
+
+ #do not build executable test
+ conf.build_mrbtest_lib_only
+
+ conf.gembox 'default'
+
+ #lightweight regular expression
+ conf.gem :github => "pbosetti/mruby-hs-regexp", :branch => "master"
+
+end