From 2ce5ae845f6bf36d90ee82cc9bac58f6210ca024 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 30 Oct 2012 16:03:53 -0700 Subject: add packaging --- packaging/baselibs.conf | 2 + packaging/check-build.sh | 13 +++ packaging/db-4.8.30.patch | 64 +++++++++++++++ packaging/db4.spec | 199 ++++++++++++++++++++++++++++++++++++++++++++++ packaging/getpatches | 10 +++ 5 files changed, 288 insertions(+) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/check-build.sh create mode 100644 packaging/db-4.8.30.patch create mode 100644 packaging/db4.spec create mode 100644 packaging/getpatches diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 00000000..55e88ce8 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,2 @@ +libdb +libdb-devel diff --git a/packaging/check-build.sh b/packaging/check-build.sh new file mode 100644 index 00000000..148e3c62 --- /dev/null +++ b/packaging/check-build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Copyright (c) 2004 SuSE Linux AG, Germany. All rights reserved. +# + +# get kernel version +OFS="$IFS" ; IFS=".-" ; version=(`uname -r`) ; IFS="$OIFS" +if test ${version[0]} -lt 2 -o ${version[1]} -lt 6 -o ${version[2]} -lt 4 ; then + echo "FATAL: kernel too old, need kernel >= 2.6.4 for this package" 1>&2 + exit 1 +fi + +exit 0 + diff --git a/packaging/db-4.8.30.patch b/packaging/db-4.8.30.patch new file mode 100644 index 00000000..4a7c235a --- /dev/null +++ b/packaging/db-4.8.30.patch @@ -0,0 +1,64 @@ +Index: dist/configure.ac +=================================================================== +--- dist/configure.ac.orig ++++ dist/configure.ac +@@ -852,20 +852,20 @@ LTLIBOBJS=`echo "$LIB@&t@OBJS" | + AC_SUBST(LTLIBOBJS) + + # Initial output file list. +-CREATE_LIST="Makefile +- db_cxx.h:$srcdir/../dbinc/db_cxx.in +- db_int.h:$srcdir/../dbinc/db_int.in +- clib_port.h:$srcdir/../dist/clib_port.in ++CREATE_LIST="Makefile \ ++ db_cxx.h:$srcdir/../dbinc/db_cxx.in \ ++ db_int.h:$srcdir/../dbinc/db_int.in \ ++ clib_port.h:$srcdir/../dist/clib_port.in \ + include.tcl:$srcdir/../test/include.tcl" + + # Create the db.h file from a source file, a list of global function + # prototypes, and, if configured for unique names, a list of #defines + # to do DB_VERSION_UNIQUE_NAME substitution. + if test "$db_cv_uniquename" = "yes"; then +- CREATE_LIST="$CREATE_LIST ++ CREATE_LIST="$CREATE_LIST \ + db.h:$srcdir/../dbinc/db.in:$srcdir/../dbinc_auto/api_flags.in:$srcdir/../dbinc_auto/ext_def.in:$srcdir/../dbinc_auto/ext_prot.in" + else +- CREATE_LIST="$CREATE_LIST ++ CREATE_LIST="$CREATE_LIST \ + db.h:$srcdir/../dbinc/db.in:$srcdir/../dbinc_auto/api_flags.in:$srcdir/../dbinc_auto/ext_prot.in" + fi + +@@ -873,7 +873,7 @@ fi + # does the DB_VERSION_UNIQUE_NAME substitution), which is included by + # the db_int.h file. + if test "$db_cv_uniquename" = "yes"; then +- CREATE_LIST="$CREATE_LIST ++ CREATE_LIST="$CREATE_LIST \ + db_int_def.h:$srcdir/../dbinc_auto/int_def.in" + db_int_def='#include "db_int_def.h"' + fi +@@ -883,18 +883,18 @@ fi + # of #defines to do DB_VERSION_UNIQUE_NAME substitution. + if test "$db_cv_compat185" = "yes"; then + if test "$db_cv_uniquename" = "yes"; then +- CREATE_LIST="$CREATE_LIST +- db_185.h:$srcdir/../dbinc/db_185.in:$srcdir/../dbinc_auto/ext_185_def.in:$srcdir/../dbinc_auto/ext_185_prot.in ++ CREATE_LIST="$CREATE_LIST \ ++ db_185.h:$srcdir/../dbinc/db_185.in:$srcdir/../dbinc_auto/ext_185_def.in:$srcdir/../dbinc_auto/ext_185_prot.in \ + db185_int.h:$srcdir/../db185/db185_int.in:$srcdir/../dbinc_auto/ext_185_def.in:$srcdir/../dbinc_auto/ext_185_prot.in" + else +- CREATE_LIST="$CREATE_LIST +- db_185.h:$srcdir/../dbinc/db_185.in:$srcdir/../dbinc_auto/ext_185_prot.in ++ CREATE_LIST="$CREATE_LIST \ ++ db_185.h:$srcdir/../dbinc/db_185.in:$srcdir/../dbinc_auto/ext_185_prot.in \ + db185_int.h:$srcdir/../db185/db185_int.in:$srcdir/../dbinc_auto/ext_185_prot.in" + fi + fi + + if test "$db_cv_stl" = "yes"; then +- CREATE_LIST="$CREATE_LIST ++ CREATE_LIST="$CREATE_LIST \ + dbstl_common.h:$srcdir/../stl/dbstl_common.in" + fi + diff --git a/packaging/db4.spec b/packaging/db4.spec new file mode 100644 index 00000000..39d02f9d --- /dev/null +++ b/packaging/db4.spec @@ -0,0 +1,199 @@ +%define generic_name db +%define docdir %{_defaultdocdir}/%{name} +%define major 4 +%define minor 8 + +Name: db4 +Version: %{major}.%{minor}.30.NC +Release: 0 +Summary: Berkeley DB Database Library Version 4.8 +License: BSD-3-Clause +Group: System/Libraries +Url: http://www.sleepycat.com +Source: db-%{version}.tar.gz +Source1: %{name}.changes +Source9: getpatches +Patch0: db-%{version}.patch +BuildRequires: autoconf +BuildRequires: fdupes +BuildRequires: gcc-c++ +Provides: db = %{version} + +%description +The Berkeley DB Database is a programmatic toolkit that provides +database support for applications. + +This package contains the necessary runtime libraries. + +%package utils +Summary: Command Line tools for Managing Berkeley DB Databases +Group: Productivity/Databases/Tools + +%description utils +The Berkeley DB Database is a programmatic toolkit that provides +database support for applications. + +This package contains the command line tools for managing Berkeley DB +databases. + +%package doc +Summary: Documentation for Berkeley DB +Group: Development/Libraries/C and C++ +BuildArch: noarch + +%description doc +The Berkeley DB Database is a programmatic toolkit that provides +database support for applications. + +This package contains the documentation. + +%package devel +Summary: Development Files and Libraries for the Berkeley DB library Version 4.8 +Group: Development/Libraries/C and C++ +Requires: %{name} = %{version} +Requires: glibc-devel + +%description devel +The Berkeley DB Database is a programmatic toolkit that provides +database support for applications. + +This package contains the header files and libraries. + +%prep +%setup -q -n %{generic_name}-%{version} +%patch0 +cd .. +tar -jcf %{generic_name}-%{version}.tar.bz2 %{generic_name}-%{version} + +%build +cd dist +# dist/RELEASE codes the build date into the binary. +# Use last change of changes file instead +LAST_MOD=`stat --format="%Y" %SOURCE1` +DIST_DATE=`date '+%B %e, %Y' --date="@$LAST_MOD"` +sed -i -e "s/^DB_RELEASE_DATE=.*$/DB_RELEASE_DATE=\"$DIST_DATE\"/" RELEASE +./s_config +CFLAGS="%{optflags} -fno-strict-aliasing" +CC=gcc +export CFLAGS CXXFLAGS CC +# +# Build now the NPTL version +# +mkdir ../build_nptl +cd ../build_nptl +../dist/configure --prefix=%{_prefix} \ + --libdir=%{_libdir} --enable-compat185 --disable-dump185 \ + --enable-shared --disable-static --enable-cxx \ + --with-mutex="POSIX/pthreads/library" \ +%ifarch %arm + %{_target_cpu}-suse-linux-gnueabi +%else + %{_target_cpu}-suse-linux +%endif +# Make sure O_DIRECT is really disabled (build host could have old kernel) +perl -pi -e 's/#define HAVE_O_DIRECT 1/#undef HAVE_O_DIRECT/' db_config.h +# Remove libtool predep_objects and postdep_objects wonkiness +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} LIBSO_LIBS='$(LIBS)' LIBXSO_LIBS='$(LIBS)'" -L%{_libdir} -lstdc++" + +%install +mkdir -p %{buildroot}%{_includedir}/db4 +CONFIG_ARGS=$(find . -name "config.log" -exec grep "\$ \.\./dist\/configure" {} \; | sed 's/.*configure\( --.*\)/\1/g') +if [ -z "$CONFIG_ARGS" ] +then + echo "could not find configure arguments ... exiting" + exit 42 +fi +mkdir -p %{buildroot}%{_libdir} +cd build_nptl +make prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} strip=true install +cd .. +# make ldd happy: +chmod 755 %{buildroot}%{_libdir}/libdb*.so +# Fix header file installation +mv %{buildroot}%{_includedir}/*.h %{buildroot}%{_includedir}/db4 +echo "#include " > %{buildroot}%{_includedir}/db.h +echo "#include " > %{buildroot}%{_includedir}/db_185.h +echo "#include " > %{buildroot}%{_includedir}/db_cxx.h +# remove dangling tags symlink from examples. +rm -f examples_cxx/tags +rm -f examples_c/tags +# Move documentation to the right directory +mkdir -p %{buildroot}%{docdir} +mv %{buildroot}%{_prefix}/docs/* %{buildroot}/%{docdir} +cp -a examples_cxx examples_c %{buildroot}/%{docdir} +cp -a LICENSE README %{buildroot}/%{docdir} +# +# Remove api documentation for C++, Java and TCL +rm -rf %{buildroot}/%{docdir}/csharp +rm -rf %{buildroot}/%{docdir}/java +rm -rf %{buildroot}/%{docdir}/api_reference/CXX +rm -rf %{buildroot}/%{docdir}/api_reference/STL +rm -rf %{buildroot}/%{docdir}/api_reference/TCL +rm -rf %{buildroot}/%{docdir}/gsg*/CXX +rm -rf %{buildroot}/%{docdir}/gsg*/JAVA +mv %{buildroot}/%{docdir}/collections/tutorial %{buildroot}/%{docdir}/ +# Remove crappy *.la files +rm -rf %{buildroot}%{_libdir}/*.la +rm -rf %{buildroot}%{_libdir}/tls/*.la +%fdupes %{buildroot}%{_libdir} +%fdupes %{buildroot}%{docdir} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%{_libdir}/libdb-%{major}.%{minor}.so +%{_libdir}/libdb_cxx-%{major}.%{minor}.so + +%files doc +%defattr(-,root,root) +%dir %{docdir} +%doc %{docdir}/LICENSE +%doc %{docdir}/README +%doc %{docdir}/index.html +%doc %{docdir}/license +%doc %{docdir}/articles +%doc %{docdir}/api_reference +%doc %{docdir}/examples_c +%doc %{docdir}/examples_cxx +%doc %{docdir}/gsg* +%doc %{docdir}/porting +%doc %{docdir}/programmer_reference +%doc %{docdir}/tutorial + +%files utils +%defattr(-,root,root) +%{_bindir}/db_archive +%{_bindir}/db_checkpoint +%{_bindir}/db_deadlock +%{_bindir}/db_dump +%{_bindir}/db_load +%{_bindir}/db_printlog +%{_bindir}/db_recover +%{_bindir}/db_sql +%{_bindir}/db_stat +%{_bindir}/db_upgrade +%{_bindir}/db_verify +%{_bindir}/db_hotbackup + +%files devel +%defattr(-,root,root) +%dir %{_includedir}/db4 +%{_includedir}/db.h +%{_includedir}/db_185.h +%{_includedir}/db_cxx.h +%{_includedir}/db4/db.h +%{_includedir}/db4/db_185.h +%{_includedir}/db4/db_cxx.h +%{_libdir}/libdb.so +%{_libdir}/libdb-%{major}.so +%{_libdir}/libdb_cxx.so +%{_libdir}/libdb_cxx-%{major}.so + +%changelog diff --git a/packaging/getpatches b/packaging/getpatches new file mode 100644 index 00000000..4cee227e --- /dev/null +++ b/packaging/getpatches @@ -0,0 +1,10 @@ +#!/bin/bash +VERSION=4.8.30 + +if [ ! $DELETE = false ] +then + DELETE=true +fi + +wget http://www.oracle.com/technology/products/berkeley-db/db/update/$VERSION/patch.$VERSION.html -r -l1 +for file in `find www.oracle.com/ -name "patch\.*" | grep -v html`; do cp $file .; done -- cgit v1.2.3