Last active
April 29, 2020 07:17
-
-
Save arika/d35116211ec519928e6891d6c565b05f to your computer and use it in GitHub Desktop.
mrubyのLinux/macOS向けクロスビルドのためのDockerfile(素のmrubyをビルドするだけならcurlとlibssl-devはたぶんいらない)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
ENV OSX_CROSS_PATH=/osxcross | |
COPY --from=dockercore/golang-cross:1.13.10 "${OSX_CROSS_PATH}/." "${OSX_CROSS_PATH}/" | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update -qq && apt-get install -y -q --no-install-recommends \ | |
bison \ | |
clang \ | |
curl \ | |
git \ | |
libc6-dev \ | |
libssl-dev \ | |
make \ | |
musl-tools \ | |
ruby-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
ENV PATH=${OSX_CROSS_PATH}/target/bin:$PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build_conf(conf) | |
conf.gembox 'default' | |
end | |
MRuby::Build.new do |conf| | |
toolchain :gcc | |
build_conf(conf) | |
conf.enable_test | |
conf.enable_debug if ENV['ENABLE_DEBUG'] | |
end | |
MRuby::Build.new('linux-x86_64') do |conf| | |
toolchain :gcc | |
[conf.cc, conf.linker].each do |cc| | |
cc.command = 'musl-gcc' | |
cc.flags += %w[-static -Os] | |
end | |
build_conf(conf) | |
end | |
MRuby::CrossBuild.new('darwin-x86_64') do |conf| | |
toolchain :clang | |
[conf.cc, conf.linker].each do |cc| | |
cc.command = 'x86_64-apple-darwin14-clang' | |
end | |
conf.cxx.command = 'x86_64-apple-darwin14-clang++' | |
conf.archiver.command = 'x86_64-apple-darwin14-ar' | |
# To configure: k0kubun/mruby-onig-regexp etc. | |
conf.build_target = 'x86_64-pc-linux-gnu' | |
conf.host_target = 'x86_64-apple-darwin14' | |
build_conf(conf) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build -t mruby-cross . | |
# copy Rakefile from https://gist.github.com/arika/38daeec40b67d8e9042e5234b4720927 | |
# copy sample_build_config.rb to build_config.rb | |
mkdir vendor | |
cd $_ | |
curl -fsSL https://github.com/mruby/mruby/archive/2.1.0.tar.gz | tar xf - | |
mv mruby-2.1.0 mruby | |
cd - | |
docker run -v $(pwd):/work -w /work mruby-cross rake |
Author
arika
commented
Apr 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment