diff --git a/.gitignore b/.gitignore index e69de29..1d3b008 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/db-4.8.30.tar.gz +/db.1.85.tar.gz diff --git a/db-1.85-errno.patch b/db-1.85-errno.patch new file mode 100644 index 0000000..ccc9ddf --- /dev/null +++ b/db-1.85-errno.patch @@ -0,0 +1,89 @@ +glibc doesn't like errno as the name of a field. +--- db.1.85/hash/hash.h Mon Feb 18 19:12:14 2002 ++++ db.1.85/hash/hash.h Mon Feb 18 19:12:20 2002 +@@ -103,7 +103,7 @@ + BUFHEAD *cpage; /* Current page */ + int cbucket; /* Current bucket */ + int cndx; /* Index of next item on cpage */ +- int errno; /* Error Number -- for DBM ++ int err; /* Error Number -- for DBM + * compatability */ + int new_file; /* Indicates if fd is backing store + * or no */ +--- db.1.85/hash/hash.c Mon Feb 18 19:12:24 2002 ++++ db.1.85/hash/hash.c Mon Feb 18 19:12:44 2002 +@@ -505,7 +505,7 @@ + else + if (wsize != sizeof(HASHHDR)) { + errno = EFTYPE; +- hashp->errno = errno; ++ hashp->err = errno; + return (-1); + } + for (i = 0; i < NCACHED; i++) +@@ -536,7 +536,7 @@ + + hashp = (HTAB *)dbp->internal; + if (flag) { +- hashp->errno = errno = EINVAL; ++ hashp->err = errno = EINVAL; + return (ERROR); + } + return (hash_access(hashp, HASH_GET, (DBT *)key, data)); +@@ -553,11 +553,11 @@ + + hashp = (HTAB *)dbp->internal; + if (flag && flag != R_NOOVERWRITE) { +- hashp->errno = errno = EINVAL; ++ hashp->err = errno = EINVAL; + return (ERROR); + } + if ((hashp->flags & O_ACCMODE) == O_RDONLY) { +- hashp->errno = errno = EPERM; ++ hashp->err = errno = EPERM; + return (ERROR); + } + return (hash_access(hashp, flag == R_NOOVERWRITE ? +@@ -574,11 +574,11 @@ + + hashp = (HTAB *)dbp->internal; + if (flag && flag != R_CURSOR) { +- hashp->errno = errno = EINVAL; ++ hashp->err = errno = EINVAL; + return (ERROR); + } + if ((hashp->flags & O_ACCMODE) == O_RDONLY) { +- hashp->errno = errno = EPERM; ++ hashp->err = errno = EPERM; + return (ERROR); + } + return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL)); +@@ -729,7 +729,7 @@ + + hashp = (HTAB *)dbp->internal; + if (flag && flag != R_FIRST && flag != R_NEXT) { +- hashp->errno = errno = EINVAL; ++ hashp->err = errno = EINVAL; + return (ERROR); + } + #ifdef HASH_STATISTICS +--- db.1.85/hash/ndbm.c Mon Feb 18 19:12:58 2002 ++++ db.1.85/hash/ndbm.c Mon Feb 18 19:13:05 2002 +@@ -180,7 +180,7 @@ + HTAB *hp; + + hp = (HTAB *)db->internal; +- return (hp->errno); ++ return (hp->err); + } + + extern int +@@ -190,7 +190,7 @@ + HTAB *hp; + + hp = (HTAB *)db->internal; +- hp->errno = 0; ++ hp->err = 0; + return (0); + } + diff --git a/db-4.5.20-jni-include-dir.patch b/db-4.5.20-jni-include-dir.patch new file mode 100644 index 0000000..fe82d38 --- /dev/null +++ b/db-4.5.20-jni-include-dir.patch @@ -0,0 +1,12 @@ +diff -up db-4.7.25/dist/configure.ac.jni db-4.7.25/dist/configure.ac +--- db-4.7.25/dist/configure.ac.jni 2008-08-20 14:22:59.000000000 +0200 ++++ db-4.7.25/dist/configure.ac 2008-08-20 14:23:39.000000000 +0200 +@@ -418,7 +418,7 @@ if test "$db_cv_java" = "yes"; then + AC_PROG_JAVAC + AC_PROG_JAR + AC_PROG_JAVA +- AC_JNI_INCLUDE_DIR ++ JNI_INCLUDE_DIRS="/usr/lib/jvm/java-1.5.0-gcj/include" + + AC_MSG_CHECKING(java version) + case "$JAVA" in diff --git a/db-4.6.21-1.85-compat.patch b/db-4.6.21-1.85-compat.patch new file mode 100644 index 0000000..c65b6ac --- /dev/null +++ b/db-4.6.21-1.85-compat.patch @@ -0,0 +1,14 @@ +diff -ur db-4.6.21/dist/Makefile.in db-4.6.21-db.h_include-patched/dist/Makefile.in +--- db-4.6.21/dist/Makefile.in 2007-07-05 18:35:02.000000000 +0000 ++++ db-4.6.21-db.h_include-patched/dist/Makefile.in 2008-09-05 08:59:36.000000000 +0000 +@@ -139,8 +139,8 @@ + # local libraries, for example. Do that by adding -I options to the DB185INC + # line, and -l options to the DB185LIB line. + ################################################## +-DB185INC= -c @CFLAGS@ -I$(srcdir) @CPPFLAGS@ +-DB185LIB= ++DB185INC= -c @CFLAGS@ -I$(srcdir) -I$(srcdir)/db.1.85/PORT/linux/include @CPPFLAGS@ ++DB185LIB= ${srcdir}/db.1.85/PORT/linux/libdb.a + + ################################################## + # NOTHING BELOW THIS LINE SHOULD EVER NEED TO BE MODIFIED. diff --git a/libdb4.spec b/libdb4.spec new file mode 100644 index 0000000..32aa61d --- /dev/null +++ b/libdb4.spec @@ -0,0 +1,360 @@ +%define __soversion_major 4 +%define __soversion %{__soversion_major}.8 + +Summary: The Berkeley DB database library (version 4) for C +Name: libdb4 +Version: 4.8.30 +Release: 1%{?dist} +Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz +Source1: http://download.oracle.com/berkeley-db/db.1.85.tar.gz +# db-1.85 upstream patches +Patch10: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.1 +Patch11: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.2 +Patch12: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.3 +Patch13: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.4 +# other patches +Patch20: db-1.85-errno.patch +Patch21: db-4.6.21-1.85-compat.patch +Patch22: db-4.5.20-jni-include-dir.patch +URL: http://www.oracle.com/database/berkeley-db/ +License: Sleepycat and BSD +Group: System Environment/Libraries +Conflicts: filesystem < 3 +Obsoletes: db4 < 5.0.0 +BuildRequires: perl libtool ed util-linux-ng +BuildRequires: tcl-devel%{?_isa} >= 8.5.2-3 +BuildRequires: chrpath +BuildRequires: gcc-java +BuildRequires: java-devel >= 1:1.6.0 + +%description +The Berkeley Database (Berkeley DB) is a programmatic toolkit that +provides embedded database support for both traditional and +client/server applications. The Berkeley DB includes B+tree, Extended +Linear Hashing, Fixed and Variable-length record access methods, +transactions, locking, logging, shared memory caching, and database +recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is +used by many applications, including Python and Perl, so this should +be installed on all systems. + +%package utils +Summary: Command line tools for managing Berkeley DB (version 4) databases +Group: Applications/Databases +Requires: %{name}%{?_isa} = %{version}-%{release} +Obsoletes: db4-utils < 5.0.0 + +%description utils +This package contains command-line tools for managing Berkeley DB (version +4) databases. + +%package devel +Summary: C development files for the Berkeley DB (version 4) library +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Obsoletes: db4-devel < 5.0.0 + +%description devel +This package contains the header files and libraries for building C +programs which use the Berkeley DB. + +%package doc +Summary: Documentation for the Berkeley DB +Group: Documentation +BuildArch: noarch +Obsoletes: db4-devel-doc < 5.0.0 + +%description doc +This package includes documentation files for the Berkeley DB database. + +%package devel-static +Summary: Berkeley DB (version 4) static libraries +Group: Development/Libraries +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Obsoletes: db4-devel-static < 5.0.0 + +%description devel-static +This package contains static libraries needed for applications that +require static linking of Berkeley DB. + +%package cxx +Summary: The Berkeley DB database library (version 4) for C++ +Group: System Environment/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Obsoletes: db4-cxx < 5.0.0 + +%description cxx +This package contains the C++ version of the Berkeley DB library (v4). + +%package cxx-devel +Summary: C++ development files for the Berkeley DB database library (version 4) +Group: Development/Libraries +Requires: %{name}-cxx%{?_isa} = %{version}-%{release} +Obsoletes: db4-cxx-devel < 5.0.0 + +%description cxx-devel +This package contains the header files and libraries for building C++ +programs which use the Berkeley DB. + +%package tcl +Summary: Development files for using the Berkeley DB (version 4) with tcl +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Obsoletes: db4-tcl < 5.0.0 + +%description tcl +This package contains the libraries for building programs which use the +Berkeley DB in Tcl. + +%package tcl-devel +Summary: Development files for using the Berkeley DB (version 4) with tcl +Group: Development/Libraries +Requires: %{name}-tcl%{?_isa} = %{version}-%{release} + +%description tcl-devel +This package contains the libraries for building programs which use the +Berkeley DB in Tcl. + +%package java +Summary: Development files for using the Berkeley DB (version 4) with Java +Group: System Environment/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Obsoletes: db4-java < 5.0.0 + +%description java +This package contains the libraries for building programs which use the +Berkeley DB in Java. + +%package java-devel +Summary: Development files for using the Berkeley DB (version 4) with Java +Group: Development/Libraries +Requires: %{name}-java%{?_isa} = %{version}-%{release} + +%description java-devel +This package contains the libraries for building programs which use the +Berkeley DB in Java. + +%prep +%setup -q -n db-%{version} -a 1 + +pushd db.1.85/PORT/linux +%patch10 -p0 -b .1.1 +popd +pushd db.1.85 +%patch11 -p0 -b .1.2 +%patch12 -p0 -b .1.3 +%patch13 -p0 -b .1.4 +%patch20 -p1 -b .errno +popd + +%patch21 -p1 -b .185compat +%patch22 -p1 -b .4.5.20.jni + +# Fix HREF references in the docs which would otherwise break when we split the docs up into subpackages. +set +x +for doc in `find . -name "*.html"`; do + chmod u+w ${doc} + sed -e 's,="../api_c/,="../../%{name}-devel-%{version}/api_c/,g' \ + -e 's,="api_c/,="../%{name}-devel-%{version}/api_c/,g' \ + -e 's,="../api_cxx/,="../../%{name}-devel-%{version}/api_cxx/,g' \ + -e 's,="api_cxx/,="../%{name}-devel-%{version}/api_cxx/,g' \ + -e 's,="../api_tcl/,="../../%{name}-devel-%{version}/api_tcl/,g' \ + -e 's,="api_tcl/,="../%{name}-devel-%{version}/api_tcl/,g' \ + -e 's,="../java/,="../../%{name}-devel-%{version}/java/,g' \ + -e 's,="java/,="../%{name}-devel-%{version}/java/,g' \ + -e 's,="../examples_c/,="../../%{name}-devel-%{version}/examples_c/,g' \ + -e 's,="examples_c/,="../%{name}-devel-%{version}/examples_c/,g' \ + -e 's,="../examples_cxx/,="../../%{name}-devel-%{version}/examples_cxx/,g' \ + -e 's,="examples_cxx/,="../%{name}-devel-%{version}/examples_cxx/,g' \ + -e 's,="../ref/,="../../%{name}-devel-%{version}/ref/,g' \ + -e 's,="ref/,="../%{name}-devel-%{version}/ref/,g' \ + -e 's,="../images/,="../../%{name}-devel-%{version}/images/,g' \ + -e 's,="images/,="../%{name}-devel-%{version}/images/,g' \ + -e 's,="../utility/,="../../%{name}-utils-%{version}/utility/,g' \ + -e 's,="utility/,="../%{name}-utils-%{version}/utility/,g' ${doc} > ${doc}.new + touch -r ${doc} ${doc}.new + cat ${doc}.new > ${doc} + touch -r ${doc}.new ${doc} + rm -f ${doc}.new +done +set -x + +cd dist +./s_config + +%build +export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" + +# Build the old db-185 libraries. +make -C db.1.85/PORT/%{_os} OORG="$CFLAGS" + +test -d dist/dist-tls || mkdir dist/dist-tls +# Static link db_dump185 with old db-185 libraries. +/bin/sh libtool --mode=compile %{__cc} $RPM_OPT_FLAGS -Idb.1.85/PORT/%{_os}/include -D_REENTRANT -c db_dump185/db_dump185.c -o dist/dist-tls/db_dump185.lo +/bin/sh libtool --mode=link %{__cc} -o dist/dist-tls/db_dump185 dist/dist-tls/db_dump185.lo db.1.85/PORT/%{_os}/libdb.a + +pushd dist/dist-tls +ln -sf ../configure . +%configure -C \ + --enable-compat185 --enable-dump185 \ + --enable-shared --enable-static \ + --enable-tcl --with-tcl=%{_libdir} \ + --enable-cxx \ + --enable-java \ + --enable-test \ + --disable-rpath \ + --with-tcl=%{_libdir}/tcl8.5 + +# Remove libtool predep_objects and postdep_objects wonkiness so that +# building without -nostdlib doesn't include them twice. Because we +# already link with g++, weird stuff happens if you don't let the +# compiler handle this. +perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool +perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool +perl -pi -e 's/-shared -nostdlib/-shared/' libtool + +make %{?_smp_mflags} + +# XXX hack around libtool not creating ./libs/libdb_java-X.Y.lai +LDBJ=./.libs/libdb_java-%{__soversion}.la +if test -f ${LDBJ} -a ! -f ${LDBJ}i; then + sed -e 's,^installed=no,installed=yes,' < ${LDBJ} > ${LDBJ}i +fi + +popd + +%install +rm -rf ${RPM_BUILD_ROOT} +mkdir -p ${RPM_BUILD_ROOT}%{_includedir} +mkdir -p ${RPM_BUILD_ROOT}%{_libdir} + +%makeinstall -C dist/dist-tls + +# XXX Nuke non-versioned archives and symlinks +rm -f ${RPM_BUILD_ROOT}%{_libdir}/{libdb.a,libdb_cxx.a} + +chmod +x ${RPM_BUILD_ROOT}%{_libdir}/*.so* + +# Move the header files to a subdirectory, in case we're deploying on a +# system with multiple versions of DB installed. +mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/%{name} +mv ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/%{name} + +# Move java jar file to the correct place +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/java +mv ${RPM_BUILD_ROOT}%{_libdir}/*.jar ${RPM_BUILD_ROOT}%{_datadir}/java + +# Eliminate installed doco +rm -rf ${RPM_BUILD_ROOT}%{_prefix}/docs + +# unify documentation and examples, remove stuff we don't need +rm -rf docs/csharp +rm -rf examples/csharp +rm -rf docs/installation + +# XXX Avoid Permission denied. strip when building as non-root. +chmod u+w ${RPM_BUILD_ROOT}%{_bindir} ${RPM_BUILD_ROOT}%{_bindir}/* + +# remove unneeded .la files (#225675) +rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la + +# rename utils so that they won't conflict with libdb (#749293) +pushd ${RPM_BUILD_ROOT}%{_bindir} +for i in `ls | sed s/db_//`; do + mv db_$i db%{__soversion_major}_$i; +done +popd + +# remove RPATHs +chrpath -d ${RPM_BUILD_ROOT}%{_libdir}/*.so ${RPM_BUILD_ROOT}%{_bindir}/* + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%post -p /sbin/ldconfig cxx + +%postun -p /sbin/ldconfig cxx + +%post -p /sbin/ldconfig tcl + +%postun -p /sbin/ldconfig tcl + +%post -p /sbin/ldconfig java + +%postun -p /sbin/ldconfig java + +%files +%defattr(-,root,root,-) +%doc LICENSE README +%{_libdir}/libdb-%{__soversion}.so +%{_libdir}/libdb-%{__soversion_major}.so + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libdb.so +%dir %{_includedir}/%{name} +%{_includedir}/%{name}/db.h +%{_includedir}/%{name}/db_185.h + +%files doc +%defattr(-,root,root,-) +%doc docs/* +%doc examples_c examples_cxx examples_java + +%files devel-static +%defattr(-,root,root,-) +%{_libdir}/libdb-%{__soversion}.a +%{_libdir}/libdb_cxx-%{__soversion}.a +%{_libdir}/libdb_tcl-%{__soversion}.a +%{_libdir}/libdb_java-%{__soversion}.a + +%files utils +%defattr(-,root,root,-) +%{_bindir}/db*_archive +%{_bindir}/db*_checkpoint +%{_bindir}/db*_deadlock +%{_bindir}/db*_dump* +%{_bindir}/db*_hotbackup +%{_bindir}/db*_load +%{_bindir}/db*_printlog +%{_bindir}/db*_recover +%{_bindir}/db*_sql +%{_bindir}/db*_stat +%{_bindir}/db*_upgrade +%{_bindir}/db*_verify + +%files cxx +%defattr(-,root,root,-) +%{_libdir}/libdb_cxx-%{__soversion}.so +%{_libdir}/libdb_cxx-%{__soversion_major}.so + +%files cxx-devel +%defattr(-,root,root,-) +%{_includedir}/%{name}/db_cxx.h +%{_libdir}/libdb_cxx.so + +%files tcl +%defattr(-,root,root,-) +%{_libdir}/libdb_tcl-%{__soversion}.so +%{_libdir}/libdb_tcl-%{__soversion_major}.so + +%files tcl-devel +%defattr(-,root,root,-) +%{_libdir}/libdb_tcl.so + +%files java +%defattr(-,root,root,-) +%{_libdir}/libdb_java-%{__soversion}*.so +%{_libdir}/libdb_java-%{__soversion_major}*.so +%{_datadir}/java/*.jar + +%files java-devel +%defattr(-,root,root,-) +%{_libdir}/libdb_java.so + +%changelog +* Sun Apr 22 2012 Jindrich Novy 4.8.30-1 +- introduction of libdb4 diff --git a/patch.1.1 b/patch.1.1 new file mode 100644 index 0000000..fe3177d --- /dev/null +++ b/patch.1.1 @@ -0,0 +1,20 @@ +*** Makefile.orig Wed Jul 13 21:43:16 1994 +--- Makefile Wed Dec 31 19:00:00 1969 +*************** +*** 15,22 **** + + ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} + rm -f $@ +! ar cq $@ \ +! `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort` + ranlib $@ + + clean: +--- 15,21 ---- + + ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} + rm -f $@ +! ar cq $@ ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} + ranlib $@ + + clean: diff --git a/patch.1.2 b/patch.1.2 new file mode 100644 index 0000000..a343909 --- /dev/null +++ b/patch.1.2 @@ -0,0 +1,19 @@ +*** btree/bt_split.c Tue Jul 26 14:22:02 1994 +--- btree/bt_split.c Sat Jan 4 14:38:55 1997 +*************** +*** 673,679 **** + * where we decide to try and copy too much onto the left page. + * Make sure that doesn't happen. + */ +! if (skip <= off && used + nbytes >= full) { + --off; + break; + } +--- 673,679 ---- + * where we decide to try and copy too much onto the left page. + * Make sure that doesn't happen. + */ +! if (skip <= off && used + nbytes >= full || nxt == top - 1) { + --off; + break; + } diff --git a/patch.1.3 b/patch.1.3 new file mode 100644 index 0000000..5ca03df --- /dev/null +++ b/patch.1.3 @@ -0,0 +1,37 @@ +*** btree/bt_split.c.orig Sat Feb 8 10:14:10 1997 +--- btree/bt_split.c Sat Feb 8 10:14:51 1997 +*************** +*** 673,679 **** + * where we decide to try and copy too much onto the left page. + * Make sure that doesn't happen. + */ +! if (skip <= off && used + nbytes >= full || nxt == top - 1) { + --off; + break; + } +--- 673,680 ---- + * where we decide to try and copy too much onto the left page. + * Make sure that doesn't happen. + */ +! if (skip <= off && +! used + nbytes + sizeof(indx_t) >= full || nxt == top - 1) { + --off; + break; + } +*************** +*** 686,692 **** + memmove((char *)l + l->upper, src, nbytes); + } + +! used += nbytes; + if (used >= half) { + if (!isbigkey || bigkeycnt == 3) + break; +--- 687,693 ---- + memmove((char *)l + l->upper, src, nbytes); + } + +! used += nbytes + sizeof(indx_t); + if (used >= half) { + if (!isbigkey || bigkeycnt == 3) + break; diff --git a/patch.1.4 b/patch.1.4 new file mode 100644 index 0000000..cec5fbc --- /dev/null +++ b/patch.1.4 @@ -0,0 +1,22 @@ +*** btree/bt_page.c.orig Wed Jul 13 21:29:02 1994 +--- btree/bt_page.c Wed Jun 11 20:14:43 1997 +*************** +*** 65,70 **** +--- 65,71 ---- + h->prevpg = P_INVALID; + h->nextpg = t->bt_free; + t->bt_free = h->pgno; ++ F_SET(t, B_METADIRTY); + + /* Make sure the page gets written back. */ + return (mpool_put(t->bt_mp, h, MPOOL_DIRTY)); +*************** +*** 92,97 **** +--- 93,99 ---- + (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) { + *npg = t->bt_free; + t->bt_free = h->nextpg; ++ F_SET(t, B_METADIRTY); + return (h); + } + return (mpool_new(t->bt_mp, npg)); diff --git a/sources b/sources index e69de29..262c2bd 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +f80022099c5742cd179343556179aa8c db-4.8.30.tar.gz +42cc6c1e1e25818bd3e3f91328edb0f1 db.1.85.tar.gz