summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/smb_build/TODO4
-rw-r--r--source4/build/smb_build/input.pm8
-rw-r--r--source4/build/smb_build/makefile.pm1
-rw-r--r--source4/build/smb_build/output.pm2
-rw-r--r--source4/build/smb_build/smb_build_h.pm36
5 files changed, 38 insertions, 13 deletions
diff --git a/source4/build/smb_build/TODO b/source4/build/smb_build/TODO
index 190940fadb..f98a3d2bb5 100644
--- a/source4/build/smb_build/TODO
+++ b/source4/build/smb_build/TODO
@@ -7,6 +7,10 @@
(in Samba or other projects) can use the same (3rd) library.
- add register function to smbtorture
- init functions per shared library / binary
+ - add init functions + use lists of function pointers
+ - rpc_ndr
+ - list not automatically generated
+ - utility function for 'init mutex'
- install shared modules
- call load_modules() from subsystems/libraries/binaries with modules
- remove smb_build.h include from includes.h and INIT_OBJ_FILES. Replace
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 11a5eac1fb..bbf7efd8a0 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -49,6 +49,10 @@ sub check_module($$$)
die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
my $use_default = 0;
+
+ if (not exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS})) {
+ $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS} = [];
+ }
if (!(defined($INPUT->{$mod->{SUBSYSTEM}}))) {
$mod->{ENABLE} = "NO";
@@ -68,12 +72,12 @@ sub check_module($$$)
$mod->{OUTPUT_TYPE} = $default_ot;
}
- if ($mod->{OUTPUT_TYPE} eq "SHARED_LIBRARY" or
- $mod->{OUTPUT_TYPE} eq "STATIC_LIBRARY") {
+ if ($mod->{OUTPUT_TYPE} eq "SHARED_LIBRARY") {
$mod->{INSTALLDIR} = "LIBDIR/$mod->{SUBSYSTEM}";
push (@{$mod->{REQUIRED_SUBSYSTEMS}}, $mod->{SUBSYSTEM});
} else {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{REQUIRED_SUBSYSTEMS}}, $mod->{NAME});
+ push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
}
}
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index b7a6ace404..598aaaba44 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -70,6 +70,7 @@ BINDIR = $self->{config}->{bindir}
SBINDIR = $self->{config}->{sbindir}
datadir = $self->{config}->{datadir}
LIBDIR = $self->{config}->{libdir}
+MODULESDIR = $self->{config}->{libdir}
INCLUDEDIR = $self->{config}->{includedir}
CONFIGDIR = $self->{config}->{configdir}
localstatedir = $self->{config}->{localstatedir}
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index d3d0840350..2fa8e0207a 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -137,8 +137,8 @@ sub create_output($)
push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
}
push(@{$part->{SUBSYSTEM_INIT_FUNCTIONS}}, $elem->{INIT_FUNCTION}) if
- #$part->{OUTPUT_TYPE} eq "BINARY" and
defined($elem->{INIT_FUNCTION}) and
+ $elem->{TYPE} ne "MODULE" and
$part->{OUTPUT_TYPE} ne "SHARED_LIBRARY";
}
}
diff --git a/source4/build/smb_build/smb_build_h.pm b/source4/build/smb_build/smb_build_h.pm
index e06e965ac7..2bb9f35c53 100644
--- a/source4/build/smb_build/smb_build_h.pm
+++ b/source4/build/smb_build/smb_build_h.pm
@@ -24,6 +24,8 @@ sub _prepare_smb_build_h($)
{
my $depend = shift;
my @defines = ();
+ my %declared = ();
+ my $output = "";
#
# loop over all binaries
@@ -42,7 +44,9 @@ sub _prepare_smb_build_h($)
$DEFINE->{KEY} = $name . "_init_subsystems";
$DEFINE->{VAL} = "do { \\\n";
foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) {
- $DEFINE->{VAL} .= "\t\textern NTSTATUS $subkey(void); \\\n";
+ next if defined($declared{$subkey});
+ $output .= "NTSTATUS $subkey(void);\n";
+ $declared{$subkey} = 1;
}
foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) {
@@ -53,6 +57,24 @@ sub _prepare_smb_build_h($)
push(@defines,$DEFINE);
}
+ foreach my $key (values %{$depend}) {
+ my $DEFINE = ();
+ next if ($key->{TYPE} ne "LIBRARY" and $key->{TYPE} ne "SUBSYSTEM");
+ next unless defined($key->{INIT_FUNCTIONS});
+
+ $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";
+ $DEFINE->{KEY} = "STATIC_$key->{NAME}_MODULES";
+ $DEFINE->{VAL} = "{ \\\n";
+ foreach (@{$key->{INIT_FUNCTIONS}}) {
+ $DEFINE->{VAL} .= "\t$_, \\\n";
+ $output .= "NTSTATUS $_(void);\n";
+ }
+
+ $DEFINE->{VAL} .= "\tNULL \\\n }";
+
+ push(@defines,$DEFINE);
+ }
+
#
# Shared modules
#
@@ -78,10 +100,7 @@ sub _prepare_smb_build_h($)
#
# loop over all SMB_BUILD_H define sections
#
- my $output = "";
- foreach my $key (@defines) {
- $output .= _add_define_section($key);
- }
+ foreach (@defines) { $output .= _add_define_section($_); }
return $output;
}
@@ -98,15 +117,12 @@ sub _prepare_smb_build_h($)
sub create_smb_build_h($$)
{
my ($CTX, $file) = @_;
- my $output = "/* autogenerated by build/smb_build/main.pl */\n";
-
- $output .= _prepare_smb_build_h($CTX);
open(SMB_BUILD_H,">$file") || die ("Can't open `$file'\n");
- print SMB_BUILD_H $output;
+ print SMB_BUILD_H "/* autogenerated by build/smb_build/main.pl */\n";
+ print SMB_BUILD_H _prepare_smb_build_h($CTX);
close(SMB_BUILD_H);
print __FILE__.": creating $file\n";
- return;
}
1;