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

Name: rubygem-%{gem_name}
Version: 1.2.1
Release: 5%{?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
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby-devel
BuildRequires: rubygem(rspec)

# 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: bundled(libev) = 4.22

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


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

%description doc
Documentation for %{name}.

%prep
gem unpack %{SOURCE0}

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

gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec

%build
# 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
# http://pkgs.fedoraproject.org/cgit/rpms/rubygems.git/tree/macros.rubygems
%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

%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.
rspec -I$(dirs +1)%{gem_extdir_mri} spec
popd

%files
%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
* Tue Feb 21 2017 Jun Aruga <jaruga@redhat.com> - 1.2.1-5
- Add flag to avoid warnings from strict-aliasing optimization.

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Jan 12 2017 Vít Ondruch <vondruch@redhat.com> - 1.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Ruby_2.4

* 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