python: Build shared python modules for generic use.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 14 Jan 2008 22:04:57 +0000 (23:04 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 16 Jan 2008 14:08:00 +0000 (15:08 +0100)
source/build/smb_build/input.pm
source/build/smb_build/makefile.pm
source/scripting/python/config.mk

index 6d5c4f4a1ed5fbdb610802467d19d112a75416f9..0b26aee65e37319dc539283766301b8f87df5604 100644 (file)
@@ -182,7 +182,7 @@ sub check_python($$$)
 
        $python->{SUBSYSTEM} = "LIBPYTHON";
 
-       check_module($INPUT, $python, $default_ot);
+       check_module($INPUT, $python, ["SHARED_LIBRARY", "STATIC_LIBRARY"]);
 }
 
 sub check_binary($$)
index 0e7771c3f2a337786abcc17d9b19fcdfc641dbbd..ce1e757c61b9c1523b0d1cc0b44484ab985dc503 100644 (file)
@@ -27,6 +27,7 @@ sub new($$$)
        $self->{torture_progs} = [];
        $self->{static_libs} = [];
        $self->{python_dsos} = [];
+       $self->{python_pys} = [];
        $self->{shared_libs} = [];
        $self->{installable_shared_libs} = [];
        $self->{headers} = [];
@@ -345,7 +346,7 @@ sub SharedModule($$)
 
        push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
 
-       if (defined($ctx->{INIT_FUNCTION})) {
+       if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") {
                my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
                $init_fn =~ s/\(\*\)/init_module/;
                my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
@@ -539,7 +540,7 @@ sub PythonFiles($$)
                $self->output("$target: $source\n" .
                                          "\tmkdir -p \$(builddir)/bin/python\n" .
                              "\tcp $source \$@\n\n");
-               push (@{$self->{python_dsos}}, $target);
+               push (@{$self->{python_pys}}, $target);
        }
 }
 
@@ -714,6 +715,7 @@ sub write($$)
        $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
        $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
        $self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
+       $self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
        $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
        $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
        $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
index f00b4779199a0d6b00b7a607329e51b6c1b73ebd..450da0e90a66603ed4bbff7b2e479089bc29b4ee 100644 (file)
@@ -16,7 +16,7 @@ PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS
 SWIG_FILE = misc.i
 
 # Swig extensions
-swig: pythonmods
+swig:: pythonmods
 
 .SUFFIXES: _wrap.c .i
 
@@ -28,13 +28,19 @@ realdistclean::
        @-rm -f bin/python/*
        # FIXME: Remove _wrap.c files
 
-pythonmods: $(PYTHON_DSOS)
+pythonmods:: $(PYTHON_DSOS) $(PYTHON_PYS)
 
 PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py
 
 pydoctor:: pythonmods
        LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --make-html --docformat=restructuredtext --add-package scripting/python/samba/ $(addprefix --add-module , $(PYDOCTOR_MODULES))
 
+installpython:: pythonmods
+       @$(SHELL) $(srcdir)/script/installpython.sh \
+               $(INSTALLPERMS) \
+               $(DESTDIR)$(PYTHONDIR) \
+               scripting/python bin/python
+
 clean::
        @echo "Removing python modules"
        @rm -f bin/python/*