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
41dbcf7a
Commit
41dbcf7a
authored
May 01, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2165 from take-cheeze/header_searcher
Implement header searcher to use readline in mirb if possible.
parents
c17761d5
052fe512
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
2 deletions
+43
-2
mrbgems/mruby-bin-mirb/mrbgem.rake
mrbgems/mruby-bin-mirb/mrbgem.rake
+6
-1
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
+1
-1
tasks/mruby_build_commands.rake
tasks/mruby_build_commands.rake
+12
-0
tasks/toolchains/gcc.rake
tasks/toolchains/gcc.rake
+24
-0
No files found.
mrbgems/mruby-bin-mirb/mrbgem.rake
View file @
41dbcf7a
...
...
@@ -3,7 +3,12 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec|
spec
.
author
=
'mruby developers'
spec
.
summary
=
'mirb command'
spec
.
linker
.
libraries
<<
'readline'
if
spec
.
cc
.
defines
.
include?
"ENABLE_READLINE"
if
spec
.
build
.
cc
.
search_header_path
'readline/readline.h'
spec
.
cc
.
defines
<<
"ENABLE_READLINE"
spec
.
linker
.
libraries
<<
'readline'
elsif
spec
.
build
.
cc
.
search_header_path
'linenoise.h'
spec
.
cc
.
defines
<<
"ENABLE_LINENOISE"
end
spec
.
bins
=
%w(mirb)
end
mrbgems/mruby-bin-mirb/tools/mirb/mirb.c
View file @
41dbcf7a
...
...
@@ -22,7 +22,7 @@
#define MIRB_WRITE_HISTORY(path) write_history(path)
#define MIRB_READ_HISTORY(path) read_history(path)
#define MIRB_USING_HISTORY() using_history()
#elif
ENABLE_LINENOISE
#elif
defined(ENABLE_LINENOISE)
#define ENABLE_READLINE
#include <linenoise.h>
#define MIRB_ADD_HISTORY(line) linenoiseHistoryAdd(line)
...
...
tasks/mruby_build_commands.rake
View file @
41dbcf7a
...
...
@@ -54,6 +54,18 @@ module MRuby
@compile_options
=
'%{flags} -o %{outfile} -c %{infile}'
end
alias
header_search_paths
include_paths
def
search_header_path
(
name
)
header_search_paths
.
find
do
|
v
|
File
.
exist?
build
.
filename
(
"
#{
v
}
/
#{
name
}
"
).
sub
(
/^"(.*)"$/
,
'\1'
)
end
end
def
search_header
(
name
)
path
=
search_header_path
name
path
&&
build
.
filename
(
"
#{
path
}
/
#{
name
}
"
).
sub
(
/^"(.*)"$/
,
'\1'
)
end
def
all_flags
(
_defineds
=
[],
_include_paths
=
[],
_flags
=
[])
define_flags
=
[
defines
,
_defineds
].
flatten
.
map
{
|
d
|
option_define
%
d
}
include_path_flags
=
[
include_paths
,
_include_paths
].
flatten
.
map
do
|
f
|
...
...
tasks/toolchains/gcc.rake
View file @
41dbcf7a
...
...
@@ -28,4 +28,28 @@ MRuby::Toolchain.new(:gcc) do |conf|
linker
.
option_library_path
=
'-L%s'
linker
.
link_options
=
'%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
end
[[
conf
.
cc
,
'c'
],
[
conf
.
cxx
,
'c++'
]].
each
do
|
cc
,
lang
|
cc
.
define_singleton_method
(
:header_search_paths
)
do
if
@header_search_command
!=
command
result
=
`echo |
#{
build
.
filename
command
}
-x
#{
lang
}
-Wp,-v - -fsyntax-only 2>&1`
result
=
`echo |
#{
command
}
-x
#{
lang
}
-Wp,-v - -fsyntax-only 2>&1`
if
$?
.
exitstatus
!=
0
return
include_paths
if
$?
.
exitstatus
!=
0
@frameworks
=
[]
@header_search_paths
=
result
.
lines
.
map
{
|
v
|
framework
=
v
.
match
(
/^ (.*)(?: \(framework directory\))$/
)
if
framework
@frameworks
<<
framework
[
1
]
next
nil
end
v
.
match
(
/^ (.*)$/
)
}.
compact
.
map
{
|
v
|
v
[
1
]
}.
select
{
|
v
|
File
.
directory?
v
}
@header_search_paths
+=
include_paths
@header_search_command
=
command
end
@header_search_paths
end
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