mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-27 01:50:28 +00:00
Merge pull request #1918 from nghttp2/mruby-cross
mruby: Support cross build for autotools
This commit is contained in:
commit
892a6162ab
2
third-party/CMakeLists.txt
vendored
2
third-party/CMakeLists.txt
vendored
@ -58,7 +58,7 @@ if(ENABLE_THIRD_PARTY)
|
||||
"MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/build_config.rb"
|
||||
"BUILD_DIR=${MRUBY_BUILD_DIR}"
|
||||
"INSTALL_DIR=${MRUBY_BUILD_DIR}/install/bin"
|
||||
"CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}"
|
||||
"MRUBY_CC=${CMAKE_C_COMPILER}" "MRUBY_CXX=${CMAKE_CXX_COMPILER}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mruby/minirake"
|
||||
-f "${CMAKE_CURRENT_SOURCE_DIR}/mruby/Rakefile"
|
||||
${_byproducts}
|
||||
|
9
third-party/Makefile.am
vendored
9
third-party/Makefile.am
vendored
@ -574,10 +574,9 @@ mruby:
|
||||
MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \
|
||||
BUILD_DIR="${abs_builddir}/mruby/build" \
|
||||
INSTALL_DIR="${abs_builddir}/mruby/build/install/bin" \
|
||||
CC="${CC}" CXX="$(firstword $(CXX))" LD="${LD}" \
|
||||
CFLAGS="${CPPFLAGS} ${CFLAGS}" \
|
||||
CXXFLAGS="$(wordlist 2, $(words $(CXX)), $(CXX)) ${CPPFLAGS} ${CXXFLAGS}" \
|
||||
LDFLAGS="${LDFLAGS}" \
|
||||
MRUBY_CC="${CC}" MRUBY_CXX="$(firstword $(CXX))" MRUBY_LD="${LD}" \
|
||||
MRUBY_AR="${AR}" \
|
||||
HOST="${host}" BUILD="${build}" \
|
||||
"${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile"
|
||||
|
||||
all-local: mruby
|
||||
@ -586,7 +585,7 @@ clean-local:
|
||||
[ ! -f "${abs_builddir}/mruby/build/build_config.rb" ] || \
|
||||
MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \
|
||||
BUILD_DIR="${abs_builddir}/mruby/build" \
|
||||
CC="${CC}" \
|
||||
MRUBY_CC="${CC}" \
|
||||
"${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" clean
|
||||
|
||||
endif # HAVE_MRUBY
|
||||
|
26
third-party/build_config.rb
vendored
26
third-party/build_config.rb
vendored
@ -1,6 +1,16 @@
|
||||
MRuby::Build.new do |conf|
|
||||
toolchain :clang if ENV['CC'].include? "clang"
|
||||
toolchain :gcc if ENV['CC'].include? "gcc"
|
||||
def config(conf)
|
||||
toolchain :clang if ENV['MRUBY_CC'].include? "clang"
|
||||
toolchain :gcc if ENV['MRUBY_CC'].include? "gcc"
|
||||
|
||||
conf.cc.command = ENV['MRUBY_CC']
|
||||
conf.cxx.command = ENV['MRUBY_CXX']
|
||||
|
||||
if ENV['MRUBY_LD']
|
||||
conf.linker.command = ENV['MRUBY_LD']
|
||||
end
|
||||
if ENV['MRUBY_AR']
|
||||
conf.archiver.command = ENV['MRUBY_AR']
|
||||
end
|
||||
|
||||
# C++ project needs this. Without this, mruby exception does not
|
||||
# properly destroy C++ object allocated on stack.
|
||||
@ -12,3 +22,13 @@ MRuby::Build.new do |conf|
|
||||
conf.gembox 'default'
|
||||
conf.gem :core => 'mruby-eval'
|
||||
end
|
||||
|
||||
if ENV['BUILD'] == ENV['HOST'] then
|
||||
MRuby::Build.new do |conf|
|
||||
config(conf)
|
||||
end
|
||||
else
|
||||
MRuby::CrossBuild.new(ENV['HOST']) do |conf|
|
||||
config(conf)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user