Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37506821
en ru br
ALT Linux repos
S:3.1.2-alt2.1
5.0: 1.8.7-alt7
4.1: 1.8.7-alt0.M41.5
4.0: 1.8.6-alt2.M40.2
3.0: 1.8.2-alt7

Group :: Development/Ruby
RPM: ruby

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

# vim: set ft=spec: -*- rpm-spec -*-
# $Id: ruby,v 1.7 2005/01/23 22:04:15 raorn Exp $

%define _configure_target --build=%_target_platform
%def_enable debug

Packager: Ruby Maintainers Team <ruby at packages.altlinux.org>

Name: ruby
Version: 1.8.2
%define subver %(echo %version |cut -d. -f1,2)
Release: alt7

Summary: Object Oriented Scripting Language
License: Dual: GPL and Ruby
Group: Development/Ruby
Url: http://www.ruby-lang.org/
AutoReq: yes, noshell
Requires: %name-stdlibs = %version-%release
Obsoletes: ri, ruby-SimpleMarkup, rdoc
Provides: ri, ruby-SimpleMarkup, rdoc

# I'm repackaging it to .tar.bz2 -- it is over 400Kb gain

Source: ftp://ftp.ruby-lang.org/pub/ruby/%name-%version.tar.bz2
# All documentation extras moved to ruby-doc-extra package
Source1: http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/~checkout~/shim/ruby16/doc/features-ruby18.txt
Source2: README.ALT-CP1251
Patch1: ruby-1.8-fhs-vendor-alt.patch
Patch2: socket-alt.patch
Patch3: ruby-configure.patch
Patch4: ruby-1.8.2-mkd-lib64.patch

BuildRequires: flex, bison, tk-devel, libtinfo-devel, libreadline-devel, libdb4-devel
BuildRequires: libgdbm-devel, findutils, cpp, zlib-devel, ncurses-devel, openssl-devel
BuildRequires: kernel-headers, iconv

%package doc
Summary: Documentation for the powerful language Ruby
Group: Development/Ruby
Requires: %name = %version-%release
AutoReq: no

%package -n lib%name-devel
Summary: Development components for the powerful language Ruby
Group: Development/Ruby
Requires: lib%name = %version-%release
Obsoletes: %name-devel
Provides: %name-devel

%package -n lib%name-devel-static
Summary: Development components for the powerful language Ruby (static library)
Group: Development/Ruby
Requires: lib%name-devel = %version-%release
Obsoletes: %name-devel-static
Provides: %name-devel-static

%package -n lib%name
Summary: Ruby as dynamic library for embedding
Group: Development/Ruby

%package stdlibs
Summary: Standard library for Ruby
Group: Development/Ruby
Prereq: lib%name = %version-%release
Obsoletes: ruby-testunit, ruby-openssl
Provides: ruby-testunit, ruby-openssl

%package stdlibs-tk
Summary: Tcl/Tk standard library bindings for Ruby
Group: Development/Ruby
Prereq: %name-stdlibs = %version-%release

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

%description doc
This package provides documentation for the Ruby programming
language. It includes documentation for standard Ruby libraries
and HTML version of the 'Programming Ruby' book.

%description -n lib%name-devel
Ruby is the interpreted scripting language for quick and
easy object-oriented programming. This package includes
development headers needed for embedding Ruby
in other applications or compiling Ruby extensions.

%description -n lib%name-devel-static
Ruby is the interpreted scripting language for quick and
easy object-oriented programming. This package includes
statically linked Ruby library needed for embedding Ruby
in other applications.

%description -n lib%name
Ruby is the interpreted scripting language for quick and
easy object-oriented programming. This package includes
libruby dynamically linked library suited for embedding Ruby
in other applications. File system structure for standard
library of Ruby modules and classes also provided by this
package. You may want to install %name-stdlibs as well to get
access to Ruby standard classes library.

%description stdlibs
Standard library of Ruby modules and classes.

%description stdlibs-tk
Tcl/Tk bindings for Ruby. This is an extension modules
for Ruby standard library which provides easy access to
Tcl/Tk.

%prep
%setup -q
%patch1 -p1 -b .fhs
%patch2 -p1
%patch3 -p1
%patch4 -p1

%__cp -p %SOURCE1 .
%__cp -p %SOURCE2 .
iconv -f cp1251 -t koi8-r README.ALT-CP1251 -o README.ALT-KOI8-R

find . -type d -name CVS -print0 | xargs -r0 %__rm -rf --

%build
%__autoconf
%configure \
--enable-shared \
--disable-rpath \
--program-prefix= \
--program-suffix= \
--enable-wide-getaddrinfo \
--with-dbm-type=db \
--with-sitedir=%_prefix/local/share/ruby/site_ruby \
       --with-vendordir=%_prefix/share/ruby/vendor_ruby

%__make
%__make test

%install
%__make DESTDIR=%buildroot install

%__mkdir_p %buildroot%_datadir/%name/vendor_ruby/%subver
%__mkdir_p %buildroot%_prefix/lib/%name/vendor_ruby/%subver/%{_target_cpu}-%{_host_os}

%__mkdir_p extensions
# Search documentation for extensions
(find ext -type f -name '*.txt*' -o -name 'test*'
find ext \( -type f -name 'README*' \) -o \( -type d -name 'sample' -o -name 'doc' \)
) | grep -v CVS | ./miniruby -pn -Ilib -rEnglish -e '
require "ftools"
require "fileutils"
$LAST_READ_LINE.chomp!
begin
   File.makedirs("extensions/"+File.dirname($LAST_READ_LINE))
rescue
end

FileUtils.cp_r $LAST_READ_LINE, "extensions/#{$LAST_READ_LINE}"
'

%__mv extensions/ext/* extensions/ && %__rm -rf extensions/ext

echo "VENDOR_SPECIFIC=true" >%buildroot%_datadir/%name/vendor_ruby/vendor-specific.rb

# generate file lists for appropriate packages

# 1. Generate full file list
(cd %buildroot ; find usr/lib/%name ! -type d -printf "/%%p\n") > %name.list
(cd %buildroot ; find usr/lib/%name   -type d -printf "%%%%dir /%%p\n") >> %name.list
(cd %buildroot ; find usr/share/%name ! -type d -printf "/%%p\n") >> %name.list
(cd %buildroot ; find usr/share/%name   -type d -printf "%%%%dir /%%p\n") >> %name.list

# 2. Remove components of lib%name-devel[-static]

./miniruby -ni -Ilib -rEnglish -e 'print if !Regexp.new("%{_target_cpu}-%{_host_os}/.*[ha]\$").match $LAST_READ_LINE' %name.list

%__cp %name.list %name-tk.list
%__cp %name.list %name-core.list

# 3. Generate list for %name-stdlibs-tcltk

./miniruby -ni -Ilib -rEnglish -e 'print if /tcl|tk/.match $LAST_READ_LINE' %name-tk.list

# 4. Generate list for %name-stdlibs-core

./miniruby -ni -Ilib -rEnglish -e '
   VENDOR_SPECIFIC=true unless defined?(VENDOR_SPECIFIC)
   require "./rbconfig"
   require "ftools"
   include Config
   re_array = []
   ["sitearchdir", "sitelibdir", "archdir", "rubylibdir"].each do |dir|
components = CONFIG[dir].split("/")
0.upto components.length-1 do |idx|
   re_array.push components[0..-1-idx].join("/")
end
   end
   regexp = "%%dir (" + re_array.join("|") + ")\$"
   print if Regexp.new(regexp).match $LAST_READ_LINE' %name-core.list

# 5. Generate list for %name-stdlibs

cat %name-tk.list %name-core.list %name.list | sort | uniq -u > %name-stdlibs.list

# 6. Generate RPM macros for libruby-devel

%__mkdir -p %buildroot%_sysconfdir/rpm/macros.d
./miniruby -e '
   VENDOR_SPECIFIC=true unless defined?(VENDOR_SPECIFIC)
   require "./rbconfig"
   include Config
   ["sitearchdir", "sitelibdir", "archdir", "rubylibdir"].each do |dir|
puts "%%%%ruby_%%s #{CONFIG[dir]}" %% dir.gsub(/ruby/,"")
   end
   puts "%%ruby_begin ruby -e '\''"
   puts "%%ruby_end '\''"
   puts "%%ruby_ri_sitedir     %_datadir/ri/%subver/site"
   puts "%%rdoc  DESTDIR=\"%%buildroot\" rdoc --ri-site --all"
' >%buildroot%_sysconfdir/rpm/macros.d/ruby

echo "%%ruby_configure ruby -rvendor-specific extconf.rb --ruby=%_bindir/ruby" >>%buildroot%_sysconfdir/rpm/macros.d/ruby

# Workaround error in instruby.rb which thinks libruby.so.1.8 is manpage :)

%__rm -f %buildroot%_man8dir/*

# 7. Generate system-wide documentation for ri

%__mkdir -p %buildroot%_datadir/ri/%subver
LD_LIBRARY_PATH=%buildroot%_libdir \
DESTDIR=%buildroot \
RUBYLIB="%buildroot%_prefix/lib/%name/%subver/%{_target_cpu}-%{_host_os}:lib:." \
   %buildroot%_bindir/ruby bin/rdoc -Y -a

# lib/rdoc/rdoc.rb:

#  Create an output dir if it doesn't exist. If it does
#  exist, but doesn't contain the flag file <tt>created.rid</tt>
#  then we refuse to use it, as we may clobber some
#  manually generated documentation
# So put creted.rid into RI site dir
%__mkdir -p %buildroot%_datadir/ri/%subver/site
%__cp -p %buildroot%_datadir/ri/%subver/system/created.rid %buildroot%_datadir/ri/%subver/site

# 8. Script to generate all rdoc documentation

echo '#!/usr/bin/env ruby

require "rbconfig"
include Config

system("rdoc -Y -a #{CONFIG['\''rubylibdir'\'']}") &&
system("rdoc -R -a %ruby_sitelibdir #{CONFIG['\''sitelibdir'\'']}")
' > %buildroot%_bindir/rdocall

%__chmod +x %buildroot%_bindir/rdocall

# This is a hack but we really don't need to bytecompile

# Python comparison sample in the Ruby manual
unset RPM_PYTHON

%post -n lib%name -p %post_ldconfig

%postun -n lib%name -p %postun_ldconfig

%files stdlibs -f %name-stdlibs.list

%files stdlibs-tk -f %name-tk.list

%files
%doc README* LEGAL COPYING* ToDo GPL LGPL  ChangeLog features-ruby18.txt
%_bindir/*
%_mandir/*/*
%dir %_datadir/ri/%subver
%dir %_datadir/ri/%subver/system
%dir %_datadir/ri/%subver/site
%_datadir/ri/%subver/site/created.rid
%_datadir/ri/%subver/system/*

%files -n lib%name -f %name-core.list
%_libdir/*.so.*
%dir %_datadir/ri

%files doc
%docdir %_docdir/%name-%version
%doc README.* extensions doc sample

%files -n lib%name-devel
%_prefix/lib/%name/%subver/%_target_cpu-%_host_os/*.h
%_libdir/*.so
%_sysconfdir/rpm/macros.d/%name

%files -n lib%name-devel-static
%_libdir/*.a

%changelog

Full changelog you can see here

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin