patch.1.3
[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 # db-1.85 upstream patches
10 Patch13: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.4
11 # other patches
12 Patch20: db-1.85-errno.patch
13 Patch22: db-4.6.21-1.85-compat.patch
14 Patch24: db-4.5.20-jni-include-dir.patch
15 # License clarification patch
16 # http://devel.trisquel.info/gitweb/?p=package-helpers.git;a=blob;f=helpers/DATA/db4.8/007-mt19937db.c_license.patch;h=1036db4d337ce4c60984380b89afcaa63b2ef88f;hb=df48d40d3544088338759e8bea2e7f832a564d48
17 Patch25: 007-mt19937db.c_license.patch
18 URL: http://www.oracle.com/database/berkeley-db/
19 License: BSD-3-Clause and LGPL-2.0+
20 Group: System/Libraries
21 BuildRequires: perl libtool
22 BuildRequires: tcl-devel >= 8.5.2-3
23 BuildRequires: java-devel >= 1:1.6.0
24 BuildRequires: chrpath
25 Conflicts: filesystem < 3
26
27 %description
28 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
29 provides embedded database support for both traditional and
30 client/server applications. The Berkeley DB includes B+tree, Extended
31 Linear Hashing, Fixed and Variable-length record access methods,
32 transactions, locking, logging, shared memory caching, and database
33 recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
34 used by many applications, including Python and Perl, so this should
35 be installed on all systems.
36
37 %package utils
38 Summary: Command line tools for managing Berkeley DB databases
39 Group: Applications/Core Applications
40 Requires: %{name}%{?_isa} = %{version}-%{release}
41
42 %description utils
43 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
44 provides embedded database support for both traditional and
45 client/server applications. Berkeley DB includes B+tree, Extended
46 Linear Hashing, Fixed and Variable-length record access methods,
47 transactions, locking, logging, shared memory caching, and database
48 recovery. DB supports C, C++, Java and Perl APIs.
49
50 %package devel
51 Summary: C development files for the Berkeley DB library
52 Group: Development/Libraries
53 Requires: %{name}%{?_isa} = %{version}-%{release}
54
55 %description devel
56 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
57 provides embedded database support for both traditional and
58 client/server applications. This package contains the header files,
59 libraries, and documentation for building programs which use the
60 Berkeley DB.
61
62 %package devel-doc
63 Summary: C development documentation files for the Berkeley DB library
64 Group: Documentation
65 Requires: %{name} = %{version}-%{release}
66 Requires: %{name}-devel = %{version}-%{release}
67 BuildArch: noarch
68
69 %description devel-doc
70 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
71 provides embedded database support for both traditional and
72 client/server applications. This package contains the header files,
73 libraries, and documentation for building programs which use the
74 Berkeley DB.
75
76 %package devel-static
77 Summary: Berkeley DB static libraries
78 Group: Development/Libraries
79 Requires: %{name}-devel%{?_isa} = %{version}-%{release}
80
81 %description devel-static
82 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
83 provides embedded database support for both traditional and
84 client/server applications. This package contains static libraries
85 needed for applications that require static linking of
86 Berkeley DB.
87
88 %package cxx
89 Summary: The Berkeley DB database library for C++
90 Group: System/Libraries
91 Requires: %{name}%{?_isa} = %{version}-%{release}
92
93 %description cxx
94 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
95 provides embedded database support for both traditional and
96 client/server applications. The Berkeley DB includes B+tree, Extended
97 Linear Hashing, Fixed and Variable-length record access methods,
98 transactions, locking, logging, shared memory caching, and database
99 recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
100 used by many applications, including Python and Perl, so this should
101 be installed on all systems.
102
103 %package cxx-devel
104 Summary: The Berkeley DB database library for C++
105 Group: System/Libraries
106 Requires: %{name}-cxx%{?_isa} = %{version}-%{release}
107 Requires: %{name}-devel%{?_isa} = %{version}-%{release}
108
109 %description cxx-devel
110 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
111 provides embedded database support for both traditional and
112 client/server applications. The Berkeley DB includes B+tree, Extended
113 Linear Hashing, Fixed and Variable-length record access methods,
114 transactions, locking, logging, shared memory caching, and database
115 recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
116 used by many applications, including Python and Perl, so this should
117 be installed on all systems.
118
119 %package tcl
120 Summary: Development files for using the Berkeley DB with tcl
121 Group: Development/Libraries
122 Requires: %{name}%{?_isa} = %{version}-%{release}
123
124 %description tcl
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 Tcl.
129
130 %package tcl-devel
131 Summary: Development files for using the Berkeley DB with tcl
132 Group: Development/Libraries
133 Requires: %{name}-tcl%{?_isa} = %{version}-%{release}
134
135 %description tcl-devel
136 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
137 provides embedded database support for both traditional and
138 client/server applications. This package contains the libraries
139 for building programs which use the Berkeley DB in Tcl.
140
141 %package sql
142 Summary: Development files for using the Berkeley DB with sql
143 Group: Development/Libraries
144 Requires: %{name}%{?_isa} = %{version}-%{release}
145
146 %description sql
147 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
148 provides embedded database support for both traditional and
149 client/server applications. This package contains the libraries
150 for building programs which use the Berkeley DB in SQL.
151
152 %package sql-devel
153 Summary: Development files for using the Berkeley DB with sql
154 Group: Development/Libraries
155 Requires: %{name}-sql%{?_isa} = %{version}-%{release}
156
157 %description sql-devel
158 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
159 provides embedded database support for both traditional and
160 client/server applications. This package contains the libraries
161 for building programs which use the Berkeley DB in SQL.
162
163 %package java
164 Summary: Development files for using the Berkeley DB with Java
165 Group: Development/Libraries
166 Requires: %{name}%{?_isa} = %{version}-%{release}
167
168 %description java
169 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
170 provides embedded database support for both traditional and
171 client/server applications. This package contains the libraries
172 for building programs which use the Berkeley DB in Java.
173
174 %package java-devel
175 Summary: Development files for using the Berkeley DB with Java
176 Group: Development/Libraries
177 Requires: %{name}-java%{?_isa} = %{version}-%{release}
178
179 %description java-devel
180 The Berkeley Database (Berkeley DB) is a programmatic toolkit that
181 provides embedded database support for both traditional and
182 client/server applications. This package contains the libraries
183 for building programs which use the Berkeley DB in Java.
184
185 %prep
186 %setup -q -n db-%{version}
187
188 pushd db.1.85
189 %patch13 -p0 -b .1.4
190 %patch20 -p1 -b .errno
191 popd
192
193 %patch22 -p1 -b .185compat
194 %patch24 -p1 -b .4.5.20.jni
195 %patch25 -p1 -b .licensefix
196
197 cd dist
198 ./s_config
199
200 %build
201 CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
202 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/"
203 export CFLAGS
204
205 # Build the old db-185 libraries.
206 make -C db.1.85/PORT/%{_os} OORG="$CFLAGS"
207
208 test -d dist/dist-tls || mkdir dist/dist-tls
209 # Static link db_dump185 with old db-185 libraries.
210 /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
211 /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
212
213 pushd dist/dist-tls
214 ln -sf ../configure .
215 %configure -C \
216         --enable-compat185 --enable-dump185 \
217         --enable-shared --enable-static \
218         --enable-tcl --with-tcl=%{_libdir} \
219         --enable-cxx --enable-sql \
220         --enable-java \
221         --enable-test \
222         --disable-rpath \
223         --with-tcl=%{_libdir}/tcl8.5
224
225 # Remove libtool predep_objects and postdep_objects wonkiness so that
226 # building without -nostdlib doesn't include them twice.  Because we
227 # already link with g++, weird stuff happens if you don't let the
228 # compiler handle this.
229 perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool
230 perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool
231 perl -pi -e 's/-shared -nostdlib/-shared/' libtool
232
233 make %{?_smp_mflags}
234
235 # XXX hack around libtool not creating ./libs/libdb_java-X.Y.lai
236 LDBJ=./.libs/libdb_java-%{__soversion}.la
237 if test -f ${LDBJ} -a ! -f ${LDBJ}i; then
238         sed -e 's,^installed=no,installed=yes,' < ${LDBJ} > ${LDBJ}i
239 fi
240 popd
241
242 %install
243 rm -rf ${RPM_BUILD_ROOT}
244 mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
245 mkdir -p ${RPM_BUILD_ROOT}%{_libdir}
246
247 # Force off stripping of installed binaries
248 %makeinstall STRIP=/bin/true -C dist/dist-tls
249
250 # XXX Nuke non-versioned archives and symlinks
251 rm -f ${RPM_BUILD_ROOT}%{_libdir}/{libdb.a,libdb_cxx.a,libdb_tcl.a,libdb_sql.a}
252
253 chmod +x ${RPM_BUILD_ROOT}%{_libdir}/*.so*
254
255 # Move the header files to a subdirectory, in case we're deploying on a
256 # system with multiple versions of DB installed.
257 mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/%{name}
258 mv ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/%{name}/
259
260 # Create symlinks to includes so that "use <db.h> and link with -ldb" works.
261 for i in db.h db_cxx.h db_185.h; do
262         ln -s %{name}/$i ${RPM_BUILD_ROOT}%{_includedir}
263 done
264
265 # Move java jar file to the correct place
266 mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/java
267 mv ${RPM_BUILD_ROOT}%{_libdir}/*.jar ${RPM_BUILD_ROOT}%{_datadir}/java
268
269 # Eliminate installed doco
270 rm -rf ${RPM_BUILD_ROOT}%{_prefix}/docs
271
272 # XXX Avoid Permission denied. strip when building as non-root.
273 chmod u+w ${RPM_BUILD_ROOT}%{_bindir} ${RPM_BUILD_ROOT}%{_bindir}/*
274
275 # remove unneeded .la files (#225675)
276 rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
277
278 # remove RPATHs
279 chrpath -d ${RPM_BUILD_ROOT}%{_libdir}/*.so ${RPM_BUILD_ROOT}%{_bindir}/*
280
281 # unify documentation and examples, remove stuff we don't need
282 rm -rf docs/csharp
283 rm -rf examples/csharp
284 rm -rf docs/installation
285 mv examples docs
286
287 %clean
288 rm -rf ${RPM_BUILD_ROOT}
289
290 %post -p /sbin/ldconfig
291
292 %postun -p /sbin/ldconfig
293
294 %post -p /sbin/ldconfig cxx
295
296 %postun -p /sbin/ldconfig cxx
297
298 %post -p /sbin/ldconfig sql
299
300 %postun -p /sbin/ldconfig sql
301
302 %post -p /sbin/ldconfig tcl
303
304 %postun -p /sbin/ldconfig tcl
305
306 %post -p /sbin/ldconfig java
307
308 %postun -p /sbin/ldconfig java
309
310 %files
311 %defattr(-,root,root,-)
312 %doc LICENSE README
313 %{_libdir}/libdb-%{__soversion}.so
314 %{_libdir}/libdb-%{__soversion_major}.so
315
316 %files devel
317 %defattr(-,root,root,-)
318 %{_libdir}/libdb.so
319 %dir %{_includedir}/%{name}
320 %{_includedir}/%{name}/db.h
321 %{_includedir}/%{name}/db_185.h
322 %{_includedir}/db.h
323 %{_includedir}/db_185.h
324
325 %files devel-doc
326 %defattr(-,root,root,-)
327 %doc    docs/*
328
329 %files devel-static
330 %defattr(-,root,root,-)
331 %{_libdir}/libdb-%{__soversion}.a
332 %{_libdir}/libdb_cxx-%{__soversion}.a
333 %{_libdir}/libdb_tcl-%{__soversion}.a
334 %{_libdir}/libdb_sql-%{__soversion}.a
335 %{_libdir}/libdb_java-%{__soversion}.a
336
337 %files utils
338 %defattr(-,root,root,-)
339 %{_bindir}/db*_archive
340 %{_bindir}/db*_checkpoint
341 %{_bindir}/db*_deadlock
342 %{_bindir}/db*_dump*
343 %{_bindir}/db*_hotbackup
344 %{_bindir}/db*_load
345 %{_bindir}/db*_printlog
346 %{_bindir}/db*_recover
347 %{_bindir}/db*_replicate
348 %{_bindir}/db*_stat
349 %{_bindir}/db*_upgrade
350 %{_bindir}/db*_verify
351 %{_bindir}/db*_tuner
352
353 %files cxx
354 %defattr(-,root,root,-)
355 %{_libdir}/libdb_cxx-%{__soversion}.so
356 %{_libdir}/libdb_cxx-%{__soversion_major}.so
357
358 %files cxx-devel
359 %defattr(-,root,root,-)
360 %{_includedir}/%{name}/db_cxx.h
361 %{_includedir}/db_cxx.h
362 %{_libdir}/libdb_cxx.so
363
364 %files tcl
365 %defattr(-,root,root,-)
366 %{_libdir}/libdb_tcl-%{__soversion}.so
367 %{_libdir}/libdb_tcl-%{__soversion_major}.so
368
369 %files tcl-devel
370 %defattr(-,root,root,-)
371 %{_libdir}/libdb_tcl.so
372
373 %files sql
374 %defattr(-,root,root,-)
375 %{_libdir}/libdb_sql-%{__soversion}.so
376 %{_libdir}/libdb_sql-%{__soversion_major}.so
377
378 %files sql-devel
379 %defattr(-,root,root,-)
380 %{_bindir}/dbsql
381 %{_libdir}/libdb_sql.so
382 %{_includedir}/%{name}/dbsql.h
383
384 %files java
385 %defattr(-,root,root,-)
386 %{_libdir}/libdb_java-%{__soversion_major}*.so
387 %{_datadir}/java/*.jar
388
389 %files java-devel
390 %defattr(-,root,root,-)
391 %{_libdir}/libdb_java.so