Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/mrb_ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ void mrb_ext_set_instance_tt(struct RClass* class, enum mrb_vtype type) {
MRB_SET_INSTANCE_TT(class, type);
}

int mrb_ext_ary_len(struct mrb_state* mrb, mrb_value array) {
return mrb_ary_len(mrb, array);
long long mrb_ext_ary_len(struct mrb_state* mrb, mrb_value array) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has been dropped in favour of RARRAY_LEN

(void)mrb;
mrb_assert(mrb_array_p(array));
return RARRAY_LEN(array);
}

unsigned int mrb_ext_get_mid(struct mrb_state* mrb) {
Expand Down
25 changes: 24 additions & 1 deletion src/mruby/get_mruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# * compile, linker & archiver
# * unzip

VERSION=1.2.0
VERSION=1.4.1
CURRENT=$PWD
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

# Checks is /tmp/mruby needs cleaning or creation.

Expand All @@ -35,6 +36,9 @@ mkdir -p mruby-out/src/mrbgems

cd mruby-$VERSION

# Use only supported gems.
cat $DIR/mrusty.gembox > mrbgems/default.gembox
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for minirake not to create _init / _final functions for mruby-io and mruby-bin*.


# minirake compiles the compiler and rb files to C.

./minirake
Expand Down Expand Up @@ -64,11 +68,30 @@ rm -rf build/host/mrbgems/mruby-bin*
rm -rf mrbgems/mruby-test
rm -rf build/host/mrbgems/mruby-test

rm -rf mrbgems/mruby-io*
rm -rf build/host/mrbgems/mruby-io*

rm -rf mrbgems/mruby-socket*
rm -rf build/host/mrbgems/mruby-socket*

# Copies all gems.

cp -R mrbgems/* ../mruby-out/src/mrbgems
cp -R build/host/mrbgems/* ../mruby-out/src/mrbgems

# String needs additional mruby header.

sed -i -e $'s/#include "common.h"/#include "mruby.h"\\\n#include "common.h"/g' include/mruby/string.h
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange thing, string.h causes dozen undefined type errors without it.


# Copies header files so they will be available in top level includes.

find include/mruby -type f -name '*.h' -exec cp {} ../mruby-out/include \;
Copy link
Author

@mlga mlga Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mruby-pack has includes in form of header.h instead of mruby/header.h.


# Copies ext header files required by gems.

mkdir -p ../mruby-out/include/mruby/ext
find mrbgems -path '*/ext/*' -name '*.h' -exec cp {} ../mruby-out/include/mruby/ext \;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, copies only ext/io.h.


cd ..

tar -cf $CURRENT/mruby-out.tar mruby-out
Binary file modified src/mruby/mruby-out.tar
Binary file not shown.
88 changes: 88 additions & 0 deletions src/mruby/mrusty.gembox
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
MRuby::GemBox.new do |conf|
# Use standard IO/File class
# conf.gem :core => "mruby-io"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was problematic.


# Use standard Array#pack, String#unpack methods
conf.gem :core => "mruby-pack"

# Use standard Kernel#sprintf method
conf.gem :core => "mruby-sprintf"

# Use standard print/puts/p
conf.gem :core => "mruby-print"

# Use standard Math module
conf.gem :core => "mruby-math"

# Use standard Time class
conf.gem :core => "mruby-time"

# Use standard Struct class
conf.gem :core => "mruby-struct"

# Use Comparable module extension
conf.gem :core => "mruby-compar-ext"

# Use Enumerable module extension
conf.gem :core => "mruby-enum-ext"

# Use String class extension
conf.gem :core => "mruby-string-ext"

# Use Numeric class extension
conf.gem :core => "mruby-numeric-ext"

# Use Array class extension
conf.gem :core => "mruby-array-ext"

# Use Hash class extension
conf.gem :core => "mruby-hash-ext"

# Use Range class extension
conf.gem :core => "mruby-range-ext"

# Use Proc class extension
conf.gem :core => "mruby-proc-ext"

# Use Symbol class extension
conf.gem :core => "mruby-symbol-ext"

# Use Random class
conf.gem :core => "mruby-random"

# Use Object class extension
conf.gem :core => "mruby-object-ext"

# Use ObjectSpace class
conf.gem :core => "mruby-objectspace"

# Use Fiber class
conf.gem :core => "mruby-fiber"

# Use Enumerator class (require mruby-fiber)
conf.gem :core => "mruby-enumerator"

# Use Enumerator::Lazy class (require mruby-enumerator)
conf.gem :core => "mruby-enum-lazy"

# Use toplevel object (main) methods extension
conf.gem :core => "mruby-toplevel-ext"

# Generate mirb command
# conf.gem :core => "mruby-bin-mirb"

# Generate mruby command
# conf.gem :core => "mruby-bin-mruby"

# Generate mruby-strip command
# conf.gem :core => "mruby-bin-strip"

# Use Kernel module extension
conf.gem :core => "mruby-kernel-ext"

# Use class/module extension
conf.gem :core => "mruby-class-ext"

# Use mruby-compiler to build other mrbgems
conf.gem :core => "mruby-compiler"
end
2 changes: 1 addition & 1 deletion src/mruby_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ extern "C" {
#[inline]
pub fn mrb_ary_set(mrb: *const MrState, array: MrValue, i: i32, value: MrValue);
#[inline]
pub fn mrb_ext_ary_len(mrb: *const MrState, array: MrValue) -> i32;
pub fn mrb_ext_ary_len(mrb: *const MrState, array: MrValue) -> i64;

#[inline]
pub fn mrb_ext_raise(mrb: *const MrState, eclass: *const c_char, msg: *const c_char);
Expand Down