Ruby SIG:Draft Package Guidelines/Example Ruby Macros File

From FedoraProject

Jump to: navigation, search
# General Ruby package locations

%rubyabi %(%{_bindir}/ruby -r rbconfig -e 'puts RUBY_VERSION')
%rubyapi %(%{_bindir}/ruby -r rbconfig -e 'puts RUBY_VERSION')

%rubyabi_mm %(echo %rubyabi | awk -F'.' '{print $1 "." $2}')
%rubyapi_mm %(echo %rubyapi | awk -F'.' '{print $1 "." $2}')

# This is the local lib/arch and should not be used for packaging
%ruby_sitelib %{_prefix}/local/share/ruby/
%ruby_sitearch %{_prefix}/local/%{_lib}/ruby/

# ruby extconf.rb is tricky, as it requires an environment variable
# CONFIGURE_ARGS to include --vendor for everything to end up in the
# correct directory
%_ruby_extconf \
    export CONFIGURE_ARGS="--vendor" \
    %{_bindir}/ruby extconf.rb

##
## Multi-version package macro
##

%ruby_multiver_package %(for ruby_version in %{ruby_versions}; do \
echo "\
\
%package -n ruby-${ruby_version}-%{ruby_libname} \
BuildRequires:  ruby-${ruby_version} \
BuildRequires:  ruby(abi) = ${ruby_version} \
Requires:       ruby(abi) = ${ruby_version} \
Summary:        Ruby ${ruby_version} version for package %{name} \
\
%description -n ruby-${ruby_version}-%{ruby_libname} \
This is the ${ruby_version} Ruby version package for %{name} \
\
"; done)

##
## Multi-version setup macro
##

%ruby_multiver_setup %(for ruby_version in %{ruby_versions}; do \
echo "\
\
%setup -q -c -n ruby-${ruby_version}-%{ruby_libname} \
\
"; done)

##
## Multi-version build macro
##

%ruby_multiver_build %(echo "\
\
for ruby_version in %{ruby_versions}; do \
pushd ruby-\\${ruby_version}-%{ruby_libname} \
build_rubyver \\${ruby_version} \
make %{?_smp_mflags} \
popd \
\
done \
")

# This is the general location for libs/archs compatible with all
# or most of the Ruby versions available in the Fedora repositories
%ruby_vendorlib %{_datadir}/ruby/
%ruby_vendorarch %{_libdir}/ruby/

# This are more specific
%ruby_sitelib_192 %{_prefix}/local/share/ruby/1.9.2/
%ruby_sitelib_191 %{_prefix}/local/share/ruby/1.9.1/
%ruby_sitelib_19 %{_prefix}/local/share/ruby/1.9/

%ruby_sitelib_187 %{_prefix}/local/share/ruby/1.8.7/
%ruby_sitelib_186 %{_prefix}/local/share/ruby/1.8.6/
%ruby_sitelib_185 %{_prefix}/local/share/ruby/1.8.5/
%ruby_sitelib_18 %{_prefix}/local/share/ruby/1.8/

%ruby_sitearch_192 %{_prefix}/local/%{_lib}/ruby/1.9.2/
%ruby_sitearch_191 %{_prefix}/local/%{_lib}/ruby/1.9.1/
%ruby_sitearch_19 %{_prefix}/local/%{_lib}/ruby/1.9/

%ruby_sitearch_187 %{_prefix}/local/%{_lib}/ruby/1.8.7/
%ruby_sitearch_186 %{_prefix}/local/%{_lib}/ruby/1.8.6/
%ruby_sitearch_185 %{_prefix}/local/%{_lib}/ruby/1.8.5/
%ruby_sitearch_18 %{_prefix}/local/%{_lib}/ruby/1.8/

%ruby_vendorlib_192 %{_datadir}/ruby/1.9.2/
%ruby_vendorlib_191 %{_datadir}/ruby/1.9.1/
%ruby_vendorlib_19 %{_datadir}/ruby/1.9/

%ruby_vendorlib_187 %{_datadir}/ruby/1.8.7/
%ruby_vendorlib_186 %{_datadir}/ruby/1.8.6/
%ruby_vendorlib_185 %{_datadir}/ruby/1.8.5/
%ruby_vendorlib_18 %{_datadir}/ruby/1.8/

%ruby_vendorarch_192 %{_libdir}/ruby/1.9.2/
%ruby_vendorarch_191 %{_libdir}/ruby/1.9.1/
%ruby_vendorarch_19 %{_libdir}/ruby/1.9/

%ruby_vendorarch_187 %{_libdir}/ruby/1.8.7/
%ruby_vendorarch_186 %{_libdir}/ruby/1.8.6/
%ruby_vendorarch_185 %{_libdir}/ruby/1.8.5/
%ruby_vendorarch_18 %{_libdir}/ruby/1.8/