Skip to content

Commit

Permalink
Use MSYS Makefiles generator in mingw32
Browse files Browse the repository at this point in the history
This at least has it compiling with RubyInstaller + DevKit.
  • Loading branch information
Yuki Izumi authored and gjtorikian committed Oct 11, 2016
1 parent b0c51c1 commit 23bec5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ require 'rake/clean'
require 'rake/extensiontask'
require 'digest/md5'

host_os = RbConfig::CONFIG['host_os']
require 'devkit' if host_os == 'mingw32'

task :default => [:test]

# Gem Spec
Expand All @@ -16,9 +19,7 @@ end
Rake::Task['clean'].enhance do
ext_dir = File.join(File.dirname(__FILE__), 'ext', 'commonmarker', 'cmark')
Dir.chdir(ext_dir) do
host_os = RbConfig::CONFIG['host_os']
make = (host_os == 'mingw32') ? 'nmake.bat' : 'make'
`#{make} clean`
`make clean`
end
end

Expand Down
7 changes: 3 additions & 4 deletions ext/commonmarker/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@

Dir.chdir(CMARK_BUILD_DIR) do
if host_os == 'mingw32'
make = 'nmake'
system 'cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE= -D CMAKE_INSTALL_PREFIX=windows .."'
system 'cmake .. -G "MSYS Makefiles"'
else
make = 'make'
system 'cmake .. -DCMAKE_C_FLAGS=-fPIC'
end
system "#{make} libcmark_static" or abort "make libcmark_static failed"
system "make libcmark_static" or abort "make libcmark_static failed"
# rake-compiler seems to complain about this line, not sure why it's messing with it
FileUtils.rm_rf(File.join(CMARK_BUILD_DIR, 'Testing', 'Temporary'))
end
Expand All @@ -47,5 +45,6 @@

$LDFLAGS << " -L#{CMARK_BUILD_DIR}/src -lcmark"
$CFLAGS << " -O2 -I#{CMARK_DIR}/src -I#{CMARK_BUILD_DIR}/src"
$CFLAGS << " -DCMARK_STATIC_DEFINE"

create_makefile('commonmarker/commonmarker')

0 comments on commit 23bec5e

Please sign in to comment.