Skip to content

Commit

Permalink
Simplify mkmf-rice, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 28, 2024
1 parent df7a134 commit 2cb6512
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
include:
- os: ubuntu-20.04
ruby: '3.1'
- os: macos-13
ruby: '3.1'
exclude:
# There's something wrong with this setup in GHA such that
# it gets weird linking errors, however I'm unable to reproduce
Expand Down
28 changes: 5 additions & 23 deletions lib/mkmf-rice.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
require 'mkmf'

IS_MSWIN = RbConfig::CONFIG['host_os'].match?(/mswin/)
IS_MINGW = RbConfig::CONFIG['host_os'].match?(/mingw/)
IS_DARWIN = RbConfig::CONFIG['host_os'].match?(/darwin/)

# The cpp_command is not overwritten in the experimental mkmf C++ support.
# See https://bugs.ruby-lang.org/issues/17578
MakeMakefile['C++'].module_eval do
def cpp_command(outfile, opt="")
conf = cc_config(opt)
if $universal and (arch_flag = conf['ARCH_FLAG']) and !arch_flag.empty?
conf['ARCH_FLAG'] = arch_flag.gsub(/(?:\G|\s)-arch\s+\S+/, '')
end
RbConfig::expand("$(CXX) -E #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_CXX} #{outfile}",
conf)
end
end
IS_MSWIN = /mswin/ =~ RUBY_PLATFORM
IS_MINGW = /mingw/ =~ RUBY_PLATFORM

# Now pull in the C++ support
include MakeMakefile['C++']
Expand All @@ -38,10 +24,6 @@ def cpp_command(outfile, opt="")
raise("Could not find rice/rice.hpp header")
end

if IS_DARWIN
have_library('c++')
elsif !IS_MSWIN
if !have_library('stdc++fs')
have_library('stdc++')
end
end
if !IS_MSWIN && !have_library('stdc++fs')
have_library('stdc++')
end

0 comments on commit 2cb6512

Please sign in to comment.