From Fedora Project Wiki
A .spec
could look like:
%global ruby_libname packagingtest Name: ruby-%{ruby_libname} Version: 0.1 Release: 1%{?dist} Summary: Packaging test for Ruby Group: Development/Tools License: GPLv2+ URL: http://www.example.org BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Source0: packagingtest.txt.tar.gz %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo " %package -n ruby-${ruby_version}-%{ruby_libname} BuildRequires: ruby-${ruby_version} # or, BuildRequires: ruby(abi) = ${ruby_version} Requires: ruby(abi) = ${ruby_version} Summary: Ruby ${ruby_version} version of this package %description -n ruby-${ruby_version}-%{ruby_libname} Some description for the Ruby ${ruby_version} version of this package "; done) %description Some description for the Ruby library %prep %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo " %setup -q -c -n ruby-${ruby_version}-%{ruby_libname} "; done) %build cd %{_builddir} function buildit() { %configure --with-ruby=ruby-$1 } %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo " pushd ruby-${ruby_version}-%{ruby_libname} buildit ${ruby_version} make %{?_smp_mflags} popd "; done) %install rm -rf %{buildroot} %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo " pushd ./${ruby_version} make install DESTDIR=%{buildroot} "; done) %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc %changelog * Sun Jul 27 2010 Jeroen van Meeuwen <kanarip@fedoraproject.org> - 0.1-1 - Do some foo