From e49ae398bdc25b2cde277e9a3242b4c17d3ffb50 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 2 Jun 2022 19:07:58 +0900 Subject: [PATCH] Rakefile: add install target; close #5712 This change is not complete. Contribution is welcome. - need to update `mruby-config` to refer installed path - may need to support installing shared library - need to support cross-compiled binaries --- Rakefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Rakefile b/Rakefile index 227d1d5d5..9396b8cd1 100644 --- a/Rakefile +++ b/Rakefile @@ -67,3 +67,31 @@ task :deep_clean => %w[clean doc:clean] do end puts "Cleaned up mrbgems build folder" end + +PREFIX = ENV['PREFIX'] || ENV['INSTALL_PREFIX'] || '/usr/local' + +desc "install compiled products" +task :install => :install_bin do + if host = MRuby.targets['host'] + install_D host.libmruby_static, File.join(PREFIX, "lib", File.basename(host.libmruby_static)) + # install mruby.h and mrbconf.h + Dir.glob(File.join(MRUBY_ROOT, "include", "*.h")) do |src| + install_D src, File.join(PREFIX, "include", File.basename(src)) + end + Dir.glob(File.join(MRUBY_ROOT, "include", "mruby", "*.h")) do |src| + install_D src, File.join(PREFIX, "include", "mruby", File.basename(src)) + end + Dir.glob(File.join(File.join(MRUBY_ROOT, "build", "host", "include", "mruby", "presym", "*.h"))) do |src| + install_D src, File.join(PREFIX, "include", "mruby", "presym", File.basename(src)) + end + end +end + +desc "install compiled executable (on host)" +task :install_bin => :all do + if host = MRuby.targets['host'] + Dir.glob(File.join(MRUBY_ROOT, "bin", "*")) do |src| + install_D src, File.join(PREFIX, "bin", File.basename(src)) + end + end +end