summaryrefslogtreecommitdiffstats
path: root/mysql55/ruby-mysql.spec.diff
blob: f218b1ef6fa279ccbb6704ebba949bd29b905f9d (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
--- ruby-mysql.spec.nodsc	2012-05-31 10:25:30.648935292 +0200
+++ ruby-mysql.spec	2012-06-01 14:21:48.393990525 +0200
@@ -1,4 +1,12 @@
-Name:           ruby-mysql
+# Sets %%pkg_name to 'ruby-mysql' if we build for scl.
+%{?scl:%scl_package ruby-mysql}
+# If we don't build for scl, then pkg_name is empty.
+# This way, we can always use %%pkg_name for 'ruby-mysql', be it scl build or not.
+%{!?scl:%global pkg_name ruby-mysql}
+# %%{name} then references to either 'ruby-mysql' (not in scl) or '%%{?scl:%scl_prefix}ruby-mysql' (in scl).
+%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')}
+
+Name:           %{?scl_prefix}ruby-mysql
 Version:        2.8.2
 Release:        6%{?dist}
 Summary:        A Ruby interface to MySQL
@@ -9,10 +17,11 @@ URL:            http://www.tmtm.org/en/m
 
 Source0:        http://tmtm.org/downloads/mysql/ruby/mysql-ruby-%{version}.tar.gz
 
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires:  ruby ruby-devel mysql-devel
+BuildRequires:  ruby ruby-devel %{?scl_prefix}mysql-devel
 Requires:       ruby(abi) = 1.9.1
-Provides:       ruby(mysql) = %{version}
+Provides:       %{?scl_prefix}ruby(mysql) = %{version}
+
+%{?scl:Requires:%scl_runtime}
 
 %description
 This is the MySQL API module for Ruby. It provides the same functions for
@@ -24,13 +33,14 @@ Ruby programs that the MySQL C API provi
 
 
 %build
+%{?scl:scl enable %scl - << \EOF}
 export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
-ruby extconf.rb --vendor --with-mysql-config
+ruby extconf.rb --with-mysql-config=%{_bindir}/mysql_config
+sed -ie 's|$(DESTDIR)/usr/|$(DESTDIR)%{_prefix}/|g' Makefile
 make %{?_smp_mflags}
-
+%{?scl:EOF}
 
 %install
-rm -rf $RPM_BUILD_ROOT
 env DESTDIR=$RPM_BUILD_ROOT make install
 
 
@@ -41,7 +51,7 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root,-)
 %doc README.html README_ja.html tommy.css COPYING COPYING.ja 
-%{ruby_vendorarchdir}/mysql.so
+%{?scl:%_scl_root}%{ruby_sitearch}/mysql.so
 
 
 %changelog