Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
75dd4a5a
Commit
75dd4a5a
authored
Mar 15, 2013
by
Yukihiro Matz Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
resolve conflict
parents
22756f45
2ff330ee
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
158 additions
and
17 deletions
+158
-17
Rakefile
Rakefile
+1
-0
src/array.c
src/array.c
+1
-0
src/class.c
src/class.c
+1
-0
src/codegen.c
src/codegen.c
+1
-0
src/kernel.c
src/kernel.c
+2
-0
tasks/mruby_build.rake
tasks/mruby_build.rake
+8
-0
tasks/mruby_build_commands.rake
tasks/mruby_build_commands.rake
+36
-11
tasks/toolchains/androideabi.rake
tasks/toolchains/androideabi.rake
+108
-6
No files found.
Rakefile
View file @
75dd4a5a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
# Build description.
# Build description.
# basic build file for mruby
# basic build file for mruby
MRUBY_ROOT
=
File
.
dirname
(
File
.
expand_path
(
__FILE__
))
MRUBY_ROOT
=
File
.
dirname
(
File
.
expand_path
(
__FILE__
))
MRUBY_BUILD_HOST_IS_CYGWIN
=
RUBY_PLATFORM
.
include?
(
'cygwin'
)
# load build systems
# load build systems
load
"
#{
MRUBY_ROOT
}
/tasks/ruby_ext.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/ruby_ext.rake"
...
...
src/array.c
View file @
75dd4a5a
...
@@ -702,6 +702,7 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
...
@@ -702,6 +702,7 @@ mrb_ary_aget(mrb_state *mrb, mrb_value self)
default:
default:
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"wrong number of arguments"
);
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"wrong number of arguments"
);
break
;
}
}
return
mrb_nil_value
();
/* dummy to avoid warning : not reach here */
return
mrb_nil_value
();
/* dummy to avoid warning : not reach here */
...
...
src/class.c
View file @
75dd4a5a
...
@@ -408,6 +408,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
...
@@ -408,6 +408,7 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
if
(
argc
<=
i
&&
!
opt
)
{
if
(
argc
<=
i
&&
!
opt
)
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"wrong number of arguments"
);
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"wrong number of arguments"
);
}
}
break
;
}
}
switch
(
c
)
{
switch
(
c
)
{
...
...
src/codegen.c
View file @
75dd4a5a
...
@@ -379,6 +379,7 @@ dispatch(codegen_scope *s, int pc)
...
@@ -379,6 +379,7 @@ dispatch(codegen_scope *s, int pc)
fprintf
(
stderr
,
"bug: dispatch on non JMP op
\n
"
);
fprintf
(
stderr
,
"bug: dispatch on non JMP op
\n
"
);
#endif
#endif
scope_error
(
s
);
scope_error
(
s
);
break
;
}
}
s
->
iseq
[
pc
]
=
MKOP_AsBx
(
c
,
GETARG_A
(
i
),
diff
);
s
->
iseq
[
pc
]
=
MKOP_AsBx
(
c
,
GETARG_A
(
i
),
diff
);
}
}
...
...
src/kernel.c
View file @
75dd4a5a
...
@@ -518,6 +518,7 @@ mrb_obj_instance_eval(mrb_state *mrb, mrb_value self)
...
@@ -518,6 +518,7 @@ mrb_obj_instance_eval(mrb_state *mrb, mrb_value self)
default:
default:
cv
=
mrb_singleton_class
(
mrb
,
self
);
cv
=
mrb_singleton_class
(
mrb
,
self
);
c
=
mrb_class_ptr
(
cv
);
c
=
mrb_class_ptr
(
cv
);
break
;
}
}
return
mrb_yield_internal
(
mrb
,
b
,
0
,
0
,
self
,
c
);
return
mrb_yield_internal
(
mrb
,
b
,
0
,
0
,
self
,
c
);
}
}
...
@@ -931,6 +932,7 @@ mrb_f_raise(mrb_state *mrb, mrb_value self)
...
@@ -931,6 +932,7 @@ mrb_f_raise(mrb_state *mrb, mrb_value self)
exc
=
mrb_make_exception
(
mrb
,
argc
,
a
);
exc
=
mrb_make_exception
(
mrb
,
argc
,
a
);
mrb_obj_iv_set
(
mrb
,
mrb_obj_ptr
(
exc
),
mrb_intern
(
mrb
,
"lastpc"
),
mrb_voidp_value
(
mrb
->
ci
->
pc
));
mrb_obj_iv_set
(
mrb
,
mrb_obj_ptr
(
exc
),
mrb_intern
(
mrb
,
"lastpc"
),
mrb_voidp_value
(
mrb
->
ci
->
pc
));
mrb_exc_raise
(
mrb
,
exc
);
mrb_exc_raise
(
mrb
,
exc
);
break
;
}
}
return
mrb_nil_value
();
/* not reached */
return
mrb_nil_value
();
/* not reached */
}
}
...
...
tasks/mruby_build.rake
View file @
75dd4a5a
...
@@ -128,6 +128,14 @@ module MRuby
...
@@ -128,6 +128,14 @@ module MRuby
end
end
end
end
def
cygwin_filename
(
name
)
if
name
.
is_a?
(
Array
)
name
.
flatten
.
map
{
|
n
|
cygwin_filename
(
n
)
}
else
'"%s"'
%
`cygpath -w "
#{
filename
(
name
)
}
"`
.
strip
end
end
def
exefile
(
name
)
def
exefile
(
name
)
if
name
.
is_a?
(
Array
)
if
name
.
is_a?
(
Array
)
name
.
flatten
.
map
{
|
n
|
exefile
(
n
)
}
name
.
flatten
.
map
{
|
n
|
exefile
(
n
)
}
...
...
tasks/mruby_build_commands.rake
View file @
75dd4a5a
...
@@ -4,7 +4,7 @@ module MRuby
...
@@ -4,7 +4,7 @@ module MRuby
class
Command
class
Command
include
Rake
::
DSL
include
Rake
::
DSL
extend
Forwardable
extend
Forwardable
def_delegators
:@build
,
:filename
,
:objfile
,
:libfile
,
:exefile
def_delegators
:@build
,
:filename
,
:objfile
,
:libfile
,
:exefile
,
:cygwin_filename
attr_accessor
:build
,
:command
attr_accessor
:build
,
:command
def
initialize
(
build
)
def
initialize
(
build
)
...
@@ -49,8 +49,12 @@ module MRuby
...
@@ -49,8 +49,12 @@ module MRuby
def
all_flags
(
_defineds
=
[],
_include_paths
=
[],
_flags
=
[])
def
all_flags
(
_defineds
=
[],
_include_paths
=
[],
_flags
=
[])
define_flags
=
[
defines
,
_defineds
].
flatten
.
map
{
|
d
|
option_define
%
d
}
define_flags
=
[
defines
,
_defineds
].
flatten
.
map
{
|
d
|
option_define
%
d
}
include_path_flags
=
[
include_paths
,
_include_paths
].
flatten
.
map
do
|
f
|
include_path_flags
=
[
include_paths
,
_include_paths
].
flatten
.
map
do
|
f
|
if
MRUBY_BUILD_HOST_IS_CYGWIN
option_include_path
%
cygwin_filename
(
f
)
else
option_include_path
%
filename
(
f
)
option_include_path
%
filename
(
f
)
end
end
end
[
flags
,
define_flags
,
include_path_flags
,
_flags
].
flatten
.
join
(
' '
)
[
flags
,
define_flags
,
include_path_flags
,
_flags
].
flatten
.
join
(
' '
)
end
end
...
@@ -61,9 +65,14 @@ module MRuby
...
@@ -61,9 +65,14 @@ module MRuby
option_include_path
%
filename
(
f
)
option_include_path
%
filename
(
f
)
end
end
_pp
"CC"
,
infile
.
relative_path
,
outfile
.
relative_path
_pp
"CC"
,
infile
.
relative_path
,
outfile
.
relative_path
if
MRUBY_BUILD_HOST_IS_CYGWIN
_run
compile_options
,
{
:flags
=>
all_flags
(
_defineds
,
_include_paths
,
_flags
),
:infile
=>
cygwin_filename
(
infile
),
:outfile
=>
cygwin_filename
(
outfile
)
}
else
_run
compile_options
,
{
:flags
=>
all_flags
(
_defineds
,
_include_paths
,
_flags
),
_run
compile_options
,
{
:flags
=>
all_flags
(
_defineds
,
_include_paths
,
_flags
),
:infile
=>
filename
(
infile
),
:outfile
=>
filename
(
outfile
)
}
:infile
=>
filename
(
infile
),
:outfile
=>
filename
(
outfile
)
}
end
end
end
def
define_rules
(
build_dir
,
source_dir
=
''
)
def
define_rules
(
build_dir
,
source_dir
=
''
)
@out_ext
=
build
.
exts
.
object
@out_ext
=
build
.
exts
.
object
...
@@ -127,8 +136,12 @@ module MRuby
...
@@ -127,8 +136,12 @@ module MRuby
def
all_flags
(
_library_paths
=
[],
_flags
=
[])
def
all_flags
(
_library_paths
=
[],
_flags
=
[])
library_path_flags
=
[
library_paths
,
_library_paths
].
flatten
.
map
do
|
f
|
library_path_flags
=
[
library_paths
,
_library_paths
].
flatten
.
map
do
|
f
|
if
MRUBY_BUILD_HOST_IS_CYGWIN
option_library_path
%
cygwin_filename
(
f
)
else
option_library_path
%
filename
(
f
)
option_library_path
%
filename
(
f
)
end
end
end
[
flags
,
library_path_flags
,
_flags
].
flatten
.
join
(
' '
)
[
flags
,
library_path_flags
,
_flags
].
flatten
.
join
(
' '
)
end
end
...
@@ -142,6 +155,13 @@ module MRuby
...
@@ -142,6 +155,13 @@ module MRuby
library_path_flags
=
[
library_paths
,
_library_paths
].
flatten
.
map
{
|
f
|
option_library_path
%
filename
(
f
)
}
library_path_flags
=
[
library_paths
,
_library_paths
].
flatten
.
map
{
|
f
|
option_library_path
%
filename
(
f
)
}
_pp
"LD"
,
outfile
.
relative_path
_pp
"LD"
,
outfile
.
relative_path
if
MRUBY_BUILD_HOST_IS_CYGWIN
_run
link_options
,
{
:flags
=>
all_flags
(
_library_paths
,
_flags
),
:outfile
=>
cygwin_filename
(
outfile
)
,
:objs
=>
cygwin_filename
(
objfiles
).
join
(
' '
),
:flags_before_libraries
=>
[
flags_before_libraries
,
_flags_before_libraries
].
flatten
.
join
(
' '
),
:flags_after_libraries
=>
[
flags_after_libraries
,
_flags_after_libraries
].
flatten
.
join
(
' '
),
:libs
=>
library_flags
.
join
(
' '
)
}
else
_run
link_options
,
{
:flags
=>
all_flags
(
_library_paths
,
_flags
),
_run
link_options
,
{
:flags
=>
all_flags
(
_library_paths
,
_flags
),
:outfile
=>
filename
(
outfile
)
,
:objs
=>
filename
(
objfiles
).
join
(
' '
),
:outfile
=>
filename
(
outfile
)
,
:objs
=>
filename
(
objfiles
).
join
(
' '
),
:flags_before_libraries
=>
[
flags_before_libraries
,
_flags_before_libraries
].
flatten
.
join
(
' '
),
:flags_before_libraries
=>
[
flags_before_libraries
,
_flags_before_libraries
].
flatten
.
join
(
' '
),
...
@@ -149,6 +169,7 @@ module MRuby
...
@@ -149,6 +169,7 @@ module MRuby
:libs
=>
library_flags
.
join
(
' '
)
}
:libs
=>
library_flags
.
join
(
' '
)
}
end
end
end
end
end
class
Command::Archiver
<
Command
class
Command::Archiver
<
Command
attr_accessor
:archive_options
attr_accessor
:archive_options
...
@@ -162,9 +183,13 @@ module MRuby
...
@@ -162,9 +183,13 @@ module MRuby
def
run
(
outfile
,
objfiles
)
def
run
(
outfile
,
objfiles
)
FileUtils
.
mkdir_p
File
.
dirname
(
outfile
)
FileUtils
.
mkdir_p
File
.
dirname
(
outfile
)
_pp
"AR"
,
outfile
.
relative_path
_pp
"AR"
,
outfile
.
relative_path
if
MRUBY_BUILD_HOST_IS_CYGWIN
_run
archive_options
,
{
:outfile
=>
cygwin_filename
(
outfile
),
:objs
=>
cygwin_filename
(
objfiles
).
join
(
' '
)
}
else
_run
archive_options
,
{
:outfile
=>
filename
(
outfile
),
:objs
=>
filename
(
objfiles
).
join
(
' '
)
}
_run
archive_options
,
{
:outfile
=>
filename
(
outfile
),
:objs
=>
filename
(
objfiles
).
join
(
' '
)
}
end
end
end
end
end
class
Command::Yacc
<
Command
class
Command::Yacc
<
Command
attr_accessor
:compile_options
attr_accessor
:compile_options
...
...
tasks/toolchains/androideabi.rake
View file @
75dd4a5a
...
@@ -11,13 +11,115 @@
...
@@ -11,13 +11,115 @@
MRuby
::
Toolchain
.
new
(
:androideabi
)
do
|
conf
|
MRuby
::
Toolchain
.
new
(
:androideabi
)
do
|
conf
|
toolchain
:gcc
toolchain
:gcc
ANDROID_STANDALONE_TOOLCHAIN
=
ENV
[
'ANDROID_STANDALONE_TOOLCHAIN'
]
+
'/bin/arm-linux-androideabi-'
DEFAULT_ANDROID_TOOLCHAIN
=
'gcc'
SYSROOT
=
ENV
[
'ANDROID_STANDALONE_TOOLCHAIN'
]
+
'/sysroot'
DEFAULT_ANDROID_TARGET_ARCH
=
'arm'
DEFAULT_ANDROID_TARGET_ARCH_ABI
=
'armeabi'
DEFAULT_ANDROID_TARGET_PLATFORM
=
'android-14'
DEFAULT_GCC_VERSION
=
'4.6'
DEFAULT_CLANG_VERSION
=
'3.1'
GCC_COMMON_CFLAGS
=
%W(-ffunction-sections -funwind-tables -fstack-protector)
GCC_COMMON_LDFLAGS
=
%W()
# 'ANDROID_STANDALONE_TOOLCHAIN' or 'ANDROID_NDK_HOME' must be set.
ANDROID_STANDALONE_TOOLCHAIN
=
ENV
[
'ANDROID_STANDALONE_TOOLCHAIN'
]
ANDROID_NDK_HOME
=
ENV
[
'ANDROID_NDK_HOME'
]
ANDROID_TARGET_ARCH
=
ENV
[
'ANDROID_TARGET_ARCH'
]
||
DEFAULT_ANDROID_TARGET_ARCH
ANDROID_TARGET_ARCH_ABI
=
ENV
[
'ANDROID_TARGET_ARCH_ABI'
]
||
DEFAULT_ANDROID_TARGET_ARCH_ABI
ANDROID_TOOLCHAIN
=
ENV
[
'ANDROID_TOOLCHAIN'
]
||
DEFAULT_ANDROID_TOOLCHAIN
case
ANDROID_TARGET_ARCH
.
downcase
when
'arch-arm'
,
'arm'
then
toolchain_prefix
=
'arm-linux-androideabi-'
when
'arch-x86'
,
'x86'
then
toolchain_prefix
=
'i686-linux-android-'
when
'arch-mips'
,
'mips'
then
toolchain_prefix
=
'mipsel-linux-android-'
else
# Any other architectures are not supported by Android NDK.
# Notify error.
end
if
ANDROID_STANDALONE_TOOLCHAIN
==
nil
then
if
RUBY_PLATFORM
.
include?
(
'darwin'
)
then
HOST_PLATFORM
=
'darwin-x86'
elsif
RUBY_PLATFORM
.
include?
(
'linux'
)
then
HOST_PLATFORM
=
'linux-x86'
elsif
RUBY_PLATFORM
.
include?
(
'win'
)
then
HOST_PLATFORM
=
'windows'
else
# Unknown host platform.
end
ANDROID_TARGET_PLATFORM
=
ENV
[
'ANDROID_TARGET_PLATFORM'
]
||
DEFAULT_ANDROID_TARGET_PLATFORM
path_to_toolchain
=
ANDROID_NDK_HOME
+
'/toolchains/'
path_to_sysroot
=
ANDROID_NDK_HOME
+
'/platforms/'
+
ANDROID_TARGET_PLATFORM
if
ANDROID_TOOLCHAIN
.
downcase
==
'gcc'
then
case
ANDROID_TARGET_ARCH
.
downcase
when
'arch-arm'
,
'arm'
then
path_to_toolchain
+=
'arm-linux-androideabi-'
path_to_sysroot
+=
'/arch-arm'
when
'arch-x86'
,
'x86'
then
path_to_toolchain
+=
'x86-'
path_to_sysroot
+=
'/arch-x86'
when
'arch-mips'
,
'mips'
then
path_to_toolchain
+=
'mipsel-linux-android-'
path_to_sysroot
+=
'/arch-mips'
else
# Any other architecture are not supported by Android NDK.
end
path_to_toolchain
+=
DEFAULT_GCC_VERSION
+
'/prebuilt/'
+
HOST_PLATFORM
else
path_to_toolchain
+=
'llvm-'
+
DEFAULT_CLANG_VERSION
+
'/prebuilt/'
+
HOST_PLATFORM
end
else
path_to_toolchain
=
ANDROID_STANDALONE_TOOLCHAIN
path_to_sysroot
=
ANDROID_STANDALONE_TOOLCHAIN
+
'/sysroot'
end
SYSROOT
=
path_to_sysroot
case
ANDROID_TARGET_ARCH
.
downcase
when
'arch-arm'
,
'arm'
then
if
ANDROID_TARGET_ARCH_ABI
.
downcase
==
'armeabi-v7a'
then
ARCH_CFLAGS
=
%W(-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16)
ARCH_LDFLAGS
=
%W(-march=armv7-a -Wl,--fix-cortex-a8)
else
ARCH_CFLAGS
=
%W(-march=armv5te -mtune=xscale -msoft-float)
ARCH_LDFLAGS
=
%W()
end
when
'arch-x86'
,
'x86'
then
ARCH_CFLAGS
=
%W()
ARCH_LDFLAGS
=
%W()
when
'arch-mips'
,
'mips'
then
ARCH_CFLAGS
=
%W(-fpic -fno-strict-aliasing -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers)
ARCH_LDFLAGS
=
%W()
else
# Notify error
end
case
ANDROID_TOOLCHAIN
.
downcase
when
'gcc'
then
ANDROID_CC
=
path_to_toolchain
+
'/bin/'
+
toolchain_prefix
+
'gcc'
ANDROID_LD
=
path_to_toolchain
+
'/bin/'
+
toolchain_prefix
+
'gcc'
ANDROID_AR
=
path_to_toolchain
+
'/bin/'
+
toolchain_prefix
+
'ar'
ANDROID_CFLAGS
=
GCC_COMMON_CFLAGS
+
%W(-mandroid --sysroot="
#{
SYSROOT
}
")
+
ARCH_CFLAGS
ANDROID_LDFLAGS
=
GCC_COMMON_LDFLAGS
+
%W(-mandroid --sysroot="
#{
SYSROOT
}
")
+
ARCH_LDFLAGS
when
'clang'
then
# clang is not supported yet.
when
'clang31'
,
'clang3.1'
then
# clang is not supported yet.
else
# Any other toolchains are not supported by Android NDK.
# Notify error.
end
[
conf
.
cc
,
conf
.
cxx
,
conf
.
objc
,
conf
.
asm
].
each
do
|
cc
|
[
conf
.
cc
,
conf
.
cxx
,
conf
.
objc
,
conf
.
asm
].
each
do
|
cc
|
cc
.
command
=
ENV
[
'CC'
]
||
ANDROID_
STANDALONE_TOOLCHAIN
+
'gcc'
cc
.
command
=
ENV
[
'CC'
]
||
ANDROID_
CC
cc
.
flags
=
[
ENV
[
'CFLAGS'
]
||
[
'--sysroot '
+
SYSROOT
]
]
cc
.
flags
=
[
ENV
[
'CFLAGS'
]
||
ANDROID_CFLAGS
]
end
end
conf
.
linker
.
command
=
ENV
[
'LD'
]
||
ANDROID_STANDALONE_TOOLCHAIN
+
'gcc'
conf
.
linker
.
command
=
ENV
[
'LD'
]
||
ANDROID_LD
conf
.
archiver
.
command
=
ENV
[
'AR'
]
||
ANDROID_STANDALONE_TOOLCHAIN
+
'ar'
conf
.
linker
.
flags
=
[
ENV
[
'LDFLAGS'
]
||
ANDROID_LDFLAGS
]
conf
.
archiver
.
command
=
ENV
[
'AR'
]
||
ANDROID_AR
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment