--- ruby-postgres.spec.nodsc 2012-06-05 09:10:39.579420732 +0200 +++ ruby-postgres.spec 2012-06-05 09:27:29.960542186 +0200 @@ -1,6 +1,12 @@ +# Sets %%pkg_name to 'ruby-postgres' if we build for scl. +%{?scl:%scl_package ruby-postgres} +# If we don't build for scl, then pkg_name is empty. +# This way, we can always use %%pkg_name for 'ruby-postgres', be it scl build or not. +%{!?scl:%global pkg_name ruby-postgres} +# %%{name} then references to either 'ruby-postgres' (not in scl) or '%%{?scl:%scl_prefix}ruby-postgres' (in scl). %{!?ruby_sitearch: %define ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")} -Name: ruby-postgres +Name: %{?scl_prefix}ruby-postgres Version: 0.7.9 Release: 2010.01.28.2%{?dist} Summary: A Ruby interface for the PostgreSQL database engine @@ -9,8 +15,7 @@ Group: Development/Languages # terms as ruby. License: Ruby URL: http://bitbucket.org/ged/ruby-pg/ -Source: http://bitbucket.org/ged/ruby-pg/downloads/%{name}-%{version}.2008.01.28.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n) +Source: http://bitbucket.org/ged/ruby-pg/downloads/%{pkg_name}-%{version}.2008.01.28.tar.gz Patch1: 0001-Implement-trace.patch Patch2: 0002-Implement-notifies.patch Patch3: 0003-Implement-print.patch @@ -19,38 +24,38 @@ Requires: ruby >= 1.3 Requires: ruby(abi) = 1.8 BuildRequires: ruby >= 1.3 -BuildRequires: postgresql-devel >= 6.5 +BuildRequires: %{?scl_prefix}postgresql-devel >= 6.5 BuildRequires: ruby-devel -Provides: ruby(postgres) = %{version} +Provides: %{?scl_prefix}ruby(postgres) = %{version} + +%{?scl:Requires:%scl_runtime} %description Database driver to access PostgreSQL databases from Ruby. %prep -%setup -q +%setup -q -n %{pkg_name}-%{version} %patch1 -p1 %patch2 -p1 %patch3 -p1 chmod a-x sample/psql.rb %build +%{?scl:scl enable %scl - << \EOF} cd ext ruby extconf.rb --with-cflags="$RPM_OPT_FLAGS" make +%{?scl:EOF} %install cd ext -rm -rf $RPM_BUILD_ROOT -make DESTDIR=%{buildroot} install - -%clean -rm -rf %{buildroot} +make DESTDIR=%{buildroot}%{?scl:%_scl_root} install %files %defattr(-, root, root) %doc ChangeLog README README.ja doc sample -%{ruby_sitearch}/postgres.so +%{?scl:%_scl_root}%{ruby_sitearch}/postgres.so %changelog * Sat Jan 14 2012 Fedora Release Engineering - 0.7.9-2010.01.28.2