ruby-changes:27055
From: nobu <ko1@a...>
Date: Wed, 6 Feb 2013 17:33:06 +0900 (JST)
Subject: [ruby-changes:27055] nobu:r39107 (trunk): configure.in: arch dependent library directory options
nobu 2013-02-06 17:32:53 +0900 (Wed, 06 Feb 2013) New Revision: 39107 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39107 Log: configure.in: arch dependent library directory options * configure.in (rubyarchprefix, sitearchdir, vendorarchdir): add options to customize architecture dependent library directories. * template/ruby.pc.in, tool/mkconfig.rb, tool/rbinstall.rb: use configured values. * tool/mkconfig.rb: expand rubyarchdir to extract prefix. Modified files: trunk/ChangeLog trunk/configure.in trunk/template/ruby.pc.in trunk/tool/mkconfig.rb trunk/tool/rbinstall.rb Index: configure.in =================================================================== --- configure.in (revision 39106) +++ configure.in (revision 39107) @@ -3155,6 +3155,7 @@ shvar_to_cpp() { https://github.com/ruby/ruby/blob/trunk/configure.in#L3155 -e 's/\${sitedir}/"RUBY_SITE_LIB"/g' \ -e 's/\${rubylibdir}/"RUBY_LIB"/g' \ -e 's/\${rubylibprefix}/"RUBY_LIB_PREFIX"/g' \ + -e 's/\${rubyarchprefix}/"RUBY_ARCH_PREFIX_FOR(arch)"/g' \ -e 's/\${exec_prefix}/"RUBY_EXEC_PREFIX"/g' \ -e 's|^\"NONE/|RUBY_EXEC_PREFIX\"/|' \ -e 's|^\"NONE\"|\"'"${prefix}"'\"|' \ @@ -3174,6 +3175,13 @@ AC_SUBST(rubylibprefix) https://github.com/ruby/ruby/blob/trunk/configure.in#L3175 rubylibdir='${rubylibprefix}/${ruby_version}' rubyarchdir='${rubylibdir}/${arch}' +rubyarchprefix='${rubylibprefix}/${arch}' +AC_ARG_WITH(rubyarchprefix, + AS_HELP_STRING([--with-rubyarchprefix=DIR], + [prefix for architecture dependent ruby libraries [[RUBYLIBPREFIX/ARCH]]]), + [rubyarchprefix="$withval"]) +AC_SUBST(rubyarchprefix) + RI_BASE_NAME=`echo ${RUBY_BASE_NAME} | sed 's/ruby/ri/'` ridir='${datarootdir}/${RI_BASE_NAME}' AC_ARG_WITH(ridir, @@ -3212,14 +3220,24 @@ AC_ARG_WITH(sitedir, https://github.com/ruby/ruby/blob/trunk/configure.in#L3220 [sitedir=$withval], [sitedir='${rubylibprefix}/site_ruby']) sitelibdir='${sitedir}/${ruby_version}' -sitearchdir='${sitelibdir}/${sitearch}' + +AC_ARG_WITH(sitearchdir, + AS_HELP_STRING([--with-arch-sitedir=DIR], + [architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]), + [sitearchdir=$withval], + [sitearchdir='${sitelibdir}/${sitearch}']) AC_ARG_WITH(vendordir, AS_HELP_STRING([--with-vendordir=DIR], [vendor libraries in DIR [[RUBY_LIB_PREFIX/vendor_ruby]], "no" to disable vendor directory]), [vendordir=$withval], [vendordir='${rubylibprefix}/vendor_ruby']) vendorlibdir='${vendordir}/${ruby_version}' -vendorarchdir='${vendorlibdir}/${sitearch}' + +AC_ARG_WITH(vendorarchdir, + AS_HELP_STRING([--with-arch-vendordir=DIR], + [architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]), + [vendorarchdir=$withval], + [vendorarchdir='${vendorlibdir}/${sitearch}']) if test "${LOAD_RELATIVE+set}"; then AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) @@ -3228,6 +3246,7 @@ else https://github.com/ruby/ruby/blob/trunk/configure.in#L3246 shvar_to_cpp RUBY_EXEC_PREFIX "${exec_prefix}" fi shvar_to_cpp RUBY_LIB_PREFIX "${rubylibprefix}" +shvar_to_cpp RUBY_ARCH_PREFIX_FOR "${rubyarchprefix}" shvar_to_cpp RIDIR "${ridir}" if test ${RUBY_LIB_VERSION_STYLE+set}; then @@ -3237,6 +3256,7 @@ else https://github.com/ruby/ruby/blob/trunk/configure.in#L3256 fi AC_DEFINE_UNQUOTED(RUBY_EXEC_PREFIX, ${RUBY_EXEC_PREFIX}) AC_DEFINE_UNQUOTED(RUBY_LIB_PREFIX, ${RUBY_LIB_PREFIX} !<verconf>!) +AC_DEFINE_UNQUOTED(RUBY_ARCH_PREFIX_FOR(arch), ${RUBY_ARCH_PREFIX_FOR} !<verconf>!) shvar_to_cpp RUBY_LIB "${rubylibdir}" if test "x${RUBY_LIB}" != 'xRUBY_LIB_PREFIX"/"RUBY_LIB_VERSION'; then @@ -3264,8 +3284,14 @@ fi https://github.com/ruby/ruby/blob/trunk/configure.in#L3284 AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl +AC_SUBST(rubylibdir)dnl +AC_SUBST(rubyarchdir)dnl AC_SUBST(sitedir)dnl +AC_SUBST(sitelibdir)dnl +AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl +AC_SUBST(vendorlibdir)dnl +AC_SUBST(vendorarchdir)dnl configure_args=$ac_configure_args AC_SUBST(configure_args)dnl Index: ChangeLog =================================================================== --- ChangeLog (revision 39106) +++ ChangeLog (revision 39107) @@ -1,4 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Wed Feb 6 17:32:46 2013 Nobuyoshi Nakada <nobu@r...> +Wed Feb 6 17:32:51 2013 Nobuyoshi Nakada <nobu@r...> + + * configure.in (rubyarchprefix, sitearchdir, vendorarchdir): add + options to customize architecture dependent library directories. + + * template/ruby.pc.in, tool/mkconfig.rb, tool/rbinstall.rb: use + configured values. + + * tool/mkconfig.rb: expand rubyarchdir to extract prefix. * configure.in (RUBY_VERSION_NAME), template/ruby.pc.in: add substitution and define. Index: tool/rbinstall.rb =================================================================== --- tool/rbinstall.rb (revision 39106) +++ tool/rbinstall.rb (revision 39107) @@ -308,7 +308,7 @@ libdir = CONFIG["libdir", true] https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L308 archhdrdir = rubyhdrdir = CONFIG["rubyhdrdir", true] archhdrdir += "/" + CONFIG["arch", true] rubylibdir = CONFIG["rubylibdir", true] -archlibdir = CONFIG["archdir", true] +archlibdir = CONFIG["rubyarchdir", true] sitelibdir = CONFIG["sitelibdir"] sitearchlibdir = CONFIG["sitearchdir"] vendorlibdir = CONFIG["vendorlibdir"] Index: tool/mkconfig.rb =================================================================== --- tool/mkconfig.rb (revision 39106) +++ tool/mkconfig.rb (revision 39107) @@ -113,11 +113,10 @@ File.foreach "config.status" do |line| https://github.com/ruby/ruby/blob/trunk/tool/mkconfig.rb#L113 end end end + vars[name] = val if name == "configure_args" val.gsub!(/ +(?!-)/, "=") if win32 val.gsub!(/--with-out-ext/, "--without-ext") - elsif name == "libdir" - v_runtime[:libdir] = val[/\$(\(exec_prefix\)|\{exec_prefix\})\/(.*)/, 2] end val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump case name @@ -133,7 +132,6 @@ File.foreach "config.status" do |line| https://github.com/ruby/ruby/blob/trunk/tool/mkconfig.rb#L132 end end v = " CONFIG[\"#{name}\"] #{win32 && vars[name] ? '<< "\n"' : '='} #{val}\n" - vars[name] = true if fast[name] v_fast << v else @@ -149,7 +147,26 @@ end https://github.com/ruby/ruby/blob/trunk/tool/mkconfig.rb#L147 drive = File::PATH_SEPARATOR == ';' -prefix = "/#{v_runtime[:libdir] || 'lib'}/ruby/#{version}/#{arch}" +def vars.expand(val, config = self) + newval = val.gsub(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) { + var = $& + if !(v = $1 || $2) + '$' + elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]] + pat, sub = $1, $2 + config[v] = false + config[v] = expand(key, config) + key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat + key + else + var + end + } + val.replace(newval) unless newval == val + val +end +vars["prefix"] = "" +prefix = vars.expand(vars["rubyarchdir"]) print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n" print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n" print <<'ARCH' if universal @@ -207,18 +224,7 @@ end https://github.com/ruby/ruby/blob/trunk/tool/mkconfig.rb#L224 print(*v_fast) print(*v_others) print <<EOS - CONFIG["rubylibdir"] = "$(rubylibprefix)/$(ruby_version)" - CONFIG["archdir"] = "$(rubylibdir)/$(arch)" -EOS -print <<EOS unless v_disabled["sitedir"] - CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)" - CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)" -EOS -print <<EOS unless v_disabled["vendordir"] - CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)" - CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)" -EOS -print <<EOS + CONFIG["archdir"] = "$(rubyarchdir)" CONFIG["topdir"] = File.dirname(__FILE__) MAKEFILE_CONFIG = {} CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup} Index: template/ruby.pc.in =================================================================== --- template/ruby.pc.in (revision 39106) +++ template/ruby.pc.in (revision 39107) @@ -26,12 +26,15 @@ LIBS=@LIBS@ https://github.com/ruby/ruby/blob/trunk/template/ruby.pc.in#L26 DLDFLAGS=@DLDFLAGS@ ruby=${bindir}/${RUBY_INSTALL_NAME}@EXEEXT@ rubylibprefix=@rubylibprefix@ -rubylibdir=${rubylibprefix}/${ruby_version} -vendordir=${rubylibprefix}/vendor_ruby -sitedir=${rubylibprefix}/site_ruby -rubyarchdir=${rubylibdir}/${arch} -vendorarchdir=${vendordir}/${sitearch} -sitearchdir=${sitedir}/${sitearch} +rubyarchprefix=@rubyarchprefix@ +rubylibdir=@rubylibdir@ +vendordir=@vendordir@ +sitedir=@sitedir@ +vendorlibdir=@vendorlibdir@ +sitelibdir=@sitelibdir@ +rubyarchdir=@rubyarchdir@ +vendorarchdir=@vendorarchdir@ +sitearchdir=@sitearchdir@ rubyhdrdir=@rubyhdrdir@ vendorhdrdir=@vendorhdrdir@ sitehdrdir=@sitehdrdir@ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/