Blob Blame History Raw
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

# Generated from nio4r-1.2.1.gem by gem2rpm -*- rpm-spec -*-
%global gem_name nio4r

Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 1.2.1
Release: 3%{?dist}
Summary: New IO for Ruby
Group: Development/Languages
# The entire source code is MIT, bundled libev is BSD or GPLv2+
License: MIT and (BSD or GPLv2+)
URL: https://github.com/celluloid/nio4r
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem

Requires: %{?scl_prefix_ruby}ruby(release)
Requires: %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: %{?scl_prefix_ruby}ruby-devel
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildRequires: %{?scl_prefix}rubygem(rspec)
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}

# Explicitly require runtime subpackage, as long as older scl-utils do not generate it
%{?scl:Requires: %{?scl_prefix}runtime}

# As bundled libev ev.c is modified from original one,
# we have to use the bundled libev instead of separating it and
# using system libev.
# See below commits.
# Release the GIL when libev polls
# https://github.com/celluloid/nio4r/commit/6801433
# A more productive message re: GVL
# https://github.com/celluloid/nio4r/commit/fba5c68
Provides: %{?scl_prefix}bundled(libev) = 4.22

%description
NIO provides a high performance selector API for monitoring IO objects


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

%description doc
Documentation for %{pkg_name}.

%prep
%{?scl:scl enable %{scl} - << \EOF}
set -e
gem unpack %{SOURCE0}

%setup -q -D -T -n  %{gem_name}-%{version}

gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%{?scl:EOF}

%build
%{?scl:scl enable %{scl} - << \EOF}
set -e
# Create the gem as gem install only works on a gem file
gem build %{gem_name}.gemspec

# Update %%optflags used in %%gem_install to avoid strict-aliasing warnings.
# https://github.com/socketry/nio4r/pull/130
%global optflags %{?optflags} -fno-strict-aliasing

# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install
%{?scl:EOF}

%install

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

mkdir -p %{buildroot}%{gem_extdir_mri}
cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/

# Prevent dangling symlink in -debuginfo (rhbz#878863).
rm -rf %{buildroot}%{gem_instdir}/ext/

# Remove useless shebang.
# https://github.com/celluloid/nio4r/pull/86
sed -i 's|^#!/usr/bin/env rake$||' %{buildroot}%{gem_instdir}/Rakefile

# Add executable bits to the file with shebang.
# https://github.com/celluloid/nio4r/pull/85
chmod 755 %{buildroot}%{gem_instdir}/examples/echo_server.rb


# Run the test suite
%check
pushd .%{gem_instdir}
# Ignore code coverage and bundler.
sed -i '/require "coveralls"/ s/^/#/' spec/spec_helper.rb
sed -i '/Coveralls.wear!/ s/^/#/' spec/spec_helper.rb
sed -i '/require "bundler\/setup"/ s/^/#/' spec/spec_helper.rb
# Load nio4r_ext.so.
export RUBYOPT="-I$(dirs +1)%{gem_extdir_mri}"
%{?scl:scl enable %{scl} - << \EOF}
rspec spec
%{?scl:EOF}
popd

%files
# There is no %%license macro on RHEL6.
# https://bugzilla.redhat.com/show_bug.cgi?id=1386246
%{!?_licensedir:%global license %%doc}

%dir %{gem_instdir}
%{gem_extdir_mri}
%exclude %{gem_instdir}/.*
%license %{gem_instdir}/LICENSE.txt
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/README.md
%doc %{gem_instdir}/CHANGES.md
%{gem_instdir}/logo.png
%{gem_instdir}/tasks
%{gem_instdir}/Rakefile
%{gem_instdir}/examples
%{gem_instdir}/nio4r.gemspec
%{gem_instdir}/spec

%changelog
* Wed Feb 22 2017 Jun Aruga <jaruga@redhat.com> - 1.2.1-3
- Add flag to avoid warnings from strict-aliasing optimization.

* Thu Jun 30 2016 Jun Aruga <jaruga@redhat.com> - 1.2.1-2
- Swap the description and summary

* Tue Jun 28 2016 Jun Aruga <jaruga@redhat.com> - 1.2.1-1
- Initial package