diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-26 16:36:24 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-26 16:36:24 +0100 |
commit | 5874c53eba3d195d4d9017c1b884e9413221f91e (patch) | |
tree | f1f9d0b451e23df5c00d298962f5cc519f772aaa /source4/build | |
parent | ef15b28d244dcaaa38a07055c3a88f6199173611 (diff) | |
download | samba-5874c53eba3d195d4d9017c1b884e9413221f91e.tar.gz samba-5874c53eba3d195d4d9017c1b884e9413221f91e.tar.bz2 samba-5874c53eba3d195d4d9017c1b884e9413221f91e.zip |
Support building .so versions of the modules.
(This used to be commit 673fb9c1855f9d61d4d311bcd5e3fea0210fe6ed)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/make/python.mk | 28 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 9 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 47 |
3 files changed, 50 insertions, 34 deletions
diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk index 6f54cd6a44..bd0926717d 100644 --- a/source4/build/make/python.mk +++ b/source4/build/make/python.mk @@ -1,13 +1,9 @@ pythonbuilddir = $(builddir)/bin/python # Install Python -# Arguments: Module path, source location +# Arguments: Module path define python_module_template -$$(pythonbuilddir)/$(1): $(2) ; - mkdir -p $$(@D) - cp $$< $$@ - installpython:: $$(pythonbuilddir)/$(1) ; cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1) @@ -18,6 +14,28 @@ pythonmods:: $$(pythonbuilddir)/$(1) ; endef +define python_py_module_template + +$$(pythonbuilddir)/$(1): $(2) ; + mkdir -p $$(@D) + cp $$< $$@ + +$(call python_module_template,$(1)) + +endef + +# Python C module +# Arguments: Module path, object files +define python_c_module_template + +$$(pythonbuilddir)/$(1): $(2) ; + @echo Linking $$@ + @mkdir -p $$(@D) + @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) + +$(call python_module_template,$(1)) +endef + # Swig extensions swig:: pythonmods diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index 3d715a513e..7a6988515c 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -61,9 +61,6 @@ foreach my $key (values %$OUTPUT) { ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") { $shared_libs_used = 1; } - $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or - $key->{TYPE} eq "PYTHON") and - grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES}); $mkenv->Header($key) if defined($key->{PUBLIC_HEADERS}); if ($key->{TYPE} eq "MODULE" and @{$key->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ" and defined($key->{INIT_FUNCTION})) { @@ -84,9 +81,9 @@ foreach my $key (values %$OUTPUT) { $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or - $key->{TYPE} eq "PYTHON") and - grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" and + grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}})); + $mkenv->PythonModule($key) if ($key->{TYPE} eq "PYTHON"); $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}) or defined($key->{PUBLIC_PROTO_HEADER}); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index df34f070c7..9a66cccbfe 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -113,11 +113,16 @@ sub _prepare_list($$$) $self->output("$ctx->{NAME}_$var =$tmplist\n"); } -sub SharedModulePrimitives($$) +sub PythonModule($$) { my ($self,$ctx) = @_; - - #FIXME + + $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); + $self->_prepare_list($ctx, "FULL_OBJ_LIST"); + $self->_prepare_list($ctx, "DEPEND_LIST"); + $self->_prepare_list($ctx, "LINK_FLAGS"); + + $self->output("\$(eval \$(call python_c_module_template,$ctx->{LIBRARY_REALNAME},\$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS)))\n"); } sub SharedModule($$) @@ -127,28 +132,24 @@ sub SharedModule($$) my $sane_subsystem = lc($ctx->{SUBSYSTEM}); $sane_subsystem =~ s/^lib//; - if ($ctx->{TYPE} eq "PYTHON") { - $self->output("\$(call python_module_template," . basename($ctx->{NAME}) . ",$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME})\n"); - } else { - $self->output("PLUGINS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n"); - $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); - } + $self->output("PLUGINS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n"); + $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + if (defined($ctx->{ALIASES})) { + foreach (@{$ctx->{ALIASES}}) { + $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); } + } - $self->output("uninstallplugins::\n"); - $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("uninstallplugins::\n"); + $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); - } + if (defined($ctx->{ALIASES})) { + foreach (@{$ctx->{ALIASES}}) { + $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); } } @@ -295,7 +296,7 @@ sub PythonFiles($$) my ($self,$ctx) = @_; foreach (@{$ctx->{PYTHON_FILES}}) { - $self->output("\$(call python_module_template," . basename($_) . ",\$(addprefix $ctx->{BASEDIR}/, $_))\n"); + $self->output("\$(eval \$(call python_py_module_template," . basename($_) . ",\$(addprefix $ctx->{BASEDIR}/, $_)))\n"); } } |