mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
verconf.h.in: template for verconf.h
* template/verconf.h.in: generate verconf.h from the template and rbconfig.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae9dbb6ce1
commit
434f0abd02
5 changed files with 71 additions and 58 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu May 16 13:12:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* template/verconf.h.in: generate verconf.h from the template and
|
||||
rbconfig.rb.
|
||||
|
||||
Thu May 16 05:47:18 2013 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* ext/psych/lib/psych/visitors/yaml_tree.rb: fix syntax error.
|
||||
|
|
|
@ -834,9 +834,9 @@ newline.$(OBJEXT): $(NEWLINE_C) {$(VPATH)}defines.h \
|
|||
{$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \
|
||||
{$(VPATH)}transcode_data.h {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}subst.h
|
||||
|
||||
verconf.h: verconf.in $(srcdir)/tool/shvar_to_cpp.rb $(RBCONFIG)
|
||||
verconf.h: $(srcdir)/template/verconf.h.in $(srcdir)/tool/generic_erb.rb $(RBCONFIG)
|
||||
$(ECHO) creating $@
|
||||
$(Q) $(MINIRUBY) "$(srcdir)/tool/shvar_to_cpp.rb" verconf.in > $@
|
||||
$(Q) $(MINIRUBY) "$(srcdir)/tool/generic_erb.rb" $(srcdir)/template/verconf.h.in > $@
|
||||
|
||||
DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
|
||||
eval.$(OBJEXT) \
|
||||
|
|
40
configure.in
40
configure.in
|
@ -231,8 +231,6 @@ RUBYW_BASE_NAME=`echo rubyw | sed "$program_transform_name"`
|
|||
AC_SUBST(RUBY_BASE_NAME)
|
||||
AC_SUBST(RUBYW_BASE_NAME)
|
||||
AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
|
||||
AC_DEFINE_UNQUOTED(RUBY_BASE_NAME, "${RUBY_BASE_NAME}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_VERSION_NAME, RUBY_BASE_NAME"-"RUBY_LIB_VERSION !<verconf>!)
|
||||
|
||||
AC_CANONICAL_TARGET
|
||||
test x"$target_alias" = x &&
|
||||
|
@ -2833,6 +2831,8 @@ else
|
|||
fi
|
||||
AC_SUBST(setup)
|
||||
|
||||
save_prefix="$prefix"
|
||||
save_exec_prefix="$exec_prefix"
|
||||
test x"$prefix" = xNONE && prefix=$ac_default_prefix
|
||||
test x"${exec_prefix}" = xNONE && exec_prefix="$prefix"
|
||||
pat=`echo "${exec_prefix}" | tr -c '\012' .`'\(.*\)'
|
||||
|
@ -2841,6 +2841,8 @@ for var in bindir libdir; do
|
|||
AS_CASE(["$val"], ["${exec_prefix}"*], [val='${exec_prefix}'"`expr \"$val\" : \"$pat\"`"])
|
||||
eval $var='"$val"'
|
||||
done
|
||||
prefix="$save_prefix"
|
||||
exec_prefix="$save_exec_prefix"
|
||||
|
||||
BTESTRUBY='$(MINIRUBY)'
|
||||
if test x"$cross_compiling" = xyes; then
|
||||
|
@ -3534,6 +3536,8 @@ elif test -z "${ruby_version}"; then
|
|||
else
|
||||
RUBY_LIB_VERSION="\"${ruby_version}\""
|
||||
fi
|
||||
AC_SUBST(RUBY_LIB_VERSION_STYLE)
|
||||
AC_SUBST(RUBY_LIB_VERSION)
|
||||
|
||||
AC_ARG_WITH(sitedir,
|
||||
AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
|
||||
|
@ -3566,30 +3570,7 @@ else
|
|||
RUBY_EXEC_PREFIX="${exec_prefix}"
|
||||
fi
|
||||
|
||||
if test ${RUBY_LIB_VERSION_STYLE+set}; then
|
||||
AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION_STYLE, $RUBY_LIB_VERSION_STYLE !<verconf>!)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION, "$RUBY_LIB_VERSION" !<verconf>!)
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(RUBY_EXEC_PREFIX, "${RUBY_EXEC_PREFIX}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_LIB_PREFIX, "${rubylibprefix}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_ARCH_PREFIX_FOR(arch), "${rubyarchprefix}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_SITEARCH_PREFIX_FOR(arch), "${rubysitearchprefix}" !<verconf>!)
|
||||
|
||||
AC_DEFINE_UNQUOTED(RUBY_LIB, "${rubylibdir}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_ARCH_LIB_FOR(arch), "${rubyarchdir}" !<verconf>!)
|
||||
if test "x$sitedir" = xno; then
|
||||
AC_DEFINE(NO_RUBY_SITE_LIB, [] !<verconf>!)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${sitedir}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCH_LIB_FOR(arch), "${sitearchdir}" !<verconf>!)
|
||||
fi
|
||||
if test "x$vendordir" = xno; then
|
||||
AC_DEFINE(NO_RUBY_VENDOR_LIB, [] !<verconf>!)
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${vendordir}" !<verconf>!)
|
||||
AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCH_LIB_FOR(arch), "${vendorarchdir}" !<verconf>!)
|
||||
fi
|
||||
AC_SUBST(RUBY_EXEC_PREFIX)
|
||||
|
||||
AC_SUBST(libdirname, ${multiarch+arch}libdir)
|
||||
AC_SUBST(archlibdir)dnl
|
||||
|
@ -3638,14 +3619,13 @@ fi
|
|||
|
||||
unset sitearch
|
||||
AS_CASE(["$target_os"],[mingw*],[sitearch="$target_cpu-$rb_cv_msvcrt"])
|
||||
test ${sitearch+set} && AC_DEFINE_UNQUOTED(RUBY_SITEARCH, "${sitearch}" !<verconf>!)
|
||||
: ${sitearch='${arch}'}
|
||||
|
||||
AC_ARG_WITH(search-path,
|
||||
AS_HELP_STRING([--with-search-path=DIR], [specify the additional search path]),
|
||||
[search_path=$withval])
|
||||
if test "$search_path" != ""; then
|
||||
AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path" !<verconf>!)
|
||||
AC_SUBST(RUBY_SEARCH_PATH, $search_path)
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(rubyhdrdir,
|
||||
|
@ -3723,12 +3703,10 @@ guard=INCLUDE_RUBY_CONFIG_H
|
|||
{
|
||||
echo "#ifndef $guard"
|
||||
echo "#define $guard 1"
|
||||
grep -v "^#define PACKAGE_" confdefs.h | grep -v ' !<verconf>!$'
|
||||
grep -v "^#define PACKAGE_" confdefs.h
|
||||
echo "#endif /* $guard */"
|
||||
} | tr -d '\015' |
|
||||
${srcdir}/tool/ifchange "${config_h}" -
|
||||
sed -n 's/ !<verconf>!$//p' confdefs.h | ${srcdir}/tool/ifchange verconf.in -
|
||||
rm -f verconf.h
|
||||
tr -d '\015' < largefile.h > confdefs.h
|
||||
rm largefile.h
|
||||
|
||||
|
|
55
template/verconf.h.in
Normal file
55
template/verconf.h.in
Normal file
|
@ -0,0 +1,55 @@
|
|||
% require './rbconfig'
|
||||
% C = RbConfig::MAKEFILE_CONFIG
|
||||
%
|
||||
% verconf =
|
||||
#define RUBY_BASE_NAME "${RUBY_BASE_NAME}"
|
||||
#define RUBY_VERSION_NAME RUBY_BASE_NAME"-"RUBY_LIB_VERSION
|
||||
% if C["RUBY_LIB_VERSION_STYLE"]
|
||||
#define RUBY_LIB_VERSION_STYLE ${RUBY_LIB_VERSION_STYLE}
|
||||
% else
|
||||
#define RUBY_LIB_VERSION ${RUBY_LIB_VERSION}
|
||||
% end
|
||||
#define RUBY_EXEC_PREFIX "${RUBY_EXEC_PREFIX}"
|
||||
#define RUBY_LIB_PREFIX "${rubylibprefix}"
|
||||
% unless C["sitearch"] == '$(arch)'
|
||||
#define RUBY_SITEARCH "${sitearch}"
|
||||
% end
|
||||
#define RUBY_ARCH_PREFIX_FOR(arch) "${rubyarchprefix}"
|
||||
#define RUBY_SITEARCH_PREFIX_FOR(arch) "${rubysitearchprefix}"
|
||||
#define RUBY_LIB "${rubylibdir}"
|
||||
#define RUBY_ARCH_LIB_FOR(arch) "${rubyarchdir}"
|
||||
% if C["sitedir"] == "no"
|
||||
#define NO_RUBY_SITE_LIB 1
|
||||
% else
|
||||
#define RUBY_SITE_LIB "${sitedir}"
|
||||
#define RUBY_SITE_ARCH_LIB_FOR(arch) "${sitearchdir}"
|
||||
% end
|
||||
% if C["vendordir"] == "no"
|
||||
#define NO_RUBY_VENDOR_LIB 1
|
||||
% else
|
||||
#define RUBY_VENDOR_LIB "${vendordir}"
|
||||
#define RUBY_VENDOR_ARCH_LIB_FOR(arch) "${vendorarchdir}"
|
||||
% end
|
||||
% unless C["RUBY_SEARCH_PATH"] == ""
|
||||
#define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}"
|
||||
% end
|
||||
%
|
||||
% R = {}
|
||||
% R["ruby_version"] = '"RUBY_LIB_VERSION"'
|
||||
% R["arch"] = '"arch"'
|
||||
% R["sitearch"] = '"arch"'
|
||||
% R["vendorlibdir"] = '"RUBY_VENDOR_LIB2"'
|
||||
% R["sitelibdir"] = '"RUBY_SITE_LIB2"'
|
||||
% R["vendordir"] = '"RUBY_VENDOR_LIB"'
|
||||
% R["sitedir"] = '"RUBY_SITE_LIB"'
|
||||
% R["rubylibdir"] = '"RUBY_LIB"'
|
||||
% R["rubylibprefix"] = '"RUBY_LIB_PREFIX"'
|
||||
% R["rubyarchprefix"] = '"RUBY_ARCH_PREFIX_FOR(arch)"'
|
||||
% R["rubysitearchprefix"] = '"RUBY_SITEARCH_PREFIX_FOR(arch)"'
|
||||
% R["exec_prefix"] = '"RUBY_EXEC_PREFIX"'
|
||||
% verconf.gsub!(/^(#define\s+(\S+)\s+)(.*)/) {
|
||||
% pre, name, repl = $1, $2, $3
|
||||
% pat = %["#{name}"]
|
||||
% c = C.merge(R.reject {|key, value| key == name or value.include?(pat)})
|
||||
% pre + RbConfig.expand(repl, c).gsub(/^""(?!$)|(.)""$/, '\1')
|
||||
% }
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
require './rbconfig'
|
||||
C = RbConfig::MAKEFILE_CONFIG.dup
|
||||
C["ruby_version"] = '"RUBY_LIB_VERSION"'
|
||||
C["arch"] = '"arch"'
|
||||
C["sitearch"] = '"arch"'
|
||||
C["vendorarchdir"] = '"RUBY_VENDOR_ARCH_LIB"'
|
||||
C["sitearchdir"] = '"RUBY_SITE_ARCH_LIB"'
|
||||
C["vendorlibdir"] = '"RUBY_VENDOR_LIB2"'
|
||||
C["sitelibdir"] = '"RUBY_SITE_LIB2"'
|
||||
C["vendordir"] = '"RUBY_VENDOR_LIB"'
|
||||
C["sitedir"] = '"RUBY_SITE_LIB"'
|
||||
C["rubylibdir"] = '"RUBY_LIB"'
|
||||
C["rubylibprefix"] = '"RUBY_LIB_PREFIX"'
|
||||
C["rubyarchprefix"] = '"RUBY_ARCH_PREFIX_FOR(arch)"'
|
||||
C["rubysitearchprefix"] = '"RUBY_SITEARCH_PREFIX_FOR(arch)"'
|
||||
C["exec_prefix"] = '"RUBY_EXEC_PREFIX"'
|
||||
|
||||
verconf = File.read(ARGV[0])
|
||||
verconf.gsub!(/^(#define\s+\S+\s+)(.*)/) {
|
||||
$1 + RbConfig.expand($2, C).gsub(/^""(?!$)|(.)""$/, '\1')
|
||||
}
|
||||
|
||||
puts verconf
|
Loading…
Reference in a new issue