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