Skip to content

Commit fcbaafa

Browse files
committed
Add toolchain support for OpenWRT
1 parent 1887042 commit fcbaafa

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tasks/toolchains/openwrt.rake

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# usage of environmental variables to set the
2+
# cross compiling toolchain proper
3+
MRuby::Toolchain.new(:openwrt) do |conf|
4+
[conf.cc, conf.objc, conf.asm].each do |cc|
5+
cc.command = ENV['TARGET_CC']
6+
cc.flags = ENV['TARGET_CFLAGS']
7+
cc.include_paths = ["#{MRUBY_ROOT}/include"]
8+
cc.defines = %w(DISABLE_GEMS)
9+
cc.option_include_path = '-I%s'
10+
cc.option_define = '-D%s'
11+
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
12+
end
13+
14+
[conf.cxx].each do |cxx|
15+
cxx.command = ENV['TARGET_CXX']
16+
cxx.flags = ENV['TARGET_CXXFLAGS']
17+
cxx.include_paths = ["#{MRUBY_ROOT}/include"]
18+
cxx.defines = %w(DISABLE_GEMS)
19+
cxx.option_include_path = '-I%s'
20+
cxx.option_define = '-D%s'
21+
cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
22+
end
23+
24+
conf.linker do |linker|
25+
linker.command = ENV['TARGET_CC']
26+
linker.flags = ENV['TARGET_LDFLAGS']
27+
linker.libraries = %w(m)
28+
linker.library_paths = []
29+
linker.option_library = '-l%s'
30+
linker.option_library_path = '-L%s'
31+
linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
32+
end
33+
34+
conf.archiver do |archiver|
35+
archiver.command = ENV['TARGET_AR']
36+
archiver.archive_options = 'rs %{outfile} %{objs}'
37+
end
38+
end

0 commit comments

Comments
 (0)