summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb.mk
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb.mk')
-rw-r--r--source4/lib/ldb/ldb.mk21
1 files changed, 14 insertions, 7 deletions
diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk
index b9aa24b276..ec4c34f6d8 100644
--- a/source4/lib/ldb/ldb.mk
+++ b/source4/lib/ldb/ldb.mk
@@ -65,18 +65,25 @@ examples/ldifreader: examples/ldifreader.o $(LIBS)
$(CC) -o examples/ldifreader examples/ldifreader.o $(LIB_FLAGS)
# Python bindings
-build-python:: lib/libldb.$(SHLIBEXT) ldb_wrap.c
- $(ldbdir)/setup.py build
+build-python:: _ldb.$(SHLIBEXT)
+
+ldb_wrap.o: $(ldbdir)/ldb_wrap.c
+ $(CC) -c $(ldbdir)/ldb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+
+_ldb.$(SHLIBEXT): $(LIBS) ldb_wrap.o
+ $(SHLD) $(SHLD_FLAGS) -o _ldb.$(SHLIBEXT) ldb_wrap.o $(LIB_FLAGS)
install-python:: build-python
- $(ldbdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
+ mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \
+ $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
+ cp $(ldbdir)/ldb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"`
+ cp _ldb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
install-swig::
cp ldb.i `$(SWIG) -swiglib`
check-python:: build-python
- # FIXME: This isn't portable
- LD_LIBRARY_PATH=lib PYTHONPATH=.:build/lib.linux-i686-2.4/ trial tests/python/api.py
+ LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) $(PYTHON) $(ldbdir)/tests/python/api.py
-clean-python::
- $(ldbdir)/setup.py clean
+clean::
+ rm -f _ldb.$(SHLIBEXT)