From 81c21088196fd92d08c253efc2feb8dbead88acf Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Mon, 19 Oct 2020 15:03:22 +0900 Subject: 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). --- .github/workflows/build.yml | 14 ++-- .travis.yml | 2 +- README.md | 14 +--- Rakefile | 9 +-- appveyor.yml | 2 +- build_config.rb | 86 ++++++++++++++++++++++++ build_config/ArduinoDue.rb | 74 +++++++++++++++++++++ build_config/IntelEdison.rb | 69 ++++++++++++++++++++ build_config/IntelGalileo.rb | 89 +++++++++++++++++++++++++ build_config/RX630.rb | 65 ++++++++++++++++++ build_config/android_arm64-v8a.rb | 11 ++++ build_config/android_armeabi.rb | 11 ++++ build_config/android_armeabi_v7a_neon_hard.rb | 13 ++++ build_config/appveyor.rb | 18 +++++ build_config/bench.rb | 11 ++++ build_config/boxing.rb | 29 +++++++++ build_config/chipKITMax32.rb | 70 ++++++++++++++++++++ build_config/clang-asan.rb | 21 ++++++ build_config/cross-32bit.rb | 14 ++++ build_config/dreamcast_shelf.rb | 94 +++++++++++++++++++++++++++ build_config/host-cxx.rb | 13 ++++ build_config/host-debug.rb | 26 ++++++++ build_config/host-gprof.rb | 14 ++++ build_config/host-m32.rb | 15 +++++ build_config/host-shared.rb | 36 ++++++++++ build_config/travis.rb | 39 +++++++++++ doc/guides/compile.md | 39 ++++------- doc/mruby3.md | 32 +++------ lib/mruby/build.rb | 11 ++++ lib/mruby/lockfile.rb | 2 +- target/ArduinoDue.rb | 74 --------------------- target/IntelEdison.rb | 69 -------------------- target/IntelGalileo.rb | 89 ------------------------- target/RX630.rb | 65 ------------------ target/android_arm64-v8a.rb | 11 ---- target/android_armeabi.rb | 11 ---- target/android_armeabi_v7a_neon_hard.rb | 13 ---- target/appveyor.rb | 18 ----- target/bench.rb | 11 ---- target/boxing.rb | 29 --------- target/chipKITMax32.rb | 70 -------------------- target/clang-asan.rb | 21 ------ target/cross-32bit.rb | 14 ---- target/dreamcast_shelf.rb | 94 --------------------------- target/host-cxx.rb | 13 ---- target/host-debug.rb | 26 -------- target/host-gprof.rb | 14 ---- target/host-m32.rb | 15 ----- target/host-shared.rb | 36 ---------- target/host.rb | 86 ------------------------ target/travis.rb | 39 ----------- tasks/benchmark.rake | 6 +- 52 files changed, 868 insertions(+), 899 deletions(-) create mode 100644 build_config.rb create mode 100644 build_config/ArduinoDue.rb create mode 100644 build_config/IntelEdison.rb create mode 100644 build_config/IntelGalileo.rb create mode 100644 build_config/RX630.rb create mode 100644 build_config/android_arm64-v8a.rb create mode 100644 build_config/android_armeabi.rb create mode 100644 build_config/android_armeabi_v7a_neon_hard.rb create mode 100644 build_config/appveyor.rb create mode 100644 build_config/bench.rb create mode 100644 build_config/boxing.rb create mode 100644 build_config/chipKITMax32.rb create mode 100644 build_config/clang-asan.rb create mode 100644 build_config/cross-32bit.rb create mode 100644 build_config/dreamcast_shelf.rb create mode 100644 build_config/host-cxx.rb create mode 100644 build_config/host-debug.rb create mode 100644 build_config/host-gprof.rb create mode 100644 build_config/host-m32.rb create mode 100644 build_config/host-shared.rb create mode 100644 build_config/travis.rb delete mode 100644 target/ArduinoDue.rb delete mode 100644 target/IntelEdison.rb delete mode 100644 target/IntelGalileo.rb delete mode 100644 target/RX630.rb delete mode 100644 target/android_arm64-v8a.rb delete mode 100644 target/android_armeabi.rb delete mode 100644 target/android_armeabi_v7a_neon_hard.rb delete mode 100644 target/appveyor.rb delete mode 100644 target/bench.rb delete mode 100644 target/boxing.rb delete mode 100644 target/chipKITMax32.rb delete mode 100644 target/clang-asan.rb delete mode 100644 target/cross-32bit.rb delete mode 100644 target/dreamcast_shelf.rb delete mode 100644 target/host-cxx.rb delete mode 100644 target/host-debug.rb delete mode 100644 target/host-gprof.rb delete mode 100644 target/host-m32.rb delete mode 100644 target/host-shared.rb delete mode 100644 target/host.rb delete mode 100644 target/travis.rb diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95f7c40d8..56fbe86c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: Ubuntu-1604: runs-on: ubuntu-16.04 env: - MRUBY_TARGET: travis + MRUBY_CONFIG: travis steps: - uses: actions/checkout@v1 - name: apt @@ -17,7 +17,7 @@ jobs: Ubuntu-1804-gcc: runs-on: ubuntu-18.04 env: - MRUBY_TARGET: travis + MRUBY_CONFIG: travis CC: gcc CXX: g++ steps: @@ -30,7 +30,7 @@ jobs: Ubuntu-1804-clang: runs-on: ubuntu-18.04 env: - MRUBY_TARGET: travis + MRUBY_CONFIG: travis CC: clang CXX: clang++ steps: @@ -43,7 +43,7 @@ jobs: macOS: runs-on: macos-latest env: - MRUBY_TARGET: travis + MRUBY_CONFIG: travis steps: - uses: actions/checkout@v1 - name: brew @@ -54,7 +54,7 @@ jobs: Windows-MinGW: runs-on: windows-latest env: - MRUBY_TARGET: travis + MRUBY_CONFIG: travis CFLAGS: -g -O1 -Wall -Wundef steps: - uses: actions/checkout@v1 @@ -66,7 +66,7 @@ jobs: Windows-Cygwin: runs-on: windows-latest env: - MRUBY_TARGET: travis + MRUBY_CONFIG: travis steps: - uses: actions/checkout@v1 - uses: actions/cache@v1 @@ -91,7 +91,7 @@ jobs: Windows-VC: runs-on: windows-latest env: - MRUBY_TARGET: appveyor + MRUBY_CONFIG: appveyor # TODO(take-cheeze): Re-enable /O2 CFLAGS: "/c /nologo /W3 /we4013 /Zi /MD /D_CRT_SECURE_NO_WARNINGS" CXXFLAGS: "/c /nologo /W3 /Zi /MD /EHs /D_CRT_SECURE_NO_WARNINGS" diff --git a/.travis.yml b/.travis.yml index 676ac27b5..7da3d40a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ jobs: - export PATH="/usr/local/opt/bison/bin:$PATH" env: - - MRUBY_TARGET=travis + - MRUBY_CONFIG=travis script: - rake gensym && rake -m && rake test diff --git a/README.md b/README.md index 959abb0fc..5abf3445d 100644 --- a/README.md +++ b/README.md @@ -38,22 +38,10 @@ The URL of the mruby home-page is: https://mruby.org. We don't have a mailing list, but you can use [GitHub issues](https://github.com/mruby/mruby/issues). -## How to compile and install (mruby and gems) +## How to compile, test, and install (mruby and gems) See the [compile.md](https://github.com/mruby/mruby/blob/master/doc/guides/compile.md) file. -## How to Build - -To build mruby, execute the following from the project's root directory. - - $ rake TARGET= test - -The default `TARGET` is `host`. `TARGET` will be loaded from `target` directory. - -Note: `bison` bundled with MacOS is too old to compile `mruby`. -Try `brew install bison` and follow the instuction shown to update -the `$PATH` to compile `mruby`. - ## Building documentation There are two sets of documentation in mruby: the mruby API (generated by yard) and C API (Doxygen) diff --git a/Rakefile b/Rakefile index 5c5a6e8eb..036894592 100644 --- a/Rakefile +++ b/Rakefile @@ -14,14 +14,7 @@ require "mruby-core-ext" require "mruby/build" # load configuration file -if ENV['MRUBY_CONFIG'] - MRUBY_CONFIG = ENV['MRUBY_CONFIG'] - MRUBY_TARGET = File.basename(MRUBY_CONFIG, ".rb") -else - MRUBY_TARGET = ENV['MRUBY_TARGET'] || ENV['TARGET'] || "host" - MRUBY_CONFIG = "#{MRUBY_ROOT}/target/#{MRUBY_TARGET}.rb" -end -load MRUBY_CONFIG +MRUBY_CONFIG = MRuby::Build.load_config # load basic rules MRuby.each_target do |build| diff --git a/appveyor.yml b/appveyor.yml index e2fa0e900..e2a79f20d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,7 +40,7 @@ init: build_script: - - set MRUBY_TARGET=appveyor + - set MRUBY_CONFIG=appveyor - rake gensym - rake -m all - rake -E $stdout.sync=true test diff --git a/build_config.rb b/build_config.rb new file mode 100644 index 000000000..0a92b9108 --- /dev/null +++ b/build_config.rb @@ -0,0 +1,86 @@ +MRuby::Build.new do |conf| + # load specific toolchain settings + + # Gets set by the VS command prompts. + if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] + toolchain :visualcpp + else + toolchain :gcc + end + + # Use mrbgems + # conf.gem 'examples/mrbgems/ruby_extension_example' + # conf.gem 'examples/mrbgems/c_extension_example' do |g| + # g.cc.flags << '-g' # append cflags in this gem + # end + # conf.gem 'examples/mrbgems/c_and_ruby_extension_example' + # conf.gem :core => 'mruby-eval' + # conf.gem :mgem => 'mruby-onig-regexp' + # conf.gem :github => 'mattn/mruby-onig-regexp' + # conf.gem :git => 'git@github.com:mattn/mruby-onig-regexp.git', :branch => 'master', :options => '-v' + + # include the GEM box + conf.gembox 'full-core' + + # C compiler settings + # conf.cc do |cc| + # cc.command = ENV['CC'] || 'gcc' + # cc.flags = [ENV['CFLAGS'] || %w()] + # cc.include_paths = ["#{root}/include"] + # cc.defines = %w() + # cc.option_include_path = %q[-I"%s"] + # cc.option_define = '-D%s' + # cc.compile_options = %Q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"] + # end + + # mrbc settings + # conf.mrbc do |mrbc| + # mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers + # end + + # Linker settings + # conf.linker do |linker| + # linker.command = ENV['LD'] || 'gcc' + # linker.flags = [ENV['LDFLAGS'] || []] + # linker.flags_before_libraries = [] + # linker.libraries = %w() + # linker.flags_after_libraries = [] + # linker.library_paths = [] + # linker.option_library = '-l%s' + # linker.option_library_path = '-L%s' + # linker.link_options = "%{flags} -o "%{outfile}" %{objs} %{libs}" + # end + + # Archiver settings + # conf.archiver do |archiver| + # archiver.command = ENV['AR'] || 'ar' + # archiver.archive_options = 'rs "%{outfile}" %{objs}' + # end + + # Parser generator settings + # conf.yacc do |yacc| + # yacc.command = ENV['YACC'] || 'bison' + # yacc.compile_options = %q[-o "%{outfile}" "%{infile}"] + # end + + # gperf settings + # conf.gperf do |gperf| + # gperf.command = 'gperf' + # gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"] + # end + + # file extensions + # conf.exts do |exts| + # exts.object = '.o' + # exts.executable = '' # '.exe' if Windows + # exts.library = '.a' + # end + + # file separetor + # conf.file_separator = '/' + + # Turn on `enable_debug` for better debugging + # conf.enable_debug + conf.enable_bintest + conf.enable_test +end diff --git a/build_config/ArduinoDue.rb b/build_config/ArduinoDue.rb new file mode 100644 index 000000000..5859f8508 --- /dev/null +++ b/build_config/ArduinoDue.rb @@ -0,0 +1,74 @@ +# Cross Compiling configuration for Arduino Due +# http://arduino.cc/en/Main/ArduinoBoardDue +# +# Requires Arduino IDE >= 1.5 +MRuby::CrossBuild.new("ArduinoDue") do |conf| + toolchain :gcc + + # Mac OS X, Arduino IDE <= 1.5.6 + # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Resources/Java' + # Mac OS X, Arduino IDE >= 1.5.7 + # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Java' + # GNU Linux + ARDUINO_PATH = '/opt/arduino' + # Arduino IDE <= 1.5.6 + BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin" + # Arduino IDE >= 1.5.7 + # BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin" + SAM_PATH = "#{ARDUINO_PATH}/hardware/arduino/sam" + TARGET_PATH = "#{SAM_PATH}/variants/arduino_due_x" + + conf.cc do |cc| + cc.command = "#{BIN_PATH}/arm-none-eabi-gcc" + cc.include_paths << ["#{SAM_PATH}/system/libsam", "#{SAM_PATH}/system/CMSIS/CMSIS/Include/", + "#{SAM_PATH}/system/CMSIS/Device/ATMEL/", + "#{SAM_PATH}/cores/arduino", "#{SAM_PATH}/libraries","#{TARGET_PATH}"] + cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 + -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM + -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due") + cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] + + #configuration for low memory environment + cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) + cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) + cc.defines << %w(MRB_GC_STRESS) + #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. + #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval + end + + conf.cxx do |cxx| + cxx.command = conf.cc.command.dup + cxx.include_paths = conf.cc.include_paths.dup + cxx.flags = conf.cc.flags.dup + cxx.flags << %w(-fno-rtti -fno-exceptions) + cxx.defines = conf.cc.defines.dup + cxx.compile_options = conf.cc.compile_options.dup + end + + conf.archiver do |archiver| + archiver.command = "#{BIN_PATH}/arm-none-eabi-ar" + archiver.archive_options = 'rcs "%{outfile}" %{objs}' + end + + #no executables + conf.bins = [] + + #do not build executable test + conf.build_mrbtest_lib_only + + #disable C++ exception + conf.disable_cxx_exception + + #gems from core + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-enum-ext" + + #light-weight regular expression + conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" + + #Arduino API + #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" + +end 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 diff --git a/build_config/IntelGalileo.rb b/build_config/IntelGalileo.rb new file mode 100644 index 000000000..e996efa5b --- /dev/null +++ b/build_config/IntelGalileo.rb @@ -0,0 +1,89 @@ +# Cross Compiling configuration for Intel Galileo on Arduino environment +# http://arduino.cc/en/ArduinoCertified/IntelGalileo +# +# Requires Arduino IDE for Intel Galileo +MRuby::CrossBuild.new("Galileo") do |conf| + toolchain :gcc + + # Mac OS X + # Assume you renamed Arduino.app to Arduino_Galileo.app + GALILEO_ARDUINO_PATH = '/Applications/Arduino_Galileo.app/Contents/Resources/Java' + # GNU Linux + #ARDUINO_GALILEO_PATH = '/opt/arduino' + + GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc" + GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc" + GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86" + + + conf.cc do |cc| + cc.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-gcc" + cc.include_paths << ["#{GALILEO_X86_PATH}/cores/arduino", "#{GALILEO_X86_PATH}/variants/galileo_fab_d"] + cc.flags = %w(-m32 -march=i586 -c -g -Os -w + -ffunction-sections -fdata-sections -MMD -DARDUINO=153) + cc.flags << "--sysroot=#{GALILEO_SYSROOT}" + cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] + end + + conf.cxx do |cxx| + cxx.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++" + cxx.include_paths = conf.cc.include_paths.dup + cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++" + cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++/i586-poky-linux-uclibc" + 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 = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar" + archiver.archive_options = 'rcs "%{outfile}" %{objs}' + end + + conf.linker do |linker| + linker.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++" + linker.flags = %w(-m32 -march=i586) + linker.flags << "--sysroot=#{GALILEO_SYSROOT}" + linker.flags << %w(-Os -Wl,--gc-sections) + linker.libraries = %w(m pthread) + end + + #no executables + conf.bins = [] + + #do not build executable test + conf.build_mrbtest_lib_only + + #official mrbgems + conf.gem :core => "mruby-sprintf" + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-time" + conf.gem :core => "mruby-struct" + conf.gem :core => "mruby-enum-ext" + conf.gem :core => "mruby-string-ext" + conf.gem :core => "mruby-numeric-ext" + conf.gem :core => "mruby-array-ext" + conf.gem :core => "mruby-hash-ext" + conf.gem :core => "mruby-range-ext" + conf.gem :core => "mruby-proc-ext" + conf.gem :core => "mruby-symbol-ext" + conf.gem :core => "mruby-random" + conf.gem :core => "mruby-object-ext" + conf.gem :core => "mruby-objectspace" + conf.gem :core => "mruby-fiber" + conf.gem :core => "mruby-toplevel-ext" + + #lightweigh regular expression + conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" + + #Arduino API + #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" do |g| + # g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Wire" + # g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Servo" + + #enable unsupported Servo class + # g.cxx.defines << "MRUBY_ARDUINO_GALILEO_ENABLE_SERVO" + #end + +end diff --git a/build_config/RX630.rb b/build_config/RX630.rb new file mode 100644 index 000000000..01c883958 --- /dev/null +++ b/build_config/RX630.rb @@ -0,0 +1,65 @@ +# Cross Compiling configuration for RX630 +# http://gadget.renesas.com/ +# +# Requires gnurx_v14.03 +MRuby::CrossBuild.new("RX630") do |conf| + toolchain :gcc + + # Linux + BIN_PATH = "/usr/share/gnurx_v14.03_elf-1/bin" + + conf.cc do |cc| + cc.command = "#{BIN_PATH}/rx-elf-gcc" + cc.flags = "-Wall -g -O2 -flto -mcpu=rx600 -m64bit-doubles" + cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] + + #configuration for low memory environment + cc.defines << %w(MRB_USE_FLOAT32) + cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) + cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) + cc.defines << %w(MRB_GC_STRESS) + cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. + #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval + end + + conf.cxx do |cxx| + cxx.command = conf.cc.command.dup + cxx.include_paths = conf.cc.include_paths.dup + cxx.flags = conf.cc.flags.dup + cxx.defines = conf.cc.defines.dup + cxx.compile_options = conf.cc.compile_options.dup + end + + conf.linker do |linker| + linker.command="#{BIN_PATH}/rx-elf-ld" + end + + conf.archiver do |archiver| + archiver.command = "#{BIN_PATH}/rx-elf-ar" + archiver.archive_options = 'rcs "%{outfile}" %{objs}' + end + + #no executables + conf.bins = [] + + #do not build executable test + conf.build_mrbtest_lib_only + + #disable C++ exception + conf.disable_cxx_exception + + #gems from core + conf.gem :core => "mruby-sprintf" + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-enum-ext" + conf.gem :core => "mruby-numeric-ext" + + #light-weight regular expression + #conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" + + #Arduino API + #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" + +end diff --git a/build_config/android_arm64-v8a.rb b/build_config/android_arm64-v8a.rb new file mode 100644 index 000000000..7fab2f063 --- /dev/null +++ b/build_config/android_arm64-v8a.rb @@ -0,0 +1,11 @@ +# Requires Android NDK r13 or later. +MRuby::CrossBuild.new('android-arm64-v8a') do |conf| + params = { + :arch => 'arm64-v8a', + :platform => 'android-24', + :toolchain => :clang, + } + toolchain :android, params + + conf.gembox 'default' +end diff --git a/build_config/android_armeabi.rb b/build_config/android_armeabi.rb new file mode 100644 index 000000000..41a657c3b --- /dev/null +++ b/build_config/android_armeabi.rb @@ -0,0 +1,11 @@ +# Requires Android NDK r13 or later. +MRuby::CrossBuild.new('android-armeabi') do |conf| + params = { + :arch => 'armeabi', + :platform => 'android-24', + :toolchain => :clang, + } + toolchain :android, params + + conf.gembox 'default' +end diff --git a/build_config/android_armeabi_v7a_neon_hard.rb b/build_config/android_armeabi_v7a_neon_hard.rb new file mode 100644 index 000000000..6129b238e --- /dev/null +++ b/build_config/android_armeabi_v7a_neon_hard.rb @@ -0,0 +1,13 @@ +# Requires Android NDK r13 or later. +MRuby::CrossBuild.new('android-armeabi-v7a-neon-hard') do |conf| + params = { + :arch => 'armeabi-v7a', + :mfpu => 'neon', + :mfloat_abi => 'hard', + :platform => 'android-24', + :toolchain => :clang, + } + toolchain :android, params + + conf.gembox 'default' +end diff --git a/build_config/appveyor.rb b/build_config/appveyor.rb new file mode 100644 index 000000000..e084a6a36 --- /dev/null +++ b/build_config/appveyor.rb @@ -0,0 +1,18 @@ +def setup_option(conf) + conf.cc.flags[0].delete("/Zi") unless ENV['CFLAGS'] + conf.cxx.flags[0].delete("/Zi") unless ENV['CFLAGS'] || ENV['CXXFLAGS'] + conf.linker.flags << "/DEBUG:NONE" unless ENV['LDFLAGS'] +end + +MRuby::Build.new do |conf| + toolchain :visualcpp + + # include all core GEMs + conf.gembox 'full-core' + conf.compilers.each do |c| + c.defines += %w(MRB_GC_FIXED_ARENA) + end + setup_option(conf) + conf.enable_bintest + conf.enable_test +end diff --git a/build_config/bench.rb b/build_config/bench.rb new file mode 100644 index 000000000..30ec56ad3 --- /dev/null +++ b/build_config/bench.rb @@ -0,0 +1,11 @@ +MRuby::Build.new('bench') do |conf| + # Gets set by the VS command prompts. + if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] + toolchain :visualcpp + else + toolchain :gcc + conf.cc.flags << '-O3' + end + + conf.gembox 'default' +end diff --git a/build_config/boxing.rb b/build_config/boxing.rb new file mode 100644 index 000000000..97c8e8ca9 --- /dev/null +++ b/build_config/boxing.rb @@ -0,0 +1,29 @@ +MRuby::Build.new('no-boxing') do |conf| + toolchain :gcc + + conf.gembox 'default' + conf.compilers.each do |c| + c.defines += %w(MRB_NO_BOXING) + end + conf.enable_test +end + +MRuby::Build.new('word_boxing') do |conf| + toolchain :gcc + + conf.gembox 'default' + conf.compilers.each do |c| + c.defines += %w(MRB_WORD_BOXING) + end + conf.enable_test +end + +MRuby::Build.new('nan_boxing') do |conf| + toolchain :gcc + + conf.gembox 'default' + conf.compilers.each do |c| + c.defines += %w(MRB_NAN_BOXING) + end + conf.enable_test +end diff --git a/build_config/chipKITMax32.rb b/build_config/chipKITMax32.rb new file mode 100644 index 000000000..bbee221f5 --- /dev/null +++ b/build_config/chipKITMax32.rb @@ -0,0 +1,70 @@ +# Cross Compiling configuration for Digilent chipKIT Max32 +# http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32 +# +# Requires MPIDE (https://github.com/chipKIT32/chipKIT32-MAX) +# +# This configuration is based on @kyab's version +# http://d.hatena.ne.jp/kyab/20130201 +MRuby::CrossBuild.new("chipKITMax32") do |conf| + toolchain :gcc + + # Mac OS X + # MPIDE_PATH = '/Applications/Mpide.app/Contents/Resources/Java' + # GNU Linux + MPIDE_PATH = '/opt/mpide-0023-linux-20120903' + + PIC32_PATH = "#{MPIDE_PATH}/hardware/pic32" + + conf.cc do |cc| + cc.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-gcc" + cc.include_paths << ["#{PIC32_PATH}/cores/pic32", + "#{PIC32_PATH}/variants/Max32", + "#{PIC32_PATH}/libraries"] + cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align + -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_ + -DMPIDEVER=0x01000202 -DMPIDE=23) + cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] + + #configuration for low memory environment + cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) + cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) + cc.defines << %w(MRB_GC_STRESS) + #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. + #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval + end + + conf.cxx do |cxx| + cxx.command = conf.cc.command.dup + cxx.include_paths = conf.cc.include_paths.dup + 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 = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar" + archiver.archive_options = 'rcs "%{outfile}" %{objs}' + end + + #no executables + conf.bins = [] + + #do not build test executable + conf.build_mrbtest_lib_only + + #disable C++ exception + conf.disable_cxx_exception + + #gems from core + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-enum-ext" + + #light-weight regular expression + conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" + + #Arduino API + #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" + +end diff --git a/build_config/clang-asan.rb b/build_config/clang-asan.rb new file mode 100644 index 000000000..e693332c2 --- /dev/null +++ b/build_config/clang-asan.rb @@ -0,0 +1,21 @@ +MRuby::Build.new do |conf| + toolchain :clang + # include the GEM box + conf.gembox 'default' + + # C compiler settings + conf.cc do |cc| + cc.flags << "-fsanitize=address,undefined" + cc.include_paths = ["#{root}/include"] + end + + # Linker settings + conf.linker do |linker| + linker.flags << "-fsanitize=address,undefined" + end + + # Turn on `enable_debug` for better debugging + enable_debug + conf.enable_bintest + conf.enable_test +end diff --git a/build_config/cross-32bit.rb b/build_config/cross-32bit.rb new file mode 100644 index 000000000..82d5d023f --- /dev/null +++ b/build_config/cross-32bit.rb @@ -0,0 +1,14 @@ +# Define cross build settings +MRuby::CrossBuild.new('cross-32bit') do |conf| + toolchain :gcc + + conf.cc.flags << "-m32" + conf.linker.flags << "-m32" + + # conf.build_mrbtest_lib_only + + conf.gem :core => "mruby-bin-mruby" + conf.gem "#{MRUBY_ROOT}/examples/mrbgems/c_and_ruby_extension_example" + + conf.test_runner.command = 'env' +end diff --git a/build_config/dreamcast_shelf.rb b/build_config/dreamcast_shelf.rb new file mode 100644 index 000000000..3ae53184d --- /dev/null +++ b/build_config/dreamcast_shelf.rb @@ -0,0 +1,94 @@ +# Cross Compiling configuration for the Sega Dreamcast +# This configuration requires KallistiOS (KOS) +# https://dreamcast.wiki +# +# Tested on GNU/Linux, MinGW-w64/MSYS2, Cygwin, macOS and MinGW/MSYS (see below) +# +MRuby::CrossBuild.new("dreamcast") do |conf| + toolchain :gcc + + # Support for DreamSDK (based on MinGW/MSYS) + # To compile mruby with DreamSDK, RubyInstaller for Windows should be installed + DREAMSDK_HOME = ENV["DREAMSDK_HOME"] + MSYS_ROOT = !(DREAMSDK_HOME.nil? || DREAMSDK_HOME.empty?) ? "#{DREAMSDK_HOME}/msys/1.0" : "" + + # Setting paths + DREAMCAST_PATH = "#{MSYS_ROOT}/opt/toolchains/dc" + KOS_PATH = "#{DREAMCAST_PATH}/kos" + BIN_PATH = "#{DREAMCAST_PATH}/sh-elf/bin" + + # C compiler + # Flags were extracted from KallistiOS environment files + conf.cc do |cc| + cc.command = "#{BIN_PATH}/sh-elf-gcc" + cc.include_paths << ["#{KOS_PATH}/include", "#{KOS_PATH}/kernel/arch/dreamcast/include", "#{KOS_PATH}/addons/include", "#{KOS_PATH}/../kos-ports/include"] + cc.flags << ["-O2", "-fomit-frame-pointer", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-Wall", "-g", "-fno-builtin", "-ml", "-m4-single-only", "-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_PATH}/utils/ldscripts/shlelf.xc", "-nodefaultlibs"] + cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] + cc.defines << %w(_arch_dreamcast) + cc.defines << %w(_arch_sub_pristine) + end + + # C++ compiler + conf.cxx do |cxx| + cxx.command = conf.cc.command.dup + cxx.include_paths = conf.cc.include_paths.dup + cxx.flags = conf.cc.flags.dup + cxx.flags << %w(-fno-rtti -fno-exceptions) + cxx.defines = conf.cc.defines.dup + cxx.compile_options = conf.cc.compile_options.dup + end + + # Linker + # There is an issue when making the mruby library with KallistiOS: + # 'newlib_kill.o' and 'newlib_getpid.o' aren't found so they are explicitly + # specified here at least for now. + conf.linker do |linker| + linker.command="#{BIN_PATH}/sh-elf-gcc" + linker.flags << ["#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_kill.o", "#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_getpid.o", "-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group"] + linker.library_paths << ["#{KOS_PATH}/lib/dreamcast", "#{KOS_PATH}/addons/lib/dreamcast", "#{KOS_PATH}/../kos-ports/lib"] + end + + # Archiver + conf.archiver do |archiver| + archiver.command = "#{BIN_PATH}/sh-elf-ar" + archiver.archive_options = 'rcs "%{outfile}" %{objs}' + end + + # No executables + conf.bins = [] + + # Do not build executable test + conf.build_mrbtest_lib_only + + # Disable C++ exception + conf.disable_cxx_exception + + # Gems from core + # removing mruby-io + conf.gem :core => "mruby-metaprog" + conf.gem :core => "mruby-pack" + conf.gem :core => "mruby-sprintf" + conf.gem :core => "mruby-print" + conf.gem :core => "mruby-math" + conf.gem :core => "mruby-time" + conf.gem :core => "mruby-struct" + conf.gem :core => "mruby-compar-ext" + conf.gem :core => "mruby-enum-ext" + conf.gem :core => "mruby-string-ext" + conf.gem :core => "mruby-numeric-ext" + conf.gem :core => "mruby-array-ext" + conf.gem :core => "mruby-hash-ext" + conf.gem :core => "mruby-range-ext" + conf.gem :core => "mruby-proc-ext" + conf.gem :core => "mruby-symbol-ext" + conf.gem :core => "mruby-random" + conf.gem :core => "mruby-object-ext" + conf.gem :core => "mruby-objectspace" + conf.gem :core => "mruby-fiber" + conf.gem :core => "mruby-enumerator" + conf.gem :core => "mruby-enum-lazy" + conf.gem :core => "mruby-toplevel-ext" + conf.gem :core => "mruby-kernel-ext" + conf.gem :core => "mruby-class-ext" + conf.gem :core => "mruby-compiler" +end diff --git a/build_config/host-cxx.rb b/build_config/host-cxx.rb new file mode 100644 index 000000000..ae05e63c2 --- /dev/null +++ b/build_config/host-cxx.rb @@ -0,0 +1,13 @@ +MRuby::Build.new do |conf| + toolchain :gcc + + enable_debug + # include the default GEMs + conf.gembox 'full-core' + + # C compiler settings + conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK) + conf.enable_debug + conf.enable_cxx_abi + conf.enable_test +end diff --git a/build_config/host-debug.rb b/build_config/host-debug.rb new file mode 100644 index 000000000..ad4106065 --- /dev/null +++ b/build_config/host-debug.rb @@ -0,0 +1,26 @@ +MRuby::Build.new('host') do |conf| + # load specific toolchain settings + + # Gets set by the VS command prompts. + if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] + toolchain :visualcpp + else + toolchain :gcc + end + + enable_debug + + # include the default GEMs + conf.gembox 'full-core' + + # C compiler settings + conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK MRB_NO_BOXING) + + # Generate mruby debugger command (require mruby-eval) + conf.gem :core => "mruby-bin-debugger" + + # test + enable_test + # bintest + enable_bintest +end diff --git a/build_config/host-gprof.rb b/build_config/host-gprof.rb new file mode 100644 index 000000000..31b952920 --- /dev/null +++ b/build_config/host-gprof.rb @@ -0,0 +1,14 @@ +MRuby::Build.new do |conf| + # load specific toolchain settings + toolchain :gcc + + # include the GEM box + conf.gembox 'full-core' + + conf.cc.flags << '-pg' + conf.linker.flags << '-pg' + + # Turn on `enable_debug` for better debugging + enable_debug + conf.enable_test +end diff --git a/build_config/host-m32.rb b/build_config/host-m32.rb new file mode 100644 index 000000000..39b2c952f --- /dev/null +++ b/build_config/host-m32.rb @@ -0,0 +1,15 @@ +MRuby::Build.new do |conf| + # load specific toolchain settings + toolchain :gcc + + # include the GEM box + conf.gembox 'full-core' + + conf.cc.flags << '-m32' + conf.linker.flags << '-m32' + + # Turn on `enable_debug` for better debugging + enable_debug + conf.enable_test + conf.enable_bintest +end diff --git a/build_config/host-shared.rb b/build_config/host-shared.rb new file mode 100644 index 000000000..8b5028837 --- /dev/null +++ b/build_config/host-shared.rb @@ -0,0 +1,36 @@ +MRuby::Build.new do |conf| + # load specific toolchain settings + + # Gets set by the VS command prompts. + if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] + toolchain :visualcpp + else + toolchain :gcc + end + + # include the GEM box + conf.gembox 'default' + + # C compiler settings + conf.cc do |cc| + cc.flags = '-fPIC' + end + + conf.archiver do |archiver| + archiver.command = 'gcc' + archiver.archive_options = '-shared -o %{outfile} %{objs}' + end + + # file extensions + conf.exts do |exts| + exts.library = '.so' + end + + # file separetor + # conf.file_separator = '/' + + # Turn on `enable_debug` for better debugging + enable_debug + conf.enable_bintest + conf.enable_test +end diff --git a/build_config/travis.rb b/build_config/travis.rb new file mode 100644 index 000000000..58a739ce6 --- /dev/null +++ b/build_config/travis.rb @@ -0,0 +1,39 @@ +MRuby::Build.new('full-debug') do |conf| + toolchain :gcc + enable_debug + + # include all core GEMs + conf.gembox 'full-core' + conf.cc.flags += %w(-Werror=declaration-after-statement) + conf.cc.defines += %w(MRB_GC_STRESS MRB_ENABLE_DEBUG_HOOK) + + conf.enable_test +end + +MRuby::Build.new do |conf| + toolchain :gcc + + # include all core GEMs + conf.gembox 'full-core' + conf.cc.flags += %w(-Werror=declaration-after-statement) + conf.compilers.each do |c| + c.defines += %w(MRB_GC_FIXED_ARENA) + end + conf.enable_bintest + conf.enable_test +end + +MRuby::Build.new('cxx_abi') do |conf| + toolchain :gcc + + conf.gembox 'full-core' + conf.cc.flags += %w(-fpermissive) + conf.compilers.each do |c| + c.defines += %w(MRB_GC_FIXED_ARENA) + end + conf.enable_test + + enable_cxx_abi + + build_mrbc_exec +end diff --git a/doc/guides/compile.md b/doc/guides/compile.md index 233c3e594..ad57970e3 100644 --- a/doc/guides/compile.md +++ b/doc/guides/compile.md @@ -24,40 +24,29 @@ Optional: ## Build -To compile `mruby`, just call `rake` inside of the mruby source -root. To generate and execute the test tools call `rake test`. To -clean all build files call `rake clean`. To see full command line on -build, call `rake -v`. - -If you want to compile for the specific configuration, specify -`MRUBY_TARGET` or `TARGET` environment variable, e.g - -```sh -rake TAGRET=host -``` - -The default target is `host`. The compilation target desciption files -(with `.rb` suffix) are contained in the `target` directory. - -A build description file contains the build configuration of mruby and -looks like the following for example: - +Inside of the root directory of the mruby source a file exists +called *build_config.rb*. This file contains the build configuration +of mruby and looks like this for example: ```ruby MRuby::Build.new do |conf| toolchain :gcc end ``` -All tools necessary to compile mruby can be set or modified here. In -case you want to try different configuration, you can create a new -configuration file under `target` and specify the configuration using -the `MRUBY_TARGET` environment variable. +All tools necessary to compile mruby can be set or modified here. In case +you want to maintain an additional *build_config.rb* you can define a +customized path using the *$MRUBY_CONFIG* environment variable. If the +path doesn't exist, *build_config/${MRUBY_CONFIG}.rb* is used. + +To compile just call `rake` inside of the mruby source root. To +generate and execute the test tools call `rake test`. To clean +all build files call `rake clean`. To see full command line on +build, call `rake -v`. ## Build Configuration -To create a new configuration, copy the existing configuration in the -`target` directory, and modify it. We wish you submit a pull-request, -once you created a new configuration for a new platform. +We wish you submit a pull-request to *build_config/**PLATFORM**.rb*, once you +created a new configuration for a new platform. Inside of the configuration file, the following options can be configured based on your environment. diff --git a/doc/mruby3.md b/doc/mruby3.md index 029c9887e..e611a1b16 100644 --- a/doc/mruby3.md +++ b/doc/mruby3.md @@ -3,45 +3,29 @@ User visible changes in `mruby3` # Build System -You can specify `TARGET` option to `rake` via a command line -option, or via an environment variable, e.g. - -`rake TARGET=host all` - -or - -`TARGET=host rake all` - -It's much easier to switch multiple targets than the -previous `build_config.rb` system. - ## `presym` target The first compilation of `mruby` may require generation of a static symbol table named `build/presym`. You can generate the table by `rake gensym`. -## `target` directory +## `build_config` directory -Build target specification files are loaded from `target` -directory. The default `TARGET` is `host` which is described -in `target/host.rb`. There are many other targets for example: +Typical build configuration files are located in `build_config` +directory. For examples: * `host-gprof`: compiles with `gprof` for performance tuning * `host-m32`: compiles in gcc 32bit mode on 64bit platforms * `boxing`: compiles all three boxing options * `clang-asan`: compiles with `clang`'s Address Sanitizer -`target/host.rb` comes with comments to help writing a new -target description. - -If you want to have your target description out of the -source tree, you can specify the path to the description -file in `MRUBY_CONFIG`. +`build_config/${MRUBY_CONFIG}.rb` is used if the path specified +in `MRUBY_CONFIG` doesn't exist, so you can specify it as +`rake MRUBY_CONFIG=boxing`. -# Build Target Contribution +# Build Configuration Contribution -When you write a new target description, please +When you write a new build configuration description, please contribute. We welcome your contribution as a GitHub pull-request. diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index fa3853342..d07890621 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -39,6 +39,17 @@ module MRuby class Build class << self attr_accessor :current + def load_config + path = ENV['MRUBY_CONFIG'] + if path.nil? || path.empty? + path = "#{MRUBY_ROOT}/build_config.rb" + elsif !File.file?(path) && !Pathname.new(path).absolute? + f = "#{MRUBY_ROOT}/build_config/#{path}.rb" + path = File.exist?(f) ? f : File.extname(path).empty? ? f : path + end + load path + path + end end include Rake::DSL include LoadGems diff --git a/lib/mruby/lockfile.rb b/lib/mruby/lockfile.rb index 5d4313649..5abf804b4 100644 --- a/lib/mruby/lockfile.rb +++ b/lib/mruby/lockfile.rb @@ -26,7 +26,7 @@ module MRuby end def instance - @instance ||= new("#{MRUBY_ROOT}/build/#{MRUBY_TARGET}.lock") + @instance ||= new("#{MRUBY_CONFIG}.lock") end end diff --git a/target/ArduinoDue.rb b/target/ArduinoDue.rb deleted file mode 100644 index 5859f8508..000000000 --- a/target/ArduinoDue.rb +++ /dev/null @@ -1,74 +0,0 @@ -# Cross Compiling configuration for Arduino Due -# http://arduino.cc/en/Main/ArduinoBoardDue -# -# Requires Arduino IDE >= 1.5 -MRuby::CrossBuild.new("ArduinoDue") do |conf| - toolchain :gcc - - # Mac OS X, Arduino IDE <= 1.5.6 - # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Resources/Java' - # Mac OS X, Arduino IDE >= 1.5.7 - # ARDUINO_PATH = '/Applications/Arduino.app/Contents/Java' - # GNU Linux - ARDUINO_PATH = '/opt/arduino' - # Arduino IDE <= 1.5.6 - BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/g++_arm_none_eabi/bin" - # Arduino IDE >= 1.5.7 - # BIN_PATH = "#{ARDUINO_PATH}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin" - SAM_PATH = "#{ARDUINO_PATH}/hardware/arduino/sam" - TARGET_PATH = "#{SAM_PATH}/variants/arduino_due_x" - - conf.cc do |cc| - cc.command = "#{BIN_PATH}/arm-none-eabi-gcc" - cc.include_paths << ["#{SAM_PATH}/system/libsam", "#{SAM_PATH}/system/CMSIS/CMSIS/Include/", - "#{SAM_PATH}/system/CMSIS/Device/ATMEL/", - "#{SAM_PATH}/cores/arduino", "#{SAM_PATH}/libraries","#{TARGET_PATH}"] - cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 - -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM - -D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due") - cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] - - #configuration for low memory environment - cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) - cc.defines << %w(KHASH_DEFAULT_SIZE=8) - cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) - cc.defines << %w(MRB_GC_STRESS) - #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. - #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval - end - - conf.cxx do |cxx| - cxx.command = conf.cc.command.dup - cxx.include_paths = conf.cc.include_paths.dup - cxx.flags = conf.cc.flags.dup - cxx.flags << %w(-fno-rtti -fno-exceptions) - cxx.defines = conf.cc.defines.dup - cxx.compile_options = conf.cc.compile_options.dup - end - - conf.archiver do |archiver| - archiver.command = "#{BIN_PATH}/arm-none-eabi-ar" - archiver.archive_options = 'rcs "%{outfile}" %{objs}' - end - - #no executables - conf.bins = [] - - #do not build executable test - conf.build_mrbtest_lib_only - - #disable C++ exception - conf.disable_cxx_exception - - #gems from core - conf.gem :core => "mruby-print" - conf.gem :core => "mruby-math" - conf.gem :core => "mruby-enum-ext" - - #light-weight regular expression - conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" - - #Arduino API - #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" - -end diff --git a/target/IntelEdison.rb b/target/IntelEdison.rb deleted file mode 100644 index a22f9cfd2..000000000 --- a/target/IntelEdison.rb +++ /dev/null @@ -1,69 +0,0 @@ -# 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 diff --git a/target/IntelGalileo.rb b/target/IntelGalileo.rb deleted file mode 100644 index e996efa5b..000000000 --- a/target/IntelGalileo.rb +++ /dev/null @@ -1,89 +0,0 @@ -# Cross Compiling configuration for Intel Galileo on Arduino environment -# http://arduino.cc/en/ArduinoCertified/IntelGalileo -# -# Requires Arduino IDE for Intel Galileo -MRuby::CrossBuild.new("Galileo") do |conf| - toolchain :gcc - - # Mac OS X - # Assume you renamed Arduino.app to Arduino_Galileo.app - GALILEO_ARDUINO_PATH = '/Applications/Arduino_Galileo.app/Contents/Resources/Java' - # GNU Linux - #ARDUINO_GALILEO_PATH = '/opt/arduino' - - GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc" - GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc" - GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86" - - - conf.cc do |cc| - cc.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-gcc" - cc.include_paths << ["#{GALILEO_X86_PATH}/cores/arduino", "#{GALILEO_X86_PATH}/variants/galileo_fab_d"] - cc.flags = %w(-m32 -march=i586 -c -g -Os -w - -ffunction-sections -fdata-sections -MMD -DARDUINO=153) - cc.flags << "--sysroot=#{GALILEO_SYSROOT}" - cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] - end - - conf.cxx do |cxx| - cxx.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++" - cxx.include_paths = conf.cc.include_paths.dup - cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++" - cxx.include_paths << "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc/usr/include/c++/i586-poky-linux-uclibc" - 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 = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar" - archiver.archive_options = 'rcs "%{outfile}" %{objs}' - end - - conf.linker do |linker| - linker.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-g++" - linker.flags = %w(-m32 -march=i586) - linker.flags << "--sysroot=#{GALILEO_SYSROOT}" - linker.flags << %w(-Os -Wl,--gc-sections) - linker.libraries = %w(m pthread) - end - - #no executables - conf.bins = [] - - #do not build executable test - conf.build_mrbtest_lib_only - - #official mrbgems - conf.gem :core => "mruby-sprintf" - conf.gem :core => "mruby-print" - conf.gem :core => "mruby-math" - conf.gem :core => "mruby-time" - conf.gem :core => "mruby-struct" - conf.gem :core => "mruby-enum-ext" - conf.gem :core => "mruby-string-ext" - conf.gem :core => "mruby-numeric-ext" - conf.gem :core => "mruby-array-ext" - conf.gem :core => "mruby-hash-ext" - conf.gem :core => "mruby-range-ext" - conf.gem :core => "mruby-proc-ext" - conf.gem :core => "mruby-symbol-ext" - conf.gem :core => "mruby-random" - conf.gem :core => "mruby-object-ext" - conf.gem :core => "mruby-objectspace" - conf.gem :core => "mruby-fiber" - conf.gem :core => "mruby-toplevel-ext" - - #lightweigh regular expression - conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" - - #Arduino API - #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" do |g| - # g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Wire" - # g.cxx.include_paths << "#{GALILEO_X86_PATH}/libraries/Servo" - - #enable unsupported Servo class - # g.cxx.defines << "MRUBY_ARDUINO_GALILEO_ENABLE_SERVO" - #end - -end diff --git a/target/RX630.rb b/target/RX630.rb deleted file mode 100644 index 01c883958..000000000 --- a/target/RX630.rb +++ /dev/null @@ -1,65 +0,0 @@ -# Cross Compiling configuration for RX630 -# http://gadget.renesas.com/ -# -# Requires gnurx_v14.03 -MRuby::CrossBuild.new("RX630") do |conf| - toolchain :gcc - - # Linux - BIN_PATH = "/usr/share/gnurx_v14.03_elf-1/bin" - - conf.cc do |cc| - cc.command = "#{BIN_PATH}/rx-elf-gcc" - cc.flags = "-Wall -g -O2 -flto -mcpu=rx600 -m64bit-doubles" - cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] - - #configuration for low memory environment - cc.defines << %w(MRB_USE_FLOAT32) - cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) - cc.defines << %w(KHASH_DEFAULT_SIZE=8) - cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) - cc.defines << %w(MRB_GC_STRESS) - cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. - #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval - end - - conf.cxx do |cxx| - cxx.command = conf.cc.command.dup - cxx.include_paths = conf.cc.include_paths.dup - cxx.flags = conf.cc.flags.dup - cxx.defines = conf.cc.defines.dup - cxx.compile_options = conf.cc.compile_options.dup - end - - conf.linker do |linker| - linker.command="#{BIN_PATH}/rx-elf-ld" - end - - conf.archiver do |archiver| - archiver.command = "#{BIN_PATH}/rx-elf-ar" - archiver.archive_options = 'rcs "%{outfile}" %{objs}' - end - - #no executables - conf.bins = [] - - #do not build executable test - conf.build_mrbtest_lib_only - - #disable C++ exception - conf.disable_cxx_exception - - #gems from core - conf.gem :core => "mruby-sprintf" - conf.gem :core => "mruby-print" - conf.gem :core => "mruby-math" - conf.gem :core => "mruby-enum-ext" - conf.gem :core => "mruby-numeric-ext" - - #light-weight regular expression - #conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" - - #Arduino API - #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" - -end diff --git a/target/android_arm64-v8a.rb b/target/android_arm64-v8a.rb deleted file mode 100644 index 7fab2f063..000000000 --- a/target/android_arm64-v8a.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Requires Android NDK r13 or later. -MRuby::CrossBuild.new('android-arm64-v8a') do |conf| - params = { - :arch => 'arm64-v8a', - :platform => 'android-24', - :toolchain => :clang, - } - toolchain :android, params - - conf.gembox 'default' -end diff --git a/target/android_armeabi.rb b/target/android_armeabi.rb deleted file mode 100644 index 41a657c3b..000000000 --- a/target/android_armeabi.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Requires Android NDK r13 or later. -MRuby::CrossBuild.new('android-armeabi') do |conf| - params = { - :arch => 'armeabi', - :platform => 'android-24', - :toolchain => :clang, - } - toolchain :android, params - - conf.gembox 'default' -end diff --git a/target/android_armeabi_v7a_neon_hard.rb b/target/android_armeabi_v7a_neon_hard.rb deleted file mode 100644 index 6129b238e..000000000 --- a/target/android_armeabi_v7a_neon_hard.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Requires Android NDK r13 or later. -MRuby::CrossBuild.new('android-armeabi-v7a-neon-hard') do |conf| - params = { - :arch => 'armeabi-v7a', - :mfpu => 'neon', - :mfloat_abi => 'hard', - :platform => 'android-24', - :toolchain => :clang, - } - toolchain :android, params - - conf.gembox 'default' -end diff --git a/target/appveyor.rb b/target/appveyor.rb deleted file mode 100644 index e084a6a36..000000000 --- a/target/appveyor.rb +++ /dev/null @@ -1,18 +0,0 @@ -def setup_option(conf) - conf.cc.flags[0].delete("/Zi") unless ENV['CFLAGS'] - conf.cxx.flags[0].delete("/Zi") unless ENV['CFLAGS'] || ENV['CXXFLAGS'] - conf.linker.flags << "/DEBUG:NONE" unless ENV['LDFLAGS'] -end - -MRuby::Build.new do |conf| - toolchain :visualcpp - - # include all core GEMs - conf.gembox 'full-core' - conf.compilers.each do |c| - c.defines += %w(MRB_GC_FIXED_ARENA) - end - setup_option(conf) - conf.enable_bintest - conf.enable_test -end diff --git a/target/bench.rb b/target/bench.rb deleted file mode 100644 index 30ec56ad3..000000000 --- a/target/bench.rb +++ /dev/null @@ -1,11 +0,0 @@ -MRuby::Build.new('bench') do |conf| - # Gets set by the VS command prompts. - if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] - toolchain :visualcpp - else - toolchain :gcc - conf.cc.flags << '-O3' - end - - conf.gembox 'default' -end diff --git a/target/boxing.rb b/target/boxing.rb deleted file mode 100644 index 97c8e8ca9..000000000 --- a/target/boxing.rb +++ /dev/null @@ -1,29 +0,0 @@ -MRuby::Build.new('no-boxing') do |conf| - toolchain :gcc - - conf.gembox 'default' - conf.compilers.each do |c| - c.defines += %w(MRB_NO_BOXING) - end - conf.enable_test -end - -MRuby::Build.new('word_boxing') do |conf| - toolchain :gcc - - conf.gembox 'default' - conf.compilers.each do |c| - c.defines += %w(MRB_WORD_BOXING) - end - conf.enable_test -end - -MRuby::Build.new('nan_boxing') do |conf| - toolchain :gcc - - conf.gembox 'default' - conf.compilers.each do |c| - c.defines += %w(MRB_NAN_BOXING) - end - conf.enable_test -end diff --git a/target/chipKITMax32.rb b/target/chipKITMax32.rb deleted file mode 100644 index bbee221f5..000000000 --- a/target/chipKITMax32.rb +++ /dev/null @@ -1,70 +0,0 @@ -# Cross Compiling configuration for Digilent chipKIT Max32 -# http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32 -# -# Requires MPIDE (https://github.com/chipKIT32/chipKIT32-MAX) -# -# This configuration is based on @kyab's version -# http://d.hatena.ne.jp/kyab/20130201 -MRuby::CrossBuild.new("chipKITMax32") do |conf| - toolchain :gcc - - # Mac OS X - # MPIDE_PATH = '/Applications/Mpide.app/Contents/Resources/Java' - # GNU Linux - MPIDE_PATH = '/opt/mpide-0023-linux-20120903' - - PIC32_PATH = "#{MPIDE_PATH}/hardware/pic32" - - conf.cc do |cc| - cc.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-gcc" - cc.include_paths << ["#{PIC32_PATH}/cores/pic32", - "#{PIC32_PATH}/variants/Max32", - "#{PIC32_PATH}/libraries"] - cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align - -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_ - -DMPIDEVER=0x01000202 -DMPIDE=23) - cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] - - #configuration for low memory environment - cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) - cc.defines << %w(KHASH_DEFAULT_SIZE=8) - cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20) - cc.defines << %w(MRB_GC_STRESS) - #cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio. - #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval - end - - conf.cxx do |cxx| - cxx.command = conf.cc.command.dup - cxx.include_paths = conf.cc.include_paths.dup - 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 = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar" - archiver.archive_options = 'rcs "%{outfile}" %{objs}' - end - - #no executables - conf.bins = [] - - #do not build test executable - conf.build_mrbtest_lib_only - - #disable C++ exception - conf.disable_cxx_exception - - #gems from core - conf.gem :core => "mruby-print" - conf.gem :core => "mruby-math" - conf.gem :core => "mruby-enum-ext" - - #light-weight regular expression - conf.gem :github => "masamitsu-murase/mruby-hs-regexp", :branch => "master" - - #Arduino API - #conf.gem :github =>"kyab/mruby-arduino", :branch => "master" - -end diff --git a/target/clang-asan.rb b/target/clang-asan.rb deleted file mode 100644 index e693332c2..000000000 --- a/target/clang-asan.rb +++ /dev/null @@ -1,21 +0,0 @@ -MRuby::Build.new do |conf| - toolchain :clang - # include the GEM box - conf.gembox 'default' - - # C compiler settings - conf.cc do |cc| - cc.flags << "-fsanitize=address,undefined" - cc.include_paths = ["#{root}/include"] - end - - # Linker settings - conf.linker do |linker| - linker.flags << "-fsanitize=address,undefined" - end - - # Turn on `enable_debug` for better debugging - enable_debug - conf.enable_bintest - conf.enable_test -end diff --git a/target/cross-32bit.rb b/target/cross-32bit.rb deleted file mode 100644 index 82d5d023f..000000000 --- a/target/cross-32bit.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Define cross build settings -MRuby::CrossBuild.new('cross-32bit') do |conf| - toolchain :gcc - - conf.cc.flags << "-m32" - conf.linker.flags << "-m32" - - # conf.build_mrbtest_lib_only - - conf.gem :core => "mruby-bin-mruby" - conf.gem "#{MRUBY_ROOT}/examples/mrbgems/c_and_ruby_extension_example" - - conf.test_runner.command = 'env' -end diff --git a/target/dreamcast_shelf.rb b/target/dreamcast_shelf.rb deleted file mode 100644 index 3ae53184d..000000000 --- a/target/dreamcast_shelf.rb +++ /dev/null @@ -1,94 +0,0 @@ -# Cross Compiling configuration for the Sega Dreamcast -# This configuration requires KallistiOS (KOS) -# https://dreamcast.wiki -# -# Tested on GNU/Linux, MinGW-w64/MSYS2, Cygwin, macOS and MinGW/MSYS (see below) -# -MRuby::CrossBuild.new("dreamcast") do |conf| - toolchain :gcc - - # Support for DreamSDK (based on MinGW/MSYS) - # To compile mruby with DreamSDK, RubyInstaller for Windows should be installed - DREAMSDK_HOME = ENV["DREAMSDK_HOME"] - MSYS_ROOT = !(DREAMSDK_HOME.nil? || DREAMSDK_HOME.empty?) ? "#{DREAMSDK_HOME}/msys/1.0" : "" - - # Setting paths - DREAMCAST_PATH = "#{MSYS_ROOT}/opt/toolchains/dc" - KOS_PATH = "#{DREAMCAST_PATH}/kos" - BIN_PATH = "#{DREAMCAST_PATH}/sh-elf/bin" - - # C compiler - # Flags were extracted from KallistiOS environment files - conf.cc do |cc| - cc.command = "#{BIN_PATH}/sh-elf-gcc" - cc.include_paths << ["#{KOS_PATH}/include", "#{KOS_PATH}/kernel/arch/dreamcast/include", "#{KOS_PATH}/addons/include", "#{KOS_PATH}/../kos-ports/include"] - cc.flags << ["-O2", "-fomit-frame-pointer", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-Wall", "-g", "-fno-builtin", "-ml", "-m4-single-only", "-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_PATH}/utils/ldscripts/shlelf.xc", "-nodefaultlibs"] - cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"] - cc.defines << %w(_arch_dreamcast) - cc.defines << %w(_arch_sub_pristine) - end - - # C++ compiler - conf.cxx do |cxx| - cxx.command = conf.cc.command.dup - cxx.include_paths = conf.cc.include_paths.dup - cxx.flags = conf.cc.flags.dup - cxx.flags << %w(-fno-rtti -fno-exceptions) - cxx.defines = conf.cc.defines.dup - cxx.compile_options = conf.cc.compile_options.dup - end - - # Linker - # There is an issue when making the mruby library with KallistiOS: - # 'newlib_kill.o' and 'newlib_getpid.o' aren't found so they are explicitly - # specified here at least for now. - conf.linker do |linker| - linker.command="#{BIN_PATH}/sh-elf-gcc" - linker.flags << ["#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_kill.o", "#{MSYS_ROOT}/opt/toolchains/dc/kos/kernel/build/newlib_getpid.o", "-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group"] - linker.library_paths << ["#{KOS_PATH}/lib/dreamcast", "#{KOS_PATH}/addons/lib/dreamcast", "#{KOS_PATH}/../kos-ports/lib"] - end - - # Archiver - conf.archiver do |archiver| - archiver.command = "#{BIN_PATH}/sh-elf-ar" - archiver.archive_options = 'rcs "%{outfile}" %{objs}' - end - - # No executables - conf.bins = [] - - # Do not build executable test - conf.build_mrbtest_lib_only - - # Disable C++ exception - conf.disable_cxx_exception - - # Gems from core - # removing mruby-io - conf.gem :core => "mruby-metaprog" - conf.gem :core => "mruby-pack" - conf.gem :core => "mruby-sprintf" - conf.gem :core => "mruby-print" - conf.gem :core => "mruby-math" - conf.gem :core => "mruby-time" - conf.gem :core => "mruby-struct" - conf.gem :core => "mruby-compar-ext" - conf.gem :core => "mruby-enum-ext" - conf.gem :core => "mruby-string-ext" - conf.gem :core => "mruby-numeric-ext" - conf.gem :core => "mruby-array-ext" - conf.gem :core => "mruby-hash-ext" - conf.gem :core => "mruby-range-ext" - conf.gem :core => "mruby-proc-ext" - conf.gem :core => "mruby-symbol-ext" - conf.gem :core => "mruby-random" - conf.gem :core => "mruby-object-ext" - conf.gem :core => "mruby-objectspace" - conf.gem :core => "mruby-fiber" - conf.gem :core => "mruby-enumerator" - conf.gem :core => "mruby-enum-lazy" - conf.gem :core => "mruby-toplevel-ext" - conf.gem :core => "mruby-kernel-ext" - conf.gem :core => "mruby-class-ext" - conf.gem :core => "mruby-compiler" -end diff --git a/target/host-cxx.rb b/target/host-cxx.rb deleted file mode 100644 index ae05e63c2..000000000 --- a/target/host-cxx.rb +++ /dev/null @@ -1,13 +0,0 @@ -MRuby::Build.new do |conf| - toolchain :gcc - - enable_debug - # include the default GEMs - conf.gembox 'full-core' - - # C compiler settings - conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK) - conf.enable_debug - conf.enable_cxx_abi - conf.enable_test -end diff --git a/target/host-debug.rb b/target/host-debug.rb deleted file mode 100644 index ad4106065..000000000 --- a/target/host-debug.rb +++ /dev/null @@ -1,26 +0,0 @@ -MRuby::Build.new('host') do |conf| - # load specific toolchain settings - - # Gets set by the VS command prompts. - if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] - toolchain :visualcpp - else - toolchain :gcc - end - - enable_debug - - # include the default GEMs - conf.gembox 'full-core' - - # C compiler settings - conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK MRB_NO_BOXING) - - # Generate mruby debugger command (require mruby-eval) - conf.gem :core => "mruby-bin-debugger" - - # test - enable_test - # bintest - enable_bintest -end diff --git a/target/host-gprof.rb b/target/host-gprof.rb deleted file mode 100644 index 31b952920..000000000 --- a/target/host-gprof.rb +++ /dev/null @@ -1,14 +0,0 @@ -MRuby::Build.new do |conf| - # load specific toolchain settings - toolchain :gcc - - # include the GEM box - conf.gembox 'full-core' - - conf.cc.flags << '-pg' - conf.linker.flags << '-pg' - - # Turn on `enable_debug` for better debugging - enable_debug - conf.enable_test -end diff --git a/target/host-m32.rb b/target/host-m32.rb deleted file mode 100644 index 39b2c952f..000000000 --- a/target/host-m32.rb +++ /dev/null @@ -1,15 +0,0 @@ -MRuby::Build.new do |conf| - # load specific toolchain settings - toolchain :gcc - - # include the GEM box - conf.gembox 'full-core' - - conf.cc.flags << '-m32' - conf.linker.flags << '-m32' - - # Turn on `enable_debug` for better debugging - enable_debug - conf.enable_test - conf.enable_bintest -end diff --git a/target/host-shared.rb b/target/host-shared.rb deleted file mode 100644 index 8b5028837..000000000 --- a/target/host-shared.rb +++ /dev/null @@ -1,36 +0,0 @@ -MRuby::Build.new do |conf| - # load specific toolchain settings - - # Gets set by the VS command prompts. - if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] - toolchain :visualcpp - else - toolchain :gcc - end - - # include the GEM box - conf.gembox 'default' - - # C compiler settings - conf.cc do |cc| - cc.flags = '-fPIC' - end - - conf.archiver do |archiver| - archiver.command = 'gcc' - archiver.archive_options = '-shared -o %{outfile} %{objs}' - end - - # file extensions - conf.exts do |exts| - exts.library = '.so' - end - - # file separetor - # conf.file_separator = '/' - - # Turn on `enable_debug` for better debugging - enable_debug - conf.enable_bintest - conf.enable_test -end diff --git a/target/host.rb b/target/host.rb deleted file mode 100644 index 0a92b9108..000000000 --- a/target/host.rb +++ /dev/null @@ -1,86 +0,0 @@ -MRuby::Build.new do |conf| - # load specific toolchain settings - - # Gets set by the VS command prompts. - if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] - toolchain :visualcpp - else - toolchain :gcc - end - - # Use mrbgems - # conf.gem 'examples/mrbgems/ruby_extension_example' - # conf.gem 'examples/mrbgems/c_extension_example' do |g| - # g.cc.flags << '-g' # append cflags in this gem - # end - # conf.gem 'examples/mrbgems/c_and_ruby_extension_example' - # conf.gem :core => 'mruby-eval' - # conf.gem :mgem => 'mruby-onig-regexp' - # conf.gem :github => 'mattn/mruby-onig-regexp' - # conf.gem :git => 'git@github.com:mattn/mruby-onig-regexp.git', :branch => 'master', :options => '-v' - - # include the GEM box - conf.gembox 'full-core' - - # C compiler settings - # conf.cc do |cc| - # cc.command = ENV['CC'] || 'gcc' - # cc.flags = [ENV['CFLAGS'] || %w()] - # cc.include_paths = ["#{root}/include"] - # cc.defines = %w() - # cc.option_include_path = %q[-I"%s"] - # cc.option_define = '-D%s' - # cc.compile_options = %Q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"] - # end - - # mrbc settings - # conf.mrbc do |mrbc| - # mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers - # end - - # Linker settings - # conf.linker do |linker| - # linker.command = ENV['LD'] || 'gcc' - # linker.flags = [ENV['LDFLAGS'] || []] - # linker.flags_before_libraries = [] - # linker.libraries = %w() - # linker.flags_after_libraries = [] - # linker.library_paths = [] - # linker.option_library = '-l%s' - # linker.option_library_path = '-L%s' - # linker.link_options = "%{flags} -o "%{outfile}" %{objs} %{libs}" - # end - - # Archiver settings - # conf.archiver do |archiver| - # archiver.command = ENV['AR'] || 'ar' - # archiver.archive_options = 'rs "%{outfile}" %{objs}' - # end - - # Parser generator settings - # conf.yacc do |yacc| - # yacc.command = ENV['YACC'] || 'bison' - # yacc.compile_options = %q[-o "%{outfile}" "%{infile}"] - # end - - # gperf settings - # conf.gperf do |gperf| - # gperf.command = 'gperf' - # gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"] - # end - - # file extensions - # conf.exts do |exts| - # exts.object = '.o' - # exts.executable = '' # '.exe' if Windows - # exts.library = '.a' - # end - - # file separetor - # conf.file_separator = '/' - - # Turn on `enable_debug` for better debugging - # conf.enable_debug - conf.enable_bintest - conf.enable_test -end diff --git a/target/travis.rb b/target/travis.rb deleted file mode 100644 index 58a739ce6..000000000 --- a/target/travis.rb +++ /dev/null @@ -1,39 +0,0 @@ -MRuby::Build.new('full-debug') do |conf| - toolchain :gcc - enable_debug - - # include all core GEMs - conf.gembox 'full-core' - conf.cc.flags += %w(-Werror=declaration-after-statement) - conf.cc.defines += %w(MRB_GC_STRESS MRB_ENABLE_DEBUG_HOOK) - - conf.enable_test -end - -MRuby::Build.new do |conf| - toolchain :gcc - - # include all core GEMs - conf.gembox 'full-core' - conf.cc.flags += %w(-Werror=declaration-after-statement) - conf.compilers.each do |c| - c.defines += %w(MRB_GC_FIXED_ARENA) - end - conf.enable_bintest - conf.enable_test -end - -MRuby::Build.new('cxx_abi') do |conf| - toolchain :gcc - - conf.gembox 'full-core' - conf.cc.flags += %w(-fpermissive) - conf.compilers.each do |c| - c.defines += %w(MRB_GC_FIXED_ARENA) - end - conf.enable_test - - enable_cxx_abi - - build_mrbc_exec -end diff --git a/tasks/benchmark.rake b/tasks/benchmark.rake index 661fd2ada..e7500ccd9 100644 --- a/tasks/benchmark.rake +++ b/tasks/benchmark.rake @@ -9,7 +9,11 @@ def bm_files end def build_config_name - MRUBY_TARGET + if !ENV['MRUBY_CONFIG'].to_s.empty? + File.basename(ENV['MRUBY_CONFIG'], '.rb').gsub('build_config_', '') + else + "build" + end end def plot_file -- cgit v1.2.3