summaryrefslogtreecommitdiffstats
path: root/unixodbc23/unixODBC.spec.diff
blob: 79d3443745c4ab4146417443bb9f5e9fb2714a4f (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--- unixODBC.spec.nodsc	2012-06-06 10:17:10.752568671 +0200
+++ unixODBC.spec	2012-06-06 10:24:35.395122156 +0200
@@ -1,5 +1,8 @@
+%{?scl:%scl_package unixODBC}
+%{!?scl:%global pkg_name unixODBC}
+
 Summary: A complete ODBC driver manager for Linux
-Name: unixODBC
+Name: %{?scl_prefix}unixODBC
 Version: 2.3.1
 Release: 1%{?dist}
 Group: System Environment/Libraries
@@ -7,7 +10,7 @@ URL: http://www.unixODBC.org/
 # Programs are GPL, libraries are LGPL, except News Server library is GPL.
 License: GPLv2+ and LGPLv2+
 
-Source: http://www.unixODBC.org/%{name}-%{version}.tar.gz
+Source: http://www.unixODBC.org/%{pkg_name}-%{version}.tar.gz
 Source1: odbcinst.ini
 Source4: conffile.h
 Source5: README.fedora
@@ -17,12 +20,12 @@ Patch6: export-symbols.patch
 Patch8: so-version-bump.patch
 Patch9: keep-typedefs.patch
 
-Conflicts: iodbc
+Conflicts: %{?scl_prefix}iodbc
 
 BuildRequires: automake autoconf libtool libtool-ltdl-devel bison flex
 BuildRequires: readline-devel
 
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+%{?scl:Requires:%scl_runtime}
 
 %description
 Install unixODBC if you want to access databases through ODBC.
@@ -40,7 +43,7 @@ drivers. If you want to develop programs
 ODBC, you need to install this package.
 
 %prep
-%setup -q
+%setup -q %{?scl:-n %{pkg_name}-%{version}}
 %patch1 -p1
 %patch6 -p1
 %patch8 -p1
@@ -75,10 +78,34 @@ export CFLAGS CXXFLAGS
 make all
 
 %install
-rm -rf $RPM_BUILD_ROOT
-
 make DESTDIR=$RPM_BUILD_ROOT install
-install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}
+
+# we need to pass right path prefix to libraries in odbcinst.ini,
+# the easiest way how to achieve this is to generate the file here
+cat > $RPM_BUILD_ROOT%{_sysconfdir}/odbcinst.ini << EOF
+# Example driver definitions
+
+# Driver from the postgresql-odbc package
+# Setup from the unixODBC package
+[PostgreSQL]
+Description     = ODBC for PostgreSQL
+Driver          = %{_prefix}/lib/psqlodbc.so
+Setup           = %{_prefix}/lib/libodbcpsqlS.so
+Driver64        = %{_prefix}/lib64/psqlodbc.so
+Setup64         = %{_prefix}/lib64/libodbcpsqlS.so
+FileUsage       = 1
+
+
+# Driver from the mysql-connector-odbc package
+# Setup from the unixODBC package
+[MySQL]
+Description     = ODBC for MySQL
+Driver          = %{_prefix}/lib/libmyodbc5.so
+Setup           = %{_prefix}/lib/libodbcmyS.so
+Driver64        = %{_prefix}/lib64/libmyodbc5.so
+Setup64         = %{_prefix}/lib64/libodbcmyS.so
+FileUsage       = 1
+EOF
 
 # multilib header hacks
 # we only apply this to known Red Hat multilib arches, per bug #181335
@@ -127,9 +154,6 @@ do
     mv -f devel-so-list.x devel-so-list
 done
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %files -f base-so-list
 %defattr(-,root,root)
 %doc README COPYING AUTHORS ChangeLog NEWS doc