Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Independence of mruby

take_cheeze
September 19, 2017

Independence of mruby

take_cheeze

September 19, 2017
Tweet

More Decks by take_cheeze

Other Decks in Programming

Transcript

  1. Independence of mruby
    Can we build mruby without Cruby?
    Takeshi Watanabe (Fusic Co., Ltd.)

    View full-size slide

  2. About me.
    • GitHub: @take-cheeze
    • Seems like a mruby contributor(weakest of big four).
    • Just a mruby pull requester.
    • Moved to Fukuoka this July.

    View full-size slide

  3. Things to say before
    • Thank my new company for taking me to RubyKaigi.
    • I want mruby jobs!

    View full-size slide

  4. What I’ll talk
    • Why does mruby build depend on CRuby?
    • There was a guy who love rake.
    • mruby was using CMake when I first saw.
    • We don’t want to add the dependency in some cases.
    • Can GNU make replace it?
    • I’m using GNU make(don’t know nmake).
    • Don’t use file names with whitespaces in GNU make.

    View full-size slide

  5. Things to know
    • What is minirake?
    • Subset of rake for building mruby
    • Can do what rake can do with single script.
    • How to build without CRuby
    1. Build mruby only with Makefile.
    2. Run mruby build with built mruby(and minirake).

    View full-size slide

  6. Things I did.
    • Build minirake as a single binary.
    • Run build and test with built minirake and mruby.
    • Make Makefile very fat.
    ※ There was a precedent to make minirake single binary:
    • https://github.com/gromnitsky/minirake

    View full-size slide

  7. Making minirake a single binary
    1. Build minirake single binary as usual.
    2. Build mruby with built minirake.
    3. Fix things that didn’t work well.
    • Add missing things: tsort, pathname, fileutils, …
    • Make mrbgem compatible with CRuby.
    • Reusing idea before mruby-cli:
    https://github.com/mruby/mruby/pull/1676

    View full-size slide

  8. Remove CRuby dependency
    1. Port minirake scripts to Makefile.
    2. Do porting until you finish.
    • GNU make reference and stackoverflow was my friend.
    3. Makefile more than 300 line is created.
    • I can do complex text generating with Makefile.

    View full-size slide

  9. Part of artifacts:

    View full-size slide

  10. Time taken to build
    • My machine:
    • ThinkPad X1 Carbon 5th / Windows 10
    • RAM 16GB/Intel(R) Core(TM) i7-7500U CPU @2.70GHz 2.90GHz
    • Command used to run: time make test
    • About 10 minutes on Windows Subsystem for Linux
    • About 4 minutes on CentOS7 on VirtualBox

    View full-size slide

  11. Thoughts after finishing
    • Makefile is a great build tool.
    • Too many ways for process in Ruby (`,open3,spawn,system)
    • Need environment variables support to system method for cross
    build.
    • Thank all the developers of mrbgems I used.
    • Mainly port of Dir.glob (and the great idea):
    https://github.com/gromnitsky/mruby-dir-glob
    • IIJ for many stable mrbgems.
    • I want keyword arguments(because of FileUtils)
    • Actually I implemented
    it: https://github.com/mruby/mruby/pull/3629

    View full-size slide

  12. When can we use this?
    • No plan making Pull-Request.
    • It’s too big to make a review.
    • How do we do with mrbgems minirake uses?
    • Is it really useful?
    • Does mruby really need to be independent from CRuby?
    • There is many CRuby rake code to build mruby.

    View full-size slide

  13. Thanks for listening!
    • Any mruby jobs is welcomed!

    View full-size slide