diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2004-11-06 23:23:15 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:36 -0500 |
commit | 71db46ea665606384f2be1be708c74c97c9adfb2 (patch) | |
tree | 24c84e12f4fc925f3ec1e69348493d7222df1e44 /source4/build/smb_build/depend.pl | |
parent | b012ab557b8f8a2f58dfbbe8b7818f3e6d8cf38f (diff) | |
download | samba-71db46ea665606384f2be1be708c74c97c9adfb2.tar.gz samba-71db46ea665606384f2be1be708c74c97c9adfb2.tar.bz2 samba-71db46ea665606384f2be1be708c74c97c9adfb2.zip |
r3586: Fix some of the issues with the module init functions.
Both subsystems and modules can now have init functions, which can be
specified in .mk files (INIT_FUNCTION = ...)
The build system will define :
- SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal
- BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on
This removes the hack with the "static bool Initialised = " and the
"lazy_init" functions
(This used to be commit 7a8244761bfdfdfb48f8264d76951ebdfbf7bd8a)
Diffstat (limited to 'source4/build/smb_build/depend.pl')
-rw-r--r-- | source4/build/smb_build/depend.pl | 69 |
1 files changed, 26 insertions, 43 deletions
diff --git a/source4/build/smb_build/depend.pl b/source4/build/smb_build/depend.pl index a5a95eb547..a45fb725e1 100644 --- a/source4/build/smb_build/depend.pl +++ b/source4/build/smb_build/depend.pl @@ -147,6 +147,7 @@ sub _do_depend_subsystems($) foreach my $key (sort keys %{$CTX->{INPUT}{SUBSYSTEMS}}) { my $name = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME}; my @STATIC_MODULES_LIST = (); + my @INIT_FUNCTIONS = (); # # skip when the subsystem was disabled @@ -159,28 +160,19 @@ sub _do_depend_subsystems($) # create the subsystems used OBJ_LIST # my @OBJ_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{INIT_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{ADD_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } + push (@OBJ_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{INIT_OBJ_FILES}}); + push (@OBJ_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{ADD_OBJ_FILES}}); # # create the subsystems used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } - + push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_SUBSYSTEMS}})); # # create the subsystems used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{SUBSYSTEMS}{$key}{REQUIRED_LIBRARIES}}); # # now collect the info from the subsystems static modules @@ -204,35 +196,29 @@ sub _do_depend_subsystems($) # add it to the STATIC_MODULES_LIST # push(@STATIC_MODULES_LIST,$subkey); + push (@INIT_FUNCTIONS, $CTX->{INPUT}{MODULES}{$subkey}{INIT_FUNCTION}) if $CTX->{INPUT}{MODULES}{$subkey}{INIT_FUNCTION} ne ""; # # add OBJS of static modules to the subsystems used OBJ_LIST # - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{INIT_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{ADD_OBJ_FILES}}) { - push(@OBJ_LIST,$elem); - } + push (@OBJ_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{INIT_OBJ_FILES}})); + push (@OBJ_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{ADD_OBJ_FILES}})); # # add SUBSYSTEMS of static modules to the subsystems used SUBSYSTEMS_LIST # - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_SUBSYSTEMS}})); # # add LIBRARIES of static modules to the subsystems used LIBRARIES_LIST # - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, (@{$CTX->{INPUT}{MODULES}{$subkey}{REQUIRED_LIBRARIES}})); } # # set the lists # + @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{INIT_FUNCTIONS}} = @INIT_FUNCTIONS; @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{OBJ_LIST}} = @OBJ_LIST; @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}} = @STATIC_MODULES_LIST; @{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; @@ -303,9 +289,7 @@ sub _do_depend_shared_modules($) # create the shared modules used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_SUBSYSTEMS}})); # # now try to resolve the dependencies for the shared module @@ -316,9 +300,7 @@ sub _do_depend_shared_modules($) # create the shared modules used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{MODULES}{$key}{REQUIRED_LIBRARIES}}); # # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST @@ -361,9 +343,7 @@ sub _do_depend_libraries($) # create the libraries used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, @{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_SUBSYSTEMS}}); # # now try to resolve the dependencies for the library @@ -374,9 +354,7 @@ sub _do_depend_libraries($) # create the libraries used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{LIBRARIES}{$key}{REQUIRED_LIBRARIES}}); # # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST @@ -419,22 +397,26 @@ sub _do_depend_binaries($) # create the binaries used SUBSYSTEMS_LIST # my @SUBSYSTEMS_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_SUBSYSTEMS}}) { - push(@SUBSYSTEMS_LIST,$elem); - } + push (@SUBSYSTEMS_LIST, @{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_SUBSYSTEMS}}); # # now try to resolve the dependencies for the binary # @SUBSYSTEMS_LIST = _do_calc_subsystem_list($CTX, \@SUBSYSTEMS_LIST); + my @INIT_FUNCTIONS = (); + + foreach my $subkey (@SUBSYSTEMS_LIST) + { + push (@INIT_FUNCTIONS, $CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION}) if $CTX->{INPUT}{SUBSYSTEMS}{$subkey}{INIT_FUNCTION} ne ""; + + } + # # create the binaries used LIBRARIES_LIST # my @LIBRARIES_LIST = (); - foreach my $elem (@{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_LIBRARIES}}) { - push(@LIBRARIES_LIST,$elem); - } + push (@LIBRARIES_LIST, @{$CTX->{INPUT}{BINARIES}{$key}{REQUIRED_LIBRARIES}}); # # add the LIBARARIES of each subsysetm in the @SUBSYSTEMS_LIST @@ -446,6 +428,7 @@ sub _do_depend_binaries($) # @{$CTX->{DEPEND}{BINARIES}{$key}{SUBSYSTEMS_LIST}} = @SUBSYSTEMS_LIST; @{$CTX->{DEPEND}{BINARIES}{$key}{LIBRARIES_LIST}} = @LIBRARIES_LIST; + @{$CTX->{DEPEND}{BINARIES}{$key}{INIT_FUNCTIONS}} = @INIT_FUNCTIONS; } return; |