Manually compile python files rather than using setup.py.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 11 Feb 2008 23:35:11 +0000 (00:35 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 11 Feb 2008 23:35:11 +0000 (00:35 +0100)
(This used to be commit 94dfeb5e89a641e2af3d7426d9d25c87952198d2)

source4/lib/tdb/Makefile.in
source4/lib/tdb/configure.ac
source4/lib/tdb/setup.py [deleted file]
source4/lib/tdb/tdb.mk

index 9730dffe603b2bf9bbe34406ae1ddfab3a6235aa..f900469afae876cf5fc2a7227b726171d5a02389 100644 (file)
@@ -22,8 +22,11 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
 PICFLAG = @PICFLAG@
 SHLIBEXT = @SHLIBEXT@
 SWIG = swig
+PYTHON_CONFIG = @PYTHON_CONFIG@
 PYTHON_BUILD_TARGET = @PYTHON_BUILD_TARGET@
 PYTHON_INSTALL_TARGET = @PYTHON_INSTALL_TARGET@
+PYTHON_CHECK_TARGET = @PYTHON_CHECK_TARGET@
+LIB_PATH_VAR = @LIB_PATH_VAR@
 tdbdir = @tdbdir@
 
 TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@
@@ -39,7 +42,7 @@ $(SOLIB): $(TDB_OBJ)
 
 check: test
 
-test:: 
+test:: $(PYTHON_CHECK_TARGET)
 installcheck:: test install
 
 clean::
index 5747107f38d1beb178a04e8df16941458316561b..36d409ac11edda1dc5b1d3c62b5cc41cdbb8155d 100644 (file)
@@ -11,15 +11,19 @@ AC_LD_PICFLAG
 AC_LD_SHLIBEXT
 AC_LIBREPLACE_SHLD
 AC_LIBREPLACE_SHLD_FLAGS
+AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
 m4_include(libtdb.m4)
 AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
 
 PYTHON_BUILD_TARGET="build-python"
 PYTHON_INSTALL_TARGET="install-python"
+PYTHON_CHECK_TARGET="check-python"
 AC_SUBST(PYTHON_BUILD_TARGET)
 AC_SUBST(PYTHON_INSTALL_TARGET)
+AC_SUBST(PYTHON_CHECK_TARGET)
 if test -z "$PYTHON_CONFIG"; then
        PYTHON_BUILD_TARGET=""
        PYTHON_INSTALL_TARGET=""
+       PYTHON_CHECK_TARGET=""
 fi
 AC_OUTPUT(Makefile tdb.pc)
diff --git a/source4/lib/tdb/setup.py b/source4/lib/tdb/setup.py
deleted file mode 100755 (executable)
index 8be0c67..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/python
-from distutils.core import setup
-from distutils.extension import Extension
-
-setup(name='tdb',
-      version='1.0',
-      url="http://tdb.samba.org/",
-      py_modules=["tdb"],
-      ext_modules=[Extension('_tdb', ['tdb_wrap.c'], include_dirs=['include'],
-          library_dirs=["."], libraries=['tdb'])],
-)
index d6118dd38f9db37a770d386841893a29567446f7..10b7c6a92d6fde254049d301ee5adb498ad76260 100644 (file)
@@ -33,8 +33,13 @@ clean::
        rm -f $(SONAME) $(SOLIB) libtdb.a libtdb.$(SHLIBEXT)
        rm -f $(ALL_PROGS) tdb.pc
 
-build-python:: libtdb.$(SHLIBEXT) tdb_wrap.c
-       $(tdbdir)/setup.py build
+build-python:: _tdb.$(SHLIBEXT) 
+
+tdb_wrap.o: tdb_wrap.c
+       $(CC) -c $< $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
+
+_tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o
+       $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --libs`
 
 install:: installdirs installbin installheaders installlibs \
                  $(PYTHON_INSTALL_TARGET)
@@ -43,15 +48,14 @@ installpython:: build-python
        ./setup.py install --prefix=$(DESTDIR)$(prefix)
 
 check-python:: build-python
-       # FIXME: Should be more portable:
-       LD_LIBRARY_PATH=. PYTHONPATH=.:build/lib.linux-i686-2.4 trial python/tests/simple.py
+       $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" trial $(tdbdir)/python/tests/simple.py
 
 install-swig::
        mkdir -p $(DESTDIR)`$(SWIG) -swiglib`
        cp tdb.i $(DESTDIR)`$(SWIG) -swiglib`
 
-clean-python::
-       ./setup.py clean
+clean::
+       rm -f _tdb.$(SHLIBEXT)
 
 installdirs::
        mkdir -p $(DESTDIR)$(bindir)
@@ -77,5 +81,3 @@ libtdb.$(SHLIBEXT): $(SOLIB)
 
 $(SONAME): $(SOLIB)
        ln -fs $< $@
-
-