--- /dev/null
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id:
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=xapian-bindings
+PKG_VERSION:=1.0.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://oligarchy.co.uk/xapian/$(PKG_VERSION)
+PKG_FIXUP:=libtool
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+define Package/python-xapian
+ SECTION:=lang
+ CATEGORY:=Languages
+ SUBMENU:=Python
+ TITLE:=xapian python bindings
+ URL:=http://oligarchy.co.uk/xapian/
+ DEPENDS:=python +libxapian
+endef
+
+define Build/Configure
+ $(call Build/Configure/Default, --with-python)
+endef
+
+define Package/python-xapian/install
+ $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+ $(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* $(1)$(PYTHON_PKG_DIR)
+endef
+
+$(eval $(call BuildPackage,python-xapian))
+
+
--- /dev/null
+diff -urN xapian-bindings-1.0.7.orig/configure xapian-bindings-1.0.7/configure
+--- xapian-bindings-1.0.7.orig/configure 2008-08-26 18:19:07.000000000 +0200
++++ xapian-bindings-1.0.7/configure 2008-08-26 19:06:25.000000000 +0200
+@@ -15079,7 +15079,7 @@
+ { $as_echo "$as_me:$LINENO: checking for directory to install python bindings in" >&5
+ $as_echo_n "checking for directory to install python bindings in... " >&6; }
+ if test -z "$PYTHON_LIB" ; then
+- PYTHON_LIB=`$PYTHON -c 'import os,distutils.sysconfig;print(distutils.sysconfig.get_python_lib(1).replace(os.sep,"/"))'`
++ PYTHON_LIB=`$PYTHON -c "import os,distutils.sysconfig;print(distutils.sysconfig.get_python_lib(1, 0, chr(36)+'{exec_prefix}').replace(os.sep, '/'))"`
+ fi
+ { $as_echo "$as_me:$LINENO: result: $PYTHON_LIB" >&5
+ $as_echo "$PYTHON_LIB" >&6; }
+diff -urN xapian-bindings-1.0.7.orig/configure.ac xapian-bindings-1.0.7/configure.ac
+--- xapian-bindings-1.0.7.orig/configure.ac 2008-08-26 18:19:07.000000000 +0200
++++ xapian-bindings-1.0.7/configure.ac 2008-08-26 18:49:34.000000000 +0200
+@@ -243,7 +243,9 @@
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING([for directory to install python bindings in])
+ if test -z "$PYTHON_LIB" ; then
+- PYTHON_LIB=`$PYTHON -c 'import os,distutils.sysconfig;print(distutils.sysconfig.get_python_lib(1).replace(os.sep,"/"))'`
++ PYTHON_LIB=`$PYTHON -c 'import os,distutils.sysconfig;
++ print(distutils.sysconfig.get_python_lib(1,
++ prefix='${exec_prefix}').replace(os.sep,"/"))'`
+ fi
+ AC_MSG_RESULT([$PYTHON_LIB])
+ AC_ARG_VAR(PYTHON_LIB, [Directory to install python bindings in])
+diff -urN xapian-bindings-1.0.7.orig/python/Makefile.am xapian-bindings-1.0.7/python/Makefile.am
+--- xapian-bindings-1.0.7.orig/python/Makefile.am 2008-08-26 18:19:07.000000000 +0200
++++ xapian-bindings-1.0.7/python/Makefile.am 2008-08-26 18:49:34.000000000 +0200
+@@ -23,7 +23,7 @@
+
+ # Install as _DATA rather than _SCRIPTS because we don't want to make these
+ # executable (they don't have a #! line).
+-pylib_DATA = xapian.py xapian.pyc xapian.pyo
++pylib_DATA = xapian.py
+
+ pylib_LTLIBRARIES = _xapian.la
+
+@@ -53,20 +53,12 @@
+ xapian.py: modern/xapian.py
+ cp `test -f modern/xapian.py || echo '$(srcdir)/'`modern/xapian.py .
+
+-# We "import _xapian" first so that if we fail to import the glue library
+-# we don't generate a broken xapian.pyc or xapian.pyo.
+-xapian.pyc: xapian.py _xapian$(PYTHON_SO)
+- PYTHONPATH=. $(PYTHON) -c "import _xapian;import xapian"
+-
+-xapian.pyo: xapian.py _xapian$(PYTHON_SO)
+- PYTHONPATH=. $(PYTHON) -O -c "import _xapian;import xapian"
+-
+ _xapian$(PYTHON_SO): _xapian.la
+ $(LIBTOOL) --config > libtoolconfig.tmp
+ . ./libtoolconfig.tmp; cp $$objdir/_xapian$(PYTHON_SO) .
+ rm -f libtoolconfig.tmp
+
+-CLEANFILES = _xapian$(PYTHON_SO) xapian.py xapian.pyc xapian.pyo testsuite.pyc
++CLEANFILES = _xapian$(PYTHON_SO) xapian.py testsuite.pyc
+
+ if MAINTAINER_MODE
+ # We need to explicitly set -outdir because on Windows, SWIG splits paths at
+diff -urN xapian-bindings-1.0.7.orig/python/Makefile.in xapian-bindings-1.0.7/python/Makefile.in
+--- xapian-bindings-1.0.7.orig/python/Makefile.in 2008-08-26 18:19:07.000000000 +0200
++++ xapian-bindings-1.0.7/python/Makefile.in 2008-08-26 18:49:34.000000000 +0200
+@@ -292,14 +292,14 @@
+
+ # Install as _DATA rather than _SCRIPTS because we don't want to make these
+ # executable (they don't have a #! line).
+-pylib_DATA = xapian.py xapian.pyc xapian.pyo
++pylib_DATA = xapian.py
+ pylib_LTLIBRARIES = _xapian.la
+ AM_CPPFLAGS = -I$(PYTHON_INC)
+ AM_CXXFLAGS = $(SWIG_CXXFLAGS) $(XAPIAN_CXXFLAGS)
+ _xapian_la_LDFLAGS = -avoid-version -module -shrext "$(PYTHON_SO)" $(NO_UNDEFINED)
+ _xapian_la_SOURCES = modern/xapian_wrap.cc
+ _xapian_la_LIBADD = $(XAPIAN_LIBS) $(PYTHON_LIBS)
+-CLEANFILES = _xapian$(PYTHON_SO) xapian.py xapian.pyc xapian.pyo \
++CLEANFILES = _xapian$(PYTHON_SO) xapian.py \
+ testsuite.pyc $(am__append_2)
+ @MAINTAINER_MODE_FALSE@MAINTAINERCLEANFILES = $(BUILT_SOURCES)
+ all: $(BUILT_SOURCES)
+@@ -819,14 +819,6 @@
+ xapian.py: modern/xapian.py
+ cp `test -f modern/xapian.py || echo '$(srcdir)/'`modern/xapian.py .
+
+-# We "import _xapian" first so that if we fail to import the glue library
+-# we don't generate a broken xapian.pyc or xapian.pyo.
+-xapian.pyc: xapian.py _xapian$(PYTHON_SO)
+- PYTHONPATH=. $(PYTHON) -c "import _xapian;import xapian"
+-
+-xapian.pyo: xapian.py _xapian$(PYTHON_SO)
+- PYTHONPATH=. $(PYTHON) -O -c "import _xapian;import xapian"
+-
+ _xapian$(PYTHON_SO): _xapian.la
+ $(LIBTOOL) --config > libtoolconfig.tmp
+ . ./libtoolconfig.tmp; cp $$objdir/_xapian$(PYTHON_SO) .
--- /dev/null
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id:
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=xapian-core
+PKG_VERSION:=1.0.7
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://oligarchy.co.uk/xapian/$(PKG_VERSION)
+PKG_FIXUP:=libtool
+
+include $(INCLUDE_DIR)/package.mk
+
+PKG_INSTALL=1
+
+EXTRA_LDFLAGS+= \
+ -L$(STAGING_DIR)/usr/lib/libintl/lib \
+ -L$(STAGING_DIR)/usr/lib/libiconv/lib \
+ -L$(TOOLCHAIN_DIR)/lib
+
+define Package/libxapian
+ SECTION:=lib
+ CATEGORY:=Libraries
+ TITLE:=xapian
+ URL:=http://xapian.org
+ DEPENDS:=+libstdcpp
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/usr/share/aclocal
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/share/aclocal/* \
+ $(1)/usr/share/aclocal
+
+ $(INSTALL_DIR) $(1)/usr/include
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/include/xapian.h \
+ $(1)/usr/include
+ $(INSTALL_DIR) $(1)/usr/include/xapian
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/include/xapian/* \
+ $(1)/usr/include/xapian
+
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/*.{so*,la} \
+ $(1)/usr/lib/
+ $(INSTALL_DIR) $(2)/bin
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/xapian-config \
+ $(2)/bin
+ $(SED) 's,prefix=",prefix="$(STAGING_DIR),g' $(2)/bin/xapian-config
+
+ #FIXME: Libtool should handle this
+ $(SED) \
+ "s,$(STAGING_DIR)/usr/lib/libstdc++,$(TOOLCHAIN_DIR)/lib/libstdc++,g" \
+ $(1)/usr/lib/libxapian.la
+endef
+
+define Package/libxapian/install
+ $(INSTALL_DIR) $(1)/usr/lib/
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a} \
+ $(1)/usr/lib
+ $(INSTALL_DIR) $(1)/usr/bin/
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/* \
+ $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,libxapian))
+
+