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

Moved version numbers

* Define major and minor version numbers only in the public
  include/ruby/version.h header, as the API version numbers.

* Define only teeny version number in the private version.h
  header.

* RUBY_VERSION moved to version.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-12-28 02:12:34 +00:00
parent 1095705c42
commit 8422725408
8 changed files with 35 additions and 26 deletions

View file

@ -123,7 +123,6 @@ BUILTIN_TRANSOBJS = @BUILTIN_TRANSOBJS@
POSTLINK = @POSTLINK@
RUBY_BASE_NAME=@RUBY_BASE_NAME@
RUBY_PROGRAM_VERSION=@RUBY_PROGRAM_VERSION@
RUBY_API_VERSION=@RUBY_API_VERSION@
RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
RUBY_SO_NAME=@RUBY_SO_NAME@
@ -159,7 +158,9 @@ COROUTINE_OBJ = $(COROUTINE_H:.h=.@OBJEXT@)
MAJOR= @MAJOR@
MINOR= @MINOR@
TEENY= @TEENY@
RUBY_PROGRAM_VERSION = @RUBY_PROGRAM_VERSION@
# here for MJIT_MIN_HEADER_NAME, not in common.mk
RUBY_PROGRAM_VERSION = $(MAJOR).$(MINOR).$(TEENY)
LIBRUBY_A = @LIBRUBY_A@
LIBRUBY_SO = @LIBRUBY_SO@

View file

@ -55,25 +55,18 @@ AS_IF([test x"$HAVE_GIT" = xyes], [command -v "$GIT" > /dev/null || HAVE_GIT=no]
AC_SUBST(GIT)
AC_SUBST(HAVE_GIT)
eval `sed -n ['s/^@%:@define RUBY_API_VERSION_\([A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)/API_\1=\2/p'] $srcdir/include/ruby/version.h`
RUBY_PROGRAM_VERSION=`sed -n 's/^@%:@define RUBY_VERSION "\(.*\)"/\1/p' $srcdir/version.h`
MAJOR=`echo $RUBY_PROGRAM_VERSION | cut -d. -f1`
MINOR=`echo $RUBY_PROGRAM_VERSION | cut -d. -f2`
TEENY=`echo $RUBY_PROGRAM_VERSION | cut -d. -f3`
eval `sed -n -e ['s/^@%:@define RUBY_[A-Z_]*VERSION_\([A-Z][A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)$/\1=\2/p'] \
-e ['s/^@%:@define \(RUBY_PATCHLEVEL\) \(.*\)/\1=\2/p'] \
$srcdir/include/ruby/version.h $srcdir/version.h`
for v in MAJOR MINOR TEENY; do
AS_IF([eval "test \"\$$v\" = ''"], [
AC_MSG_ERROR(could not determine $v number from version.h)
])
done
AS_IF([test "$MAJOR.$MINOR" != "$API_MAJOR.$API_MINOR"], [
AC_MSG_ERROR([API version $API_MAJOR.$API_MINOR differs from program version $MAJOR.$MINOR])
])
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(TEENY)
AC_SUBST(RUBY_PROGRAM_VERSION)
AC_SUBST(RUBY_API_VERSION, '$(MAJOR).$(MINOR)')
RUBY_PATCHLEVEL=`sed -n 's/^#define RUBY_PATCHLEVEL //p' $srcdir/version.h`
dnl checks for alternative programs
AC_CANONICAL_BUILD
RUBY_RM_RECURSIVE
@ -4027,7 +4020,7 @@ AS_REQUIRE_SHELL_FN([config_summary],
)
echo "---"
echo "Configuration summary for $RUBY_BASE_NAME version $RUBY_PROGRAM_VERSION"
echo "Configuration summary for $RUBY_BASE_NAME version $MAJOR.$MINOR.$TEENY"
echo ""
config_summary "Installation prefix" "$prefix"
config_summary "exec prefix" "$exec_prefix"

View file

@ -54,11 +54,25 @@ def version
case l
when /^#define RUBY_VERSION "(\d+)\.(\d+)\.(\d+)"$/
v = $~.captures
when /^#define RUBY_VERSION_TEENY (\d+)$/
(v ||= [])[2] = $1
when /^#define RUBY_PATCHLEVEL (-?\d+)$/
p = $1
end
end
end
if v and !v[0]
open 'include/ruby/version.h', 'rb' do |f|
f.each_line do |l|
case l
when /^#define RUBY_API_VERSION_MAJOR (\d+)/
v[0] = $1
when /^#define RUBY_API_VERSION_MINOR (\d+)/
v[1] = $1
end
end
end
end
return v, p
end

View file

@ -208,7 +208,7 @@ IO.foreach(File.join(srcdir, "version.h")) do |l|
end
end
%w[MAJOR MINOR TEENY PATCHLEVEL].each do |v|
print " CONFIG[#{v.dump}] = #{versions[v].dump}\n"
print " CONFIG[#{v.dump}] = #{(versions[v]||vars[v]).dump}\n"
end
dest = drive ? %r'= "(?!\$[\(\{])(?i:[a-z]:)' : %r'= "(?!\$[\(\{])'

View file

@ -28,6 +28,10 @@ const int ruby_api_version[] = {
RUBY_API_VERSION_MINOR,
RUBY_API_VERSION_TEENY,
};
#define RUBY_VERSION \
STRINGIZE(RUBY_VERSION_MAJOR) "." \
STRINGIZE(RUBY_VERSION_MINOR) "." \
STRINGIZE(RUBY_VERSION_TEENY) ""
const char ruby_version[] = RUBY_VERSION;
const char ruby_release_date[] = RUBY_RELEASE_DATE;
const char ruby_platform[] = RUBY_PLATFORM;

View file

@ -1,4 +1,6 @@
#define RUBY_VERSION "2.7.0"
# define RUBY_VERSION_MAJOR RUBY_API_VERSION_MAJOR
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL -1

View file

@ -1059,6 +1059,9 @@ s,@archincludedir@,$${includedir}/$${arch},;t t
s,@sitearchincludedir@,$${includedir}/$${sitearch},;t t
s,@arch@,$(ARCH)-$(PLATFORM),;t t
s,@sitearch@,$(ARCH)-$(RT),;t t
s,@MAJOR@,$(MAJOR),;t t
s,@MINOR@,$(MINOR),;t t
s,@TEENY@,$(TEENY),;t t
s,@ruby_version@,$(ruby_version),;t t
s,@RUBY_PROGRAM_VERSION@,$(RUBY_PROGRAM_VERSION),;t t
s,@rubylibprefix@,$${prefix}/lib/$${RUBY_BASE_NAME},;t t

View file

@ -145,19 +145,11 @@ verconf.mk: nul
#define STRINGIZE(x) STRINGIZE0(x)
#include "version.h"
for %%I in (RUBY_RELEASE_DATE) do set ruby_release_date=%%~I
for %%I in (RUBY_VERSION) do set ruby_version=%%~I
for /f "delims=. tokens=1-3" %%I in (RUBY_VERSION) do (
set major=%%I
set minor=%%J
set teeny=%%K
)
#undef RUBY_RELEASE_DATE
#undef RUBY_PROGRAM_VERSION
echo RUBY_RELEASE_DATE = %ruby_release_date:""=%
echo RUBY_PROGRAM_VERSION = %ruby_version:""=%
echo MAJOR = %major%
echo MINOR = %minor%
echo TEENY = %teeny%
echo MAJOR = RUBY_VERSION_MAJOR
echo MINOR = RUBY_VERSION_MINOR
echo TEENY = RUBY_VERSION_TEENY
#if defined RUBY_PATCHLEVEL && RUBY_PATCHLEVEL < 0
echo RUBY_DEVEL = yes
#endif