summaryrefslogtreecommitdiffstats
path: root/postgresql92/ruby-postgres.spec.diff
blob: 6531c1ce745f41427f95066ddd6977ba7cb9bab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--- 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 <rel-eng@lists.fedoraproject.org> - 0.7.9-2010.01.28.2