diff options
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | ext/-test-/abi/extconf.rb | 1 | ||||
-rw-r--r-- | include/ruby/internal/abi.h | 6 | ||||
-rw-r--r-- | test/-ext-/test_abi.rb | 2 | ||||
-rw-r--r-- | version.h | 11 | ||||
-rw-r--r-- | win32/Makefile.sub | 8 | ||||
-rw-r--r-- | win32/setup.mak | 4 |
7 files changed, 33 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index bc21c26292..0f4a31af7e 100644 --- a/configure.ac +++ b/configure.ac @@ -88,7 +88,9 @@ AC_SUBST(GIT) AC_SUBST(HAVE_GIT) 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_ABI_VERSION\) \([0-9][0-9]*\).*/\1=\2/p'] \ -e ['s/^@%:@define \(RUBY_PATCHLEVEL\) \(.*\)/\1=\2/p'] \ + $srcdir/include/ruby/internal/abi.h \ $srcdir/include/ruby/version.h $srcdir/version.h` for v in MAJOR MINOR TEENY; do AS_IF([eval "test \"\$$v\" = ''"], [ @@ -100,6 +102,9 @@ AC_SUBST(MINOR) AC_SUBST(TEENY) AC_SUBST(RUBY_API_VERSION, '$(MAJOR).$(MINOR)') AC_SUBST(RUBY_PROGRAM_VERSION, '$(MAJOR).$(MINOR).$(TEENY)') +AS_CASE([$RUBY_PATCHLEVEL], [-*], [ + AC_DEFINE_UNQUOTED(RUBY_ABI_VERSION, [${RUBY_ABI_VERSION}]) +], [RUBY_ABI_VERSION=]) AS_IF([test "$program_prefix" = NONE], [ program_prefix= @@ -4118,6 +4123,7 @@ AS_CASE(["$ruby_version"], AS_IF([test ${RUBY_LIB_VERSION_STYLE+set}], [ { echo "#define RUBY_LIB_VERSION_STYLE $RUBY_LIB_VERSION_STYLE" + echo '@%:@include "confdefs.h"' echo '#define STRINGIZE(x) x' test -f revision.h -o -f "${srcdir}/revision.h" || echo '#define RUBY_REVISION 0' echo '#include "version.h"' diff --git a/ext/-test-/abi/extconf.rb b/ext/-test-/abi/extconf.rb index d786b15db9..3b090b7553 100644 --- a/ext/-test-/abi/extconf.rb +++ b/ext/-test-/abi/extconf.rb @@ -1,3 +1,4 @@ # frozen_string_literal: false +return unless RUBY_PATCHLEVEL < 0 require_relative "../auto_ext.rb" auto_ext(inc: true) diff --git a/include/ruby/internal/abi.h b/include/ruby/internal/abi.h index e42a1777ff..fe1977a9a1 100644 --- a/include/ruby/internal/abi.h +++ b/include/ruby/internal/abi.h @@ -1,6 +1,8 @@ #ifndef RUBY_ABI_H #define RUBY_ABI_H +#ifdef RUBY_ABI_VERSION /* should match the definition in config.h */ + /* This number represents Ruby's ABI version. * * In development Ruby, it should be bumped every time an ABI incompatible @@ -19,7 +21,7 @@ * - Backwards compatible refactors. * - Editing comments. * - * In released versions of Ruby, this number should not be changed since teeny + * In released versions of Ruby, this number is not defined since teeny * versions of Ruby should guarantee ABI compatibility. */ #define RUBY_ABI_VERSION 2 @@ -49,3 +51,5 @@ ruby_abi_version(void) #endif #endif + +#endif diff --git a/test/-ext-/test_abi.rb b/test/-ext-/test_abi.rb index 59e70107a5..d3ea6bb9b1 100644 --- a/test/-ext-/test_abi.rb +++ b/test/-ext-/test_abi.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +return unless RUBY_PATCHLEVEL < 0 + class TestABI < Test::Unit::TestCase def test_require_lib_with_incorrect_abi_on_dev_ruby omit "ABI is not checked" unless abi_checking_supported? @@ -38,18 +38,25 @@ #define RUBY_RELEASE_DAY_STR STRINGIZE(RUBY_RELEASE_DAY) #endif +#ifdef RUBY_ABI_VERSION +# define RUBY_ABI_VERSION_SUFFIX "+"STRINGIZE(RUBY_ABI_VERSION) +#else +# define RUBY_ABI_VERSION_SUFFIX "" +#endif #if !defined RUBY_LIB_VERSION && defined RUBY_LIB_VERSION_STYLE # if RUBY_LIB_VERSION_STYLE == 3 # define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR) \ - "."STRINGIZE(RUBY_API_VERSION_TEENY)"+"STRINGIZE(RUBY_ABI_VERSION) + "."STRINGIZE(RUBY_API_VERSION_TEENY) RUBY_ABI_VERSION_SUFFIX # elif RUBY_LIB_VERSION_STYLE == 2 # define RUBY_LIB_VERSION STRINGIZE(RUBY_API_VERSION_MAJOR)"."STRINGIZE(RUBY_API_VERSION_MINOR) \ - "+"STRINGIZE(RUBY_ABI_VERSION) + RUBY_ABI_VERSION_SUFFIX # endif #endif #if RUBY_PATCHLEVEL == -1 #define RUBY_PATCHLEVEL_STR "dev" +#elif defined RUBY_ABI_VERSION +#error RUBY_ABI_VERSION is defined in non-development branch #else #define RUBY_PATCHLEVEL_STR "" #endif diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 9dc5ee6f51..bea24450ed 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -148,7 +148,10 @@ PLATFORM_DIR = win32 arch = $(ARCH)-$(PLATFORM) sitearch = $(ARCH)-$(RT) !if !defined(ruby_version) -ruby_version = $(MAJOR).$(MINOR).0+$(ABI_VERSION) +ruby_version = $(MAJOR).$(MINOR).0 +!endif +!if defined(ABI_VERSION) +ruby_version = $(ruby_version)+$(ABI_VERSION) !endif !if !defined(RUBY_VERSION_NAME) RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) @@ -624,6 +627,9 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub #endif !endif #define RUBY_MSVCRT_VERSION $(RT_VER) +!if defined(ABI_VERSION) +#define RUBY_ABI_VERSION $(ABI_VERSION) +!endif #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 diff --git a/win32/setup.mak b/win32/setup.mak index 39323c61c2..fd804a84ce 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -178,6 +178,7 @@ main(void) -version-: nul verconf.mk verconf.mk: nul + @findstr /R /C:"^#define RUBY_ABI_VERSION " $(srcdir:/=\)\include\ruby\internal\abi.h > $(@) @$(CPP) -I$(srcdir) -I$(srcdir)/include <<"Creating $(@)" > $(*F).bat && cmd /c $(*F).bat > $(@) @echo off #define RUBY_REVISION 0 @@ -198,8 +199,9 @@ echo RUBY_RELEASE_DAY = %ruby_release_day:~-2% echo MAJOR = RUBY_VERSION_MAJOR echo MINOR = RUBY_VERSION_MINOR echo TEENY = RUBY_VERSION_TEENY -echo ABI_VERSION = RUBY_ABI_VERSION #if defined RUBY_PATCHLEVEL && RUBY_PATCHLEVEL < 0 +#include "$(@F)" +echo ABI_VERSION = RUBY_ABI_VERSION #endif set /a MSC_VER = _MSC_VER #if _MSC_VER >= 1920 |