File ruby21.spec of Package ruby21
%define realname ruby
%define vermajor 2.1
%define realver %{vermajor}.5
%define abiver %{vermajor}.0
%define srcext tar.gz
%define so_ver 2.1
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
%if 0%{?suse_version} > 1310
%define bin_ver 2.1
%else
%define bin_ver 21
%endif
# Common info
Name: %{realname}%{?bin_ver}
Version: %{realver}
Release: %{?extraver:0.}1%{?rhel:.el%{rhel}}%{?fedora:.fc%{fedora}}
License: BSD-2-Clause or Ruby
Group: Development/Languages/Ruby
URL: https://www.ruby-lang.org/
Summary: An Interpreted Object-Oriented Scripting Language
# Install-time parameters
Provides: ruby(abi) = %{abiver} ruby(release) = %{version}
Provides: rubygems = 2.2.2
Provides: rubygem-bigdecimal = 1.2.4 rubygem-io-console = 0.4.2
Provides: rubygem-json = 1.8.1 rubygem-minitest = 4.7.5
Provides: rubygem-psych = 2.0.5 rubygem-rake = 10.1.0
Provides: rubygem-rdoc = 4.1.0 rubygem-test-unit = %{version}.0
Provides: rubygem(bigdecimal) = 1.2.4 rubygem(io-console) = 0.4.2
Provides: rubygem(json) = 1.8.1 rubygem(minitest) = 4.7.5
Provides: rubygem(psych) = 2.0.5 rubygem(rake) = 10.1.0
Provides: rubygem(rdoc) = 4.1.0 rubygem(test-unit) = %{version}.0
Provides: rubygem(%{abiver}:bigdecimal) = 1.2.4 rubygem(%{abiver}:io-console) = 0.4.2
Provides: rubygem(%{abiver}:json) = 1.8.1 rubygem(%{abiver}:minitest) = 4.7.5
Provides: rubygem(%{abiver}:psych) = 2.0.5 rubygem(%{abiver}:rake) = 10.1.0
Provides: rubygem(%{abiver}:rdoc) = 4.1.0 rubygem(%{abiver}:test-unit) = %{version}.0
# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: ncurses-devel readline-devel libffi-devel gdbm-devel openssl-devel
BuildRequires: zlib-devel gmp-devel
# Using GCC-4.8 post-build-checks complains about destbufferoverflow
# E: ruby21 destbufferoverflow /usr/include/bits/socket2.h:70, 73
# E: ruby21 destbufferoverflow /usr/include/bits/stdio2.h:290, 293
# E: ruby21 destbufferoverflow /usr/include/bits/unistd.h:42
%if 0%{?suse_version}
BuildRequires: -post-build-checks
BuildRequires: fdupes
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source: http://cache.ruby-lang.org/pub/ruby/%{vermajor}/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
Ruby is the interpreted scripting language for quick and
easy object-oriented programming. It has many features to
process text files and to do system management tasks (as in
Perl). It is simple, straight-forward, and extensible.
== Features of Ruby
* Simple Syntax
* *Normal* Object-Oriented features(ex. class, method calls)
* *Advanced* Object-Oriented features(ex. Mix-in, Singleton-method)
* Operator Overloading
* Exception Handling
* Iterators and Closures
* Garbage Collection
* Dynamic Loading of Object files(on some architecture)
* Highly Portable (works on many Unix-like/POSIX compatible platforms
as well as Windows, Mac OS X, BeOS etc.)
cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms
%package -n ruby-devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Provides: %{name}-devel = %{version}
Requires: %{name} = %{version}
%description -n ruby-devel
Development files for %{name}
%package doc-ri
Group: Documentation/HTML
Summary: Documentation for %{name}
Provides: ruby-ri = %{version}
Requires: %{name} = %{version}
%if 0%{?suse_version} && ! 0%{?sles_version}
BuildArch: noarch
%endif
%description doc-ri
Documentation for %{name}
%package -n ruby
Group: Development/Languages/Ruby
Summary: An Interpreted Object-Oriented Scripting Language
Provides: ruby-irb = %{version} ruby-rdoc = %{version}
Requires: %{name} = %{version}
Requires: %{_sbindir}/update-alternatives
%description -n ruby
Ruby is the interpreted scripting language for quick and
easy object-oriented programming. It has many features to
process text files and to do system management tasks (as in
Perl). It is simple, straight-forward, and extensible.
== Features of Ruby
* Simple Syntax
* *Normal* Object-Oriented features(ex. class, method calls)
* *Advanced* Object-Oriented features(ex. Mix-in, Singleton-method)
* Operator Overloading
* Exception Handling
* Iterators and Closures
* Garbage Collection
* Dynamic Loading of Object files(on some architecture)
* Highly Portable (works on many Unix-like/POSIX compatible platforms
as well as Windows, Mac OS X, BeOS etc.)
cf. http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%build
%configure \
--program-suffix=%{vermajor} \
--disable-rpath \
--disable-static \
--enable-shared \
--without-valgrind \
--with-soname=ruby%{vermajor} \
CFLAGS="%{optflags}" \
CXXFLAGS="%{optflags}" \
LDFLAGS="-Wl,--as-needed -Wl,--strip-all"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%{__install} -d -m755 %{buildroot}%{_bindir}
%{__install} -d -m755 %{buildroot}%{_sysconfdir}/alternatives
# Alternatives for binaries
for bin in erb gem irb rake rdoc ri ruby testrb; do
# dummy
touch %{buildroot}%{_sysconfdir}/alternatives/${bin}
%{__ln_s} %{_sysconfdir}/alternatives/${bin} %{buildroot}%{_bindir}/${bin}
done
for man in erb irb rake ri ruby; do
# dummy
touch %{buildroot}%{_sysconfdir}/alternatives/${man}.1.gz
%{__ln_s} %{_sysconfdir}/alternatives/${man}.1.gz %{buildroot}%{_mandir}/man1/${man}.1
done
%if 0%{?suse_version}
%fdupes %{buildroot}%{_datadir}
%endif
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc BSDL COPYING GPL LEGAL NEWS README README.EXT
%{_bindir}/*%{vermajor}
%{_libdir}/*.so.%{?so_ver}*
%dir %{_libdir}/ruby/%{abiver}
%dir %{_libdir}/ruby/gems/%{abiver}
%dir %{_libdir}/ruby/site_ruby/%{abiver}
%dir %{_libdir}/ruby/vendor_ruby/%{abiver}
%dir %{_libdir}/ruby
%{_libdir}/ruby/%{abiver}/*
%{_libdir}/ruby/gems/%{abiver}/*
%doc %{_mandir}/man1/erb%{vermajor}.1*
%doc %{_mandir}/man1/irb%{vermajor}.1*
%doc %{_mandir}/man1/rake%{vermajor}.1*
%doc %{_mandir}/man1/ri%{vermajor}.1*
%doc %{_mandir}/man1/ruby%{vermajor}.1*
# Development stuff
%files -n ruby-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/ruby-%{vermajor}.pc
%{_includedir}/ruby-%{abiver}/
%{_libdir}/*.so
%exclude %{_libdir}/*a
# Documentation
%files doc-ri
%defattr(-,root,root)
%docdir %{_datadir}/ri/
%doc %{_datadir}/ri/%{abiver}/
%files -n ruby
%defattr(-,root,root)
%doc BSDL COPYING GPL LEGAL NEWS README README.EXT
%{_bindir}/erb
%{_bindir}/gem
%{_bindir}/irb
%{_bindir}/rake
%{_bindir}/rdoc
%{_bindir}/ri
%{_bindir}/ruby
%{_bindir}/testrb
%ghost %{_sysconfdir}/alternatives/erb
%ghost %{_sysconfdir}/alternatives/gem
%ghost %{_sysconfdir}/alternatives/irb
%ghost %{_sysconfdir}/alternatives/rake
%ghost %{_sysconfdir}/alternatives/rdoc
%ghost %{_sysconfdir}/alternatives/ri
%ghost %{_sysconfdir}/alternatives/ruby
%ghost %{_sysconfdir}/alternatives/testrb
%ghost %{_sysconfdir}/alternatives/erb.1.gz
%ghost %{_sysconfdir}/alternatives/irb.1.gz
%ghost %{_sysconfdir}/alternatives/rake.1.gz
%ghost %{_sysconfdir}/alternatives/ri.1.gz
%ghost %{_sysconfdir}/alternatives/ruby.1.gz
%doc %{_mandir}/man1/erb.1*
%doc %{_mandir}/man1/irb.1*
%doc %{_mandir}/man1/rake.1*
%doc %{_mandir}/man1/ri.1*
%doc %{_mandir}/man1/ruby.1*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post -n ruby
for bin in erb irb rake ri ruby; do
%{_sbindir}/update-alternatives --install \
%{_bindir}/${bin} ${bin} %{_bindir}/${bin}%{vermajor} 21 \
--slave %{_mandir}/man1/${bin}.1.gz ${bin}.1.gz %{_mandir}/man1/${bin}%{vermajor}.1.gz
done
for bin in gem rdoc testrb; do
%{_sbindir}/update-alternatives --install \
%{_bindir}/${bin} ${bin} %{_bindir}/${bin}%{vermajor} 21
done
%preun -n ruby
if [ "$1" = 0 ] ; then
for bin in erb gem irb rake rdoc ri ruby testrb; do
%{_sbindir}/update-alternatives --remove ${bin} %{_bindir}/${bin}%{vermajor}
done
fi
%changelog