Skip to content

Instantly share code, notes, and snippets.

@pvalena
Created September 17, 2021 12:33
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/16e4cbe61aa0fa6a1f1eb6fe33a20872 to your computer and use it in GitHub Desktop.
Save pvalena/16e4cbe61aa0fa6a1f1eb6fe33a20872 to your computer and use it in GitHub Desktop.
--- rubygem-ffi/.generated.spec 2021-09-17 14:21:32.676326673 +0200
+++ rubygem-ffi/rubygem-ffi.spec 2021-09-17 14:01:48.713875457 +0200
@@ -1,30 +1,32 @@
-Downloaded ffi-1.15.4
-# Generated from ffi-1.15.4.gem by gem2rpm -*- rpm-spec -*-
%global gem_name ffi
Name: rubygem-%{gem_name}
Version: 1.15.4
Release: 1%{?dist}
-Summary: Ruby FFI
-License: BSD-3-Clause
+Summary: FFI Extensions for Ruby
+License: BSD
URL: https://github.com/ffi/ffi/wiki
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
+# git clone https://github.com/ffi/ffi.git --no-checkout
+# cd ffi && git archive -v -o ffi-1.15.4-spec.txz v1.15.4 spec/
+Source1: %{gem_name}-%{version}-spec.txz
+BuildRequires: make
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
-BuildRequires: ruby-devel >= 2.3
+BuildRequires: ruby-devel
# Compiler is required for build of gem binary extension.
# https://fedoraproject.org/wiki/Packaging:C_and_C++#BuildRequires_and_Requires
BuildRequires: gcc
-# BuildRequires: rubygem(rake-compiler) >= 1.0
-# BuildRequires: rubygem(rake-compiler) < 2
-# BuildRequires: rubygem(rake-compiler-dock) >= 1.0
-# BuildRequires: rubygem(rake-compiler-dock) < 2
-# BuildRequires: rubygem(rspec) >= 2.14.1
-# BuildRequires: rubygem(rspec) < 2.15
+BuildRequires: libffi-devel
+BuildRequires: rubygem(rspec) >= 3
+BuildRequires: rubygem(bigdecimal)
%description
-Ruby FFI library.
-
+Ruby-FFI is a ruby extension for programmatically loading dynamic
+libraries, binding functions within them, and calling those functions
+from Ruby code. Moreover, a Ruby-FFI extension works without changes
+on Ruby and JRuby. Discover why should you write your next extension
+using Ruby-FFI here[http://wiki.github.com/ffi/ffi/why-use-ffi].
%package doc
Summary: Documentation for %{name}
@@ -35,14 +37,11 @@
Documentation for %{name}.
%prep
-%setup -q -n %{gem_name}-%{version}
+%setup -q -n %{gem_name}-%{version} -b 1
%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec
-
-# %%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
@@ -59,18 +58,31 @@
%check
pushd .%{gem_instdir}
-# rspec spec
+ln -s %{_builddir}/spec spec
+
+# Build the test library with Fedora build options.
+pushd spec/ffi/fixtures
+make JFLAGS="%{optflags}"
+popd
+
+# Previously disabled long double test fails on i686.
+# https://github.com/ffi/ffi/issues/849
+%ifarch i686
+sed -i '/it "add two long double numbers" do/a\
+ skip' spec/ffi/long_double_spec.rb
+%endif
+
+RUBYOPT="-I$(dirs +1)%{gem_extdir_mri}" rspec spec
popd
%files
%dir %{gem_instdir}
%{gem_extdir_mri}
+%exclude %{gem_instdir}/.*
%license %{gem_instdir}/COPYING
%license %{gem_instdir}/LICENSE
%license %{gem_instdir}/LICENSE.SPECS
%{gem_libdir}
-%{gem_instdir}/rakelib
-%{gem_instdir}/samples
%exclude %{gem_cache}
%{gem_spec}
@@ -80,8 +92,165 @@
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
+%{gem_instdir}/samples
%{gem_instdir}/ffi.gemspec
+%{gem_instdir}/rakelib/ffi_gem_helper.rb
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment