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
87d0630d
Commit
87d0630d
authored
Feb 23, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #876 from masuidrive/fixed_build_system
Support to build on pwd != mruby source root
parents
58b9e767
0970ca95
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
102 additions
and
78 deletions
+102
-78
Rakefile
Rakefile
+25
-24
mrblib/mrblib.rake
mrblib/mrblib.rake
+9
-6
src/mruby_core.rake
src/mruby_core.rake
+11
-8
tasks/mrbgems.rake
tasks/mrbgems.rake
+3
-2
tasks/mrbgems_test.rake
tasks/mrbgems_test.rake
+3
-1
tasks/mruby_build.rake
tasks/mruby_build.rake
+13
-11
tasks/mruby_build_commands.rake
tasks/mruby_build_commands.rake
+9
-9
tasks/ruby_ext.rake
tasks/ruby_ext.rake
+4
-0
tasks/toolchains/gcc.rake
tasks/toolchains/gcc.rake
+1
-1
tasks/toolchains/vs2012.rake
tasks/toolchains/vs2012.rake
+1
-1
test/mrbtest.rake
test/mrbtest.rake
+11
-9
tools/mirb/mirb.rake
tools/mirb/mirb.rake
+4
-2
tools/mrbc/mrbc.rake
tools/mrbc/mrbc.rake
+4
-2
tools/mruby/mruby.rake
tools/mruby/mruby.rake
+4
-2
No files found.
Rakefile
View file @
87d0630d
# encoding: utf-8
# encoding: utf-8
# Build description.
# Build description.
# basic build file for mruby
# basic build file for mruby
MRUBY_ROOT
=
File
.
dirname
(
File
.
expand_path
(
__FILE__
))
load
'tasks/ruby_ext.rake'
# load build systems
load
'tasks/mruby_build.rake'
load
"
#{
MRUBY_ROOT
}
/tasks/ruby_ext.rake"
load
'tasks/mrbgem_spec.rake'
load
"
#{
MRUBY_ROOT
}
/tasks/mruby_build.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/mrbgem_spec.rake"
##############################
# load configuration file
# compile flags
MRUBY_CONFIGS
=
[
"
#{
MRUBY_ROOT
}
/build_config.rb"
,
ENV
[
'MRUBY_CONFIG'
]].
compact
load
'build_config.rb'
MRUBY_CONFIGS
.
each
do
|
config
|
load
config
unless
config
.
empty?
MRUBY_CONFIGS
=
[
'build_config.rb'
]
if
ENV
[
'MRUBY_CONFIG'
]
MRUBY_CONFIGS
<<
ENV
[
'MRUBY_CONFIG'
]
load
ENV
[
'MRUBY_CONFIG'
]
end
end
# load basic rules
MRuby
.
each_target
do
|
build
|
MRuby
.
each_target
do
|
build
|
build
.
define_rules
build
.
define_rules
end
end
load
'src/mruby_core.rake'
# load custom rules
load
'mrblib/mrblib.rake'
load
"
#{
MRUBY_ROOT
}
/src/mruby_core.rake"
load
'tools/mrbc/mrbc.rake'
load
"
#{
MRUBY_ROOT
}
/mrblib/mrblib.rake"
load
"
#{
MRUBY_ROOT
}
/tools/mrbc/mrbc.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/mrbgems.rake"
load
"
#{
MRUBY_ROOT
}
/tasks/libmruby.rake"
load
"
#{
MRUBY_ROOT
}
/tools/mruby/mruby.rake"
load
"
#{
MRUBY_ROOT
}
/tools/mirb/mirb.rake"
load
'tasks/mrbgems.rake'
load
"
#{
MRUBY_ROOT
}
/tasks/mrbgems_test.rake"
load
'tasks/libmruby.rake'
load
"
#{
MRUBY_ROOT
}
/test/mrbtest.rake"
load
'tools/mruby/mruby.rake'
load
'tools/mirb/mirb.rake'
load
'tasks/mrbgems_test.rake'
load
'test/mrbtest.rake'
##############################
##############################
# generic build targets, rules
# generic build targets, rules
task
:default
=>
:all
task
:default
=>
:all
depfiles
=
MRuby
.
targets
[
'host'
].
bins
.
map
do
|
bin
|
depfiles
=
MRuby
.
targets
[
'host'
].
bins
.
map
do
|
bin
|
install_path
=
MRuby
.
targets
[
'host'
].
exefile
(
"bin/
#{
bin
}
"
)
install_path
=
MRuby
.
targets
[
'host'
].
exefile
(
"
#{
MRUBY_ROOT
}
/
bin/
#{
bin
}
"
)
source_path
=
MRuby
.
targets
[
'host'
].
exefile
(
"
#{
MRuby
.
targets
[
'host'
].
build_dir
}
/bin/
#{
bin
}
"
)
file
install_path
=>
MRuby
.
targets
[
'host'
].
exefile
(
"build/host/bin/
#{
bin
}
"
)
do
|
t
|
FileUtils
.
rm
t
.
name
,
:force
=>
true
file
install_path
=>
source_path
do
|
t
|
FileUtils
.
cp
t
.
prerequisites
.
first
,
t
.
name
FileUtils
.
cp
t
.
prerequisites
.
first
,
t
.
name
end
end
...
...
mrblib/mrblib.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
self
.
libmruby
<<
objfile
(
"
#{
build_dir
}
/
#{
dir
}
/mrblib"
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
self
.
libmruby
<<
objfile
(
"
#{
current_build_dir
}
/mrblib"
)
file
objfile
(
"
#{
build_dir
}
/
#{
dir
}
/mrblib"
)
=>
"
#{
build_dir
}
/
#{
dir
}
/mrblib.c"
file
objfile
(
"
#{
current_build_dir
}
/mrblib"
)
=>
"
#{
current_build_
dir
}
/mrblib.c"
file
"
#{
build_dir
}
/
#{
dir
}
/mrblib.c"
=>
[
mrbcfile
]
+
Dir
.
glob
(
"
#{
dir
}
/*.rb"
)
do
|
t
|
file
"
#{
current_build_dir
}
/mrblib.c"
=>
[
mrbcfile
]
+
Dir
.
glob
(
"
#{
current_
dir
}
/*.rb"
)
do
|
t
|
mrbc_
,
*
rbfiles
=
t
.
prerequisites
mrbc_
,
*
rbfiles
=
t
.
prerequisites
FileUtils
.
mkdir_p
File
.
dirname
(
t
.
name
)
FileUtils
.
mkdir_p
File
.
dirname
(
t
.
name
)
open
(
t
.
name
,
'w'
)
do
|
f
|
open
(
t
.
name
,
'w'
)
do
|
f
|
_pp
"GEN"
,
"*.rb"
,
"
#{
t
.
name
}
"
_pp
"GEN"
,
"*.rb"
,
"
#{
t
.
name
.
relative_path
}
"
f
.
puts
File
.
read
(
"
#{
dir
}
/init_mrblib.c"
)
f
.
puts
File
.
read
(
"
#{
current_
dir
}
/init_mrblib.c"
)
mrbc
.
run
f
,
rbfiles
,
'mrblib_irep'
mrbc
.
run
f
,
rbfiles
,
'mrblib_irep'
end
end
end
end
...
...
src/mruby_core.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
lex_def
=
"
#{
dir
}
/lex.def"
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
objs
=
Dir
.
glob
(
"src/*.{c}"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
build_dir
}
/%X"
))
}
+
[
objfile
(
"
#{
build_dir
}
/
#{
dir
}
/y.tab"
)]
lex_def
=
"
#{
current_dir
}
/lex.def"
objs
=
Dir
.
glob
(
"
#{
current_dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
current_build_dir
}
/%n"
))
}
objs
+=
[
objfile
(
"
#{
current_build_dir
}
/y.tab"
)]
self
.
libmruby
<<
objs
self
.
libmruby
<<
objs
file
libfile
(
"
#{
build_dir
}
/lib/libmruby_core"
)
=>
objs
do
|
t
|
file
libfile
(
"
#{
build_dir
}
/lib/libmruby_core"
)
=>
objs
do
|
t
|
...
@@ -10,16 +13,16 @@ MRuby.each_target do
...
@@ -10,16 +13,16 @@ MRuby.each_target do
end
end
# Parser
# Parser
file
"
#{
build_dir
}
/
#{
dir
}
/y.tab.c"
=>
[
"
#{
dir
}
/parse.y"
]
do
|
t
|
file
"
#{
current_build_dir
}
/y.tab.c"
=>
[
"
#{
current_
dir
}
/parse.y"
]
do
|
t
|
yacc
.
run
t
.
name
,
t
.
prerequisites
.
first
yacc
.
run
t
.
name
,
t
.
prerequisites
.
first
end
end
file
objfile
(
"
#{
build_dir
}
/
#{
dir
}
/y.tab"
)
=>
[
"
#{
build_dir
}
/
#{
dir
}
/y.tab.c"
,
lex_def
]
do
|
t
|
file
objfile
(
"
#{
current_build_dir
}
/y.tab"
)
=>
[
"
#{
current_build_
dir
}
/y.tab.c"
,
lex_def
]
do
|
t
|
cc
.
run
t
.
name
,
t
.
prerequisites
.
first
,
[],
[
dir
]
cc
.
run
t
.
name
,
t
.
prerequisites
.
first
,
[],
[
current_
dir
]
end
end
# Lexical analyzer
# Lexical analyzer
file
lex_def
=>
"
#{
dir
}
/keywords"
do
|
t
|
file
lex_def
=>
"
#{
current_
dir
}
/keywords"
do
|
t
|
gperf
.
run
t
.
name
,
t
.
prerequisites
.
first
gperf
.
run
t
.
name
,
t
.
prerequisites
.
first
end
end
end
end
tasks/mrbgems.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
if
enable_gems?
if
enable_gems?
# set up all gems
# set up all gems
...
@@ -8,7 +9,7 @@ MRuby.each_target do
...
@@ -8,7 +9,7 @@ MRuby.each_target do
# loader all gems
# loader all gems
self
.
libmruby
<<
objfile
(
"
#{
build_dir
}
/mrbgems/gem_init"
)
self
.
libmruby
<<
objfile
(
"
#{
build_dir
}
/mrbgems/gem_init"
)
file
objfile
(
"
#{
build_dir
}
/mrbgems/gem_init"
)
=>
"
#{
build_dir
}
/mrbgems/gem_init.c"
file
objfile
(
"
#{
build_dir
}
/mrbgems/gem_init"
)
=>
"
#{
build_dir
}
/mrbgems/gem_init.c"
file
"
#{
build_dir
}
/mrbgems/gem_init.c"
=>
[
MRUBY_CONFIGS
]
.
flatten
do
|
t
|
file
"
#{
build_dir
}
/mrbgems/gem_init.c"
=>
MRUBY_CONFIGS
.
flatten
do
|
t
|
FileUtils
.
mkdir_p
"
#{
build_dir
}
/mrbgems"
FileUtils
.
mkdir_p
"
#{
build_dir
}
/mrbgems"
open
(
t
.
name
,
'w'
)
do
|
f
|
open
(
t
.
name
,
'w'
)
do
|
f
|
f
.
puts
%Q[/*]
f
.
puts
%Q[/*]
...
...
tasks/mrbgems_test.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
gems
.
each
do
|
g
|
gems
.
each
do
|
g
|
test_rbobj
=
g
.
test_rbireps
.
ext
(
exts
.
object
)
test_rbobj
=
g
.
test_rbireps
.
ext
(
exts
.
object
)
...
...
tasks/mruby_build.rake
View file @
87d0630d
load
'tasks/mruby_build_gem.rake'
load
"
#{
MRUBY_ROOT
}
/tasks/mruby_build_gem.rake"
load
'tasks/mruby_build_commands.rake'
load
"
#{
MRUBY_ROOT
}
/tasks/mruby_build_commands.rake"
module
MRuby
module
MRuby
class
<<
self
class
<<
self
...
@@ -30,7 +30,7 @@ module MRuby
...
@@ -30,7 +30,7 @@ module MRuby
end
end
def
self
.
load
def
self
.
load
Dir
.
glob
(
"
#{
File
.
dirname
(
__FILE__
)
}
/toolchains/*.rake"
).
each
do
|
file
|
Dir
.
glob
(
"
#{
MRUBY_ROOT
}
/tasks
/toolchains/*.rake"
).
each
do
|
file
|
Kernel
.
load
file
Kernel
.
load
file
end
end
end
end
...
@@ -44,7 +44,7 @@ module MRuby
...
@@ -44,7 +44,7 @@ module MRuby
include
Rake
::
DSL
include
Rake
::
DSL
include
LoadGems
include
LoadGems
attr_accessor
:name
,
:bins
,
:exts
,
:file_separator
attr_accessor
:name
,
:bins
,
:exts
,
:file_separator
attr_reader
:
root
,
:
libmruby
,
:gems
attr_reader
:libmruby
,
:gems
COMPILERS
=
%w(cc cxx objc asm)
COMPILERS
=
%w(cc cxx objc asm)
COMMANDS
=
COMPILERS
+
%w(linker archiver yacc gperf git exts mrbc)
COMMANDS
=
COMPILERS
+
%w(linker archiver yacc gperf git exts mrbc)
...
@@ -56,8 +56,6 @@ module MRuby
...
@@ -56,8 +56,6 @@ module MRuby
@name
=
name
.
to_s
@name
=
name
.
to_s
unless
MRuby
.
targets
[
@name
]
unless
MRuby
.
targets
[
@name
]
@root
=
File
.
expand_path
(
"
#{
File
.
dirname
(
__FILE__
)
}
/.."
)
if
ENV
[
'OS'
]
==
'Windows_NT'
if
ENV
[
'OS'
]
==
'Windows_NT'
@exts
=
Exts
.
new
(
'.o'
,
'.exe'
,
'.a'
)
@exts
=
Exts
.
new
(
'.o'
,
'.exe'
,
'.a'
)
else
else
...
@@ -93,12 +91,16 @@ module MRuby
...
@@ -93,12 +91,16 @@ module MRuby
tc
.
setup
(
self
)
tc
.
setup
(
self
)
end
end
def
root
MRUBY_ROOT
end
def
build_dir
def
build_dir
"build/
#{
self
.
name
}
"
"
#{
MRUBY_ROOT
}
/
build/
#{
self
.
name
}
"
end
end
def
mrbcfile
def
mrbcfile
MRuby
.
targets
[
'host'
].
exefile
(
"
build/host
/bin/mrbc"
)
MRuby
.
targets
[
'host'
].
exefile
(
"
#{
MRuby
.
targets
[
'host'
].
build_dir
}
/bin/mrbc"
)
end
end
def
compilers
def
compilers
...
@@ -114,7 +116,7 @@ module MRuby
...
@@ -114,7 +116,7 @@ module MRuby
else
else
compiler
.
defines
+=
%w(DISABLE_GEMS)
compiler
.
defines
+=
%w(DISABLE_GEMS)
end
end
compiler
.
define_rules
build_dir
compiler
.
define_rules
build_dir
,
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
))
end
end
end
end
...
@@ -161,14 +163,14 @@ module MRuby
...
@@ -161,14 +163,14 @@ module MRuby
def
run_test
def
run_test
puts
">>> Test
#{
name
}
<<<"
puts
">>> Test
#{
name
}
<<<"
mrbtest
=
exefile
(
"
#{
build_dir
}
/test/mrbtest"
)
mrbtest
=
exefile
(
"
#{
build_dir
}
/test/mrbtest"
)
sh
"
#{
filename
mrbtest
}
"
sh
"
#{
filename
mrbtest
.
relative_path
}
"
puts
puts
end
end
def
print_build_summary
def
print_build_summary
puts
"================================================"
puts
"================================================"
puts
" Config Name:
#{
@name
}
"
puts
" Config Name:
#{
@name
}
"
puts
" Output Directory:
#{
self
.
build_dir
}
"
puts
" Output Directory:
#{
self
.
build_dir
.
relative_path
}
"
puts
" Binaries:
#{
@bins
.
join
(
', '
)
}
"
unless
@bins
.
empty?
puts
" Binaries:
#{
@bins
.
join
(
', '
)
}
"
unless
@bins
.
empty?
unless
@gems
.
empty?
unless
@gems
.
empty?
puts
" Included Gems:"
puts
" Included Gems:"
...
...
tasks/mruby_build_commands.rake
View file @
87d0630d
...
@@ -39,7 +39,7 @@ module MRuby
...
@@ -39,7 +39,7 @@ module MRuby
@command
=
ENV
[
'CC'
]
||
'cc'
@command
=
ENV
[
'CC'
]
||
'cc'
@flags
=
[
ENV
[
'CFLAGS'
]
||
[]]
@flags
=
[
ENV
[
'CFLAGS'
]
||
[]]
@source_exts
=
source_exts
@source_exts
=
source_exts
@include_paths
=
[
"
#{
build
.
root
}
/include"
]
@include_paths
=
[
"
#{
MRUBY_ROOT
}
/include"
]
@defines
=
%w()
@defines
=
%w()
@option_include_path
=
'-I%s'
@option_include_path
=
'-I%s'
@option_define
=
'-D%s'
@option_define
=
'-D%s'
...
@@ -60,7 +60,7 @@ module MRuby
...
@@ -60,7 +60,7 @@ module MRuby
include_path_flags
=
[
include_paths
,
_include_paths
,
File
.
dirname
(
infile
)].
flatten
.
map
do
|
f
|
include_path_flags
=
[
include_paths
,
_include_paths
,
File
.
dirname
(
infile
)].
flatten
.
map
do
|
f
|
option_include_path
%
filename
(
f
)
option_include_path
%
filename
(
f
)
end
end
_pp
"CC"
,
infile
,
outfile
_pp
"CC"
,
infile
.
relative_path
,
outfile
.
relative_path
_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
...
@@ -76,7 +76,7 @@ module MRuby
...
@@ -76,7 +76,7 @@ module MRuby
source_exts
.
each
do
|
ext
,
compile
|
source_exts
.
each
do
|
ext
,
compile
|
rule
generated_file_matcher
=>
[
rule
generated_file_matcher
=>
[
proc
{
|
file
|
proc
{
|
file
|
file
.
sub
(
generated_file_matcher
,
"
#{
source_dir
}
\\
1
#{
ext
}
"
)
file
.
sub
(
generated_file_matcher
,
"
#{
source_dir
}
/
\\
1
#{
ext
}
"
)
},
},
proc
{
|
file
|
proc
{
|
file
|
get_dependencies
(
file
)
get_dependencies
(
file
)
...
@@ -141,7 +141,7 @@ module MRuby
...
@@ -141,7 +141,7 @@ module MRuby
library_flags
=
[
libraries
,
_libraries
].
flatten
.
map
{
|
d
|
option_library
%
d
}
library_flags
=
[
libraries
,
_libraries
].
flatten
.
map
{
|
d
|
option_library
%
d
}
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
_pp
"LD"
,
outfile
.
relative_path
_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
(
' '
),
...
@@ -161,7 +161,7 @@ module MRuby
...
@@ -161,7 +161,7 @@ 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
_pp
"AR"
,
outfile
.
relative_path
_run
archive_options
,
{
:outfile
=>
filename
(
outfile
),
:objs
=>
filename
(
objfiles
).
join
(
' '
)
}
_run
archive_options
,
{
:outfile
=>
filename
(
outfile
),
:objs
=>
filename
(
objfiles
).
join
(
' '
)
}
end
end
end
end
...
@@ -177,7 +177,7 @@ module MRuby
...
@@ -177,7 +177,7 @@ module MRuby
def
run
(
outfile
,
infile
)
def
run
(
outfile
,
infile
)
FileUtils
.
mkdir_p
File
.
dirname
(
outfile
)
FileUtils
.
mkdir_p
File
.
dirname
(
outfile
)
_pp
"YACC"
,
infile
,
outfile
_pp
"YACC"
,
infile
.
relative_path
,
outfile
.
relative_path
_run
compile_options
,
{
:outfile
=>
filename
(
outfile
)
,
:infile
=>
filename
(
infile
)
}
_run
compile_options
,
{
:outfile
=>
filename
(
outfile
)
,
:infile
=>
filename
(
infile
)
}
end
end
end
end
...
@@ -193,7 +193,7 @@ module MRuby
...
@@ -193,7 +193,7 @@ module MRuby
def
run
(
outfile
,
infile
)
def
run
(
outfile
,
infile
)
FileUtils
.
mkdir_p
File
.
dirname
(
outfile
)
FileUtils
.
mkdir_p
File
.
dirname
(
outfile
)
_pp
"GPERF"
,
infile
,
outfile
_pp
"GPERF"
,
infile
.
relative_path
,
outfile
.
relative_path
_run
compile_options
,
{
:outfile
=>
filename
(
outfile
)
,
:infile
=>
filename
(
infile
)
}
_run
compile_options
,
{
:outfile
=>
filename
(
outfile
)
,
:infile
=>
filename
(
infile
)
}
end
end
end
end
...
@@ -210,7 +210,7 @@ module MRuby
...
@@ -210,7 +210,7 @@ module MRuby
end
end
def
run_clone
(
dir
,
url
,
_flags
=
[])
def
run_clone
(
dir
,
url
,
_flags
=
[])
_pp
"GIT"
,
url
,
dir
_pp
"GIT"
,
url
,
dir
.
relative_path
_run
clone_options
,
{
:flags
=>
[
flags
,
_flags
].
flatten
.
join
(
' '
),
:url
=>
url
,
:dir
=>
filename
(
dir
)
}
_run
clone_options
,
{
:flags
=>
[
flags
,
_flags
].
flatten
.
join
(
' '
),
:url
=>
url
,
:dir
=>
filename
(
dir
)
}
end
end
end
end
...
@@ -226,7 +226,7 @@ module MRuby
...
@@ -226,7 +226,7 @@ module MRuby
@command
||=
@build
.
mrbcfile
@command
||=
@build
.
mrbcfile
IO
.
popen
(
"
#{
filename
@command
}
#{
@compile_options
%
{
:funcname
=>
funcname
}
}"
,
'r+'
)
do
|
io
|
IO
.
popen
(
"
#{
filename
@command
}
#{
@compile_options
%
{
:funcname
=>
funcname
}
}"
,
'r+'
)
do
|
io
|
[
infiles
].
flatten
.
each
do
|
f
|
[
infiles
].
flatten
.
each
do
|
f
|
_pp
"MRBC"
,
"
#{
f
}
"
,
nil
,
:indent
=>
2
_pp
"MRBC"
,
f
.
relative_path
,
nil
,
:indent
=>
2
io
.
write
IO
.
read
(
f
)
io
.
write
IO
.
read
(
f
)
end
end
io
.
close_write
io
.
close_write
...
...
tasks/ruby_ext.rake
View file @
87d0630d
...
@@ -12,6 +12,10 @@ class String
...
@@ -12,6 +12,10 @@ class String
def
relative_path_from
(
dir
)
def
relative_path_from
(
dir
)
Pathname
.
new
(
File
.
expand_path
(
self
)).
relative_path_from
(
Pathname
.
new
(
File
.
expand_path
(
dir
))).
to_s
Pathname
.
new
(
File
.
expand_path
(
self
)).
relative_path_from
(
Pathname
.
new
(
File
.
expand_path
(
dir
))).
to_s
end
end
def
relative_path
relative_path_from
(
Dir
.
pwd
)
end
# Compatible with 1.9 on 1.8
# Compatible with 1.9 on 1.8
def
%
(
params
)
def
%
(
params
)
...
...
tasks/toolchains/gcc.rake
View file @
87d0630d
...
@@ -2,7 +2,7 @@ MRuby::Toolchain.new(:gcc) do |conf|
...
@@ -2,7 +2,7 @@ MRuby::Toolchain.new(:gcc) do |conf|
[
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'
]
||
'gcc'
cc
.
command
=
ENV
[
'CC'
]
||
'gcc'
cc
.
flags
=
[
ENV
[
'CFLAGS'
]
||
%w(-g -O3 -Wall -Werror-implicit-function-declaration)
]
cc
.
flags
=
[
ENV
[
'CFLAGS'
]
||
%w(-g -O3 -Wall -Werror-implicit-function-declaration)
]
cc
.
include_paths
=
[
"
#{
root
}
/include"
]
cc
.
include_paths
=
[
"
#{
MRUBY_ROOT
}
/include"
]
cc
.
defines
=
%w(DISABLE_GEMS)
cc
.
defines
=
%w(DISABLE_GEMS)
cc
.
option_include_path
=
'-I%s'
cc
.
option_include_path
=
'-I%s'
cc
.
option_define
=
'-D%s'
cc
.
option_define
=
'-D%s'
...
...
tasks/toolchains/vs2012.rake
View file @
87d0630d
...
@@ -2,7 +2,7 @@ MRuby::Toolchain.new(:vs2012) do |conf|
...
@@ -2,7 +2,7 @@ MRuby::Toolchain.new(:vs2012) do |conf|
[
conf
.
cc
,
conf
.
cxx
].
each
do
|
cc
|
[
conf
.
cc
,
conf
.
cxx
].
each
do
|
cc
|
cc
.
command
=
ENV
[
'CC'
]
||
'cl.exe'
cc
.
command
=
ENV
[
'CC'
]
||
'cl.exe'
cc
.
flags
=
[
ENV
[
'CFLAGS'
]
||
%w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)
]
cc
.
flags
=
[
ENV
[
'CFLAGS'
]
||
%w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)
]
cc
.
include_paths
=
[
"
#{
root
}
/include"
]
cc
.
include_paths
=
[
"
#{
MRUBY_ROOT
}
/include"
]
cc
.
defines
=
%w(DISABLE_GEMS)
cc
.
defines
=
%w(DISABLE_GEMS)
cc
.
option_include_path
=
'/I%s'
cc
.
option_include_path
=
'/I%s'
cc
.
option_define
=
'/D%s'
cc
.
option_define
=
'/D%s'
...
...
test/mrbtest.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
exec
=
exefile
(
"
#{
build_dir
}
/
#{
dir
}
/mrbtest"
)
exec
=
exefile
(
"
#{
current_build_
dir
}
/mrbtest"
)
clib
=
"
#{
build_dir
}
/
#{
dir
}
/mrbtest.c"
clib
=
"
#{
current_build_
dir
}
/mrbtest.c"
mlib
=
clib
.
ext
(
exts
.
object
)
mlib
=
clib
.
ext
(
exts
.
object
)
mrbs
=
Dir
.
glob
(
"
#{
dir
}
/t/*.rb"
)
mrbs
=
Dir
.
glob
(
"
#{
current_
dir
}
/t/*.rb"
)
init
=
"
#{
dir
}
/init_mrbtest.c"
init
=
"
#{
current_
dir
}
/init_mrbtest.c"
asslib
=
"
#{
dir
}
/assert.rb"
asslib
=
"
#{
current_
dir
}
/assert.rb"
mrbtest_lib
=
libfile
(
"
#{
build_dir
}
/
#{
dir
}
/mrbtest"
)
mrbtest_lib
=
libfile
(
"
#{
current_build_
dir
}
/mrbtest"
)
file
mrbtest_lib
=>
[
mlib
,
gems
.
map
(
&
:test_objs
),
gems
.
map
{
|
g
|
g
.
test_rbireps
.
ext
(
exts
.
object
)
}].
flatten
do
|
t
|
file
mrbtest_lib
=>
[
mlib
,
gems
.
map
(
&
:test_objs
),
gems
.
map
{
|
g
|
g
.
test_rbireps
.
ext
(
exts
.
object
)
}].
flatten
do
|
t
|
archiver
.
run
t
.
name
,
t
.
prerequisites
archiver
.
run
t
.
name
,
t
.
prerequisites
end
end
unless
build_mrbtest_lib_only?
unless
build_mrbtest_lib_only?
driver_obj
=
objfile
(
"
#{
build_dir
}
/
#{
dir
}
/driver"
)
driver_obj
=
objfile
(
"
#{
current_build_
dir
}
/driver"
)
file
exec
=>
[
driver_obj
,
mrbtest_lib
,
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
file
exec
=>
[
driver_obj
,
mrbtest_lib
,
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
gem_flags_before_libraries
=
gems
.
map
{
|
g
|
g
.
linker
.
flags_before_libraries
}
gem_flags_before_libraries
=
gems
.
map
{
|
g
|
g
.
linker
.
flags_before_libraries
}
...
@@ -27,7 +29,7 @@ MRuby.each_target do
...
@@ -27,7 +29,7 @@ MRuby.each_target do
file
mlib
=>
[
clib
]
file
mlib
=>
[
clib
]
file
clib
=>
[
mrbcfile
,
init
,
asslib
]
+
mrbs
do
|
t
|
file
clib
=>
[
mrbcfile
,
init
,
asslib
]
+
mrbs
do
|
t
|
_pp
"GEN"
,
"*.rb"
,
"
#{
clib
}
"
_pp
"GEN"
,
"*.rb"
,
"
#{
clib
.
relative_path
}
"
FileUtils
.
mkdir_p
File
.
dirname
(
clib
)
FileUtils
.
mkdir_p
File
.
dirname
(
clib
)
open
(
clib
,
'w'
)
do
|
f
|
open
(
clib
,
'w'
)
do
|
f
|
f
.
puts
IO
.
read
(
init
)
f
.
puts
IO
.
read
(
init
)
...
...
tools/mirb/mirb.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
if
bins
.
find
{
|
s
|
s
.
to_s
==
'mirb'
}
if
bins
.
find
{
|
s
|
s
.
to_s
==
'mirb'
}
exec
=
exefile
(
"
#{
build_dir
}
/bin/mirb"
)
exec
=
exefile
(
"
#{
build_dir
}
/bin/mirb"
)
objs
=
Dir
.
glob
(
"
#{
dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
build_dir
}
/%X"
))
}.
flatten
objs
=
Dir
.
glob
(
"
#{
current_dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
current_build_dir
}
/%n"
))
}
file
exec
=>
objs
+
[
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
file
exec
=>
objs
+
[
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
...
...
tools/mrbc/mrbc.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
if
bins
.
find
{
|
s
|
s
.
to_s
==
'mrbc'
}
if
bins
.
find
{
|
s
|
s
.
to_s
==
'mrbc'
}
exec
=
exefile
(
"
#{
build_dir
}
/bin/mrbc"
)
exec
=
exefile
(
"
#{
build_dir
}
/bin/mrbc"
)
objs
=
Dir
.
glob
(
"
#{
dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
build_dir
}
/%X
"
))
}.
flatten
objs
=
Dir
.
glob
(
"
#{
current_dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
current_build_dir
}
/%n
"
))
}.
flatten
file
exec
=>
objs
+
[
libfile
(
"
#{
build_dir
}
/lib/libmruby_core"
)]
do
|
t
|
file
exec
=>
objs
+
[
libfile
(
"
#{
build_dir
}
/lib/libmruby_core"
)]
do
|
t
|
linker
.
run
t
.
name
,
t
.
prerequisites
linker
.
run
t
.
name
,
t
.
prerequisites
...
...
tools/mruby/mruby.rake
View file @
87d0630d
MRuby
.
each_target
do
MRuby
.
each_target
do
dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
root
)
current_dir
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
Dir
.
pwd
)
relative_from_root
=
File
.
dirname
(
__FILE__
).
relative_path_from
(
MRUBY_ROOT
)
current_build_dir
=
"
#{
build_dir
}
/
#{
relative_from_root
}
"
if
bins
.
find
{
|
s
|
s
.
to_s
==
'mruby'
}
if
bins
.
find
{
|
s
|
s
.
to_s
==
'mruby'
}
exec
=
exefile
(
"
#{
build_dir
}
/bin/mruby"
)
exec
=
exefile
(
"
#{
build_dir
}
/bin/mruby"
)
objs
=
Dir
.
glob
(
"
#{
dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
build_dir
}
/%X
"
))
}.
flatten
objs
=
Dir
.
glob
(
"
#{
current_dir
}
/*.c"
).
map
{
|
f
|
objfile
(
f
.
pathmap
(
"
#{
current_build_dir
}
/%n
"
))
}.
flatten
file
exec
=>
objs
+
[
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
file
exec
=>
objs
+
[
libfile
(
"
#{
build_dir
}
/lib/libmruby"
)]
do
|
t
|
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
gem_flags
=
gems
.
map
{
|
g
|
g
.
linker
.
flags
}
...
...
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