summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Dreyer <ktdreyer@ktdreyer.com>2013-11-25 19:33:53 -0700
committerKen Dreyer <ktdreyer@ktdreyer.com>2013-11-26 17:25:37 -0700
commit76a8890ab319c03bd79a5f36d033903b23b0147c (patch)
tree1a7a9c31d6772dd4d5c348ced7a6b9b12fce5e61
parent30b9f2f8eca951058f0aa0e4cefc617d4de148f7 (diff)
downloadrubygem-unicorn-76a8890ab319c03bd79a5f36d033903b23b0147c.tar.gz
rubygem-unicorn-76a8890ab319c03bd79a5f36d033903b23b0147c.tar.xz
rubygem-unicorn-76a8890ab319c03bd79a5f36d033903b23b0147c.zip
add EL6 conditionals
This allows the RPM to be built for EL6.
-rw-r--r--rubygem-unicorn.spec43
1 files changed, 40 insertions, 3 deletions
diff --git a/rubygem-unicorn.spec b/rubygem-unicorn.spec
index c809d7e..1434602 100644
--- a/rubygem-unicorn.spec
+++ b/rubygem-unicorn.spec
@@ -27,13 +27,19 @@ Requires: rubygem(rack)
Requires: rubygem(raindrops) >= 0.7
Requires: rubygem(kgio) >= 2.6
BuildRequires: ruby-devel
+%if 0%{?el6}
+BuildRequires: ruby(rubygems)
+%else
BuildRequires: rubygems-devel
+%endif
BuildRequires: rubygem(rack)
BuildRequires: rubygem(raindrops) >= 0.7
BuildRequires: rubygem(kgio) >= 2.6
BuildRequires: rubygem(minitest)
+%if 0%{?fedora} || 0%{?rhel} > 6
BuildRequires: rubygem(isolate)
BuildRequires: ragel
+%endif
ExcludeArch: ppc ppc64
Provides: rubygem(%{gem_name}) = %{version}
@@ -91,7 +97,21 @@ sed -i "3irequire 'rubygems'" bin/unicorn_rails
# Create the gem as gem install only works on a gem file
gem build %{gem_name}.gemspec
+%if 0%{?el6}
+mkdir -p .%{gem_dir}
+export CONFIGURE_ARGS="--with-cflags='%{optflags}' $CONFIGURE_ARGS"
+gem install \
+ -V \
+ --local \
+ --install-dir .%{gem_dir} \
+ --bindir .%{_bindir} \
+ --force \
+ --rdoc \
+ --backtrace \
+ %{gem_name}-%{version}.gem
+%else
%gem_install
+%endif
%install
mkdir -p %{buildroot}%{gem_dir}
@@ -132,18 +152,35 @@ mv %{buildroot}/%{gem_instdir}/man/* %{buildroot}%{_mandir}/
# If there are C extensions, mv them to the extdir.
# You must replace REQUIRE_PATHS according to your gem specifics.
-install -d -m0755 %{buildroot}%{gem_extdir_mri}/lib
-mv %{buildroot}%{gem_instdir}/lib/unicorn_http.so %{buildroot}%{gem_extdir_mri}/lib/
+
+%if 0%{?el6}
+ # %%{gem_extdir_mri} 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
+ install -d -m0755 %{buildroot}%{gem_extdir_mri}/lib
+ # move the extension to gem_extdir_mri
+ mv %{buildroot}%{gem_libdir}/unicorn_http.so %{buildroot}%{gem_extdir_mri}/lib/
+%endif
%check
# Don't use testrb.
# http://rubyforge.org/pipermail/mongrel-unicorn/2012-December/001647.html
pushd .%{gem_instdir}
- make test
+ %if 0%{?el6}
+ # TODO: make tests work on EL6.
+ %else
+ make test
+ %endif
popd
%files
+%if 0%{?el6}
+%{ruby_sitearch}/unicorn_http.so
+%else
%{gem_extdir_mri}/*
+%endif
%dir %{gem_instdir}
%{gem_cache}
%{gem_spec}