From 2cb6512c680ad055cd8a0ba8e5056e69c09f752b Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 27 Oct 2024 23:17:42 -0700 Subject: [PATCH] Simplify mkmf-rice, part 2 --- .github/workflows/testing.yml | 2 ++ lib/mkmf-rice.rb | 28 +++++----------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 13471985..8bc5042f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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 diff --git a/lib/mkmf-rice.rb b/lib/mkmf-rice.rb index 75ebcf30..158599e9 100644 --- a/lib/mkmf-rice.rb +++ b/lib/mkmf-rice.rb @@ -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++'] @@ -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 \ No newline at end of file +if !IS_MSWIN && !have_library('stdc++fs') + have_library('stdc++') +end