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

ruby-changes:48286

From: nobu <ko1@a...>
Date: Tue, 24 Oct 2017 22:48:12 +0900 (JST)
Subject: [ruby-changes:48286] nobu:r60402 (trunk): sysconfdir on Windows

nobu	2017-10-24 22:48:08 +0900 (Tue, 24 Oct 2017)

  New Revision: 60402

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60402

  Log:
    sysconfdir on Windows
    
    * ext/etc/etc.c (etc_sysconfdir): mentioned special case on
      Windows.  [ruby-core:43110] [Bug #6121]
    
    * ext/etc/extconf.rb: define SYSCONFDIR only if sysconfdir is set
      in RbConfig::CONFIG and not empty.
    
    * win32/Makefile.sub (config.status): sysconfdir is not used on
      Windows.

  Modified files:
    trunk/configure.ac
    trunk/ext/etc/etc.c
    trunk/ext/etc/extconf.rb
    trunk/win32/Makefile.sub
Index: ext/etc/etc.c
===================================================================
--- ext/etc/etc.c	(revision 60401)
+++ ext/etc/etc.c	(revision 60402)
@@ -628,7 +628,8 @@ VALUE rb_w32_conv_from_wchar(const WCHAR https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L628
  *
  * This is typically "/etc", but is modified by the prefix used when Ruby was
  * compiled. For example, if Ruby is built and installed in /usr/local, returns
- * "/usr/local/etc".
+ * "/usr/local/etc" on other than Windows.  On Windows, this returns system
+ * provided directory always.
  */
 static VALUE
 etc_sysconfdir(VALUE obj)
Index: ext/etc/extconf.rb
===================================================================
--- ext/etc/extconf.rb	(revision 60401)
+++ ext/etc/extconf.rb	(revision 60402)
@@ -12,8 +12,10 @@ have_func("uname((struct utsname *)NULL) https://github.com/ruby/ruby/blob/trunk/ext/etc/extconf.rb#L12
 have_func("getlogin")
 have_func("getpwent")
 have_func("getgrent")
-sysconfdir = RbConfig.expand(RbConfig::CONFIG["sysconfdir"].dup, "prefix"=>"", "DESTDIR"=>"")
-$defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
+if (sysconfdir = RbConfig::CONFIG["sysconfdir"] and
+    !RbConfig.expand(sysconfdir.dup, "prefix"=>"", "DESTDIR"=>"").empty?)
+  $defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
+end
 
 have_func("sysconf")
 have_func("confstr")
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 60401)
+++ win32/Makefile.sub	(revision 60402)
@@ -829,9 +829,9 @@ s,@bindir@,$${exec_prefix}/bin,;t t https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L829
 s,@sbindir@,$${exec_prefix}/sbin,;t t
 s,@libexecdir@,$${exec_prefix}/libexec,;t t
 s,@datadir@,$${prefix}/share,;t t
-s,@sysconfdir@,$${prefix}/etc,;t t
-s,@sharedstatedir@,/etc,;t t
-s,@localstatedir@,/var,;t t
+s,@sysconfdir@,,;t t
+s,@sharedstatedir@,$${prefix}/com,;t t
+s,@localstatedir@,$${prefix}/var,;t t
 s,@libdir@,$${exec_prefix}/$(libdir_basename),;t t
 s,@includedir@,$${prefix}/include,;t t
 s,@oldincludedir@,/usr/include,;t t
Index: configure.ac
===================================================================
--- configure.ac	(revision 60401)
+++ configure.ac	(revision 60402)
@@ -512,6 +512,7 @@ AS_CASE(["$target_os"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L512
 	RT_VER=`echo "$rb_cv_msvcrt" | tr -cd [0-9]`
 	test "$RT_VER" = "" && RT_VER=60
 	AC_DEFINE_UNQUOTED(RUBY_MSVCRT_VERSION, $RT_VER)
+	sysconfdir=
     ])
     : ${enable_shared=yes}
     ],

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

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