ruby-changes:10515
From: nobu <ko1@a...>
Date: Thu, 5 Feb 2009 11:23:48 +0900 (JST)
Subject: [ruby-changes:10515] Ruby:r22069 (trunk): * configure.in (RUBY_LIB_VERSION): added for library version, to
nobu 2009-02-05 11:21:37 +0900 (Thu, 05 Feb 2009) New Revision: 22069 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22069 Log: * 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] Modified files: trunk/ChangeLog trunk/configure.in trunk/ruby.c trunk/version.c trunk/version.h Index: configure.in =================================================================== --- configure.in (revision 22068) +++ configure.in (revision 22069) @@ -2012,14 +2012,25 @@ [ --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 @@ 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 @@ 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 @@ PACKAGE=$RUBY_INSTALL_NAME AC_SUBST(PACKAGE) +AC_MSG_RESULT($PACKAGE library version = $ruby_version) AC_CONFIG_FILES($FIRSTMAKEFILE) AC_CONFIG_FILES(Makefile, [{ Index: ChangeLog =================================================================== --- ChangeLog (revision 22068) +++ ChangeLog (revision 22069) @@ -1,3 +1,19 @@ +Thu Feb 5 11:21:35 2009 Nobuyoshi Nakada <nobu@r...> + + * 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@m...> * ext/readline/readline.c (Init_readline): remove_history(0) may be Index: version.c =================================================================== --- version.c (revision 22068) +++ version.c (revision 22069) @@ -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_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) { Index: version.h =================================================================== --- version.h (revision 22068) +++ version.h (revision 22069) @@ -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 Index: ruby.c =================================================================== --- ruby.c (revision 22068) +++ ruby.c (revision 22069) @@ -359,6 +359,8 @@ 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 @@ 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,30 +408,11 @@ ruby_push_include(getenv("RUBYLIB"), identical_path); } -#ifdef RUBY_SEARCH_PATH - incpush(RUBY_RELATIVE(RUBY_SEARCH_PATH)); -#endif + while (*paths) { + incpush(RUBY_RELATIVE(paths)); + paths += strlen(paths) + 1; + } - 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)); - if (safe_level == 0) { incpush("."); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/