diff --git a/macros.rubygems b/macros.rubygems index 0652ec6..d2e8514 100644 --- a/macros.rubygems +++ b/macros.rubygems @@ -42,8 +42,8 @@ gem install \\\ } -# The 'read' command in gemspec_add _depand gemspec_remove_dep macros is not -# essential, but it is usefull to make the sript appear in build log. +# The 'read' command in %%gemspec_* macros is not essential, but it is usefull +# to make the sript appear in build log. # %gemspec_add_dep - Add dependency into .gemspec. @@ -60,7 +60,7 @@ gem install \\\ # %gemspec_add_dep(g:s:d) \ read -d '' gemspec_add_dep_script << 'EOR' || : \ - gemspec_file = '%{-s*}%{!?-s:./%{gem_name}.gemspec}' \ + gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \ \ name = '%{-g*}' \ requirements = %{*}%{!?1:nil} \ @@ -97,7 +97,7 @@ unset -v gemspec_add_dep_script \ # %gemspec_remove_dep(g:s:d) \ read -d '' gemspec_remove_dep_script << 'EOR' || : \ - gemspec_file = '%{-s*}%{!?-s:./%{gem_name}.gemspec}' \ + gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \ \ name = '%{-g*}' \ requirements = %{*}%{!?1:nil} \ @@ -128,3 +128,68 @@ EOR\ echo "$gemspec_remove_dep_script" | ruby \ unset -v gemspec_remove_dep_script \ %{nil} + + +# %%gemspec_add_file - Add files to various files lists in .gemspec. +# +# Usage: %%gemspec_add_file [options] +# +# Add files to .gemspec file. is expected to be valid Ruby code. +# Path to file is expected. Does not check real files in any way. +# By default, `files` list is edited. +# +# -s Overrides the default .gemspec location. +# -t Edit test_files only. +# -r Edit extra_rdoc_files only. +# +%gemspec_add_file(s:tr) \ +read -d '' gemspec_add_file_script << 'EOR' || : \ + gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \ + \ + abort("gemspec_add_file: Use only one '-t' or '-r' at a time.") if "%{?-t}%{?-r}" == "-t-r" \ + \ + filenames = %{*}%{!?1:nil} \ + filenames = Array(filenames) \ + \ + spec = Gem::Specification.load(gemspec_file) \ + abort("#{gemspec_file} is not accessible.") unless spec \ + \ + spec.%{?-t:test_}%{?-r:extra_rdoc_}files += filenames \ + File.write gemspec_file, spec.to_ruby \ +EOR\ +echo "$gemspec_add_file_script" | ruby \ +unset -v gemspec_add_file_script \ +%{nil} + + +# %%gemspec_remove_file - Remove files from various files lists in .gemspec. +# +# Usage: %%gemspec_remove_file [options] +# +# Remove files from .gemspec file. is expected to be valid Ruby code. +# Path to file is expected. Does not check/remove real files in any way. +# By default, `files` list is edited. File has to be removed from `test_files` +# first in order to be removable from `files`. +# +# -s Overrides the default .gemspec location. +# -t Edit test_files only. +# -r Edit extra_rdoc_files only. +# +%gemspec_remove_file(s:tr) \ +read -d '' gemspec_remove_file_script << 'EOR' || : \ + gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \ + \ + abort("gemspec_remove_file: Use only one '-t' or '-r' at a time.") if "%{?-t}%{?-r}" == "-t-r" \ + \ + filenames = %{*}%{!?1:nil} \ + filenames = Array(filenames) \ + \ + spec = Gem::Specification.load(gemspec_file) \ + abort("#{gemspec_file} is not accessible.") unless spec \ + \ + spec.%{?-t:test_}%{?-r:extra_rdoc_}files -= filenames \ + File.write gemspec_file, spec.to_ruby \ +EOR\ +echo "$gemspec_remove_file_script" | ruby \ +unset -v gemspec_remove_file_script \ +%{nil} diff --git a/ruby-2.6.0-library-options-to-MAINLIBS.patch b/ruby-2.6.0-library-options-to-MAINLIBS.patch new file mode 100644 index 0000000..199798d --- /dev/null +++ b/ruby-2.6.0-library-options-to-MAINLIBS.patch @@ -0,0 +1,177 @@ +From bb3db69e2a0c210cc3a63940622db96a97eb7947 Mon Sep 17 00:00:00 2001 +From: nobu +Date: Fri, 2 Mar 2018 01:37:53 +0000 +Subject: [PATCH] configure.ac: library options to MAINLIBS + +* configure.ac (MAINLIBS): moved library options for main program + and static libruby, and append MAINLIBS to LIBRUBYARG_STATIC, as + these libraries are not needed for linking to shared libruby. + [ruby-core:85882] [Bug #14422] + +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e +--- + configure.ac | 33 +++++++++++++++------------------ + template/ruby.pc.in | 1 + + win32/Makefile.sub | 6 ++++-- + 3 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/configure.ac b/configure.ac +index aebbae1969a5..733a0c992fd7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -10,6 +10,7 @@ AC_DISABLE_OPTION_CHECKING + AC_ARG_VAR([cflags], [additional CFLAGS]) + AC_ARG_VAR([cppflags], [additional CPPFLAGS]) + AC_ARG_VAR([cxxflags], [additional CXXFLAGS]) ++ORIG_LIBS=$LIBS + + AC_DEFUN([RUBY_RM_RECURSIVE], [ + m4_version_prereq([2.70], [-1], [ +@@ -2938,13 +2939,11 @@ AS_IF([test x"$enable_pthread" = xyes], [ + AC_DEFINE(_THREAD_SAFE) + AC_DEFINE(HAVE_LIBPTHREAD) + AC_CHECK_HEADERS(pthread_np.h, [], [], [@%:@include ]) +- AS_CASE([$pthread_lib], +- [c], [], +- [root], [], +- [c_r], [MAINLIBS="-pthread $MAINLIBS"], +- [AS_CASE(["$target_os"], +- [openbsd*|mirbsd*], [LIBS="-pthread $LIBS"], +- [LIBS="-l$pthread_lib $LIBS"])]) ++ AS_CASE(["$pthread_lib:$target_os"], ++ [c:*], [], ++ [root:*], [], ++ [c_r:*|*:openbsd*|*:mirbsd*], [LIBS="-pthread $LIBS"], ++ [LIBS="-l$pthread_lib $LIBS"]) + ], [ + AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled") + ]) +@@ -3623,7 +3622,7 @@ LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a' + LIBRUBY='$(LIBRUBY_A)' + LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static' + LIBRUBYARG='$(LIBRUBYARG_STATIC)' +-SOLIBS= ++SOLIBS='$(MAINLIBS)' + + AS_CASE(["$target_os"], + [cygwin*|mingw*|haiku*|darwin*], [ +@@ -3689,9 +3688,6 @@ AS_CASE("$enable_shared", [yes], [ + LIBRUBY_RELATIVE=no + test -z "$CCDLFLAGS" || CFLAGS="$CFLAGS $CCDLFLAGS" + ENABLE_SHARED=yes +- AS_IF([test "$rb_cv_binary_elf" = yes], [ +- SOLIBS='$(LIBS)' +- ]) + + # libdir can be overridden in config.site file (on OpenSUSE at least). + libdir_basename=lib +@@ -3726,7 +3722,6 @@ AS_CASE("$enable_shared", [yes], [ + ]) + ], + [freebsd*|dragonfly*], [ +- SOLIBS='$(LIBS)' + LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)' + LIBRUBY_SONAME='$(LIBRUBY_SO)' + AS_IF([test "$rb_cv_binary_elf" != "yes" ], [ +@@ -3735,7 +3730,6 @@ AS_CASE("$enable_shared", [yes], [ + ]) + ], + [netbsd*], [ +- SOLIBS='$(LIBS)' + LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)' + LIBRUBY_SO="${LIBRUBY_SONAME}"'.$(TEENY)' + RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"]) +@@ -3746,11 +3740,9 @@ AS_CASE("$enable_shared", [yes], [ + ]) + ], + [openbsd*|mirbsd*], [ +- SOLIBS='$(LIBS)' + LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}` + ], + [solaris*], [ +- SOLIBS='$(LIBS)' + LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)' + LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(RUBY_PROGRAM_VERSION)' + LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)' +@@ -3768,7 +3760,7 @@ AS_CASE("$enable_shared", [yes], [ + [aix*], [ + RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ["${linker_flag}-bnoentry" "$XLDFLAGS" "$LDFLAGS_OPTDIR"]) + LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}' +- SOLIBS='-lm -lc' ++ LIBS="$LIBS -lm -lc" + ], + [darwin*], [ + LIBRUBY_LDSHARED='$(CC) -dynamiclib' +@@ -3788,7 +3780,6 @@ AS_CASE("$enable_shared", [yes], [ + LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT)' + LIBRUBY_SONAME='lib$(RUBY_BASE_NAME).$(RUBY_API_VERSION).$(SOEXT)' + LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_INSTALL_NAME).$(SOEXT)' +- SOLIBS='$(LIBS)' + ], + [interix*], [ + LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)' +@@ -4031,7 +4022,6 @@ AS_CASE(["$target_os"], + ]) + LIBRUBY_ALIASES='' + FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in +- SOLIBS='$(LIBS)' + AS_IF([test x"$enable_shared" = xyes], [ + LIBRUBY='lib$(RUBY_SO_NAME).dll.a' + ], [ +@@ -4131,6 +4121,13 @@ AS_IF([test "${universal_binary-no}" = yes ], [ + [rb_cv_architecture_available=yes], [rb_cv_architecture_available=no])) + ]) + ++MAINLIBS="$LIBS" ++LIBS=$ORIG_LIBS ++AS_IF([test -n "${LIBS}"], [ ++ libspat=`echo "${LIBS}" | sed 's/[[][|.*$^]]/\\&/g;s/^ */ /;s/^ *$/ /'` ++ MAINFLAGS=`echo " $MAINLIBS " | sed "s|$libspat"'||;s/^ *//;s/ *$//'` ++]) ++LIBRUBYARG_STATIC="${LIBRUBYARG_STATIC} \$(MAINLIBS)" + CPPFLAGS="$CPPFLAGS "'$(DEFS)' + test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}' + AS_IF([test -n "${cflags+set}"], [ +diff --git a/template/ruby.pc.in b/template/ruby.pc.in +index d874f92c3b20..7ce4461c05df 100644 +--- a/template/ruby.pc.in ++++ b/template/ruby.pc.in +@@ -39,6 +39,7 @@ sitehdrdir=@sitehdrdir@ + rubyarchhdrdir=@rubyarchhdrdir@ + vendorarchhdrdir=@vendorarchhdrdir@ + sitearchhdrdir=@sitearchhdrdir@ ++MAINLIBS=@MAINLIBS@ + SOEXT=@SOEXT@ + LIBPATH=@LIBPATH@ + LIBRUBY_A=@LIBRUBY_A@ +diff --git a/win32/Makefile.sub b/win32/Makefile.sub +index 8673c121641e..f8316cccb68e 100644 +--- a/win32/Makefile.sub ++++ b/win32/Makefile.sub +@@ -279,6 +279,7 @@ MJIT_DEBUGFLAGS = $(DEBUGFLAGS) + CPPFLAGS = $(DEFS) $(ARCHDEFS) $(CPPFLAGS) + + DLDFLAGS = $(LDFLAGS) -dll ++MAINLIBS = $(LIBS) + SOLIBS = + RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc + !ifndef RCFLAGS +@@ -821,7 +822,8 @@ s,@CPPFLAGS@,$(CPPFLAGS),;t t + s,@CXXFLAGS@,$(CXXFLAGS),;t t + s,@FFLAGS@,$(FFLAGS),;t t + s,@LDFLAGS@,$(LDFLAGS),;t t +-s,@LIBS@,$(LIBS),;t t ++s,@LIBS@,,;t t ++s,@MAINLIBS@,$(MAINLIBS),;t t + s,@exec_prefix@,$${prefix},;t t + s,@prefix@,$(prefix),;t t + s,@program_transform_name@,s,.*,$(PROGRAM_PREFIX)&$(PROGRAM_SUFFIX),,;t t +@@ -909,7 +911,7 @@ s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,;t t + s,@LIBRUBY_ALIASES@,$(LIBRUBY_ALIASES),;t t + s,@LIBRUBY@,$$(RUBY_SO_NAME).lib,;t t + s,@LIBRUBYARG@,$$(LIBRUBYARG_SHARED),;t t +-s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A),;t t ++s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A) $$(MAINLIBS),;t t + s,@LIBRUBYARG_SHARED@,$$(LIBRUBY),;t t + s,@SOLIBS@,$(SOLIBS),;t t + s,@DLDLIBS@,$(DLDLIBS),;t t diff --git a/ruby.spec b/ruby.spec index 57e522c..99ef23e 100644 --- a/ruby.spec +++ b/ruby.spec @@ -21,7 +21,7 @@ %endif -%global release 92 +%global release 93 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory three, since the @@ -65,6 +65,7 @@ %bcond_without systemtap %bcond_without git %bcond_without cmake +%bcond_without gmp %if 0%{?fedora} %bcond_without hardening_test @@ -138,6 +139,9 @@ Patch10: ruby-2.5.0-Add-Gem.operating_system_defaults.patch # TestTimeTZ test failures Kiritimati and Lisbon # https://bugs.ruby-lang.org/issues/14655 Patch11: ruby-2.5.1-TestTimeTZ-test-failures-Kiritimati-and-Lisbon.patch +# Don't force libraries used to build Ruby to its dependencies. +# https://bugs.ruby-lang.org/issues/14422 +Patch15: ruby-2.6.0-library-options-to-MAINLIBS.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -148,6 +152,7 @@ Recommends: rubygem(openssl) >= %{openssl_version} BuildRequires: autoconf BuildRequires: gdbm-devel +%{?with_gmp:BuildRequires: gmp-devel} BuildRequires: libffi-devel BuildRequires: openssl-devel BuildRequires: libyaml-devel @@ -287,8 +292,6 @@ Requires: ruby(release) Requires: ruby(rubygems) >= %{rubygems_version} Requires: ruby(irb) = %{irb_version} Requires: rubygem(io-console) >= %{io_console_version} -# Hardcode the dependency to keep it compatible with dependencies of the -# official rubygem-rdoc gem. Requires: rubygem(json) >= %{json_version} Provides: rdoc = %{version}-%{release} Provides: ri = %{version}-%{release} @@ -522,6 +525,7 @@ rm -rf ext/fiddle/libffi* %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch15 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1064,6 +1068,13 @@ make check TESTS="-v $DISABLE_TESTS" %{gem_dir}/specifications/xmlrpc-%{xmlrpc_version}.gemspec %changelog +* Thu May 10 2018 Pavel Valena - 2.5.1-93 +- Add macros to edit files lists in .gemspec + (gemspec_add_file and gemspec_remove_file). + +* Wed May 02 2018 Vít Ondruch - 2.5.1-93 +- Make %%gemspec_{add,remove}_dep modify .gemspec provided by %%setup macro. + * Tue Apr 10 2018 Vít Ondruch - 2.5.1-92 - Conflict requirement needs to generate dependency. - Stop using --with-setjmp-type=setjmp on aarch64 (rhbz#1545239). @@ -1071,10 +1082,15 @@ make check TESTS="-v $DISABLE_TESTS" * Thu Mar 29 2018 Pavel Valena - 2.5.1-92 - Update to Ruby 2.5.1. +* Mon Mar 05 2018 Vít Ondruch - 2.5.0-91 +- Don't force libraries used to build Ruby to its dependencies. +- Re-enable GMP dependency. + * Thu Mar 01 2018 Vít Ondruch - 2.5.0-90 - Drop GMP dependency. * Sat Feb 24 2018 Florian Weimer - 2.5.0-89 +- Rebuild with new LDFLAGS from redhat-rpm-config - Use --with-setjmp-type=setjmp on aarch64 to work around gcc issue (#1545239) * Wed Feb 21 2018 Pavel Valena - 2.5.0-89