File ruby.spec of Package ruby.import4584

#
# spec file for package ruby
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           ruby
Version:        1.8.7.p334
Release:        1.<RELEASE4>
#
%define pkg_version 1.8.7
%define patch_level p334
%define rb_arch %(echo %{_target_cpu}-linux | sed -e "s/i686/i586/" -e "s/hppa2.0/hppa/" -e "s/ppc/powerpc/")
%define rb_ver  %(echo %{pkg_version} | sed -e 's/\\\.[0-9]\\\+$//')
#
License:        GPLv2+
Group:          Development/Languages/Ruby
#
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bison gdbm-devel gperf graphviz libjpeg-devel openssl-devel readline-devel tk-devel
# for openssl testsuite
BuildRequires:  openssl
#define with_bleak_house 1
%if 0%{suse_version} >= 1030
%define use_fdupes 1
%endif
%if 0%{?use_fdupes}
BuildRequires:  fdupes
%endif
%if 0%{?suse_version} < 930
BuildRequires:  XFree86-devel XFree86-fonts-scalable
%else
BuildRequires:  xorg-x11-devel xorg-x11-fonts-scalable
%endif
#
Provides:       /usr/bin/ruby
%if 0%{?with_bleak_house}
%define bleak_house_version 4.0
Provides:       ruby_with_bleak_house = %{bleak_house_version}-%{release}
%endif
Provides:       ruby(abi) = %{rb_ver}
#
Url:            http://www.ruby-lang.org/
Source:         ftp://ftp.ruby-lang.org/pub/ruby/ruby-%{pkg_version}-%{patch_level}.tar.bz2
Source1:        irb.1
Source2:        ruby-doc-bundle.tar.bz2
Patch1:         ruby-1.8.7.p299_lib64.patch
Patch2:         ruby-1.8.7.p22_tcltk-multilib.patch
Patch5:         ruby-1.8.7.p299_date_remove_privat.patch
Patch6:         ruby-1.8.7.p299_pedantic-headers.patch
Patch7:         ruby-1.8.7.p72_vendor_specific.patch
Patch8:         ruby-1.8.7.p72_topdir.patch
Patch9:         ruby-1.8.x_digest_non_void_return.patch
# can be removed on next version update. pulled from svn
Patch10:        ruby-1.8.x_openssl_branch_update.patch
Patch11:        ruby-1.8.x_yaml2byte.patch
Patch12:        1887f60a8540f64f5c7bb14d57c0be70506941b8.patch
Patch13:        ruby-1.8.7.p334_remove_zlib_test_params_test.patch
Patch14:        ruby-1.8.x_bigdecimal_memory_corruption.patch
# vendor ruby files taken from:
# http://svn.macports.org/repository/macports/trunk/dports/lang/ruby/
Source3:        site-specific.rb
Source4:        vendor-specific.rb
#
Source5:        ruby-rpmlintrc
Source6:        ruby.macros
%if 0%{?with_bleak_house}
#Source6:        bleak_house-%{bleak_house_version}.tar.bz2
%endif
#
Summary:        An Interpreted Object-Oriented Scripting Language

%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)



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

%package devel
License:        GPLv2+
Group:          Development/Languages/Ruby
Summary:        Development files to link against Ruby
Requires:       %{name} = %{version}
%if 0%{?with_bleak_house}
Requires:       ruby_with_bleak_house = %{bleak_house_version}
Provides:       ruby-devel_with_bleak_house = %{bleak_house_version}-%{release}
%endif

%description devel
Development files to link against Ruby.



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

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

%description tk
TCL/TK bindings for Ruby



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

%package doc-ri
License:        GPLv2+
Group:          Development/Languages/Ruby
Summary:        Ruby Interactive Documentation
Requires:       %{name} = %{version}
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description doc-ri
This package contains the RI docs for ruby



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

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

%description doc-html
This package contains the HTML docs for ruby



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

%package examples
License:        GPLv2+
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
Summary:        Example scripts for ruby

%description examples
Example scripts for ruby



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

%package test-suite
License:        GPLv2+
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}
Summary:        An Interpreted Object-Oriented Scripting Language

%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)



Authors:
--------
    Yukihiro Matsumoto <matz@netlab.co.jp>

%prep
%setup -q -n ruby-%{pkg_version}-%{patch_level} -a2 %{?with_bleak_house:-a6}
%patch1
%patch2
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13
%patch14
%if 0%{?with_bleak_house}
  for patch in valgrind configure gc ; do
    patch -p0 < bleak_house-%{bleak_house_version}/ruby/${patch}.patch
  done
%endif
find . -type f | xargs -n 1 sed -i "s@#!\s*/usr/local/bin/ruby@#!/usr/bin/ruby@"
# make sure it _really_ rebuilds parse.c for us
old parse.c

%build
# autoreconf -fi
export CFLAGS="%{optflags} -g -fno-strict-aliasing"
%configure                                         \
    --target=%{_target_platform}                   \
    --with-default-kcode=none                      \
    --with-mantype=man                             \
    --enable-shared                                \
    --disable-static
%{__make} all
%{__make} -C ext/tk/ all
#
# TODO: patch the .document files to include all needed modules.
#
export LD_LIBRARY_PATH="$PWD/"
export RUBYLIB="$PWD:$PWD/lib:$(find $PWD/.ext  $PWD/ext/ -type d |tr '\n' ':')."
./ruby bin/rdoc                        \
    --all --line-numbers --ri-system   \
    --op=ri/%{rb_ver}/system .
./ruby bin/rdoc                          \
    --all --line-numbers --charset=UTF-8 \
    --fmt=html -p --inline-source        \
    --op=rdoc/html .

%check
#
# move the tests out of the way that require an installed ruby
# we dont have that in our build environment.
#
%{__mkdir} unused.test
%{__mv} test/{drb,soap,webrick} unused.test/
%ifarch ppc64 s390x
%{__mv} test/openssl/ unused.test/
%endif
#
# -> LD_LIBRARY_PATH => we need to find libruby.so.%{rb_ver}
#    the test suite uses LD_PRELOAD=./libruby.so.%{rb_ver}
# -> RUBYLIB => find needed modules during documentation generation
#
export LD_LIBRARY_PATH="$PWD/"
export RUBYLIB="$PWD:$PWD/lib:$(find $PWD/.ext  $PWD/ext/ -type d |tr '\n' ':')."
#
# run the test suites
#
%{__make} check ||:
#
# TODO:
#   the big test suite fails with some weird openssl errors on ppc
#   to be reinvestigated
#
# %{__make} check
#
# restore the tests
#
%{__mv} unused.test/{drb,soap,webrick} test/
%ifarch ppc64 s390x
%{__mv} unused.test/openssl/ test/
%endif

%install
%makeinstall
%makeinstall -C ext/tk/
%{__install} -d -m 0755                          \
    %{buildroot}%{_docdir}/%{name}{,-test-suite} \
    %{buildroot}%{_datadir}/emacs/site-lisp      \
    %{buildroot}%{_datadir}/ri/%{rb_ver}/system/ \
    %{buildroot}%{_libdir}/%{name}/vendor_%{name}/%{rb_ver}
#
%{__install} -m 0644 misc/*.el %{buildroot}%{_datadir}/emacs/site-lisp/
%{__install} -m 0644 %{S:1}    %{buildroot}%{_mandir}/man1/irb.1
#
%{__install} -m 0644 %{S:3}    %{buildroot}%{_libdir}/%{name}/site_%{name}/%{rb_ver}
%{__install} -m 0644 %{S:4}    %{buildroot}%{_libdir}/%{name}/vendor_%{name}/%{rb_ver}
#
%{__cp} -rv                                    \
    ri/ %{buildroot}%{_datadir}/
#mv %{buildroot}%{_datadir}{,/ri/%{rb_ver}}/created.rid
%{__cp} -rv                                    \
        COPYING COPYING.ja ChangeLog GPL LEGAL \
        LGPL README README.EXT README.EXT.ja   \
        README.ja ToDo NEWS                    \
    %{buildroot}%{_docdir}/%{name}
%if 0%{?with_bleak_house}
%{__cp} -v bleak_house-%{bleak_house_version}/LICENSE     %{buildroot}%{_docdir}/%{name}/LICENSE_AFL_for_bleak_house
%{__cp} -v bleak_house-%{bleak_house_version}/LICENSE_BSD %{buildroot}%{_docdir}/%{name}/LICENSE_BSD_for_bleak_house
%endif
%{__cp} -rv \
    ruby-doc-bundle %{buildroot}%{_docdir}/%{name}
%{__cp} -rv \
    rdoc/html %{buildroot}%{_docdir}/%{name}/ruby-library-docs
%{__cp} -rv \
    sample %{buildroot}%{_docdir}/%{name}/examples
sed -i "s@#!\s*\./miniruby@#!/usr/bin/ruby@" runruby.rb
%{__cp} -r test/ runruby.rb %{buildroot}%{_docdir}/%{name}-test-suite/
%{__ln_s} -f %{_bindir}/%{name} %{buildroot}%{_docdir}/%{name}-test-suite/%{name}
%if 0%{?use_fdupes}
%fdupes %{buildroot}
%endif
chmod -v a-x %{buildroot}%{_libdir}/ruby/%{rb_ver}/%{rb_arch}/*.h
%{__install} -D -m 0644 %{S:6} %{buildroot}/etc/rpm/macros.ruby

%post   -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%config(noreplace) /etc/rpm/macros.ruby
%{_bindir}/*
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{rb_ver}
%{_libdir}/lib%{name}.so.%{rb_ver}*
%dir %{_datadir}/emacs
%dir %{_datadir}/emacs/site-lisp
%{_datadir}/emacs/site-lisp/*
%{_mandir}/man1/*
%dir %{_libdir}/%{name}/site_%{name}
%dir %{_libdir}/%{name}/site_%{name}/%{rb_ver}
%dir %{_libdir}/%{name}/site_%{name}/%{rb_ver}/%{rb_arch}
%dir %{_libdir}/%{name}/vendor_%{name}
%dir %{_libdir}/%{name}/vendor_%{name}/%{rb_ver}
%dir %{_libdir}/%{name}/vendor_%{name}/%{rb_ver}/%{rb_arch}
%{_libdir}/%{name}/site_%{name}/%{rb_ver}/site-specific.rb
%{_libdir}/%{name}/vendor_%{name}/%{rb_ver}/vendor-specific.rb
%{_libdir}/%{name}/%{rb_ver}/English.rb
%{_libdir}/%{name}/%{rb_ver}/Env.rb
%{_libdir}/%{name}/%{rb_ver}/abbrev.rb
%{_libdir}/%{name}/%{rb_ver}/base64.rb
%{_libdir}/%{name}/%{rb_ver}/benchmark.rb
%{_libdir}/%{name}/%{rb_ver}/cgi*
%{_libdir}/%{name}/%{rb_ver}/complex.rb
%{_libdir}/%{name}/%{rb_ver}/csv.rb
%{_libdir}/%{name}/%{rb_ver}/date.rb
%dir %{_libdir}/%{name}/%{rb_ver}/date
%{_libdir}/%{name}/%{rb_ver}/date/format.rb
%{_libdir}/%{name}/%{rb_ver}/date2.rb
%{_libdir}/%{name}/%{rb_ver}/debug.rb
%{_libdir}/%{name}/%{rb_ver}/delegate.rb
%{_libdir}/%{name}/%{rb_ver}/bigdecimal/
%{_libdir}/%{name}/%{rb_ver}/digest.rb
%dir %{_libdir}/%{name}/%{rb_ver}/digest/
%{_libdir}/%{name}/%{rb_ver}/digest/sha2.rb
%{_libdir}/%{name}/%{rb_ver}/dl/
%{_libdir}/%{name}/%{rb_ver}/drb*
%{_libdir}/%{name}/%{rb_ver}/e2mmap.rb
%{_libdir}/%{name}/%{rb_ver}/erb.rb
%{_libdir}/%{name}/%{rb_ver}/eregex.rb
%{_libdir}/%{name}/%{rb_ver}/expect.rb
%{_libdir}/%{name}/%{rb_ver}/fileutils.rb
%{_libdir}/%{name}/%{rb_ver}/finalize.rb
%{_libdir}/%{name}/%{rb_ver}/find.rb
%{_libdir}/%{name}/%{rb_ver}/forwardable.rb
%{_libdir}/%{name}/%{rb_ver}/ftools.rb
%{_libdir}/%{name}/%{rb_ver}/generator.rb
%{_libdir}/%{name}/%{rb_ver}/getoptlong.rb
%{_libdir}/%{name}/%{rb_ver}/getopts.rb
%{_libdir}/%{name}/%{rb_ver}/gserver.rb
%{_libdir}/%{name}/%{rb_ver}/importenv.rb
%{_libdir}/%{name}/%{rb_ver}/io/
%{_libdir}/%{name}/%{rb_ver}/ipaddr.rb
%{_libdir}/%{name}/%{rb_ver}/irb*
%{_libdir}/%{name}/%{rb_ver}/jcode.rb
%{_libdir}/%{name}/%{rb_ver}/kconv.rb
%{_libdir}/%{name}/%{rb_ver}/logger.rb
%{_libdir}/%{name}/%{rb_ver}/mailread.rb
%{_libdir}/%{name}/%{rb_ver}/mathn.rb
%{_libdir}/%{name}/%{rb_ver}/matrix.rb
%{_libdir}/%{name}/%{rb_ver}/md5.rb
%{_libdir}/%{name}/%{rb_ver}/mkmf.rb
%{_libdir}/%{name}/%{rb_ver}/monitor.rb
%{_libdir}/%{name}/%{rb_ver}/mutex_m.rb
%{_libdir}/%{name}/%{rb_ver}/net/
%{_libdir}/%{name}/%{rb_ver}/observer.rb
%{_libdir}/%{name}/%{rb_ver}/open-uri.rb
%{_libdir}/%{name}/%{rb_ver}/open3.rb
%{_libdir}/%{name}/%{rb_ver}/openssl*
%{_libdir}/%{name}/%{rb_ver}/optparse*
%{_libdir}/%{name}/%{rb_ver}/ostruct.rb
%{_libdir}/%{name}/%{rb_ver}/parsearg.rb
%{_libdir}/%{name}/%{rb_ver}/parsedate.rb
%{_libdir}/%{name}/%{rb_ver}/pathname.rb
%{_libdir}/%{name}/%{rb_ver}/ping.rb
%{_libdir}/%{name}/%{rb_ver}/pp.rb
%{_libdir}/%{name}/%{rb_ver}/prettyprint.rb
%{_libdir}/%{name}/%{rb_ver}/profile.rb
%{_libdir}/%{name}/%{rb_ver}/profiler.rb
%{_libdir}/%{name}/%{rb_ver}/pstore.rb
%dir %{_libdir}/%{name}/%{rb_ver}/racc
%{_libdir}/%{name}/%{rb_ver}/racc/parser.rb
%{_libdir}/%{name}/%{rb_ver}/rational.rb
%{_libdir}/%{name}/%{rb_ver}/rdoc/
%{_libdir}/%{name}/%{rb_ver}/readbytes.rb
%{_libdir}/%{name}/%{rb_ver}/resolv-replace.rb
%{_libdir}/%{name}/%{rb_ver}/resolv.rb
%{_libdir}/%{name}/%{rb_ver}/rexml/
%{_libdir}/%{name}/%{rb_ver}/rinda/
%{_libdir}/%{name}/%{rb_ver}/rss*
%{_libdir}/%{name}/%{rb_ver}/rubyunit.rb
%{_libdir}/%{name}/%{rb_ver}/runit/
%{_libdir}/%{name}/%{rb_ver}/scanf.rb
%{_libdir}/%{name}/%{rb_ver}/set.rb
%{_libdir}/%{name}/%{rb_ver}/securerandom.rb
%{_libdir}/%{name}/%{rb_ver}/sha1.rb
%{_libdir}/%{name}/%{rb_ver}/shell*
%{_libdir}/%{name}/%{rb_ver}/singleton.rb
%{_libdir}/%{name}/%{rb_ver}/soap/
%{_libdir}/%{name}/%{rb_ver}/sync.rb
%{_libdir}/%{name}/%{rb_ver}/tempfile.rb
%{_libdir}/%{name}/%{rb_ver}/test/
%{_libdir}/%{name}/%{rb_ver}/thread.rb
%{_libdir}/%{name}/%{rb_ver}/thwait.rb
%{_libdir}/%{name}/%{rb_ver}/time.rb
%{_libdir}/%{name}/%{rb_ver}/timeout.rb
%{_libdir}/%{name}/%{rb_ver}/tmpdir.rb
%{_libdir}/%{name}/%{rb_ver}/tracer.rb
%{_libdir}/%{name}/%{rb_ver}/tsort.rb
%{_libdir}/%{name}/%{rb_ver}/un.rb
%{_libdir}/%{name}/%{rb_ver}/uri*
%{_libdir}/%{name}/%{rb_ver}/weakref.rb
%{_libdir}/%{name}/%{rb_ver}/webrick*
%{_libdir}/%{name}/%{rb_ver}/wsdl/
%{_libdir}/%{name}/%{rb_ver}/xmlrpc/
%{_libdir}/%{name}/%{rb_ver}/xsd/
%{_libdir}/%{name}/%{rb_ver}/yaml*
%dir %{_libdir}/%{name}/%{rb_ver}/%{rb_arch}
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/rbconfig.rb
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/[a-sA-s]*.so
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/[u-zU-Z]*.so
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/thread.so
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/digest/
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/io/
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/racc/
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/COPYING*
%doc %{_docdir}/%{name}/ChangeLog
%doc %{_docdir}/%{name}/LEGAL
%doc %{_docdir}/%{name}/*GPL
%doc %{_docdir}/%{name}/NEWS
%doc %{_docdir}/%{name}/README*
%doc %{_docdir}/%{name}/ToDo
%if 0%{?with_bleak_house}
%doc %{_docdir}/%{name}/LICENSE_*_for_bleak_house
%endif

%files devel
%defattr(-,root,root)
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}-static.a
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/*.h

%files test-suite
%defattr(-,root,root)
%{_docdir}/%{name}-test-suite

%files tk
%defattr(-,root,root)
%{_libdir}/%{name}/%{rb_ver}/tcltk.rb
%{_libdir}/%{name}/%{rb_ver}/tk*
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/tcltklib.so
%{_libdir}/%{name}/%{rb_ver}/%{rb_arch}/tkutil.so
%{_libdir}/%{name}/%{rb_ver}/remote-tk.rb
%{_libdir}/%{name}/%{rb_ver}/multi-tk.rb

%files doc-html
%defattr(-,root,root)
%doc %{_docdir}/%{name}/ruby-library-docs
%doc %{_docdir}/%{name}/ruby-doc-bundle

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

%files examples
%defattr(-,root,root)
%doc %{_docdir}/%{name}/examples

%changelog