Avoid using setup.py for intsallation.
[samba.git] / source4 / lib / ldb / ldb.mk
index b9aa24b276d1c9f768c5f81093d234c965b59fd3..6d0ad44d38b887b729402e5555ddefb29ade7941 100644 (file)
@@ -65,18 +65,23 @@ 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)
+       cp $(ldbdir)/ldb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0)"`
+       cp _ldb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)"`
 
 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)