[前][次][番号順一覧][スレッド一覧]

ruby-changes:65713

From: Nobuyoshi <ko1@a...>
Date: Tue, 30 Mar 2021 23:29:08 +0900 (JST)
Subject: [ruby-changes:65713] 5cdf99f64e (master): mkmf: fixed install directories of header files in extension libraries [Bug #17761]

https://git.ruby-lang.org/ruby.git/commit/?id=5cdf99f64e

From 5cdf99f64e344b8e4638824d55f5caf33be682ca Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 30 Mar 2021 23:28:49 +0900
Subject: mkmf: fixed install directories of header files in extension
 libraries [Bug #17761]

When installing an extension library which provides a header, that
header should be installed under site_ruby (or vendor_ruby when
"--vendor" option was given to extconf.rb).  However, currently
this file is about to be installed in the core include directory.
---
 lib/mkmf.rb               |  8 ++++----
 test/mkmf/test_install.rb | 30 ++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 4 deletions(-)
 create mode 100644 test/mkmf/test_install.rb

diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 1ae9925..01f2401 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -207,8 +207,8 @@ module MakeMakefile https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L207
         ['RUBYCOMMONDIR', '$(vendordir)$(target_prefix)'],
         ['RUBYLIBDIR',    '$(vendorlibdir)$(target_prefix)'],
         ['RUBYARCHDIR',   '$(vendorarchdir)$(target_prefix)'],
-        ['HDRDIR',        '$(rubyhdrdir)/ruby$(target_prefix)'],
-        ['ARCHHDRDIR',    '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+        ['HDRDIR',        '$(vendorhdrdir)$(target_prefix)'],
+        ['ARCHHDRDIR',    '$(vendorarchhdrdir)$(target_prefix)'],
       ]
     else
       dirs = [
@@ -216,8 +216,8 @@ module MakeMakefile https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L216
         ['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
         ['RUBYLIBDIR',    '$(sitelibdir)$(target_prefix)'],
         ['RUBYARCHDIR',   '$(sitearchdir)$(target_prefix)'],
-        ['HDRDIR',        '$(rubyhdrdir)/ruby$(target_prefix)'],
-        ['ARCHHDRDIR',    '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+        ['HDRDIR',        '$(sitehdrdir)$(target_prefix)'],
+        ['ARCHHDRDIR',    '$(sitearchhdrdir)$(target_prefix)'],
       ]
     end
     dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
diff --git a/test/mkmf/test_install.rb b/test/mkmf/test_install.rb
new file mode 100644
index 0000000..7f8c603
--- /dev/null
+++ b/test/mkmf/test_install.rb
@@ -0,0 +1,30 @@ https://github.com/ruby/ruby/blob/trunk/test/mkmf/test_install.rb#L1
+# frozen_string_literal: false
+require_relative 'base'
+
+class TestMkmf
+  class TestInstall < TestMkmf
+    def test_install_dirs
+      Dir.mktmpdir do |dir|
+        File.write(dir+"/extconf.rb", "require 'mkmf'; create_makefile('test')")
+        all_assertions do |a|
+          a.foreach(
+            ["site"],
+            ["vendor", "--vendor"],
+          ) do |dest, *options|
+            assert_ruby_status(["-C", dir, "extconf.rb", *options])
+            mf = File.read(dir+"/Makefile")
+            a.foreach(
+              ["RUBYCOMMONDIR", "$(#{dest}dir)$(target_prefix)"],
+              ["RUBYLIBDIR",    "$(#{dest}libdir)$(target_prefix)"],
+              ["RUBYARCHDIR",   "$(#{dest}archdir)$(target_prefix)"],
+              ["HDRDIR",        "$(#{dest}hdrdir)$(target_prefix)"],
+              ["ARCHHDRDIR",    "$(#{dest}archhdrdir)$(target_prefix)"],
+            ) do |(var, path)|
+              assert_equal path, mf[/^#{var}\s*=\s*(.*)$/, 1]
+            end
+          end
+        end
+      end
+    end
+  end
+end
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]