Project

General

Profile

« Previous | Next » 

Revision 754c6a83

Added by Evgeni Golov about 4 years ago

rubygem-sassc %check updates and el8 build (#5053)

  • Fix rubygem-sassc

This takes the Fedora RPM spec approach of using the native libsass
instead of the bundled version.

  • make it mostly work
  • delete the rescue so that the log contains the proper error path
  • make the build arch-specific again

otherwise %{_libdir} points at /usr/lib and it can't find libsass.so

  • don't add a require on the .so file directly
  • simplify check

Co-authored-by: Ewoud Kohl van Wijngaarden <>

View differences:

packages/foreman/rubygem-sassc/rubygem-sassc.spec
# template: scl
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}
%{!?_root_libdir:%global _root_libdir %{_libdir}}
%global gem_name sassc
%global gem_require_name %{gem_name}
%define debug_package %{nil}
Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 2.2.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Use libsass with Ruby!
Group: Development/Languages
License: MIT
......
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby-devel >= 2.0.0
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildRequires: %{?scl_prefix}rubygem(ffi) >= 1.9
BuildRequires: %{?scl_prefix}rubygem(ffi) < 2
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
# end specfile generated dependencies
BuildRequires: libsass
Requires: libsass
%description
Use libsass with Ruby!
......
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%{?scl:EOF}
# disable building bundled libsass
sed -i "/s\.extensions/d" %{gem_name}.gemspec
%build
# use libsass.so.0 from host
sed -i "s/libsass\.\#{dl_ext}/libsass\.\#{dl_ext}\.0/" lib/sassc/native.rb
sed -i "/LoadError/,+1d" lib/sassc/native.rb
sed -i "s!__dir__!\"%{_root_libdir}\"!" lib/sassc/native.rb
# Create the gem as gem install only works on a gem file
%{?scl:scl enable %{scl} - << \EOF}
gem build %{gem_name}.gemspec
......
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{gem_extdir_mri}/%{gem_name}
# hack to get the C extension where we expect it to be
cp %{buildroot}/opt/theforeman/tfm/root/usr/share/gems/gems/sassc-%{version}/ext/libsass.so .%{gem_extdir_mri}/
cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri}/
cp -a .%{gem_extdir_mri}/*.so %{buildroot}%{gem_extdir_mri}/%{gem_name}/
# Prevent dangling symlink in -debuginfo (rhbz#878863)
# But this gem fails on it with error
# File not found: /builddir/build/BUILDROOT/tfm-rubygem-sassc-2.2.1-1.el7.x86_64/opt/theforeman/tfm/root/usr/share/gems/gems/sassc-2.2.1/ext.
# rm -rf %{buildroot}%{gem_instdir}/ext/
%check
%{?scl:scl enable %{scl} - << \EOF}
ruby -I "%{buildroot}%{gem_libdir}" -e "require '%{gem_require_name}'"
%{?scl:EOF}
%files
%dir %{gem_instdir}
%exclude %{gem_instdir}/ext
%{gem_extdir_mri}
%exclude %{gem_instdir}/.gitignore
%{gem_instdir}/.gitmodules
%exclude %{gem_instdir}/.gitmodules
%exclude %{gem_instdir}/.travis.yml
%{gem_instdir}/CODE_OF_CONDUCT.md
%license %{gem_instdir}/LICENSE.txt
%{gem_instdir}/ext
%{gem_libdir}
%exclude %{gem_instdir}/ext
%exclude %{gem_cache}
%{gem_spec}
%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/CHANGELOG.md
%doc %{gem_instdir}/CODE_OF_CONDUCT.md
%{gem_instdir}/Gemfile
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
......
%{gem_instdir}/test
%changelog
* Fri Mar 27 2020 Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl> - 2.2.1-2
- Add check section to test native library
* Tue Jan 28 2020 Ondřej Ezr <oezr@redhat.com> 2.2.1-1
- Add rubygem-sassc generated by gem2rpm using the scl template

Also available in: Unified diff