Skip to content

Instantly share code, notes, and snippets.

@pvalena
Created January 18, 2022 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvalena/d8810f1a66ca1d2b6c23cf6a9305f56d to your computer and use it in GitHub Desktop.
Save pvalena/d8810f1a66ca1d2b6c23cf6a9305f56d to your computer and use it in GitHub Desktop.
--- rubygem-rake-compiler/.generated.spec 2022-01-18 10:51:17.560784471 +0100
+++ rubygem-rake-compiler/rubygem-rake-compiler.spec 2022-01-18 10:39:36.136305102 +0100
@@ -1,86 +1,319 @@
-Downloaded rake-compiler-1.1.8
-# Generated from rake-compiler-1.1.8.gem by gem2rpm -*- rpm-spec -*-
%global gem_name rake-compiler
+%undefine _changelog_trimtime
+
+Summary: Rake-based Ruby C Extension task generator
Name: rubygem-%{gem_name}
Version: 1.1.8
Release: 1%{?dist}
-Summary: Rake-based Ruby Extension (C, Java) task generator
License: MIT
-URL: https://github.com/rake-compiler/rake-compiler
+URL: http://rake-compiler.rubyforge.org/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
+
+Requires: ruby(release)
BuildRequires: ruby(release)
-BuildRequires: rubygems-devel >= 1.8.23
-BuildRequires: ruby >= 1.8.7
-# BuildRequires: rubygem(rspec) >= 2.8.0
-# BuildRequires: rubygem(rspec) < 2.9
-# BuildRequires: rubygem(cucumber) >= 1.1.4
-# BuildRequires: rubygem(cucumber) < 1.2
+BuildRequires: ruby(rubygems) >= 1.3.5
+BuildRequires: rubygems-devel
+# %%check
+BuildRequires: rubygem(rake)
+BuildRequires: rubygem(cucumber)
+BuildRequires: rubygem(rspec) >= 3
+# cucumber test needs ruby.h header and compiler
+BuildRequires: gcc
+BuildRequires: ruby-devel
+Requires: ruby(rubygems) >= 1.3.5
+Requires: rubygem(rake) >= 0.8.3
BuildArch: noarch
+Provides: rubygem(%{gem_name}) = %{version}-%{release}
%description
-Provide a standard and simplified way to build and package
-Ruby extensions (C, Java) using Rake as glue.
+rake-compiler aims to help Gem developers while dealing with
+Ruby C extensions, simplifiying the code and reducing the duplication.
+
+It follows *convention over configuration* and set an standarized
+structure to build and package C extensions in your gems.
+This is the result of expriences dealing with several Gems
+that required native extensions across platforms and different
+user configurations where details like portability and
+clarity of code were lacking.
%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
-BuildArch: noarch
%description doc
-Documentation for %{name}.
+This package contains documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
+mv ../%{gem_name}-%{version}.gemspec .
-%build
-# Create the gem as gem install only works on a gem file
-gem build ../%{gem_name}-%{version}.gemspec
+# rpmlint cosmetic
+find ./lib/rake -name \*.rb | xargs sed -i -e '\@/usr/bin/env@d'
-# %%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
+# Permission
+find . -name \*.rb -print0 | xargs --null chmod 0644
+
+# be_true -> be_truthy, be_false -> be_falsey
+grep -rl be_true features/ | xargs sed -i 's|be_true|be_truthy|'
+grep -rl be_false features/ | xargs sed -i 's|be_false|be_falsey|'
+
+# Don't strip binary for default. Also kill unneeded "-pipe" from LDFLAGS
+sed -i tasks/bin/cross-ruby.rake \
+ -e '\@LDFLAGS=@d'
+
+# Cucumber 7 change
+sed -i cucumber.yml -e "s|~@java|'not @java'|"
+
+%build
+gem build %{gem_name}-%{version}.gemspec
%gem_install
%install
-mkdir -p %{buildroot}%{gem_dir}
-cp -a .%{gem_dir}/* \
- %{buildroot}%{gem_dir}/
-
+rm -rf %{buildroot}
-mkdir -p %{buildroot}%{_bindir}
-cp -a .%{_bindir}/* \
- %{buildroot}%{_bindir}/
+mkdir -p %{buildroot}%{gem_dir}
+cp -a .%{_prefix}/* %{buildroot}%{_prefix}/
-find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
+rm -f %{buildroot}%{gem_cache}
+pushd %{buildroot}%{gem_instdir}
+rm -rf \
+ Gemfile \
+ Rakefile \
+ appveyor.yml \
+ cucumber.yml \
+ features/ \
+ spec/ \
+ tasks/ \
+ tmp/ \
+ %{nil}
+popd
%check
pushd .%{gem_instdir}
-# cucumber
-# rspec spec
+ruby -Ilib -S rspec spec/
+export CUCUMBER_PUBLISH_QUIET=true
+ruby -Ilib -S cucumber
popd
%files
-%dir %{gem_instdir}
%{_bindir}/rake-compiler
+
%license %{gem_instdir}/LICENSE.txt
-%{gem_instdir}/appveyor.yml
-%{gem_instdir}/bin
+
+%dir %{gem_instdir}
+%doc %{gem_instdir}/README.md
+%doc %{gem_instdir}/History.md
+
+%{gem_instdir}/bin/
%{gem_libdir}
-%{gem_instdir}/tasks
-%exclude %{gem_cache}
+
%{gem_spec}
%files doc
-%doc %{gem_docdir}
-%{gem_instdir}/Gemfile
-%doc %{gem_instdir}/History.md
-%doc %{gem_instdir}/README.md
-%{gem_instdir}/Rakefile
-%{gem_instdir}/cucumber.yml
-%{gem_instdir}/features
-%{gem_instdir}/spec
+%{gem_docdir}
+
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment