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