summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authordearblue <[email protected]>2021-08-08 22:50:47 +0900
committerdearblue <[email protected]>2021-08-09 21:16:45 +0900
commit4c25ace8b3c170af22d630f926c95521030ba768 (patch)
tree0b0135338dc00f7bfdff04c5f79b8e7d4e4cbb83 /tasks
parent1e1d2964972eda9dd0317dfa422311e5c5b80783 (diff)
downloadmruby-4c25ace8b3c170af22d630f926c95521030ba768.tar.gz
mruby-4c25ace8b3c170af22d630f926c95521030ba768.zip
Expose all header files of the gems for small compilation
After building mruby, if the user compiles and links to `libmruby.a`, expose the included directory of the captured gems. This is a change to the `<build-dir> /lib/libmruby.flags.mak` file and will result in being added to `bin/mruby-config --cflags`. This eliminates the need for the user to look up the path and add the compiler flag if the user wants to take advantage of her gems publishing features. In the main build with `rake CONFIG=...`, there is no problem because it can only be seen from the gems that depends directly and indirectly as before. However, when compiling independently by the user using `bin/mruby-config`, a header file name collision may occur if a unique header directory is added.
Diffstat (limited to 'tasks')
-rw-r--r--tasks/libmruby.rake3
1 files changed, 2 insertions, 1 deletions
diff --git a/tasks/libmruby.rake b/tasks/libmruby.rake
index 9a7a57ff7..1fb3cbc31 100644
--- a/tasks/libmruby.rake
+++ b/tasks/libmruby.rake
@@ -14,7 +14,8 @@ MRuby.each_target do
file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libmruby_static] do |t|
mkdir_p File.dirname t.name
open(t.name, 'w') do |f|
- f.puts "MRUBY_CFLAGS = #{cc.all_flags}"
+ gemincs = gems.map { |g| g.export_include_paths.map { |n| g.filename(n) } }.flatten.uniq
+ f.puts "MRUBY_CFLAGS = #{cc.all_flags([], gemincs)}"
f.puts "MRUBY_CC = #{cc.command}"
f.puts "MRUBY_LD = #{linker.command}"