File ruby19.spec of Package ruby19

#
# spec file for package ruby19
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           ruby19
Version:        1.9.3.p194
Release:        0
#
%define pkg_version 1.9.3
%define patch_level p194
# keep in sync with macro file!
%define rb_binary_suffix 1.9
%define rb_ver  1.9.1
%define rb_arch %(echo %{_target_cpu}-linux | sed -e "s/ppc/powerpc/")
%define rb_libdir                         %{_libdir}/ruby/%{rb_ver}/
%define rb_archdir                        %{_libdir}/ruby/%{rb_ver}/%{rb_arch}
# keep in sync with macro file!
#
%if 0%{?suse_version} == 1100
%define needs_optimization_zero 1
%endif
# from valgrind.spec
%ifarch %ix86 x86_64 ppc ppc64
%define use_valgrind 1
%endif
%define run_tests 0
#
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gdbm-devel
BuildRequires:  libffi-devel
BuildRequires:  libyaml-devel
BuildRequires:  ncurses-devel
BuildRequires:  openssl-devel
BuildRequires:  pkg-config
BuildRequires:  readline-devel
BuildRequires:  tk-devel
BuildRequires:  zlib-devel
# this requires is needed as distros older than 11.3 have a buildignore on freetype2, without this the detection of the tk extension fails
BuildRequires:  freetype2-devel
%if 0%{?suse_version} > 1010
BuildRequires:  xorg-x11-libX11-devel
%else
BuildRequires:  xorg-x11-devel
%endif
%if 0%{?use_valgrind}
%if 0%{?suse_version} > 1020
BuildRequires:  valgrind-devel
%else
BuildRequires:  valgrind
%endif
%endif
%if 0%{?suse_version} > 1120
BuildRequires:  ca-certificates
BuildRequires:  ca-certificates-cacert
%else
BuildRequires:  openssl-certs
%endif
#
Provides:       rubygem-rake = 0.9.2.2
Provides:       ruby(abi) = %{rb_ver}
#
Url:            http://www.ruby-lang.org/
Source:         ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-%{pkg_version}-%{patch_level}.tar.bz2
Source6:        ruby19.macros
Source7:        gem_install_wrapper.sh
Patch:          rubygems-1.5.0_buildroot.patch
Patch1:         ruby-1.9.2p290_tcl_no_stupid_rpaths.patch
Patch2:         ruby19-export_init_prelude.patch
#
Summary:        An Interpreted Object-Oriented Scripting Language
License:        BSD-2-Clause or Ruby
Group:          Development/Languages/Ruby

%description
Ruby is an interpreted scripting language for quick and easy
object-oriented programming.  It has many features for processing text
files and performing system management tasks (as in Perl).  It is
simple, straight-forward, and extensible.

* Ruby features:

- Simple Syntax

- *Normal* Object-Oriented features (class, method calls, for
   example)

- *Advanced* Object-Oriented features(Mix-in, Singleton-method, for
   example)

- Operator Overloading

- Exception Handling

- Iterators and Closures

- Garbage Collection

- Dynamic Loading of Object Files (on some architectures)

- Highly Portable (works on many UNIX machines; DOS, Windows, Mac,
BeOS, and more)


%package devel
Summary:        Development files to link against Ruby
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
Provides:       rubygems19 = 1.3.7
Provides:       rubygems19_with_buildroot_patch
Requires:       ruby-common

%description devel
Development files to link against Ruby.

%package tk
Summary:        TCL/TK bindings for Ruby
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}

%description tk
TCL/TK bindings for Ruby

%package doc-ri
Summary:        Ruby Interactive Documentation
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
%description doc-ri
This package contains the RI docs for ruby

%package doc-html
Summary:        This package contains the HTML docs for ruby
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
%description doc-html
This package contains the HTML docs for ruby

%package examples
Summary:        Example scripts for ruby
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
%description examples
Example scripts for ruby

%package test-suite
Requires:       %{name} = %{version}
Summary:        An Interpreted Object-Oriented Scripting Language
Group:          Development/Languages/Ruby
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif
%description test-suite
Ruby is an interpreted scripting language for quick and easy
object-oriented programming.  It has many features for processing text
files and performing system management tasks (as in Perl).  It is
simple, straight-forward, and extensible.

* Ruby features:

- Simple Syntax

- *Normal* Object-Oriented features (class, method calls, for
   example)

- *Advanced* Object-Oriented features(Mix-in, Singleton-method, for
   example)

- Operator Overloading

- Exception Handling

- Iterators and Closures

- Garbage Collection

- Dynamic Loading of Object Files (on some architectures)

- Highly Portable (works on many UNIX machines; DOS, Windows, Mac,
BeOS, and more)

%prep
%setup -q -n ruby-%{pkg_version}-%{patch_level}
%patch
%patch1
%patch2 -p1
%if 0%{?needs_optimization_zero}
touch -r configure configure.timestamp
perl -p -i.bak -e 's|-O2|-O0|g' configure
diff -urN configure{.bak,} ||:
touch -r configure.timestamp configure
%endif
find sample -type f -print0 | xargs -r0 chmod a-x
grep -Erl '^#! */' benchmark bootstraptest ext lib sample test \
  | xargs -r perl -p -i -e 's|^#!\s*\S+(\s+.*)?$|#!/usr/bin/ruby1.9$1|'

%build
%if 0%{?needs_optimization_zero}
export CFLAGS="%{optflags}"
export CFLAGS="${CFLAGS//-O2/}"
export CXXFLAGS="$CFLAGS"
export FFLAGS="$CFLAGS"
%endif
%configure \
  --program-suffix=%{rb_binary_suffix}  \
  --with-soname=ruby%{rb_binary_suffix} \
  --target=%{_target_platform} \
  %if 0%{?use_valgrind}
  --with-valgrind \
  %endif
  --with-mantype=man \
  --enable-shared \
  --disable-static \
  --disable-rpath
%{__make} all V=1

%install
%makeinstall V=1
%{__install} -D -m 0644 %{S:6} %{buildroot}/etc/rpm/macros.ruby19
%{__install} -D -m 0755 %{S:7} %{buildroot}/usr/lib/rpm/gem_install_wrapper.sh

%if 0%{?run_tests}
%check
export LD_LIBRARY_PATH="$PWD"
# we know some tests will fail when they do not find a /usr/bin/ruby
make check V=1 ||:
%endif

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%config(noreplace) /etc/rpm/macros.ruby19
%{_bindir}/erb%{rb_binary_suffix}
%{_bindir}/gem%{rb_binary_suffix}
%{_bindir}/irb%{rb_binary_suffix}
%{_bindir}/rake%{rb_binary_suffix}
%{_bindir}/rdoc%{rb_binary_suffix}
%{_bindir}/ri%{rb_binary_suffix}
%{_bindir}/ruby%{rb_binary_suffix}
%{_bindir}/testrb%{rb_binary_suffix}
%{_libdir}/libruby%{rb_binary_suffix}.so.1.9*
%{_libdir}/ruby/
/usr/lib/rpm/gem_install_wrapper.sh
%exclude %{rb_libdir}/multi-tk.rb
%exclude %{rb_libdir}/remote-tk.rb
%exclude %{rb_libdir}/tcltk.rb
%exclude %{rb_libdir}/tk*.rb
%exclude %{rb_libdir}/tk/
%exclude %{rb_libdir}/tkextlib/
%exclude %{rb_archdir}/tcltklib.so
%exclude %{rb_archdir}/tkutil.so
%{_mandir}/man1/ri%{rb_binary_suffix}.1*
%{_mandir}/man1/irb%{rb_binary_suffix}.1*
%{_mandir}/man1/erb%{rb_binary_suffix}.1*
%{_mandir}/man1/rake%{rb_binary_suffix}.1*
%{_mandir}/man1/ruby%{rb_binary_suffix}.1*
%doc ChangeLog  COPYING  COPYING.ja  GPL  KNOWNBUGS.rb  LEGAL  NEWS  README  README.EXT  README.EXT.ja  README.ja  ToDo doc/* sample/

%files devel
%defattr(-,root,root,-)
%{_includedir}/ruby-%{rb_ver}
%{_libdir}/libruby%{rb_binary_suffix}.so
%{_libdir}/libruby%{rb_binary_suffix}-static.a
%{_libdir}/pkgconfig/ruby-1.9.pc

%files tk
%defattr(-,root,root,-)
%{rb_libdir}/multi-tk.rb
%{rb_libdir}/remote-tk.rb
%{rb_libdir}/tcltk.rb
%{rb_libdir}/tk*.rb
%{rb_libdir}/tk/
%{rb_libdir}/tkextlib/
%{rb_archdir}/tcltklib.so
%{rb_archdir}/tkutil.so

%files doc-ri
%defattr(-,root,root,-)
%dir %{_datadir}/ri/
%{_datadir}/ri/%{rb_ver}/

%changelog