mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
Support building .so versions of the modules.
This commit is contained in:
parent
b0408abb08
commit
673fb9c185
@ -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
|
||||
|
||||
|
@ -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});
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user