Unverified Commit 76eafa46 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5098 from shuujii/revert-MRUBY_TARGET-mechanism

Revert `MRUBY_TARGET` mechanism; ref #5096
parents 78d185ef 81c21088
...@@ -6,7 +6,7 @@ jobs: ...@@ -6,7 +6,7 @@ jobs:
Ubuntu-1604: Ubuntu-1604:
runs-on: ubuntu-16.04 runs-on: ubuntu-16.04
env: env:
MRUBY_TARGET: travis MRUBY_CONFIG: travis
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: apt - name: apt
...@@ -17,7 +17,7 @@ jobs: ...@@ -17,7 +17,7 @@ jobs:
Ubuntu-1804-gcc: Ubuntu-1804-gcc:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
env: env:
MRUBY_TARGET: travis MRUBY_CONFIG: travis
CC: gcc CC: gcc
CXX: g++ CXX: g++
steps: steps:
...@@ -30,7 +30,7 @@ jobs: ...@@ -30,7 +30,7 @@ jobs:
Ubuntu-1804-clang: Ubuntu-1804-clang:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
env: env:
MRUBY_TARGET: travis MRUBY_CONFIG: travis
CC: clang CC: clang
CXX: clang++ CXX: clang++
steps: steps:
...@@ -43,7 +43,7 @@ jobs: ...@@ -43,7 +43,7 @@ jobs:
macOS: macOS:
runs-on: macos-latest runs-on: macos-latest
env: env:
MRUBY_TARGET: travis MRUBY_CONFIG: travis
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: brew - name: brew
...@@ -54,7 +54,7 @@ jobs: ...@@ -54,7 +54,7 @@ jobs:
Windows-MinGW: Windows-MinGW:
runs-on: windows-latest runs-on: windows-latest
env: env:
MRUBY_TARGET: travis MRUBY_CONFIG: travis
CFLAGS: -g -O1 -Wall -Wundef CFLAGS: -g -O1 -Wall -Wundef
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
...@@ -66,7 +66,7 @@ jobs: ...@@ -66,7 +66,7 @@ jobs:
Windows-Cygwin: Windows-Cygwin:
runs-on: windows-latest runs-on: windows-latest
env: env:
MRUBY_TARGET: travis MRUBY_CONFIG: travis
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- uses: actions/cache@v1 - uses: actions/cache@v1
...@@ -91,7 +91,7 @@ jobs: ...@@ -91,7 +91,7 @@ jobs:
Windows-VC: Windows-VC:
runs-on: windows-latest runs-on: windows-latest
env: env:
MRUBY_TARGET: appveyor MRUBY_CONFIG: appveyor
# TODO(take-cheeze): Re-enable /O2 # TODO(take-cheeze): Re-enable /O2
CFLAGS: "/c /nologo /W3 /we4013 /Zi /MD /D_CRT_SECURE_NO_WARNINGS" CFLAGS: "/c /nologo /W3 /we4013 /Zi /MD /D_CRT_SECURE_NO_WARNINGS"
CXXFLAGS: "/c /nologo /W3 /Zi /MD /EHs /D_CRT_SECURE_NO_WARNINGS" CXXFLAGS: "/c /nologo /W3 /Zi /MD /EHs /D_CRT_SECURE_NO_WARNINGS"
......
...@@ -8,7 +8,7 @@ jobs: ...@@ -8,7 +8,7 @@ jobs:
- export PATH="/usr/local/opt/bison/bin:$PATH" - export PATH="/usr/local/opt/bison/bin:$PATH"
env: env:
- MRUBY_TARGET=travis - MRUBY_CONFIG=travis
script: script:
- rake gensym && rake -m && rake test - rake gensym && rake -m && rake test
...@@ -38,22 +38,10 @@ The URL of the mruby home-page is: https://mruby.org. ...@@ -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). 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. 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=<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 ## Building documentation
There are two sets of documentation in mruby: the mruby API (generated by yard) and C API (Doxygen) There are two sets of documentation in mruby: the mruby API (generated by yard) and C API (Doxygen)
......
...@@ -14,14 +14,7 @@ require "mruby-core-ext" ...@@ -14,14 +14,7 @@ require "mruby-core-ext"
require "mruby/build" require "mruby/build"
# load configuration file # load configuration file
if ENV['MRUBY_CONFIG'] MRUBY_CONFIG = MRuby::Build.load_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
# load basic rules # load basic rules
MRuby.each_target do |build| MRuby.each_target do |build|
......
...@@ -40,7 +40,7 @@ init: ...@@ -40,7 +40,7 @@ init:
build_script: build_script:
- set MRUBY_TARGET=appveyor - set MRUBY_CONFIG=appveyor
- rake gensym - rake gensym
- rake -m all - rake -m all
- rake -E $stdout.sync=true test - rake -E $stdout.sync=true test
...@@ -24,40 +24,29 @@ Optional: ...@@ -24,40 +24,29 @@ Optional:
## Build ## Build
To compile `mruby`, just call `rake` inside of the mruby source Inside of the root directory of the mruby source a file exists
root. To generate and execute the test tools call `rake test`. To called *build_config.rb*. This file contains the build configuration
clean all build files call `rake clean`. To see full command line on of mruby and looks like this for example:
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:
```ruby ```ruby
MRuby::Build.new do |conf| MRuby::Build.new do |conf|
toolchain :gcc toolchain :gcc
end end
``` ```
All tools necessary to compile mruby can be set or modified here. In All tools necessary to compile mruby can be set or modified here. In case
case you want to try different configuration, you can create a new you want to maintain an additional *build_config.rb* you can define a
configuration file under `target` and specify the configuration using customized path using the *$MRUBY_CONFIG* environment variable. If the
the `MRUBY_TARGET` environment variable. 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 ## Build Configuration
To create a new configuration, copy the existing configuration in the We wish you submit a pull-request to *build_config/**PLATFORM**.rb*, once you
`target` directory, and modify it. We wish you submit a pull-request, created a new configuration for a new platform.
once you created a new configuration for a new platform.
Inside of the configuration file, the following options can be Inside of the configuration file, the following options can be
configured based on your environment. configured based on your environment.
......
...@@ -3,45 +3,29 @@ User visible changes in `mruby3` ...@@ -3,45 +3,29 @@ User visible changes in `mruby3`
# Build System # 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 ## `presym` target
The first compilation of `mruby` may require generation of a The first compilation of `mruby` may require generation of a
static symbol table named `build/presym`. You can generate static symbol table named `build/presym`. You can generate
the table by `rake gensym`. the table by `rake gensym`.
## `target` directory ## `build_config` directory
Build target specification files are loaded from `target` Typical build configuration files are located in `build_config`
directory. The default `TARGET` is `host` which is described directory. For examples:
in `target/host.rb`. There are many other targets for example:
* `host-gprof`: compiles with `gprof` for performance tuning * `host-gprof`: compiles with `gprof` for performance tuning
* `host-m32`: compiles in gcc 32bit mode on 64bit platforms * `host-m32`: compiles in gcc 32bit mode on 64bit platforms
* `boxing`: compiles all three boxing options * `boxing`: compiles all three boxing options
* `clang-asan`: compiles with `clang`'s Address Sanitizer * `clang-asan`: compiles with `clang`'s Address Sanitizer
`target/host.rb` comes with comments to help writing a new `build_config/${MRUBY_CONFIG}.rb` is used if the path specified
target description. in `MRUBY_CONFIG` doesn't exist, so you can specify it as
`rake MRUBY_CONFIG=boxing`.
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 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 contribute. We welcome your contribution as a GitHub
pull-request. pull-request.
......
...@@ -39,6 +39,17 @@ module MRuby ...@@ -39,6 +39,17 @@ module MRuby
class Build class Build
class << self class << self
attr_accessor :current 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 end
include Rake::DSL include Rake::DSL
include LoadGems include LoadGems
......
...@@ -26,7 +26,7 @@ module MRuby ...@@ -26,7 +26,7 @@ module MRuby
end end
def instance def instance
@instance ||= new("#{MRUBY_ROOT}/build/#{MRUBY_TARGET}.lock") @instance ||= new("#{MRUBY_CONFIG}.lock")
end end
end end
......
...@@ -9,7 +9,11 @@ def bm_files ...@@ -9,7 +9,11 @@ def bm_files
end end
def build_config_name 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 end
def plot_file def plot_file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment