From 181a007a34f5e430eeb93e128deb6d98f1e4df82 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 2 Sep 2020 23:02:10 +0900 Subject: [PATCH] Fix mruby build Copy build_config.rb to build directory because now build_config.rb.lock is created along side it. Define toolchain depending on CC environment variable. --- third-party/Makefile.am | 7 +++++-- third-party/build_config.rb | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/third-party/Makefile.am b/third-party/Makefile.am index 59252362..4cdfb400 100644 --- a/third-party/Makefile.am +++ b/third-party/Makefile.am @@ -54,7 +54,10 @@ EXTRA_DIST += build_config.rb mruby/* .PHONY: all-local clean mruby mruby: - MRUBY_CONFIG="${srcdir}/build_config.rb" \ + mkdir -p "${abs_builddir}/mruby/build" + diff "${srcdir}/build_config.rb" "${abs_builddir}/mruby/build/build_config.rb" >& /dev/null || \ + cp "${srcdir}/build_config.rb" "${abs_builddir}/mruby/build" + MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \ BUILD_DIR="${abs_builddir}/mruby/build" \ INSTALL_DIR="${abs_builddir}/mruby/build/install/bin" \ CC="${CC}" CXX="$(firstword $(CXX))" LD="${LD}" \ @@ -66,7 +69,7 @@ mruby: all-local: mruby clean-local: - MRUBY_CONFIG="${srcdir}/build_config.rb" \ + MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \ BUILD_DIR="${abs_builddir}/mruby/build" \ "${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" clean diff --git a/third-party/build_config.rb b/third-party/build_config.rb index 706e8741..9e66958c 100644 --- a/third-party/build_config.rb +++ b/third-party/build_config.rb @@ -1,6 +1,6 @@ MRuby::Build.new do |conf| - # TODO use same compilers configured in configure script - toolchain :clang + toolchain :clang if ENV['CC'].include? "clang" + toolchain :gcc if ENV['CC'].include? "gcc" # C++ project needs this. Without this, mruby exception does not # properly destory C++ object allocated on stack.