%define subver 1.8 %define rubyver 1.8.7 %define patchversion p358 %define rel 1 %define subrel 2 Summary: Object Oriented Script Language Name: ruby Version: %{rubyver}.%{patchversion} Release: %mkrel %rel License: Ruby or GPLv2 Group: Development/Ruby BuildRequires: autoconf BuildRequires: byacc BuildRequires: ncurses-devel BuildRequires: readline-devel BuildRequires: tcl-devel tk-devel BuildRequires: db4-devel BuildRequires: gdbm-devel >= 1.8.3 BuildRequires: openssl-devel BuildRequires: zlib-devel Obsoletes: ruby-rexml Provides: ruby-rexml # explicit file provides (since such requires are automatically added by find-requires) Provides: /usr/bin/ruby Provides: ruby(abi) = %{subver} Source0: ftp://ftp.ruby-lang.org/pub/ruby/%{subver}/ruby-%{rubyver}-%{patchversion}.tar.bz2 Source1: http://www.rubycentral.com/faq/rubyfaqall.html.bz2 Source2: http://dev.rubycentral.com/downloads/files/ProgrammingRuby-0.4.tar.bz2 Source3: ruby.macros Patch0: ruby-lib64.patch Patch1: ruby-do-not-use-system-ruby-to-generate-ri-doc.patch Patch2: ruby-add-old-os-to-search-path.patch Patch3: ruby-do_not_propagate_no-undefined.patch Patch4: 110703_CVE-2011-0188.patch Patch5: ruby-1.8.7-p358-CVE-2012-4466-CVE-2012-4481.patch Patch6: ruby-2.0.0-entity-expansion-DoS-vulnerability-in-REXML.patch Patch7: ruby-2.0.0-add-missing-rexml-require.patch URL: http://www.ruby-lang.org/ %define my_target_cpu %{_target_cpu} %ifarch ppc %define my_target_cpu powerpc %endif %ifarch ppc64 %define my_target_cpu powerpc64 %endif %ifarch amd64 %define my_target_cpu x86_64 %endif # we're building for eabi %ifarch %arm %define abi -eabi %else %define abi %{nil} %endif %package doc Summary: Documentation for the powerful language Ruby Group: Development/Ruby BuildArch: noarch %package devel Summary: Development file for the powerful language Ruby Group: Development/Ruby Requires: %{name} = %{version} %package tk Summary: Tk extension for the powerful language Ruby Group: Development/Ruby Requires: %{name} = %{version} %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 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. This package contains the Ruby's documentation %description devel 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. This package contains the Ruby's devel files. %description tk 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. This package contains the Tk extension for Ruby. %prep %setup -q -n ruby-%{rubyver}-%{patchversion} %patch0 -p0 -b .lib64 %patch1 -p0 -b .ri %patch2 -p2 -b .old %patch3 -p2 -b .undefined %patch4 -p1 -b .CVE-2011-0188 %patch5 -p1 -b .CVE-2012-4466-CVE-2012-4481 %patch6 -p1 -b .CVE-2013-1821 %patch7 -p0 -b .rexml # Once fix FTBTS issue (redhat bug 716021). Remove the below # when it is no longer needed. sed -i.redirect -e '\@RUBY@s@\.rb >@\.rb | cat >@' ext/dl/depend autoreconf %build echo '.text' | gcc -shared -o libdummy.so.0 -xassembler - -ltcl -ltk >& /dev/null && { if %{_bindir}/ldd libdummy.so.0 | grep -q "lib\(tcl\|tk\).so"; then echo "Your tcl/tk is broken, get one with versioning in the libraries." exit 1 fi rm -f libdummy.so.0 } CFLAGS=`echo %{optflags} | sed 's/-fomit-frame-pointer//'` %configure2_5x --enable-shared --disable-rpath --enable-pthread \ --with-sitedir=%{_prefix}/lib/ruby/site_ruby \ --with-vendordir=%{_prefix}/lib/ruby/vendor_ruby \ --with-old-os=linux-gnu %make %install %makeinstall_std install-doc install -d %{buildroot}%{_docdir}/%{name}-%{version} cp -a COPYING* ChangeLog README* ToDo sample %{buildroot}%{_docdir}/%{name}-%{version} bzcat %{SOURCE1} > %{buildroot}%{_docdir}/%{name}-%{version}/FAQ.html install -d %{buildroot}%{_datadir}/emacs/site-lisp cp -a misc/ruby-mode.el %{buildroot}%{_datadir}/emacs/site-lisp install -d %{buildroot}%{_sysconfdir}/emacs/site-start.d cat <%{buildroot}%{_sysconfdir}/emacs/site-start.d/%{name}.el (autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t) (add-to-list 'auto-mode-alist '("\\\\.rb$" . ruby-mode)) (add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode)) EOF (cd %{buildroot}%{_docdir}/%{name}-%{version} ; tar xfj %{SOURCE2} ; cd Pro*; mv -f html/* . ; rm -rf html xml) # Make the file/dirs list, filtering out tcl/tk and devel files ( cd %{buildroot} \ && find usr/lib/ruby/%{subver} \ \( -not -type d -printf "/%%p\n" \) \ -or \( -type d -printf "%%%%dir /%%p\n" \) \ ) | egrep -v '/(tcl)?tk|(%{my_target_cpu}-%{_target_os}%{abi}/.*[ha]$)' > %{name}.list # Fix scripts permissions and location find %{buildroot} sample -type f | file -i -f - | grep text | cut -d: -f1 >text.list cat text.list | xargs chmod 0644 # Magic grepping to get only files with '#!' in the first line cat text.list | xargs grep -n '^#!' | grep ':1:#!' | cut -d: -f1 >shebang.list cat shebang.list | xargs sed -i -e 's|/usr/local/bin|/usr/bin|; s|\./ruby|/usr/bin/ruby|' cat shebang.list | xargs chmod 0755 # Install the rpm macros mkdir -p %{buildroot}%{_sysconfdir}/rpm/macros.d cp %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.d %check make test %clean rm -rf %{buildroot} %files -f %{name}.list %dir %{_docdir}/%{name}-%{version} %{_docdir}/%{name}-%{version}/README %{_bindir}/* %dir %{_prefix}/lib/%{name}/ %{_libdir}/libruby.so.* %{_prefix}/lib/%{name}/site_ruby %{_mandir}/*/* %{_datadir}/emacs/site-lisp/* %config(noreplace) %{_sysconfdir}/emacs/site-start.d/* %{_sysconfdir}/rpm/macros.d/%{name}.macros %files doc %{_datadir}/ri %dir %{_docdir}/%{name}-%{version} %{_docdir}/%{name}-%{version}/COPYING* %{_docdir}/%{name}-%{version}/ChangeLog %{_docdir}/%{name}-%{version}/README.* %{_docdir}/%{name}-%{version}/FAQ.html %{_docdir}/%{name}-%{version}/ToDo %{_docdir}/%{name}-%{version}/sample %{_docdir}/%{name}-%{version}/ProgrammingRuby* %files devel %{_prefix}/lib/%{name}/%{subver}/%{my_target_cpu}-%{_target_os}%{abi}/*.[ah] %{_libdir}/libruby-static.a %{_libdir}/libruby.so %files tk %{_prefix}/lib/%{name}/%{subver}/%{my_target_cpu}-%{_target_os}%{abi}/tcltk* %{_prefix}/lib/%{name}/%{subver}/%{my_target_cpu}-%{_target_os}%{abi}/tk* %{_prefix}/lib/%{name}/%{subver}/tcltk* %{_prefix}/lib/%{name}/%{subver}/tk* %{_prefix}/lib/%{name}/%{subver}/test/unit/ui/tk