diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/.gitkeep | 0 | ||||
| -rw-r--r-- | doc/compile/README.md | 82 | ||||
| -rw-r--r-- | doc/mrbgems/README.md | 5 |
3 files changed, 73 insertions, 14 deletions
diff --git a/doc/.gitkeep b/doc/.gitkeep deleted file mode 100644 index e69de29bb..000000000 --- a/doc/.gitkeep +++ /dev/null diff --git a/doc/compile/README.md b/doc/compile/README.md index e7f382f15..19bcf1ac6 100644 --- a/doc/compile/README.md +++ b/doc/compile/README.md @@ -14,8 +14,8 @@ To compile mruby out of the source code you need the following tools: Optional: * GIT (to update mruby source and integrate mrbgems easier) -* C++ compiler (to use GEMs which include *.cpp) -* Assembler (to use GEMs which include *.asm) +* C++ compiler (to use GEMs which include \*.cpp) +* Assembler (to use GEMs which include \*.asm) ## Usage @@ -59,17 +59,13 @@ GCC toolchain. toolchain :clang -#### Visual Studio 2010 +#### Visual Studio 2010, 2012 and 2013 -Toolchain configuration for Visual Studio 2010 on Windows. +Toolchain configuration for Visual Studio on Windows. If you use the +[Visual Studio Command Prompt](http://msdn.microsoft.com/en-us/library/ms229859\(v=vs.110\).aspx), +you normally do not have to specify this manually, since it gets automatically detected by our build process. - toolchain :vs2010 - -#### Visual Studio 2012 - -Toolchain configuration for Visual Studio 2012 on Windows. - - toolchain :vs2012 + toolchain :visualcpp #### Android @@ -159,7 +155,7 @@ Configuration of the GPerf binary and flags. ### File Extensions - conf.exts do |exts + conf.exts do |exts| exts.object = ... exts.executable = ... exts.library = ... @@ -179,6 +175,7 @@ Integrate GEMs in the build process. See doc/mrbgems/README.md for more option about mrbgems. + ### Mrbtest Configuration Mrbtest build process. @@ -187,6 +184,49 @@ If you want mrbtest.a only, You should set ```conf.build_mrbtest_lib_only``` conf.build_mrbtest_lib_only +### Bintest + +Tests for mrbgem tools using CRuby. +To have bintests place \*.rb scripts to ```bintest/``` directory of mrbgems. +See ```mruby-bin-*/bintest/*.rb``` if you need examples. +If you want a temporary files use `tempfile` module of CRuby instead of ```/tmp/```. + +You can enable it with following: + + conf.enable_bintest + +### C++ ABI + +mruby can use C++ exception to raise exception internally. +It is called C++ ABI mode. +By using C++ exception it can release C++ stack object correctly. +Whenever you mix C++ code C++ ABI mode would be enabled automatically. +If you need to enable C++ ABI mode explicity add the following: + + conf.enable_cxx_abi + +#### C++ exception disabling. + +If you need to force C++ exception disable +(For example using a compiler option to disable C++ exception) +add following: + + conf.disable_cxx_exception + +Note that it must be called before ```enable_cxx_abi``` or ```gem``` method. + +### Debugging mode + +To enable debugging mode add the following: + + conf.enable_debug + +When debugging mode is enabled +* Macro ```MRB_DEBUG``` would be defined. + * Which means ```mrb_assert()``` macro is enabled. +* Debug information of irep would be generated by ```mrbc```. + * Because ```-g``` flag would be added to ```mrbc``` runner. + * You can have better backtrace of mruby scripts with this. ## Cross-Compilation @@ -206,6 +246,20 @@ like this: All configuration options of ```MRuby::Build``` can also be used in ```MRuby::CrossBuild```. +### Mrbtest in Cross-Compilation + +In cross compilation, you can run ```mrbtest``` on emulator if +you have it by changing configuration of test runner. + + conf.test_runner do |t| + t.command = ... # set emulator. this value must be non nil or false + t.flags = ... # set flags of emulator + + def t.run(bin) # override `run` if you need to change the behavior of it + ... # `bin` is the full path of mrbtest + end + end + ## Build process During the build process the directory *build* will be created in the @@ -242,7 +296,7 @@ result will be stored in *build/host/src/y.tab.c*) * create *build/host/lib/libmruby_core.a* out of all object files (C only) * create ```build/host/bin/mrbc``` by compiling *tools/mrbc/mrbc.c* and linking with *build/host/lib/libmruby_core.a* -* create *build/host/mrblib/mrblib.c* by compiling all *.rb files +* create *build/host/mrblib/mrblib.c* by compiling all \*.rb files under *mrblib* with ```build/host/bin/mrbc``` * compile *build/host/mrblib/mrblib.c* to *build/host/mrblib/mrblib.o* * create *build/host/lib/libmruby.a* out of all object files (C and Ruby) @@ -316,7 +370,7 @@ in *build/i386/src*) * generate parser grammar out of *src/parse.y* (generated result will be stored in *build/i386/src/y.tab.c*) * cross-compile *build/i386/src/y.tab.c* to *build/i386/src/y.tab.o* -* create *build/i386/mrblib/mrblib.c* by compiling all *.rb files +* create *build/i386/mrblib/mrblib.c* by compiling all \*.rb files under *mrblib* with the native ```build/host/bin/mrbc``` * cross-compile *build/host/mrblib/mrblib.c* to *build/host/mrblib/mrblib.o* * create *build/i386/lib/libmruby.a* out of all object files (C and Ruby) diff --git a/doc/mrbgems/README.md b/doc/mrbgems/README.md index 65b794dc0..481ce08de 100644 --- a/doc/mrbgems/README.md +++ b/doc/mrbgems/README.md @@ -203,6 +203,7 @@ mruby can be extended with pure Ruby. It is possible to override existing classes or add new ones in this way. Put all Ruby files into the *mrblib* folder. + ### Pre-Conditions none @@ -229,6 +230,10 @@ mruby can be extended with C and Ruby at the same time. It is possible to override existing classes or add new ones in this way. Put all Ruby files into the *mrblib* folder and all C files into the *src* folder. +mruby codes under *mrblib* directory would be executed after gem init C +function is called. Make sure *mruby script* depends on *C code* and +*C code* doesn't depend on *mruby script*. + ### Pre-Conditions See C and Ruby example. |
