From 8261306196a9e7da6751b2d4b2b156b3763e1760 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 4 Mar 2020 00:28:56 -0800 Subject: [PATCH 1/6] Support Windows --- .github/workflows/docker.yml | 16 +++++++++- Rakefile | 2 ++ build_config.rb | 46 +++++++++++++++++++++++++++++ dockcross/windows-i686/Dockerfile | 3 ++ dockcross/windows-x86_64/Dockerfile | 3 ++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 dockcross/windows-i686/Dockerfile create mode 100644 dockcross/windows-x86_64/Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b014179..8320298 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: [linux, darwin] + os: [linux, darwin, windows] arch: [x86_64, i686, i386, armhf, aarch64] exclude: - os: linux @@ -37,6 +37,12 @@ jobs: arch: armhf - os: darwin arch: aarch64 + - os: windows + arch: i386 + - os: windows + arch: armhf + - os: windows + arch: aarch64 fail-fast: false steps: - name: Install libraries @@ -84,6 +90,14 @@ jobs: with: name: mitamae-i386-darwin path: mitamae-build/ + - uses: actions/download-artifact@v1 + with: + name: mitamae-x86_64-windows + path: mitamae-build/ + - uses: actions/download-artifact@v1 + with: + name: mitamae-i686-windows + path: mitamae-build/ - name: Release run: | diff --git a/Rakefile b/Rakefile index d9b55e5..f0e1938 100644 --- a/Rakefile +++ b/Rakefile @@ -19,6 +19,8 @@ DOCKCROSS_TARGETS = %w[ linux-aarch64 darwin-x86_64 darwin-i386 + windows-x86_64 + windows-i686 ] STRIP_TARGETS = %w[ diff --git a/build_config.rb b/build_config.rb index aa36dae..c0ea919 100644 --- a/build_config.rb +++ b/build_config.rb @@ -151,3 +151,49 @@ def debug_config(conf) gem_config(conf) end end + +if build_targets.include?('windows-x86_64') + MRuby::CrossBuild.new('windows-x86_64') do |conf| + toolchain :gcc + + [conf.cc, conf.linker].each do |cc| + cc.command = 'x86_64-w64-mingw32-gcc' + end + conf.cxx.command = 'x86_64-w64-mingw32-g++' + conf.archiver.command = 'x86_64-w64-mingw32-gcc-ar' + + conf.exts do |exts| + exts.object = '.obj' + exts.executable = '.exe' + exts.library = '.lib' + end + + conf.build_target = 'x86_64-pc-linux-gnu' + conf.host_target = 'x86_64-w64-mingw32' + + gem_config(conf) + end +end + +if build_targets.include?('windows-i686') + MRuby::CrossBuild.new('windows-i686') do |conf| + toolchain :gcc + + [conf.cc, conf.linker].each do |cc| + cc.command = 'i686-w64-mingw32-gcc' + end + conf.cxx.command = 'i686-w64-mingw32-g++' + conf.archiver.command = 'i686-w64-mingw32-gcc-ar' + + conf.exts do |exts| + exts.object = '.obj' + exts.executable = '.exe' + exts.library = '.lib' + end + + conf.build_target = 'i686-pc-linux-gnu' + conf.host_target = 'i686-w64-mingw32' + + gem_config(conf) + end +end diff --git a/dockcross/windows-i686/Dockerfile b/dockcross/windows-i686/Dockerfile new file mode 100644 index 0000000..5e59dba --- /dev/null +++ b/dockcross/windows-i686/Dockerfile @@ -0,0 +1,3 @@ +# k0kubun/mitamae-dockcross:windows-i686 +# Using mruby-cli-docker for now. TODO: Use dockcross +FROM hone/mruby-cli diff --git a/dockcross/windows-x86_64/Dockerfile b/dockcross/windows-x86_64/Dockerfile new file mode 100644 index 0000000..548720a --- /dev/null +++ b/dockcross/windows-x86_64/Dockerfile @@ -0,0 +1,3 @@ +# k0kubun/mitamae-dockcross:windows-x86_64 +# Using mruby-cli-docker for now. TODO: Use dockcross +FROM hone/mruby-cli From 94fa2dcb449313e0e85708405808f5dcb16ced01 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 4 Mar 2020 01:34:23 -0800 Subject: [PATCH 2/6] Make sure we use GNU ld for mruby-onig-regexp --- build_config.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build_config.rb b/build_config.rb index c0ea919..e860e2b 100644 --- a/build_config.rb +++ b/build_config.rb @@ -156,9 +156,8 @@ def debug_config(conf) MRuby::CrossBuild.new('windows-x86_64') do |conf| toolchain :gcc - [conf.cc, conf.linker].each do |cc| - cc.command = 'x86_64-w64-mingw32-gcc' - end + conf.cc.command = 'x86_64-w64-mingw32-gcc' + conf.linker.command = 'x86_64-w64-mingw32-ld' conf.cxx.command = 'x86_64-w64-mingw32-g++' conf.archiver.command = 'x86_64-w64-mingw32-gcc-ar' @@ -179,9 +178,8 @@ def debug_config(conf) MRuby::CrossBuild.new('windows-i686') do |conf| toolchain :gcc - [conf.cc, conf.linker].each do |cc| - cc.command = 'i686-w64-mingw32-gcc' - end + conf.cc.command = 'i686-w64-mingw32-gcc' + conf.linker.command = 'i686-w64-mingw32-ld' conf.cxx.command = 'i686-w64-mingw32-g++' conf.archiver.command = 'i686-w64-mingw32-gcc-ar' From 6541fff1e357c223ead74d4f6aad55654e4c10ec Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 4 Mar 2020 01:49:55 -0800 Subject: [PATCH 3/6] Fork mruby-file-stat to configure with --host --- build_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_config.rb b/build_config.rb index e860e2b..6609474 100644 --- a/build_config.rb +++ b/build_config.rb @@ -4,12 +4,12 @@ def gem_config(conf) # be sure to include this gem (the cli app) conf.gem File.expand_path(File.dirname(__FILE__)) - conf.gem mgem: 'mruby-file-stat', checksum_hash: '2d3ea9b5d59d2b41133228a71c110b75cb30a31e' conf.gem mgem: 'mruby-hashie', checksum_hash: 'c69255a94debcd641f2087b569f5625509bde698' conf.gem mgem: 'mruby-open3', checksum_hash: 'b7480b6300a81d0e5fac469a36a383518e3dfc78' conf.gem mgem: 'mruby-shellwords', checksum_hash: '2a284d99b2121615e43d6accdb0e4cde1868a0d8' conf.gem mgem: 'mruby-specinfra', checksum_hash: '6caf46e69238b50054bed78cb86ead49c3b7730c' conf.gem github: 'k0kubun/mruby-erb', checksum_hash: '978257e478633542c440c9248e8cdf33c5ad2074' + conf.gem github: 'k0kubun/mruby-file-stat', checksum_hash: '13297c3e60d93b0ce763260b9047cac375ea7f12' conf.gem github: 'k0kubun/mruby-tempfile', checksum_hash: 'e628c8fcb4bca3f3456640a8b56d1ae98c594e24' conf.gem github: 'mrbgems/mruby-yaml', checksum_hash: '0606652a6e99d902cd3101cf2d757a7c0c37a7fd' conf.gem github: 'eagletmt/mruby-etc', checksum_hash: 'v0.1.0' From 494d611cced650e6d92a5f95d44a94e27f565741 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 5 Mar 2020 23:40:02 -0800 Subject: [PATCH 4/6] Fork mruby-open3 and mruby-process --- build_config.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_config.rb b/build_config.rb index 6609474..cfe3041 100644 --- a/build_config.rb +++ b/build_config.rb @@ -5,11 +5,12 @@ def gem_config(conf) conf.gem File.expand_path(File.dirname(__FILE__)) conf.gem mgem: 'mruby-hashie', checksum_hash: 'c69255a94debcd641f2087b569f5625509bde698' - conf.gem mgem: 'mruby-open3', checksum_hash: 'b7480b6300a81d0e5fac469a36a383518e3dfc78' + conf.gem mgem: 'mruby-open3', checksum_hash: '5608d98f52303072af0e5ee26a45852e2720ce19' conf.gem mgem: 'mruby-shellwords', checksum_hash: '2a284d99b2121615e43d6accdb0e4cde1868a0d8' conf.gem mgem: 'mruby-specinfra', checksum_hash: '6caf46e69238b50054bed78cb86ead49c3b7730c' conf.gem github: 'k0kubun/mruby-erb', checksum_hash: '978257e478633542c440c9248e8cdf33c5ad2074' conf.gem github: 'k0kubun/mruby-file-stat', checksum_hash: '13297c3e60d93b0ce763260b9047cac375ea7f12' + conf.gem github: 'k0kubun/mruby-process', checksum_hash: 'd908a208ce6e4b89b9405f63c3580664008fbb0f' conf.gem github: 'k0kubun/mruby-tempfile', checksum_hash: 'e628c8fcb4bca3f3456640a8b56d1ae98c594e24' conf.gem github: 'mrbgems/mruby-yaml', checksum_hash: '0606652a6e99d902cd3101cf2d757a7c0c37a7fd' conf.gem github: 'eagletmt/mruby-etc', checksum_hash: 'v0.1.0' From 055536a38f5dab4cb9447b3009b37832988a20fc Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 5 Mar 2020 23:48:42 -0800 Subject: [PATCH 5/6] Fork mruby-tempfile --- build_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_config.rb b/build_config.rb index cfe3041..3bc8e64 100644 --- a/build_config.rb +++ b/build_config.rb @@ -11,7 +11,7 @@ def gem_config(conf) conf.gem github: 'k0kubun/mruby-erb', checksum_hash: '978257e478633542c440c9248e8cdf33c5ad2074' conf.gem github: 'k0kubun/mruby-file-stat', checksum_hash: '13297c3e60d93b0ce763260b9047cac375ea7f12' conf.gem github: 'k0kubun/mruby-process', checksum_hash: 'd908a208ce6e4b89b9405f63c3580664008fbb0f' - conf.gem github: 'k0kubun/mruby-tempfile', checksum_hash: 'e628c8fcb4bca3f3456640a8b56d1ae98c594e24' + conf.gem github: 'k0kubun/mruby-tempfile', checksum_hash: '26273b9f884bb4c9e58ba83010ccd5b4258fb82e' conf.gem github: 'mrbgems/mruby-yaml', checksum_hash: '0606652a6e99d902cd3101cf2d757a7c0c37a7fd' conf.gem github: 'eagletmt/mruby-etc', checksum_hash: 'v0.1.0' end From 2068260fea98b853cbeb186903fcf906bf0131fa Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Thu, 5 Mar 2020 23:55:07 -0800 Subject: [PATCH 6/6] Fork mruby-etc --- build_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_config.rb b/build_config.rb index 3bc8e64..53fa295 100644 --- a/build_config.rb +++ b/build_config.rb @@ -13,7 +13,7 @@ def gem_config(conf) conf.gem github: 'k0kubun/mruby-process', checksum_hash: 'd908a208ce6e4b89b9405f63c3580664008fbb0f' conf.gem github: 'k0kubun/mruby-tempfile', checksum_hash: '26273b9f884bb4c9e58ba83010ccd5b4258fb82e' conf.gem github: 'mrbgems/mruby-yaml', checksum_hash: '0606652a6e99d902cd3101cf2d757a7c0c37a7fd' - conf.gem github: 'eagletmt/mruby-etc', checksum_hash: 'v0.1.0' + conf.gem github: 'k0kubun/mruby-etc', checksum_hash: '67da23cf58d1010832e41141280e6cba5a926f77' end def debug_config(conf)