From 3303bd61758bf924385603c35e897f6e8f215a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Mon, 3 Sep 2018 23:51:25 +0200 Subject: [PATCH] mruby: initial add 1.4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Müller --- recipes-support/mruby/mruby-native.bb | 3 + recipes-support/mruby/mruby.bb | 12 ++ recipes-support/mruby/mruby.inc | 21 +++ .../0001-Align-compile-to-our-needs.patch | 147 ++++++++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 recipes-support/mruby/mruby-native.bb create mode 100644 recipes-support/mruby/mruby.bb create mode 100644 recipes-support/mruby/mruby.inc create mode 100644 recipes-support/mruby/mruby/0001-Align-compile-to-our-needs.patch diff --git a/recipes-support/mruby/mruby-native.bb b/recipes-support/mruby/mruby-native.bb new file mode 100644 index 00000000..05b64f31 --- /dev/null +++ b/recipes-support/mruby/mruby-native.bb @@ -0,0 +1,3 @@ +require ${BPN}.inc + +inherit native diff --git a/recipes-support/mruby/mruby.bb b/recipes-support/mruby/mruby.bb new file mode 100644 index 00000000..dd01cb1a --- /dev/null +++ b/recipes-support/mruby/mruby.bb @@ -0,0 +1,12 @@ +require ${BPN}.inc + +DEPENDS += " \ + ${BPN}-native \ +" + +do_configure_prepend() { + # find native mrbc + sed -i 's:\#{mrbc_build.build_dir}/bin/mrbc:${STAGING_BINDIR_NATIVE}/mrbc:' ${S}/lib/mruby/build.rb +} + +# REVISIT: Check build for big endian machines diff --git a/recipes-support/mruby/mruby.inc b/recipes-support/mruby/mruby.inc new file mode 100644 index 00000000..d73e34cb --- /dev/null +++ b/recipes-support/mruby/mruby.inc @@ -0,0 +1,21 @@ +SUMMARY = "Lightweight Ruby" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://MITL;md5=5515af1f5ed2280bc0b7e56b600a9aa3" + +SRC_URI = " \ + git://github.com/mruby/mruby.git \ + file://0001-Align-compile-to-our-needs.patch \ +" +SRCREV = "023070a6396233974785a8fd5735b9380a884f27" +S = "${WORKDIR}/git" +PV = "1.4.1" + +DEPENDS += " \ + bison-native \ + ruby-native \ +" + +do_install() { + install -d ${D}/${bindir} + cp ${B}/build/host/bin/* ${D}/${bindir}/ +} diff --git a/recipes-support/mruby/mruby/0001-Align-compile-to-our-needs.patch b/recipes-support/mruby/mruby/0001-Align-compile-to-our-needs.patch new file mode 100644 index 00000000..620bb575 --- /dev/null +++ b/recipes-support/mruby/mruby/0001-Align-compile-to-our-needs.patch @@ -0,0 +1,147 @@ +From 8d8dbc4fad71bb683a81036a7fc323ac45e2da76 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Sun, 2 Sep 2018 22:03:29 +0200 +Subject: [PATCH] Align compile to our needs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [configuration] + +Signed-off-by: Andreas Müller +--- + Rakefile | 10 ++++------ + build_config.rb | 37 +++++++++++++++++++++++++------------ + lib/mruby/build/command.rb | 2 +- + tasks/toolchains/gcc.rake | 2 +- + 4 files changed, 31 insertions(+), 20 deletions(-) + +diff --git a/Rakefile b/Rakefile +index 2f6fa056..74aa5e8f 100644 +--- a/Rakefile ++++ b/Rakefile +@@ -83,15 +83,13 @@ MRuby.each_target do |target| + end + depfiles += [ install_path ] + elsif target == MRuby.targets['host-debug'] +- unless MRuby.targets['host'].gems.map {|g| g.bins}.include?([bin]) +- install_path = MRuby.targets['host-debug'].exefile("#{bin_path}/#{bin}") ++ install_path = MRuby.targets['host-debug'].exefile("#{bin_path}/#{bin}") + +- file install_path => exec do |t| +- FileUtils.rm_f t.name, { :verbose => $verbose } +- FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose } ++ file install_path => exec do |t| ++ FileUtils.rm_f t.name, { :verbose => $verbose } ++ FileUtils.cp t.prerequisites.first, t.name, { :verbose => $verbose } + end + depfiles += [ install_path ] +- end + else + depfiles += [ exec ] + end +diff --git a/build_config.rb b/build_config.rb +index 1429837b..98d0a40d 100644 +--- a/build_config.rb ++++ b/build_config.rb +@@ -24,15 +24,15 @@ MRuby::Build.new do |conf| + # include the default GEMs + conf.gembox 'default' + # C compiler settings +- # conf.cc do |cc| +- # cc.command = ENV['CC'] || 'gcc' +- # cc.flags = [ENV['CFLAGS'] || %w()] ++ conf.cc do |cc| ++ cc.command = ENV['CC'] ++ cc.flags = [ENV['CFLAGS']] + # cc.include_paths = ["#{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 ++ end + + # mrbc settings + # conf.mrbc do |mrbc| +@@ -40,9 +40,9 @@ MRuby::Build.new do |conf| + # end + + # Linker settings +- # conf.linker do |linker| +- # linker.command = ENV['LD'] || 'gcc' +- # linker.flags = [ENV['LDFLAGS'] || []] ++ conf.linker do |linker| ++ linker.command = ENV['CC'] ++ linker.flags = [ENV['LDFLAGS']] + # linker.flags_before_libraries = [] + # linker.libraries = %w() + # linker.flags_after_libraries = [] +@@ -50,13 +50,12 @@ MRuby::Build.new do |conf| + # linker.option_library = '-l%s' + # linker.option_library_path = '-L%s' + # linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}" +- # end ++ end + + # Archiver settings +- # conf.archiver do |archiver| +- # archiver.command = ENV['AR'] || 'ar' +- # archiver.archive_options = 'rs %{outfile} %{objs}' +- # end ++ conf.archiver do |archiver| ++ archiver.command = ENV['AR'] ++ end + + # Parser generator settings + # conf.yacc do |yacc| +@@ -101,6 +100,20 @@ MRuby::Build.new('host-debug') do |conf| + + # C compiler settings + conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK) ++ conf.cc do |cc| ++ cc.command = ENV['CC'] ++ cc.flags = [ENV['CFLAGS']] ++ end ++ # Linker settings ++ conf.linker do |linker| ++ linker.command = ENV['CC'] ++ linker.flags = [ENV['LDFLAGS']] ++ end ++ ++ # Archiver settings ++ conf.archiver do |archiver| ++ archiver.command = ENV['AR'] ++ end + + # Generate mruby debugger command (require mruby-eval) + conf.gem :core => "mruby-bin-debugger" +diff --git a/lib/mruby/build/command.rb b/lib/mruby/build/command.rb +index 694b4a24..5744556c 100644 +--- a/lib/mruby/build/command.rb ++++ b/lib/mruby/build/command.rb +@@ -143,7 +143,7 @@ module MRuby + + def initialize(build) + super +- @command = ENV['LD'] || 'ld' ++ @command = ENV['CC'] || 'ld' + @flags = (ENV['LDFLAGS'] || []) + @flags_before_libraries, @flags_after_libraries = [], [] + @libraries = [] +diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake +index fc2e0bff..5d9f96fc 100644 +--- a/tasks/toolchains/gcc.rake ++++ b/tasks/toolchains/gcc.rake +@@ -22,7 +22,7 @@ MRuby::Toolchain.new(:gcc) do |conf, _params| + end + + conf.linker do |linker| +- linker.command = ENV['LD'] || 'gcc' ++ linker.command = ENV['CC'] + linker.flags = [ENV['LDFLAGS'] || %w()] + linker.libraries = %w(m) + linker.library_paths = [] +-- +2.14.4 +