From Fedora Project Wiki
m (Created page with 'A <code>.spec</code> could look like: %global ruby_libname packagingtest Name: ruby-%{ruby_libname} Version: 0.1 Release: 1%{?dist} Summary: ...')
 
mNo edit summary
 
Line 2: Line 2:


  %global ruby_libname packagingtest
  %global ruby_libname packagingtest
# In case you choose some of the system wide macros
%global ruby_versions 1.8.6 1.8.7 1.9.1
   
   
  Name:          ruby-%{ruby_libname}
  Name:          ruby-%{ruby_libname}
Line 14: Line 16:
  Source0:        packagingtest.txt.tar.gz
  Source0:        packagingtest.txt.tar.gz
   
   
# Either execute some custom sequence similar to the following:
  %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo "
  %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo "
   
   
Line 29: Line 32:
  "; done)
  "; done)
   
   
# or, use a system wide macro:
%ruby_multiver_package
  %description
  %description
  Some description for the Ruby library
  Some description for the Ruby library
   
   
  %prep
  %prep
# Again, either execute some custom sequence similar to the following:
  %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo "
  %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo "
   
   
Line 38: Line 45:
   
   
  "; done)
  "; done)
# or use a system wide macro:
%ruby_multiver_setup
   
   
  %build
  %build
  cd %{_builddir}
  cd %{_builddir}
   
   
# This function needs to be in the .spec as expansion results in
# things going FUBAR.
  function buildit() {
  function buildit() {
  %configure --with-ruby=ruby-$1
  %configure --with-ruby=ruby-$1
  }
  }
   
   
# Again either use something customizable
  %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo "
  %(for ruby_version in 1.8.6 1.8.7 1.9.1; do echo "
  pushd ruby-${ruby_version}-%{ruby_libname}
  pushd ruby-${ruby_version}-%{ruby_libname}
Line 53: Line 66:
   
   
  "; done)
  "; done)
# or use a system wide macro:
%ruby_multiver_build
   
   
  %install
  %install

Latest revision as of 13:53, 27 June 2010

A .spec could look like:

%global ruby_libname packagingtest
# In case you choose some of the system wide macros
%global ruby_versions 1.8.6 1.8.7 1.9.1

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

# Either execute some custom sequence similar to the following:
%(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)

# or, use a system wide macro:
%ruby_multiver_package
%description
Some description for the Ruby library

%prep
# Again, either execute some custom sequence similar to the following:
%(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)

# or use a system wide macro:
%ruby_multiver_setup

%build
cd %{_builddir}

# This function needs to be in the .spec as expansion results in
# things going FUBAR.
function buildit() {
%configure --with-ruby=ruby-$1
}

# Again either use something customizable
%(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)

# or use a system wide macro:
%ruby_multiver_build

%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