+inherit gettext
+
+acpaths = "-I ${S}/db/dist/aclocal -I ${S}/db/dist/aclocal_java"
+
+export STAGING_INCDIR_NATIVE
+
+SRC_URI += "file://rpm.spec.patch \
+ file://db3_configure.patch \
+ file://db_configure.ac.patch \
+ file://db_Makefile.in.patch \
+ file://Makefile.am.patch \
+ "
+
+do_patch_append () {
+ echo RLM begining of do_patch
+ export HOST_SYS
+ cat ${WORKDIR}/rpm.spec.patch | patch -s -p1 --fuzz=2
+ cat ${WORKDIR}/db3_configure.patch | patch -s -p1 --fuzz=2
+ cat ${WORKDIR}/db_configure.ac.patch | patch -s -p1 --fuzz=2
+ cat ${WORKDIR}/db_Makefile.in.patch | patch -s -p1 --fuzz=2
+ cat ${WORKDIR}/Makefile.am.patch | patch -s -p1 --fuzz=2
+ cp db3/configure db3/configure.ac
+
+ autotools_do_configure_rpm
+ mv db3/configure.ac db3/configure
+ pushd "${S}/db/dist"
+ autotools_do_configure_rpm
+ popd
+ echo RLM end of do_patch
+}
+
+autotools_do_configure_rpm() {
+ # WARNING: gross hack follows:
+ # An autotools built package generally needs these scripts, however only
+ # automake or libtoolize actually install the current versions of them.
+ # This is a problem in builds that do not use libtool or automake, in the case
+ # where we -need- the latest version of these scripts. e.g. running a build
+ # for a package whose autotools are old, on an x86_64 machine, which the old
+ # config.sub does not support. Work around this by installing them manually
+ # regardless.
+ ( for ac in `find ./ -name configure.in -o -name configure.ac`; do
+ rm -f `dirname $ac`/configure
+ done )
+ if [ -e ./configure.in -o -e ./configure.ac ]; then
+ olddir=`pwd`
+ cd .
+ # Remove any previous copy of the m4 macros
+ rm -rf ${B}/aclocal-copy/
+ ACLOCAL="aclocal --system-acdir=${B}/aclocal-copy/"
+ if [ x"${acpaths}" = xdefault ]; then
+ acpaths=
+ for i in `find . -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \
+ grep -v 'acinclude.m4' | grep -v 'aclocal-copy' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do
+ acpaths="$acpaths -I $i"
+ done
+ else
+ acpaths="${acpaths}"
+ fi
+ AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"`
+ automake --version
+ echo "AUTOV is $AUTOV"
+ if [ -d ${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV ]; then
+ ACLOCAL="$ACLOCAL --automake-acdir=${STAGING_DATADIR_NATIVE}/aclocal-$AUTOV"
+ fi
+ # The aclocal directory could get modified by other processes
+ # uninstalling data from the sysroot. See Yocto #861 for details.
+ # We avoid this by taking a copy here and then files cannot disappear.
+ # We copy native first, then target. This avoids certain races since cp-noerror
+ # won't overwrite existing files.
+ mkdir -p ${B}/aclocal-copy/
+ if [ -d ${STAGING_DATADIR_NATIVE}/aclocal ]; then
+ cp-noerror ${STAGING_DATADIR_NATIVE}/aclocal/ ${B}/aclocal-copy/
+ fi
+ if [ -d ${STAGING_DATADIR}/aclocal -a "${STAGING_DATADIR_NATIVE}/aclocal" != "${STAGING_DATADIR}/aclocal" ]; then
+ cp-noerror ${STAGING_DATADIR}/aclocal/ ${B}/aclocal-copy/
+ fi
+ # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look
+ # like it was auto-generated. Work around this by blowing it away
+ # by hand, unless the package specifically asked not to run aclocal.
+ if ! echo ${EXTRA_AUTORECONF} ${TIZEN_EXTRA_AUTORECONF} | grep -q "aclocal"; then
+ rm -f aclocal.m4
+ fi
+ if [ -e configure.in ]; then
+ CONFIGURE_AC=configure.in
+ else
+ CONFIGURE_AC=configure.ac
+ fi
+ if grep "^[[:space:]]*AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+ if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then
+ : do nothing -- we still have an old unmodified configure.ac
+ else
+ bbnote Executing glib-gettextize --force --copy
+ echo "no" | glib-gettextize --force --copy
+ fi
+ else if grep "^[[:space:]]*AM_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then
+ # We'd call gettextize here if it wasn't so broken...
+ cp ${STAGING_DATADIR_NATIVE}/gettext/config.rpath ${AUTOTOOLS_AUXDIR}/
+ if [ -d ./po/ ]; then
+ cp ${STAGING_DATADIR_NATIVE}/gettext/po/Makefile.in.in ./po/
+ if [ ! -e ./po/remove-potcdate.sin ]; then
+ cp ${STAGING_DATADIR_NATIVE}/gettext/po/remove-potcdate.sin ./po/
+ fi
+ fi
+ for i in gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4; do
+ for j in `find . -name $i | grep -v aclocal-copy`; do
+ rm $j
+ done
+ done
+ fi
+ fi
+ mkdir -p m4
+ if grep "^[[:space:]]*[AI][CT]_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then
+ bbnote Executing intltoolize --copy --force --automake
+ intltoolize --copy --force --automake
+ fi
+ bbnote Executing ACLOCAL=\"$ACLOCAL\" autoreconf --verbose --install --force ${EXTRA_AUTORECONF} ${TIZEN_EXTRA_AUTORECONF} $acpaths
+ ACLOCAL="$ACLOCAL" autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} ${TIZEN_EXTRA_AUTORECONF} $acpaths || bbfatal "autoreconf execution failed."
+ cd $olddir
+ fi
+}
\ No newline at end of file
--- /dev/null
+diff --git a/packaging/rpm.spec b/packaging/rpm.spec
+index 2380dd3..acc226b 100644
+--- a/packaging/rpm.spec
++++ b/packaging/rpm.spec
+@@ -182,21 +182,49 @@ rm -f rpmdb/db.h
+ #%patch90 -p1
+ %patch100 -p1
+
+-
+ rm -f m4/libtool.m4
+ rm -f m4/lt*.m4
+
+ %build
+ cp %{SOURCE1001} .
+-CPPFLAGS="$CPPFLAGS `pkg-config --cflags nss`"
+-CFLAGS="%{optflags}"
++CPPFLAGS="$CPPFLAGS -I${STAGING_INCDIR}/nspr4 -I${STAGING_INCDIR}/nss3"
++CFLAGS="%{optflags} -DHAVE_SYSTEM_INCLUDE_FILES"
+ export CPPFLAGS CFLAGS LDFLAGS
+
+ # Using configure macro has some unwanted side-effects on rpm platform
+ # setup, use the old-fashioned way for now only defining minimal paths.
+
+ libtoolize -f -c
+-./autogen.sh \
++#export CPPFLAGS
++#export CFLAGS
++#export LDFLAGS
++
++#pushd db/dist/
++#autoreconf -i --verbose
++#popd
++
++#autoreconf -i --verbose
++
++#./autogen.sh \
++#./configure \
++pushd db/dist
++. ./RELEASE
++
++# Edit version information we couldn't pre-compute.
++sed -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \
++ -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \
++ -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \
++ -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \
++ -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \
++ -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure > configure.version
++mv configure.version configure
++
++chmod 555 configure
++
++chmod 555 config.guess config.sub install-sh
++popd
++
++./configure \
+ --prefix=%{_prefix} \
+ --sysconfdir=%{_sysconfdir} \
+ --localstatedir=%{_localstatedir} \
+@@ -207,8 +235,12 @@ libtoolize -f -c
+ %endif
+ --with-lua \
+ --with-cap \
+- --with-msm
+-
++ --with-msm \
++ --build=%{_build} \
++ --host=%{_host} \
++ --target=%{_target_platform}
++
++
+ make %{?_smp_mflags}
+
+ %install
+@@ -248,10 +280,7 @@ rm -rf %{buildroot}%{_mandir}/*/man?
+ %clean
+ rm -rf %{buildroot}
+
+-%if %{with check}
+-%check
+-make check
+-%endif
++
+
+ %remove_docs
+ rm -rf %{buildroot}/usr/share/man
+@@ -271,7 +300,7 @@ fi
+ exit 0
+
+
+-%files -f rpm.lang
++%files
+ %manifest rpm.manifest
+ %defattr(-,root,root,-)
+ %doc GROUPS COPYING CREDITS
+@@ -305,7 +334,7 @@ exit 0
+ %{_libdir}/rpm/rpm2cpio.sh
+ %{_libdir}/rpm/tgpg
+
+-%{_libdir}/rpm/platform
++#%{_libdir}/rpm/platform
+
+ %files libs
+ %manifest rpm.manifest