1 |
%define subver 1.8 |
2 |
%define rubyver 1.8.7 |
3 |
%define patchversion p357 |
4 |
%define rel 1 |
5 |
|
6 |
Summary: Object Oriented Script Language |
7 |
Name: ruby |
8 |
Version: %{rubyver}.%{patchversion} |
9 |
Release: %mkrel %rel |
10 |
License: Ruby or GPLv2 |
11 |
Group: Development/Ruby |
12 |
BuildRequires: autoconf |
13 |
BuildRequires: byacc |
14 |
BuildRequires: ncurses-devel |
15 |
BuildRequires: readline-devel |
16 |
BuildRequires: tcl-devel tk-devel |
17 |
BuildRequires: db4-devel |
18 |
BuildRequires: libgdbm-devel >= 1.8.3 |
19 |
BuildRequires: openssl-devel |
20 |
BuildRequires: zlib-devel |
21 |
Obsoletes: ruby-rexml |
22 |
Provides: ruby-rexml |
23 |
# explicit file provides (since such requires are automatically added by find-requires) |
24 |
Provides: /usr/bin/ruby |
25 |
Provides: ruby(abi) = %subver |
26 |
|
27 |
Source0: ftp://ftp.ruby-lang.org/pub/ruby/%{subver}/ruby-%{rubyver}-%{patchversion}.tar.bz2 |
28 |
Source1: http://www.rubycentral.com/faq/rubyfaqall.html.bz2 |
29 |
Source2: http://dev.rubycentral.com/downloads/files/ProgrammingRuby-0.4.tar.bz2 |
30 |
Source3: ruby.macros |
31 |
Patch0: ruby-lib64.patch |
32 |
Patch1: ruby-do-not-use-system-ruby-to-generate-ri-doc.patch |
33 |
Patch2: ruby-add-old-os-to-search-path.patch |
34 |
Patch3: ruby-do_not_propagate_no-undefined.patch |
35 |
Patch4: 110703_CVE-2011-0188.patch |
36 |
URL: http://www.ruby-lang.org/ |
37 |
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root |
38 |
|
39 |
%define my_target_cpu %{_target_cpu} |
40 |
%ifarch ppc |
41 |
%define my_target_cpu powerpc |
42 |
%endif |
43 |
%ifarch ppc64 |
44 |
%define my_target_cpu powerpc64 |
45 |
%endif |
46 |
%ifarch amd64 |
47 |
%define my_target_cpu x86_64 |
48 |
%endif |
49 |
|
50 |
# we're building for eabi |
51 |
%ifarch %arm |
52 |
%define abi -eabi |
53 |
%else |
54 |
%define abi %{nil} |
55 |
%endif |
56 |
|
57 |
%package doc |
58 |
Summary: Documentation for the powerful language Ruby |
59 |
Group: Development/Ruby |
60 |
|
61 |
%package devel |
62 |
Summary: Development file for the powerful language Ruby |
63 |
Group: Development/Ruby |
64 |
Requires: %{name} = %{version} |
65 |
|
66 |
%package tk |
67 |
Summary: Tk extension for the powerful language Ruby |
68 |
Group: Development/Ruby |
69 |
Requires: %{name} = %{version} |
70 |
|
71 |
%description |
72 |
Ruby is the interpreted scripting language for quick and |
73 |
easy object-oriented programming. It has many features to |
74 |
process text files and to do system management tasks (as in |
75 |
Perl). It is simple, straight-forward, and extensible. |
76 |
|
77 |
%description doc |
78 |
Ruby is the interpreted scripting language for quick and |
79 |
easy object-oriented programming. It has many features to |
80 |
process text files and to do system management tasks (as in |
81 |
Perl). It is simple, straight-forward, and extensible. |
82 |
|
83 |
This package contains the Ruby's documentation |
84 |
|
85 |
%description devel |
86 |
Ruby is the interpreted scripting language for quick and |
87 |
easy object-oriented programming. It has many features to |
88 |
process text files and to do system management tasks (as in |
89 |
Perl). It is simple, straight-forward, and extensible. |
90 |
|
91 |
This package contains the Ruby's devel files. |
92 |
|
93 |
%description tk |
94 |
Ruby is the interpreted scripting language for quick and |
95 |
easy object-oriented programming. It has many features to |
96 |
process text files and to do system management tasks (as in |
97 |
Perl). It is simple, straight-forward, and extensible. |
98 |
|
99 |
This package contains the Tk extension for Ruby. |
100 |
|
101 |
%prep |
102 |
%setup -q -n ruby-%{rubyver}-%{patchversion} |
103 |
%patch0 -p0 -b .lib64 |
104 |
%patch1 -p0 -b .ri |
105 |
%patch2 -p2 -b .old |
106 |
%patch3 -p2 -b .undefined |
107 |
%patch4 -p1 -b .CVE-2011-0188 |
108 |
|
109 |
autoreconf |
110 |
|
111 |
%build |
112 |
echo '.text' | gcc -shared -o libdummy.so.0 -xassembler - -ltcl -ltk >& /dev/null && { |
113 |
if %{_bindir}/ldd libdummy.so.0 | grep -q "lib\(tcl\|tk\).so"; then |
114 |
echo "Your tcl/tk is broken, get one with versioning in the libraries." |
115 |
exit 1 |
116 |
fi |
117 |
rm -f libdummy.so.0 |
118 |
} |
119 |
|
120 |
CFLAGS=`echo %optflags | sed 's/-fomit-frame-pointer//'` |
121 |
%configure2_5x --enable-shared --disable-rpath --enable-pthread \ |
122 |
--with-sitedir=%_prefix/lib/ruby/site_ruby \ |
123 |
--with-vendordir=%_prefix/lib/ruby/vendor_ruby \ |
124 |
--with-old-os=linux-gnu |
125 |
|
126 |
%make |
127 |
|
128 |
|
129 |
%install |
130 |
rm -rf %buildroot |
131 |
%makeinstall_std install-doc |
132 |
|
133 |
install -d %buildroot%{_docdir}/%{name}-%{version} |
134 |
cp -a COPYING* ChangeLog README* ToDo sample %buildroot%{_docdir}/%{name}-%{version} |
135 |
bzcat %{SOURCE1} > %buildroot%{_docdir}/%{name}-%{version}/FAQ.html |
136 |
|
137 |
install -d %buildroot%{_datadir}/emacs/site-lisp |
138 |
cp -a misc/ruby-mode.el %buildroot%{_datadir}/emacs/site-lisp |
139 |
|
140 |
install -d %buildroot%{_sysconfdir}/emacs/site-start.d |
141 |
cat <<EOF >%buildroot%{_sysconfdir}/emacs/site-start.d/%{name}.el |
142 |
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t) |
143 |
(add-to-list 'auto-mode-alist '("\\\\.rb$" . ruby-mode)) |
144 |
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode)) |
145 |
EOF |
146 |
|
147 |
(cd %buildroot%{_docdir}/%{name}-%{version} ; tar xfj %{SOURCE2} ; cd Pro*; mv -f html/* . ; rm -rf html xml) |
148 |
|
149 |
# Make the file/dirs list, filtering out tcl/tk and devel files |
150 |
( cd %buildroot \ |
151 |
&& find usr/lib/ruby/%{subver} \ |
152 |
\( -not -type d -printf "/%%p\n" \) \ |
153 |
-or \( -type d -printf "%%%%dir /%%p\n" \) \ |
154 |
) | egrep -v '/(tcl)?tk|(%{my_target_cpu}-%{_target_os}%{abi}/.*[ha]$)' > %{name}.list |
155 |
|
156 |
# Fix scripts permissions and location |
157 |
find %buildroot sample -type f | file -i -f - | grep text | cut -d: -f1 >text.list |
158 |
cat text.list | xargs chmod 0644 |
159 |
# Magic grepping to get only files with '#!' in the first line |
160 |
cat text.list | xargs grep -n '^#!' | grep ':1:#!' | cut -d: -f1 >shebang.list |
161 |
cat shebang.list | xargs sed -i -e 's|/usr/local/bin|/usr/bin|; s|\./ruby|/usr/bin/ruby|' |
162 |
cat shebang.list | xargs chmod 0755 |
163 |
|
164 |
|
165 |
# Install the rpm macros |
166 |
mkdir -p %buildroot%{_sysconfdir}/rpm/macros.d |
167 |
cp %{SOURCE3} %buildroot%{_sysconfdir}/rpm/macros.d |
168 |
%check |
169 |
make test |
170 |
|
171 |
%clean |
172 |
rm -rf %buildroot |
173 |
|
174 |
%files -f %{name}.list |
175 |
%defattr(-, root, root) |
176 |
%dir %{_docdir}/%{name}-%{version} |
177 |
%{_docdir}/%{name}-%{version}/README |
178 |
%{_bindir}/* |
179 |
%dir %{_prefix}/lib/%{name}/ |
180 |
%{_libdir}/libruby.so.* |
181 |
%{_prefix}/lib/%{name}/site_ruby |
182 |
%{_mandir}/*/* |
183 |
%{_datadir}/emacs/site-lisp/* |
184 |
%config(noreplace) %{_sysconfdir}/emacs/site-start.d/* |
185 |
%{_sysconfdir}/rpm/macros.d/%{name}.macros |
186 |
|
187 |
%files doc |
188 |
%defattr(-, root, root) |
189 |
%{_datadir}/ri |
190 |
%dir %{_docdir}/%{name}-%{version} |
191 |
%{_docdir}/%{name}-%{version}/COPYING* |
192 |
%{_docdir}/%{name}-%{version}/ChangeLog |
193 |
%{_docdir}/%{name}-%{version}/README.* |
194 |
%{_docdir}/%{name}-%{version}/FAQ.html |
195 |
%{_docdir}/%{name}-%{version}/ToDo |
196 |
%{_docdir}/%{name}-%{version}/sample |
197 |
%{_docdir}/%{name}-%{version}/ProgrammingRuby* |
198 |
|
199 |
%files devel |
200 |
%defattr(-, root, root) |
201 |
%{_prefix}/lib/%{name}/%{subver}/%{my_target_cpu}-%{_target_os}%{abi}/*.[ah] |
202 |
%{_libdir}/libruby-static.a |
203 |
%{_libdir}/libruby.so |
204 |
|
205 |
%files tk |
206 |
%defattr(-, root, root) |
207 |
%{_prefix}/lib/%{name}/%{subver}/%{my_target_cpu}-%{_target_os}%{abi}/tcltk* |
208 |
%{_prefix}/lib/%{name}/%{subver}/%{my_target_cpu}-%{_target_os}%{abi}/tk* |
209 |
%{_prefix}/lib/%{name}/%{subver}/tcltk* |
210 |
%{_prefix}/lib/%{name}/%{subver}/tk* |
211 |
%{_prefix}/lib/%{name}/%{subver}/test/unit/ui/tk |
212 |
|
213 |
|
214 |
|