1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* configure.in (RUBY_LIB_VERSION): added for library version, to

split from core version.  [ruby-dev:37748]

* configure.in (RUBY_LIB_PATH, etc): moved actual version
  dependent stuff to version.c.

* ruby.c (ruby_init_loadpath_safe): ditto.

* version.c (ruby_initial_load_paths): moved initial load path
  version depending on version from ruby.c.

* version.h (RUBY_VERSION_{MAJOR,MINOR,TEENY}): now mean library
  and API version, and reverted to 1.9.1.  [ruby-dev:37889]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-02-05 02:21:37 +00:00
parent 0d0fe1a5ad
commit f4e9d9a2c5
5 changed files with 108 additions and 48 deletions

View file

@ -1,3 +1,19 @@
Thu Feb 5 11:21:35 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_LIB_VERSION): added for library version, to
split from core version. [ruby-dev:37748]
* configure.in (RUBY_LIB_PATH, etc): moved actual version
dependent stuff to version.c.
* ruby.c (ruby_init_loadpath_safe): ditto.
* version.c (ruby_initial_load_paths): moved initial load path
version depending on version from ruby.c.
* version.h (RUBY_VERSION_{MAJOR,MINOR,TEENY}): now mean library
and API version, and reverted to 1.9.1. [ruby-dev:37889]
Thu Feb 5 07:39:33 2009 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* ext/readline/readline.c (Init_readline): remove_history(0) may be

View file

@ -2012,14 +2012,25 @@ AC_ARG_WITH(ruby-version,
[ --with-ruby-version=STR ruby version string for version specific directories [[full]] (full|minor|STR)],
[ruby_version=$withval],
[ruby_version=full])
unset RUBY_LIB_VERSION
case "$ruby_version" in
full)
ruby_version="${MAJOR}.${MINOR}.${TEENY}"
RUBY_LIB_VERSION='STRINGIZE(RUBY_VERSION_MAJOR)"."STRINGIZE(RUBY_VERSION_MINOR)"."STRINGIZE(RUBY_VERSION_TEENY)'
;;
minor)
ruby_version="${MAJOR}.${MINOR}"
RUBY_LIB_VERSION='STRINGIZE(RUBY_VERSION_MAJOR)"."STRINGIZE(RUBY_VERSION_MINOR)'
;;
esac
if test ${RUBY_LIB_VERSION+set}; then
{
echo '#include "version.h"'
echo "ruby_version=${RUBY_LIB_VERSION}"
} > conftest.c
ruby_version="`$CPP -I"${srcdir}" -D'STRINGIZE(x)=x' conftest.c | grep '^ruby_version='`"
eval $ruby_version
else
RUBY_LIB_VERSION="\"${ruby_version}\""
fi
AC_ARG_WITH(sitedir,
[ --with-sitedir=DIR site libraries in DIR [[LIBDIR/ruby/site_ruby]]],
@ -2045,15 +2056,37 @@ case "$target_os" in
RUBY_VENDOR_LIB_PATH="`eval echo \\"$VENDOR_DIR\\" | sed 's|^NONE/|'"$prefix"'/|'`"
;;
esac
RUBY_LIB_PATH="${RUBY_LIB_PREFIX}/${ruby_version}"
RUBY_SITE_LIB_PATH2="${RUBY_SITE_LIB_PATH}/${ruby_version}"
RUBY_VENDOR_LIB_PATH2="${RUBY_VENDOR_LIB_PATH}/${ruby_version}"
RUBY_LIB_PATH='RUBY_LIB_PREFIX"/"RUBY_LIB_VERSION'
case "$RUBY_SITE_LIB_PATH" in
dnl (
"$RUBY_LIB_PREFIX/"*)
RUBY_SITE_LIB_PATH='RUBY_LIB_PREFIX"/'"`expr \"$RUBY_SITE_LIB_PATH\" : \"$RUBY_LIB_PREFIX/\"'\(.*\)'`"'"'
;;
dnl (
*)
RUBY_SITE_LIB_PATH="\"${RUBY_SITE_LIB_PATH}\""
;;
esac
RUBY_SITE_LIB_PATH2='RUBY_SITE_LIB"/"RUBY_LIB_VERSION'
case "$RUBY_VENDOR_LIB_PATH" in
dnl (
"$RUBY_LIB_PREFIX/"*)
RUBY_VENDOR_LIB_PATH='RUBY_LIB_PREFIX"/'"`expr \"$RUBY_VENDOR_LIB_PATH\" : \"$RUBY_LIB_PREFIX/\"'\(.*\)'`"'"'
;;
dnl (
*)
RUBY_VENDOR_LIB_PATH="\"${RUBY_VENDOR_LIB_PATH}\""
;;
esac
RUBY_VENDOR_LIB_PATH2='RUBY_VENDOR_LIB"/"RUBY_LIB_VERSION'
AC_DEFINE_UNQUOTED(RUBY_LIB, "${RUBY_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, "${RUBY_SITE_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, "${RUBY_SITE_LIB_PATH2}")
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, "${RUBY_VENDOR_LIB_PATH}")
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, "${RUBY_VENDOR_LIB_PATH2}")
AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION, ${RUBY_LIB_VERSION})
AC_DEFINE_UNQUOTED(RUBY_LIB_PREFIX, "${RUBY_LIB_PREFIX}")
AC_DEFINE_UNQUOTED(RUBY_LIB, ${RUBY_LIB_PATH})
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, ${RUBY_SITE_LIB_PATH})
AC_DEFINE_UNQUOTED(RUBY_SITE_LIB2, ${RUBY_SITE_LIB_PATH2})
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, ${RUBY_VENDOR_LIB_PATH})
AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB2, ${RUBY_VENDOR_LIB_PATH2})
AC_SUBST(arch)dnl
AC_SUBST(sitearch)dnl
@ -2066,28 +2099,24 @@ AC_SUBST(configure_args)dnl
if test "$fat_binary" != no ; then
arch="fat-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB,
"${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
"${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB,
"${RUBY_VENDOR_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB, RUBY_LIB"/"RUBY_PLATFORM)
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB, RUBY_SITE_LIB"/"RUBY_PLATFORM)
AC_DEFINE_UNQUOTED(RUBY_VENDOR_THIN_ARCHLIB, RUBY_VENDOR_LIB"/"RUBY_PLATFORM)
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__"-${target_os}")
else
arch="${target_cpu}-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
fi
unset sitearch
case "$target_os" in
mingw*) sitearch="$target_cpu-$rb_cv_msvcrt" ;;
*) sitearch="${arch}" ;;
esac
test ${sitearch+set} && AC_DEFINE_UNQUOTED(RUBY_SITEARCH, "${sitearch}")
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, "${RUBY_SITE_LIB_PATH2}/${sitearch}")
AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, "${RUBY_VENDOR_LIB_PATH2}/${sitearch}")
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, RUBY_LIB"/"RUBY_ARCH)
AC_DEFINE_UNQUOTED(RUBY_SITE_ARCHLIB, RUBY_SITE_LIB2"/"RUBY_SITEARCH)
AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCHLIB, RUBY_VENDOR_LIB2"/"RUBY_SITEARCH)
AC_ARG_WITH(search-path,
[ --with-search-path=DIR specify the additional search path],
@ -2170,6 +2199,7 @@ AC_SUBST(BUILTIN_TRANSOBJS)
PACKAGE=$RUBY_INSTALL_NAME
AC_SUBST(PACKAGE)
AC_MSG_RESULT($PACKAGE library version = $ruby_version)
AC_CONFIG_FILES($FIRSTMAKEFILE)
AC_CONFIG_FILES(Makefile, [{

31
ruby.c
View file

@ -359,6 +359,8 @@ void
ruby_init_loadpath_safe(int safe_level)
{
VALUE load_path;
extern const char ruby_initial_load_paths[];
const char *paths = ruby_initial_load_paths;
#if defined LOAD_RELATIVE
char libpath[MAXPATHLEN + 1];
char *p;
@ -395,7 +397,7 @@ ruby_init_loadpath_safe(int safe_level)
rest = sizeof(libpath) - 1 - (p - libpath);
#define RUBY_RELATIVE(path) (strncpy(p, (path), rest), libpath)
#define RUBY_RELATIVE(path) (strlcpy(p, (path), rest), libpath)
#else
#define RUBY_RELATIVE(path) (path)
#endif
@ -406,29 +408,10 @@ ruby_init_loadpath_safe(int safe_level)
ruby_push_include(getenv("RUBYLIB"), identical_path);
}
#ifdef RUBY_SEARCH_PATH
incpush(RUBY_RELATIVE(RUBY_SEARCH_PATH));
#endif
incpush(RUBY_RELATIVE(RUBY_SITE_LIB2));
#ifdef RUBY_SITE_THIN_ARCHLIB
incpush(RUBY_RELATIVE(RUBY_SITE_THIN_ARCHLIB));
#endif
incpush(RUBY_RELATIVE(RUBY_SITE_ARCHLIB));
incpush(RUBY_RELATIVE(RUBY_SITE_LIB));
incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB2));
#ifdef RUBY_VENDOR_THIN_ARCHLIB
incpush(RUBY_RELATIVE(RUBY_VENDOR_THIN_ARCHLIB));
#endif
incpush(RUBY_RELATIVE(RUBY_VENDOR_ARCHLIB));
incpush(RUBY_RELATIVE(RUBY_VENDOR_LIB));
incpush(RUBY_RELATIVE(RUBY_LIB));
#ifdef RUBY_THIN_ARCHLIB
incpush(RUBY_RELATIVE(RUBY_THIN_ARCHLIB));
#endif
incpush(RUBY_RELATIVE(RUBY_ARCHLIB));
while (*paths) {
incpush(RUBY_RELATIVE(paths));
paths += strlen(paths) + 1;
}
if (safe_level == 0) {
incpush(".");

View file

@ -16,6 +16,13 @@
#define PRINT(type) puts(ruby_##type)
#define MKSTR(type) rb_obj_freeze(rb_usascii_str_new(ruby_##type, sizeof(ruby_##type)-1))
#ifndef RUBY_ARCH
#define RUBY_ARCH RUBY_PLATFORM
#endif
#ifndef RUBY_SITEARCH
#define RUBY_SITEARCH RUBY_ARCH
#endif
const char ruby_version[] = RUBY_VERSION;
const char ruby_release_date[] = RUBY_RELEASE_DATE;
const char ruby_platform[] = RUBY_PLATFORM;
@ -24,6 +31,30 @@ const char ruby_description[] = RUBY_DESCRIPTION;
const char ruby_copyright[] = RUBY_COPYRIGHT;
const char ruby_engine[] = "ruby";
const char ruby_initial_load_paths[] =
#ifdef RUBY_SEARCH_PATH
RUBY_SEARCH_PATH "\0"
#endif
RUBY_SITE_LIB2 "\0"
#ifdef RUBY_SITE_THIN_ARCHLIB
RUBY_SITE_THIN_ARCHLIB "\0"
#endif
RUBY_SITE_ARCHLIB "\0"
RUBY_SITE_LIB "\0"
RUBY_VENDOR_LIB2 "\0"
#ifdef RUBY_VENDOR_THIN_ARCHLIB
RUBY_VENDOR_THIN_ARCHLIB "\0"
#endif
RUBY_VENDOR_ARCHLIB "\0"
RUBY_VENDOR_LIB "\0"
RUBY_LIB "\0"
#ifdef RUBY_THIN_ARCHLIB
RUBY_THIN_ARCHLIB "\0"
#endif
RUBY_ARCHLIB "\0";
void
Init_version(void)
{

View file

@ -5,7 +5,7 @@
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 2
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 5