ruby/ruby.macros
Stephan Kulow 96685ceb06 Accepting request 127027 from home:coolo:branches:openSUSE:Factory
- Provide the following new RPM macros:
  + %gem_unpack
  + %gem_build
  + %gem_install (retaining the old behavior)

- add automatic provides and requires for rubygems

OBS-URL: https://build.opensuse.org/request/show/127027
OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=32
2012-07-04 05:08:42 +00:00

71 lines
1.9 KiB
Plaintext

%gem_install %{gem19_install}
%rubygems_requires %{rubygems19_requires}
%rb_binary %{rb19_binary}
%gem_binary /usr/bin/gem
%rb_arch %{rb19_arch}
%rb_ver %{rb19_ver}
%rb_dir %{rb19_dir}
%rb_libdir %{rb19_libdir}
%rb_archdir %{rb19_archdir}
%rb_sitedir %rb19_sitedir
%rb_sitelibdir %rb19_sitelibdir
%rb_sitearchdir %rb19_sitearchdir
%rb_vendordir %rb19_vendordir
%rb_vendorlibdir %rb19_vendorlibdir
%rb_vendorarchdir %rb19_vendorarchdir
# old names
%rb_sitelib %rb19_sitelibdir
%rb_sitearch %rb19_sitearchdir
#
%rb_vendorlib %rb19_vendorlibdir
%rb_vendorarch %rb19_vendorarchdir
# %%gem_unpack macro unpacks a gem file into %%{_builddir}
#
# example:
# %prep
# %gem_unpack %{SOURCE0}
# %patch1 -p1
#
%gem_unpack() \
if [ %# -eq 0 ]; then \
%{gem_binary} unpack --verbose %{SOURCE0} \
else \
%{gem_binary} unpack --verbose %1 \
fi \
cd %{mod_name}-%{version} \
%{nil}
# %%gem_build macro ...
#
%gem_build() \
GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name "*.gemspec" | xargs dirname` \
cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose *.gemspec \
%{nil}
# %%gem_install macro ...
#
# When invoked with a single parameter, the macro retains the old macro behavior, i.e.
# building the upstream gem directly in $RPM_BUILD_ROOT without unpacking to %{_builddir} first.
#
%gem_install() \
if [ %# -eq 1 ]; then \
%{gem_binary} install --verbose --local --build-root=%{buildroot} \
else \
GEM_FILE=`find . -maxdepth 2 -type f -name "%{mod_name}-%{version}.gem"` \
%{gem_binary} install --verbose --local --bindir %{buildroot}%{_bindir} --install-dir %{buildroot}%{_libdir}/ruby/gems/%{rb_ver} $GEM_FILE \
fi \
%{nil}
%gem_cleanup() \
/usr/bin/gem_build_cleanup %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \
%{nil}