File rubygem-rice.spec of Package rubygem-rice

#
# spec file for package rubygem-rice
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           rubygem-rice
Version:        1.7.0
Release:        0
%define mod_name rice
%define mod_full_name %{mod_name}-%{version}
%define myarch %{_target_cpu}
%ifarch %ix86
%define myarch x86
%endif
%ifarch ppc
%define myarch powerpc
%endif
%ifarch ppc64
%define myarch powerpc64
%endif
%ifarch ppc64le
%define myarch powerpc64le
%endif

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gettext-devel
BuildRequires:  ruby-devel
BuildRequires:  ruby-macros >= 1
Url:            http://opensuse.org
Source:         http://rubygems.org/gems/%{mod_full_name}.gem
Source1:        %{mod_name}-rpmlintrc
Summary:        Your swiss army knife for executing external commands in Ruby safely
License:        MIT
Group:          Development/Languages/Ruby

%description
Your swiss army knife for executing external commands in Ruby safely and
conveniently.

%package doc
Summary:        RDoc documentation for %{mod_name}
Group:          Development/Languages/Ruby
Requires:       %{name} = %{version}

%description doc
Documentation generated at gem installation time.
Usually in RDoc and RI formats.

%prep
%gem_unpack

%build
%gem_build

%install
touch meta.files
touch meta.dirs

%gem_install -f
rm -rf %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/autom4te.cache
mkdir -p %{buildroot}%{_docdir}/%{name}

pushd %{buildroot}

# Lookup metadata files
for check in page-gem_build_complete.ri page-gem_make_out.ri gem.build_complete gem_make.out;do
  for file in $(find -name $check);do
    item=$(echo $file | cut -f2- -d.)
    echo $item >> meta.files
    echo %dir $(dirname $item) >> meta.dirs
  done || true
done

# Fix RICE_PREFIX to not point to buildroot
for file in $(find -name mkmf-rice.rb);do
  sed -i -e 's@%{buildroot}@@g' $file
done

popd

if test -e %{buildroot}/meta.files;then
  mv %{buildroot}/meta.files meta.files
  cat %{buildroot}/meta.dirs | sort | uniq >> meta.files
  test -d "%{buildroot}/%{_libdir}/ruby/gems/%{rb_ver}/doc/extensions/%{myarch}-linux/%{rb_ver}" && echo "%dir %{_libdir}/ruby/gems/%{rb_ver}/doc/extensions/%{myarch}-linux/%{rb_ver}" >> meta.files
  rm -f %{buildroot}/meta.dirs
fi

%fdupes -s %{buildroot}

%files -f meta.files
%defattr(-,root,root,-)
%{_docdir}/%{name}
%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem
%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/
%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec

%files doc
%defattr(-,root,root,-)
%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/

%changelog
openSUSE Build Service is sponsored by