diff options
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r-- | source4/lib/tdb/Makefile.in | 126 | ||||
-rw-r--r-- | source4/lib/tdb/config.mk | 4 | ||||
-rw-r--r-- | source4/lib/tdb/configure.ac | 5 | ||||
-rw-r--r-- | source4/lib/tdb/python/tests/simple.py | 5 | ||||
-rw-r--r-- | source4/lib/tdb/rules.mk | 21 | ||||
-rwxr-xr-x | source4/lib/tdb/setup.py | 11 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.mk | 86 |
7 files changed, 139 insertions, 119 deletions
diff --git a/source4/lib/tdb/Makefile.in b/source4/lib/tdb/Makefile.in index c98d7e0497..090bb6e2dc 100644 --- a/source4/lib/tdb/Makefile.in +++ b/source4/lib/tdb/Makefile.in @@ -22,122 +22,38 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PICFLAG = @PICFLAG@ SHLIBEXT = @SHLIBEXT@ SWIG = swig - -.PHONY: test - -PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT) -PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT) -ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL) +PYTHON = @PYTHON@ +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@ -DIRS = bin common tools - -SONAME = libtdb.$(SHLIBEXT).1 -SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION) - -all: showflags dirs $(PROGS) $(SOLIB) libtdb.a @PYTHON_BUILD_TARGET@ - -showflags: - @echo 'tdb will be compiled with flags:' - @echo ' CFLAGS = $(CFLAGS)' - @echo ' CPPFLAGS = $(CPPFLAGS)' - @echo ' LDFLAGS = $(LDFLAGS)' - @echo ' LIBS = $(LIBS)' - -.SUFFIXES: .c .o - -.c.o: - @echo Compiling $*.c - @mkdir -p `dirname $@` - @$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@ - -dirs: - @mkdir -p $(DIRS) - -install: all installdirs installbin installheaders installlibs @PYTHON_INSTALL_TARGET@ - -installdirs: - mkdir -p $(DESTDIR)$(bindir) - mkdir -p $(DESTDIR)$(includedir) - mkdir -p $(DESTDIR)$(libdir) - mkdir -p $(DESTDIR)$(libdir)/pkgconfig - -installbin: installdirs - cp $(PROGS) $(DESTDIR)$(bindir) - -installheaders: installdirs - cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir) - -installlibs: installdirs - cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig - cp libtdb.a $(SOLIB) $(DESTDIR)$(libdir) - -libtdb.a: $(TDB_OBJ) - ar -rv libtdb.a $(TDB_OBJ) +default: all -libtdb.$(SHLIBEXT): $(SOLIB) - ln -fs $< $@ +include $(tdbdir)/tdb.mk +include $(tdbdir)/rules.mk -$(SONAME): $(SOLIB) - ln -fs $< $@ +all:: showflags dirs $(PROGS) $(TDB_SOLIB) libtdb.a $(PYTHON_BUILD_TARGET) -$(SOLIB): $(TDB_OBJ) - $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(SONAME) +install:: all +$(TDB_SOLIB): $(TDB_OBJ) + $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(TDB_SONAME) -TDB_LIB = libtdb.a +check: test -bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm +test:: $(PYTHON_CHECK_TARGET) +installcheck:: test install -bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb +clean:: + rm -f *.o *.a */*.o -bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb - -bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb - -bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb - -test: bin/tdbtorture$(EXEEXT) - bin/tdbtorture$(EXEEXT) - -installcheck: test install - -clean: - rm -f $(ALL_PROGS) *.o *.a common/*.o tools/*.o tdb.pc - rm -f test.db test.tdb torture.tdb test.gdbm - rm -f $(SONAME) $(SOLIB) libtdb.a libtdb.$(SHLIBEXT) - -distclean: clean - rm -f *~ */*~ +distclean:: clean rm -f config.log config.status include/config.h config.cache rm -f Makefile -realdistclean: distclean +realdistclean:: distclean rm -f configure include/config.h.in - -.SUFFIXES: .i _wrap.c - -.i_wrap.c: - $(SWIG) -O -Wall -python -keyword $< - -build-python: libtdb.$(SHLIBEXT) tdb_wrap.c - ./setup.py build - -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 - -install-swig: - mkdir -p $(DESTDIR)`$(SWIG) -swiglib` - cp tdb.i $(DESTDIR)`$(SWIG) -swiglib` - -clean-python: - ./setup.py clean diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index 820c55e363..89d6af9043 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -1,9 +1,7 @@ ################################################ # Start SUBSYSTEM LIBTDB [LIBRARY::LIBTDB] -VERSION = 0.0.1 -SO_VERSION = 0 -PC_FILE = tdb.pc +OUTPUT_TYPE = STATIC_LIBRARY OBJ_FILES = \ common/tdb.o common/dump.o common/io.o common/lock.o \ common/open.o common/traverse.o common/freelist.o \ diff --git a/source4/lib/tdb/configure.ac b/source4/lib/tdb/configure.ac index 5747107f38..9b16a82c33 100644 --- a/source4/lib/tdb/configure.ac +++ b/source4/lib/tdb/configure.ac @@ -11,15 +11,20 @@ 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]) +AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python]) 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/python/tests/simple.py b/source4/lib/tdb/python/tests/simple.py index 1cc51aea07..94407b6398 100644 --- a/source4/lib/tdb/python/tests/simple.py +++ b/source4/lib/tdb/python/tests/simple.py @@ -142,3 +142,8 @@ class SimpleTdbTests(TestCase): self.assertEquals(0, len(self.tdb)) self.tdb["entry"] = "value" self.assertEquals(1, len(self.tdb)) + + +if __name__ == '__main__': + import unittest + unittest.TestProgram() diff --git a/source4/lib/tdb/rules.mk b/source4/lib/tdb/rules.mk new file mode 100644 index 0000000000..7b765625df --- /dev/null +++ b/source4/lib/tdb/rules.mk @@ -0,0 +1,21 @@ +.SUFFIXES: .i _wrap.c + +.i_wrap.c: + $(SWIG) -O -Wall -python -keyword $< + +showflags:: + @echo 'tdb will be compiled with flags:' + @echo ' CFLAGS = $(CFLAGS)' + @echo ' CPPFLAGS = $(CPPFLAGS)' + @echo ' LDFLAGS = $(LDFLAGS)' + @echo ' LIBS = $(LIBS)' + +.SUFFIXES: .c .o + +.c.o: + @echo Compiling $*.c + @mkdir -p `dirname $@` + @$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@ + +distclean:: + rm -f *~ */*~ diff --git a/source4/lib/tdb/setup.py b/source4/lib/tdb/setup.py deleted file mode 100755 index 8be0c67e0b..0000000000 --- a/source4/lib/tdb/setup.py +++ /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'])], -) diff --git a/source4/lib/tdb/tdb.mk b/source4/lib/tdb/tdb.mk new file mode 100644 index 0000000000..0e53927366 --- /dev/null +++ b/source4/lib/tdb/tdb.mk @@ -0,0 +1,86 @@ +dirs:: + @mkdir -p bin common tools + +PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT) +PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT) +ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL) + +TDB_SONAME = libtdb.$(SHLIBEXT).1 +TDB_SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION) + +TDB_LIB = libtdb.a + +bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm + +bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb + +bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb + +bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb + +bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb + +test:: bin/tdbtorture$(EXEEXT) $(TDB_SONAME) + $(LIB_PATH_VAR)=. bin/tdbtorture$(EXEEXT) + +clean:: + rm -f test.db test.tdb torture.tdb test.gdbm + rm -f $(TDB_SONAME) $(TDB_SOLIB) libtdb.a libtdb.$(SHLIBEXT) + rm -f $(ALL_PROGS) tdb.pc + +build-python:: _tdb.$(SHLIBEXT) + +tdb_wrap.o: $(tdbdir)/tdb_wrap.c + $(CC) $(PICFLAG) -c $(tdbdir)/tdb_wrap.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) + +install-python:: build-python + 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 $(tdbdir)/tdb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` + cp _tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"` + +check-python:: build-python + $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py + +install-swig:: + mkdir -p $(DESTDIR)`$(SWIG) -swiglib` + cp tdb.i $(DESTDIR)`$(SWIG) -swiglib` + +clean:: + rm -f _tdb.$(SHLIBEXT) + +installdirs:: + mkdir -p $(DESTDIR)$(bindir) + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(libdir)/pkgconfig + +installbin:: all installdirs + cp $(PROGS) $(DESTDIR)$(bindir) + +installheaders:: installdirs + cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir) + +installlibs:: all installdirs + cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig + cp libtdb.a $(TDB_SOLIB) $(DESTDIR)$(libdir) + +libtdb.a: $(TDB_OBJ) + ar -rv libtdb.a $(TDB_OBJ) + +libtdb.$(SHLIBEXT): $(TDB_SOLIB) + ln -fs $< $@ + +$(TDB_SONAME): $(TDB_SOLIB) + ln -fs $< $@ |