summaryrefslogtreecommitdiffstats
path: root/rubygem-unicorn.spec
blob: 475549990cc303bb0f0b4163a66be447afb4c8fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Generated from unicorn-4.3.1.gem by gem2rpm -*- rpm-spec -*-
%global gem_name unicorn
%if 0%{?el6}
%global rubyabi 1.8
%else
%global rubyabi 1.9.1
%endif

Summary: Rack HTTP server for fast clients and Unix
Name: rubygem-%{gem_name}
Version: 4.3.1
Release: 1%{?dist}
Group: Development/Languages
License: GPLv2 or GPLv3 or Ruby
URL: http://unicorn.bogomips.org/
Source0: %{gem_name}-%{version}.gem
Patch0: unicorn-4.5.0-teeinput-namespace-conflict.patch
Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems) 
Requires: rubygem(rack) 
Requires: rubygem(kgio) => 2.6
Requires: rubygem(kgio) < 3
Requires: rubygem(raindrops) => 0.7
Requires: rubygem(raindrops) < 1
BuildRequires: ruby(abi) = %{rubyabi}
%if 0%{?el6}
BuildRequires: ruby(rubygems)
%else
BuildRequires: rubygems-devel
%endif
BuildRequires: ruby-devel
BuildRequires: rubygem(rack)
BuildRequires: rubygem(kgio) => 2.6
BuildRequires: rubygem(kgio) < 3
BuildRequires: rubygem(raindrops) => 0.7
BuildRequires: rubygem(raindrops) < 1
BuildRequires: rubygem(minitest)
BuildRequires: rubygem(rails)
Provides: rubygem(%{gem_name}) = %{version}

# macros for RHEL6 compatibility:
%{!?gem_dir: %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)}
%{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}}
%{!?gem_libdir: %global gem_libdir %{gem_instdir}/lib}
%{!?gem_cache: %global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem}
%{!?gem_spec: %global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec}
%{!?gem_docdir: %global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version}}
%{!?gem_extdir: %global gem_extdir %{_libdir}/gems/exts/%{gem_name}-%{version}}
%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]')}

%description
Unicorn is an HTTP server for Rack applications designed to only serve
fast clients on low-latency, high-bandwidth connections and take
advantage of features in Unix/Unix-like kernels.  Slow clients should
only be served by placing a reverse proxy capable of fully buffering
both the the request and response in between Unicorn and slow clients.


%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{name}

%prep
%setup -q -c -T
mkdir -p .%{gem_dir}
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install --local --install-dir .%{gem_dir} \
            --bindir .%{_bindir} \
            -V \
            --force %{SOURCE0}

pushd .%{gem_instdir}
%patch0 -p1
popd

# Fix wrong shebang
sed -i -e '/^#!\//, 1d' .%{gem_instdir}/bin/unicorn
sed -i -e '/^#!\//, 1d' .%{gem_instdir}/bin/unicorn_rails
sed -i -e '1i#!/usr/bin/ruby' .%{gem_instdir}/bin/unicorn
sed -i -e '1i#!/usr/bin/ruby' .%{gem_instdir}/bin/unicorn_rails

# Require rubygems when running tests
sed -i "2irequire 'rubygems'" .%{gem_instdir}/test/test_helper.rb

# Clean up development-only files
rm -f .%{gem_instdir}/.CHANGELOG.old
rm -f .%{gem_instdir}/.document
rm -f .%{gem_instdir}/.gitignore
rm -f .%{gem_instdir}/.mailmap
rm -f .%{gem_instdir}/.manifest
rm -f .%{gem_instdir}/.wrongdoc.yml
rm -f .%{gem_instdir}/local.mk.sample
rm -f .%{gem_instdir}/GIT-VERSION-FILE
rm -f .%{gem_instdir}/GIT-VERSION-GEN
rm -f .%{gem_instdir}/GNUmakefile
rm -f .%{gem_instdir}/setup.rb
find .%{gem_instdir} -name .gitignore -exec rm {} +
find .%{gem_instdir} -name .gitkeep -exec rm {} +
# Remove extra gemspec file
rm -rf .%{gem_instdir}/%{gem_name}.gemspec

# Remove broken test
rm -rf .%{gem_instdir}/test/rails

%build

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/

%if 0%{?el6}
# gem_extdir doesn't really work on EL 6
mkdir -p %{buildroot}%{ruby_sitearch}
# move the extension to ruby_sitearch
mv %{buildroot}%{gem_libdir}/unicorn_http.so %{buildroot}%{ruby_sitearch}
%else
mkdir -p %{buildroot}%{gem_extdir}/lib
# move the extension to gem_extdir
mv %{buildroot}%{gem_libdir}/unicorn_http.so %{buildroot}%{gem_extdir}/lib/
%endif

mkdir -p %{buildroot}%{_bindir}
cp -a .%{_bindir}/* \
        %{buildroot}%{_bindir}/

find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x

# Install man pages in the proper location
mkdir -p %{buildroot}%{_mandir}
mv %{buildroot}/%{gem_instdir}/man/* %{buildroot}%{_mandir}/

# Remove the binary extension sources and build leftovers.
rm -rf %{buildroot}%{gem_instdir}/ext

%check
pushd .%{gem_instdir}
  # Tests don't work if run as a suite. Must run individually.
  %if 0%{?el6}
    # Tests fail on EL 6 or Rails 2.3
  %else
    ruby -Ilib -e "Dir.glob('./test/**/test_*.rb').each {|t| require t}"
  %endif
popd

%files
%dir %{gem_instdir}
%doc %{gem_instdir}/COPYING
%doc %{gem_instdir}/LICENSE
%{_bindir}/unicorn
%{_bindir}/unicorn_rails
%doc %{_mandir}/man1/unicorn.1.gz
%doc %{_mandir}/man1/unicorn_rails.1.gz
%{gem_instdir}/bin
%{gem_libdir}
%if 0%{?el6}
%{ruby_sitearch}/unicorn_http.so
%else
%{gem_extdir}
%endif
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/FAQ
%doc %{gem_instdir}/README
%doc %{gem_instdir}/TUNING
%doc %{gem_instdir}/PHILOSOPHY
%doc %{gem_instdir}/HACKING
%doc %{gem_instdir}/DESIGN
%doc %{gem_instdir}/CONTRIBUTORS
%doc %{gem_instdir}/SIGNALS
%doc %{gem_instdir}/KNOWN_ISSUES
%doc %{gem_instdir}/TODO
%doc %{gem_instdir}/NEWS
%doc %{gem_instdir}/ChangeLog
%doc %{gem_instdir}/LATEST
%doc %{gem_instdir}/ISSUES
%doc %{gem_instdir}/Sandbox
%doc %{gem_instdir}/Links
%doc %{gem_instdir}/Application_Timeouts
%doc %{gem_instdir}/test
%doc %{gem_instdir}/t
%doc %{gem_instdir}/Documentation
%{gem_instdir}/examples
%{gem_instdir}/Rakefile
%{gem_instdir}/script

%changelog
* Tue Feb 19 2013 ktdreyer@ktdreyer.com - 4.3.1-1
- Initial package, created with gem2rpm 0.8.1