]> git.pld-linux.org Git - projects/template-specs.git/blob - ruby.spec
sample to setup shadow py3 tree
[projects/template-specs.git] / ruby.spec
1
2 # TODO
3 # - any policy what to package in %{ruby_ridir}?
4 #
5 # Conditional build:
6 %bcond_without  tests           # build without tests
7 %bcond_without  doc                     # don't build ri/rdoc
8
9 %define pkgname MODULE_NAME
10 Summary:        -
11 Name:           ruby-%{pkgname}
12 Version:        -
13 Release:        0.1
14 License:        - (enter GPL/GPL v2/GPL v3+/LGPL/MIT/Ruby License/other license name here)
15 #Source0:       http://rubyforge.org/frs/download.php/18699/%{pkgname}-%{version}.tgz
16 Source0:        http://rubygems.org/downloads/%{pkgname}-%{version}.gem
17 # Source0-md5:  -
18 Group:          Development/Languages
19 URL:            http://rubyforge.org/projects/.../
20 BuildRequires:  rpm-rubyprov
21 BuildRequires:  rpmbuild(macros) >= 1.665
22 #BuildRequires: setup.rb
23 # optional locale BR, see ri/rdoc building below
24 #%if %(locale -a | grep -q '^en_US$'; echo $?)
25 #BuildRequires: glibc-localedb-all
26 #%endif
27 %if %{with tests}
28 #BuildRequires: ruby-rspec
29 %endif
30 #BuildArch:     noarch
31 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32
33 %description
34 ...
35
36 %package rdoc
37 Summary:        HTML documentation for %{pkgname}
38 Summary(pl.UTF-8):      Dokumentacja w formacie HTML dla %{pkgname}
39 Group:          Documentation
40 Requires:       ruby >= 1:1.8.7-4
41
42 %description rdoc
43 HTML documentation for %{pkgname}.
44
45 %description rdoc -l pl.UTF-8
46 Dokumentacja w formacie HTML dla %{pkgname}.
47
48 %package ri
49 Summary:        ri documentation for %{pkgname}
50 Summary(pl.UTF-8):      Dokumentacja w formacie ri dla %{pkgname}
51 Group:          Documentation
52 Requires:       ruby
53
54 %description ri
55 ri documentation for %{pkgname}.
56
57 %description ri -l pl.UTF-8
58 Dokumentacji w formacie ri dla %{pkgname}.
59
60 %prep
61 # gem
62 %setup -q -n %{pkgname}-%{version}
63 # tgz
64 #%setup -q -n %{pkgname}-%{version}
65
66 # ext build
67 cp -p %{_datadir}/setup.rb .
68
69 # cleanup backups after patching
70 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
71
72 %build
73 # write .gemspec
74 %__gem_helper spec
75
76 # make gemspec self-contained
77 ruby -r rubygems -e 'spec = eval(File.read("%{pkgname}.gemspec"))
78         File.open("%{pkgname}-%{version}.gemspec", "w") do |file|
79         file.puts spec.to_ruby_for_cache
80 end'
81
82 %if old
83 cp %{_datadir}/setup.rb .
84 %{__ruby} setup.rb config \
85         --rbdir=%{ruby_vendorlibdir} \
86         --sodir=%{ruby_vendorarchdir}
87
88 ruby setup.rb config \
89         --site-ruby=%{ruby_vendorlibdir} \
90         --so-dir=%{ruby_vendorarchdir}
91
92 ruby extconf.rb --vendor --with-pgsql-include=%{_includedir}/pgsql/server
93
94 ruby setup.rb config \
95         --prefix=%{_prefix} \
96         --siterubyver=%{ruby_vendorlibdir} \
97         --siterubyverarch=%{ruby_vendorarchdir} \
98
99 ruby setup.rb config \
100         --prefix=%{_prefix} \
101         --site-ruby=%{ruby_vendorlibdir}
102
103 %{__ruby} install.rb \
104         --sitelibdir=%{ruby_vendorlibdir} \
105
106 %cmake \
107         -DCUSTOM_RUBY_SITE_ARCH_DIR:PATH=%{ruby_vendorarchdir} \
108         -DCUSTOM_RUBY_SITE_LIB_DIR:PATH=%{ruby_vendorlibdir} \
109         ..
110
111 ruby setup.rb setup
112
113 %{__ruby} setup.rb setup
114 %endif
115
116 # binary pkgs:
117 cd ext/%{pkgname}
118 %{__ruby} extconf.rb
119 %{__make} \
120         CC="%{__cc}" \
121         LDFLAGS="%{rpmldflags}" \
122         CFLAGS="%{rpmcflags} -fPIC"
123
124 # with rdoc/ri:
125 # optional locale force, see BR above as well
126 # UTF8 locale needed for doc generation
127 #export LC_ALL=en_US.UTF-8
128
129 rdoc --ri --op ri lib
130 rdoc --op rdoc lib
131 # rm -r ri/NOT_THIS_MODULE_RELATED_DIRS
132 rm ri/created.rid
133
134 %install
135 rm -rf $RPM_BUILD_ROOT
136 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_ridir},%{ruby_rdocdir}}
137 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_ridir},%{ruby_rdocdir},%{_bindir}}
138 %{__ruby} setup.rb install \
139         --prefix=$RPM_BUILD_ROOT
140
141 install -d $RPM_BUILD_ROOT%{ruby_vendorlibdir}
142 cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
143
144 cp -a bin/* $RPM_BUILD_ROOT%{_bindir}
145 cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
146
147 cp -a ri/* $RPM_BUILD_ROOT%{ruby_ridir}
148
149 # install ext
150 install -d $RPM_BUILD_ROOT%{ruby_vendorarchdir}
151 install -p ext/ruby_http_parser/ruby_http_parser.so $RPM_BUILD_ROOT%{ruby_vendorarchdir}
152
153 install -d $RPM_BUILD_ROOT%{ruby_rdocdir}/%{name}-%{version}
154 cp -a rdoc/* $RPM_BUILD_ROOT%{ruby_rdocdir}/%{name}-%{version}
155
156 # install gemspec
157 install -d $RPM_BUILD_ROOT%{ruby_specdir}
158 install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir}}
159 cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir}
160
161 %clean
162 rm -rf $RPM_BUILD_ROOT
163
164 %files
165 %defattr(644,root,root,755)
166 %doc CHANGELOG README
167 %{ruby_vendorlibdir}/%{pkgname}.rb
168 %{ruby_vendorlibdir}/%{pkgname}
169 %attr(755,root,root) %{ruby_vendorarchdir}/%{pkgname}_ext.so
170 %{ruby_specdir}/%{pkgname}-%{version}.gemspec
171
172 %if %{with doc}
173 %files rdoc
174 %defattr(644,root,root,755)
175 %{ruby_rdocdir}/%{name}-%{version}
176
177 %files ri
178 %defattr(644,root,root,755)
179 %{ruby_ridir}/%{pkgname}
180 %endif
This page took 0.061579 seconds and 3 git commands to generate.