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