]>
Commit | Line | Data |
---|---|---|
1 | <% if ! spec.development_dependencies.empty? -%> | |
2 | # | |
3 | # Conditional build: | |
4 | %bcond_without tests # build without tests | |
5 | ||
6 | <% end -%> | |
7 | %define pkgname <%= spec.name %> | |
8 | Summary: <%= spec.summary %> | |
9 | Name: ruby-%{pkgname} | |
10 | Version: <%= spec.version %> | |
11 | Release: 0.1 | |
12 | License: <%= spec.licenses.empty? ? "GPL v2+ or Ruby" : spec.licenses.join(", ") %> | |
13 | Group: Development/Languages | |
14 | Source0: http://rubygems.org/downloads/%{pkgname}-%{version}.gem | |
15 | # Source0-md5: - | |
16 | URL: <%= spec.homepage %> | |
17 | BuildRequires: rpm-rubyprov | |
18 | BuildRequires: rpmbuild(macros) >= 1.656 | |
19 | <% if ! spec.extensions.empty? -%> | |
20 | BuildRequires: ruby-devel | |
21 | <% end -%> | |
22 | <% if ! spec.executables.empty? -%> | |
23 | BuildRequires: sed >= 4.0 | |
24 | <% end -%> | |
25 | <% if ! spec.development_dependencies.empty? -%> | |
26 | %if %{with tests} | |
27 | <% for d in spec.development_dependencies.sort -%> | |
28 | <% for req in d.requirement -%> | |
29 | BuildRequires: ruby-<%= d.name %> <%= req %> | |
30 | <% end -%> | |
31 | <% end -%> | |
32 | %endif | |
33 | <% end -%> | |
34 | <% if ! spec.required_rubygems_version.empty? and ! spec.required_rubygems_version.first.empty? -%> | |
35 | Requires: ruby-rubygems <%= spec.required_rubygems_version.first %> | |
36 | <% end -%> | |
37 | <% for d in spec.runtime_dependencies.sort -%> | |
38 | <% for req in d.requirement -%> | |
39 | Requires: ruby-<%= d.name %> <%= req %> | |
40 | <% end -%> | |
41 | <% end -%> | |
42 | <% if spec.extensions.empty? -%> | |
43 | BuildArch: noarch | |
44 | <% end -%> | |
45 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
46 | ||
47 | %description | |
48 | <%= spec.description %> | |
49 | ||
50 | %prep | |
51 | %setup -q -n %{pkgname}-%{version} | |
52 | <% if ! spec.executables.empty? -%> | |
53 | %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/* | |
54 | <% end -%> | |
55 | ||
56 | %build | |
57 | # write .gemspec | |
58 | %__gem_helper spec | |
59 | ||
60 | <% if !spec.extensions.empty? -%> | |
61 | cd ext/%{pkgname} | |
62 | %{__ruby} extconf.rb | |
63 | %{__make} \ | |
64 | CC="%{__cc}" \ | |
65 | LDFLAGS="%{rpmldflags}" \ | |
66 | CFLAGS="%{rpmcflags} -fPIC" | |
67 | <% end -%> | |
68 | ||
69 | %install | |
70 | rm -rf $RPM_BUILD_ROOT | |
71 | <% if spec.executables.empty? -%> | |
72 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir}} | |
73 | <% else -%> | |
74 | install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir},%{_bindir}} | |
75 | <% end -%> | |
76 | cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir} | |
77 | <% if ! spec.executables.empty? -%> | |
78 | cp -a bin/* $RPM_BUILD_ROOT%{_bindir} | |
79 | <% end -%> | |
80 | cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir} | |
81 | ||
82 | %clean | |
83 | rm -rf $RPM_BUILD_ROOT | |
84 | ||
85 | %files | |
86 | %defattr(644,root,root,755) | |
87 | <% for f in spec.executables.sort -%> | |
88 | %attr(755,root,root) %{_bindir}/<%= f %> | |
89 | <% end -%> | |
90 | %{ruby_vendorlibdir}/%{pkgname}.rb | |
91 | %{ruby_vendorlibdir}/%{pkgname} | |
92 | %{ruby_specdir}/%{pkgname}-%{version}.gemspec |