summaryrefslogtreecommitdiff
path: root/source4/build/smb_build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build/smb_build')
-rw-r--r--source4/build/smb_build/header.pm20
-rw-r--r--source4/build/smb_build/input.pm8
-rw-r--r--source4/build/smb_build/makefile.pm37
-rw-r--r--source4/build/smb_build/output.pm17
4 files changed, 50 insertions, 32 deletions
diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm
index 1cc5361b65..a34bcb9025 100644
--- a/source4/build/smb_build/header.pm
+++ b/source4/build/smb_build/header.pm
@@ -48,26 +48,6 @@ sub _prepare_build_h($)
}
#
- # Shared modules
- #
- foreach my $key (values %{$depend}) {
- next if $key->{TYPE} ne "MODULE";
- next if $key->{ENABLE} ne "YES";
- next if $key->{OUTPUT_TYPE} ne "SHARED_LIBRARY";
-
- my $name = $key->{NAME};
- next if not defined($key->{INIT_FUNCTION});
-
- my $DEFINE = ();
-
- $DEFINE->{COMMENT} = "$name is built shared";
- $DEFINE->{KEY} = $key->{INIT_FUNCTION};
- $DEFINE->{VAL} = "init_module";
-
- push(@defines,$DEFINE);
- }
-
- #
# loop over all BUILD_H define sections
#
foreach (@defines) { $output .= _add_define_section($_); }
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 8cad9aafa6..fd887094aa 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -66,6 +66,12 @@ sub check_module($$$)
return;
}
+ if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) {
+ $mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE};
+ } else {
+ $mod->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)";
+ }
+
if (defined($mod->{CHOSEN_BUILD}) and $mod->{CHOSEN_BUILD} ne "DEFAULT")
{
$mod->{OUTPUT_TYPE} = $mod->{CHOSEN_BUILD};
@@ -160,7 +166,7 @@ sub check($$$$$)
}
unless (defined($part->{STANDARD_VISIBILITY})) {
- if ($part->{TYPE} eq "BINARY") {
+ if ($part->{TYPE} eq "MODULE" or $part->{TYPE} eq "BINARY") {
$part->{STANDARD_VISIBILITY} = "hidden";
} else {
$part->{STANDARD_VISIBILITY} = "default";
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 44b54a5058..e033e0e4b2 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -24,6 +24,8 @@ sub new($$$)
$self->{static_libs} = [];
$self->{shared_libs} = [];
$self->{headers} = [];
+ $self->{shared_modules} = [];
+ $self->{plugins} = [];
$self->{install_plugins} = "";
$self->{uninstall_plugins} = "";
$self->{pc_files} = [];
@@ -259,6 +261,7 @@ sub SharedLibrary($$)
my ($self,$ctx) = @_;
my $installdir;
+ my $init_obj = "";
if ($self->{duplicate_build}) {
$installdir = "bin/install";
@@ -270,8 +273,12 @@ sub SharedLibrary($$)
push (@{$self->{shared_libs}}, "bin/$ctx->{LIBRARY_REALNAME}");
} elsif ($ctx->{TYPE} eq "MODULE") {
push (@{$self->{shared_modules}}, "bin/$ctx->{LIBRARY_REALNAME}");
+ push (@{$self->{plugins}}, "$installdir/$ctx->{LIBRARY_REALNAME}");
+ $self->{install_plugins} .= "\t\@echo Install $installdir/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)/\n";
+ $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/\n";
$self->{install_plugins} .= "\t\@cp $installdir/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
+ $self->{uninstall_plugins} .= "\t\@echo Uninstall \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
$self->{uninstall_plugins} .= "\t\@rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
}
@@ -282,20 +289,37 @@ sub SharedLibrary($$)
$self->_prepare_list($ctx, "LINK_FLAGS");
push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
-
+
if ($ctx->{NOPROTO} eq "NO") {
push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)");
}
+ if ($ctx->{TYPE} eq "MODULE" and defined($ctx->{INIT_FUNCTION})) {
+ my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
+ $init_fn =~ s/\(\*\)/init_module/;
+ my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
+ $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/;
+
+ $self->output(<< "__EOD__"
+bin/$ctx->{NAME}_init_module.c:
+ \@echo Creating \$\@
+ \@echo \"#include \\\"includes.h\\\"\" > \$\@
+ \@echo \"$proto_fn;\" >> \$\@
+ \@echo -e \"_PUBLIC_ $init_fn \\n{\\n\\treturn $ctx->{INIT_FUNCTION}();\\n}\\n\" >> \$\@
+__EOD__
+);
+ $init_obj = "bin/$ctx->{NAME}_init_module.o";
+ }
+
if ($self->{duplicate_build}) {
$self->output(<< "__EOD__"
#
-bin/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
+bin/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+ $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
__EOD__
);
@@ -318,11 +342,11 @@ __EOD__
$self->output(<< "__EOD__"
#
-$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
+$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+ $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
__EOD__
);
@@ -559,8 +583,9 @@ sub write($$)
$self->output("PROTO_OBJS = " . array2oneperline($self->{proto_objs}) . "\n");
$self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) . "\n");
$self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
+ $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
- $self->output("\ninstallplugins: \$(SHARED_MODULES)\n".$self->{install_plugins}."\n");
+ $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
$self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
$self->_prepare_mk_files();
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 02e30ceeb5..0897232f98 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -43,15 +43,23 @@ sub generate_shared_library($)
{
my $lib = shift;
my $link_name;
+ my $lib_name;
@{$lib->{DEPEND_LIST}} = ();
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJ_LIST)");
- $link_name = $lib->{NAME};
- $link_name =~ s/^LIB//;
- $link_name = lc($link_name);
+ $link_name = lc($lib->{NAME});
+ $lib_name = $link_name;
+
+ if ($lib->{TYPE} eq "LIBRARY") {
+ $link_name = $lib->{NAME};
+ $link_name =~ s/^LIB//;
+ $link_name = lc($link_name);
+ $lib_name = "lib$link_name";
+ $lib->{OUTPUT} = "-l$link_name";
+ }
- $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_NAME} = "lib$link_name.\$(SHLIBEXT)";
+ $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_NAME} = "$lib_name.\$(SHLIBEXT)";
$lib->{TARGET} = "bin/$lib->{LIBRARY_NAME}";
if (defined($lib->{MAJOR_VERSION})) {
$lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}";
@@ -59,7 +67,6 @@ sub generate_shared_library($)
$lib->{TARGET} = "bin/$lib->{LIBRARY_REALNAME}";
@{$lib->{LINK_FLAGS}} = ("\$(SONAMEFLAG)$lib->{LIBRARY_SONAME}");
}
- $lib->{OUTPUT} = "-l$link_name";
}
sub generate_static_library($)