Disable TCL
[platform/upstream/libdb.git] / packaging / libdb.spec
1 %define __soversion_major 5
2 %define __soversion %{__soversion_major}.3
3
4 Summary: The Berkeley DB database library for C
5 Name: libdb
6 Version: 5.3.21
7 Release: 11
8 Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz
9 URL: http://www.oracle.com/database/berkeley-db/
10 License: BSD-3-Clause and LGPL-2.0+
11 Group: System/Libraries
12 BuildRequires: perl libtool
13 BuildRequires: chrpath
14 Conflicts: filesystem < 3
15
16 %description
17 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
18 provides embedded database support for both traditional and
19 client/server applications. The Berkeley DB includes B+tree, Extended
20 Linear Hashing, Fixed and Variable-length record access methods,
21 transactions, locking, logging, shared memory caching, and database
22 recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
23 used by many applications, including Python and Perl, so this should
24 be installed on all systems.
25
26 %package utils
27 Summary: Command line tools for managing Berkeley DB databases
28 Group: Applications/Core Applications
29 Requires: %{name}%{?_isa} = %{version}-%{release}
30
31 %description utils
32 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
33 provides embedded database support for both traditional and
34 client/server applications. Berkeley DB includes B+tree, Extended
35 Linear Hashing, Fixed and Variable-length record access methods,
36 transactions, locking, logging, shared memory caching, and database
37 recovery. DB supports C, C++, Java and Perl APIs.
38
39 %package devel
40 Summary: C development files for the Berkeley DB library
41 Group: Development/Libraries
42 Requires: %{name}%{?_isa} = %{version}-%{release}
43
44 %description devel
45 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
46 provides embedded database support for both traditional and
47 client/server applications. This package contains the header files,
48 libraries, and documentation for building programs which use the
49 Berkeley DB.
50
51 %package devel-doc
52 Summary: C development documentation files for the Berkeley DB library
53 Group: Documentation
54 Requires: %{name} = %{version}-%{release}
55 Requires: %{name}-devel = %{version}-%{release}
56 BuildArch: noarch
57
58 %description devel-doc
59 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
60 provides embedded database support for both traditional and
61 client/server applications. This package contains the header files,
62 libraries, and documentation for building programs which use the
63 Berkeley DB.
64
65 %package devel-static
66 Summary: Berkeley DB static libraries
67 Group: Development/Libraries
68 Requires: %{name}-devel%{?_isa} = %{version}-%{release}
69
70 %description devel-static
71 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
72 provides embedded database support for both traditional and
73 client/server applications. This package contains static libraries
74 needed for applications that require static linking of
75 Berkeley DB.
76
77 %package cxx
78 Summary: The Berkeley DB database library for C++
79 Group: System/Libraries
80 Requires: %{name}%{?_isa} = %{version}-%{release}
81
82 %description cxx
83 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
84 provides embedded database support for both traditional and
85 client/server applications. The Berkeley DB includes B+tree, Extended
86 Linear Hashing, Fixed and Variable-length record access methods,
87 transactions, locking, logging, shared memory caching, and database
88 recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
89 used by many applications, including Python and Perl, so this should
90 be installed on all systems.
91
92 %package cxx-devel
93 Summary: The Berkeley DB database library for C++
94 Group: System/Libraries
95 Requires: %{name}-cxx%{?_isa} = %{version}-%{release}
96 Requires: %{name}-devel%{?_isa} = %{version}-%{release}
97
98 %description cxx-devel
99 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
100 provides embedded database support for both traditional and
101 client/server applications. The Berkeley DB includes B+tree, Extended
102 Linear Hashing, Fixed and Variable-length record access methods,
103 transactions, locking, logging, shared memory caching, and database
104 recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
105 used by many applications, including Python and Perl, so this should
106 be installed on all systems.
107
108 %package sql
109 Summary: Development files for using the Berkeley DB with sql
110 Group: Development/Libraries
111 Requires: %{name}%{?_isa} = %{version}-%{release}
112
113 %description sql
114 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
115 provides embedded database support for both traditional and
116 client/server applications. This package contains the libraries
117 for building programs which use the Berkeley DB in SQL.
118
119 %package sql-devel
120 Summary: Development files for using the Berkeley DB with sql
121 Group: Development/Libraries
122 Requires: %{name}-sql%{?_isa} = %{version}-%{release}
123
124 %description sql-devel
125 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
126 provides embedded database support for both traditional and
127 client/server applications. This package contains the libraries
128 for building programs which use the Berkeley DB in SQL.
129
130 %prep
131 %setup -q -n db-%{version}
132
133 cd dist
134 ./s_config
135
136 %build
137 CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
138 CFLAGS="$CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -I../../../lang/sql/sqlite/ext/fts3/"
139 export CFLAGS
140
141 # Build the old db-185 libraries.
142 make -C db.1.85/PORT/%{_os} OORG="$CFLAGS"
143
144 test -d dist/dist-tls || mkdir dist/dist-tls
145 # Static link db_dump185 with old db-185 libraries.
146 /bin/sh libtool --tag=CC --mode=compile %{__cc} $RPM_OPT_FLAGS -Idb.1.85/PORT/%{_os}/include -D_REENTRANT -c util/db_dump185.c -o dist/dist-tls/db_dump185.lo
147 /bin/sh libtool --tag=LD --mode=link %{__cc} -o dist/dist-tls/db_dump185 dist/dist-tls/db_dump185.lo db.1.85/PORT/%{_os}/libdb.a
148
149 pushd dist/dist-tls
150 ln -sf ../configure .
151 %configure -C \
152         --enable-compat185 --enable-dump185 \
153         --enable-shared --enable-static \
154         --enable-cxx --enable-sql \
155     --disable-java \
156         --disable-test \
157         --disable-rpath \
158     --disable-tcl
159
160 # Remove libtool predep_objects and postdep_objects wonkiness so that
161 # building without -nostdlib doesn't include them twice.  Because we
162 # already link with g++, weird stuff happens if you don't let the
163 # compiler handle this.
164 perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool
165 perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool
166 perl -pi -e 's/-shared -nostdlib/-shared/' libtool
167
168 make %{?_smp_mflags}
169 popd
170
171 %install
172 rm -rf ${RPM_BUILD_ROOT}
173 mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
174 mkdir -p ${RPM_BUILD_ROOT}%{_libdir}
175
176 # Force off stripping of installed binaries
177 %makeinstall STRIP=/bin/true -C dist/dist-tls
178
179 # XXX Nuke non-versioned archives and symlinks
180 rm -f ${RPM_BUILD_ROOT}%{_libdir}/{libdb.a,libdb_cxx.a,libdb_sql.a}
181
182 chmod +x ${RPM_BUILD_ROOT}%{_libdir}/*.so*
183
184 # Move the header files to a subdirectory, in case we're deploying on a
185 # system with multiple versions of DB installed.
186 mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/%{name}
187 mv ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/%{name}/
188
189 # Create symlinks to includes so that "use <db.h> and link with -ldb" works.
190 for i in db.h db_cxx.h db_185.h; do
191         ln -s %{name}/$i ${RPM_BUILD_ROOT}%{_includedir}
192 done
193
194 # Eliminate installed doco
195 rm -rf ${RPM_BUILD_ROOT}%{_prefix}/docs
196
197 # XXX Avoid Permission denied. strip when building as non-root.
198 chmod u+w ${RPM_BUILD_ROOT}%{_bindir} ${RPM_BUILD_ROOT}%{_bindir}/*
199
200 # remove unneeded .la files (#225675)
201 rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
202
203 # remove RPATHs
204 chrpath -d ${RPM_BUILD_ROOT}%{_libdir}/*.so ${RPM_BUILD_ROOT}%{_bindir}/*
205
206 # unify documentation and examples, remove stuff we don't need
207 rm -rf docs/csharp
208 rm -rf examples/csharp
209 rm -rf docs/installation
210 mv examples docs
211
212 %clean
213 rm -rf ${RPM_BUILD_ROOT}
214
215 %post -p /sbin/ldconfig
216
217 %postun -p /sbin/ldconfig
218
219 %post -p /sbin/ldconfig cxx
220
221 %postun -p /sbin/ldconfig cxx
222
223 %post -p /sbin/ldconfig sql
224
225 %postun -p /sbin/ldconfig sql
226
227 %files
228 %defattr(-,root,root,-)
229 %doc LICENSE README
230 %{_libdir}/libdb-%{__soversion}.so
231 %{_libdir}/libdb-%{__soversion_major}.so
232
233 %files devel
234 %defattr(-,root,root,-)
235 %{_libdir}/libdb.so
236 %dir %{_includedir}/%{name}
237 %{_includedir}/%{name}/db.h
238 %{_includedir}/%{name}/db_185.h
239 %{_includedir}/db.h
240 %{_includedir}/db_185.h
241
242 %files devel-doc
243 %defattr(-,root,root,-)
244 %doc    docs/*
245
246 %files devel-static
247 %defattr(-,root,root,-)
248 %{_libdir}/libdb-%{__soversion}.a
249 %{_libdir}/libdb_cxx-%{__soversion}.a
250 %{_libdir}/libdb_sql-%{__soversion}.a
251
252 %files utils
253 %defattr(-,root,root,-)
254 %{_bindir}/db*_archive
255 %{_bindir}/db*_checkpoint
256 %{_bindir}/db*_deadlock
257 %{_bindir}/db*_dump*
258 %{_bindir}/db*_hotbackup
259 %{_bindir}/db*_load
260 %{_bindir}/db*_printlog
261 %{_bindir}/db*_recover
262 %{_bindir}/db*_replicate
263 %{_bindir}/db*_stat
264 %{_bindir}/db*_upgrade
265 %{_bindir}/db*_verify
266 %{_bindir}/db*_tuner
267
268 %files cxx
269 %defattr(-,root,root,-)
270 %{_libdir}/libdb_cxx-%{__soversion}.so
271 %{_libdir}/libdb_cxx-%{__soversion_major}.so
272
273 %files cxx-devel
274 %defattr(-,root,root,-)
275 %{_includedir}/%{name}/db_cxx.h
276 %{_includedir}/db_cxx.h
277 %{_libdir}/libdb_cxx.so
278
279 %files sql
280 %defattr(-,root,root,-)
281 %{_libdir}/libdb_sql-%{__soversion}.so
282 %{_libdir}/libdb_sql-%{__soversion_major}.so
283
284 %files sql-devel
285 %defattr(-,root,root,-)
286 %{_bindir}/dbsql
287 %{_libdir}/libdb_sql.so
288 %{_includedir}/%{name}/dbsql.h