diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-23 23:54:30 -0600 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-24 01:51:06 -0600 |
commit | be33f4c611d37ebba59ff618033dc73601339ad1 (patch) | |
tree | 2d1fdd393172069a89dd5819d614db6a917bc984 /source4/build/smb_build | |
parent | 1ab5bcfb93c9fc7b18d55e6c5995efddf97fea09 (diff) | |
download | samba-be33f4c611d37ebba59ff618033dc73601339ad1.tar.gz samba-be33f4c611d37ebba59ff618033dc73601339ad1.tar.bz2 samba-be33f4c611d37ebba59ff618033dc73601339ad1.zip |
r26576: Allow the static module loading code to be used for the Python modules.
Simplify the way module initialization functions are handled.
(This used to be commit ba8be2dfc0de4434c798663336b81f7f95cde520)
Diffstat (limited to 'source4/build/smb_build')
-rwxr-xr-x | source4/build/smb_build/dot.pl | 8 | ||||
-rw-r--r-- | source4/build/smb_build/header.pm | 14 | ||||
-rw-r--r-- | source4/build/smb_build/input.pm | 19 |
3 files changed, 24 insertions, 17 deletions
diff --git a/source4/build/smb_build/dot.pl b/source4/build/smb_build/dot.pl index c8203d4cdd..82f89c081a 100755 --- a/source4/build/smb_build/dot.pl +++ b/source4/build/smb_build/dot.pl @@ -25,9 +25,11 @@ sub generate($$$) foreach my $part (values %{$depend}) { next if (defined($only) and not contains($only,$part->{NAME})); - foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}, - @{$part->{PRIVATE_DEPENDENCIES}}) { - $res .= "\t\"$part->{NAME}\" -> \"$elem\";\n"; + foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}) { + $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* public */\n"; + } + foreach my $elem (@{$part->{PRIVATE_DEPENDENCIES}}) { + $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* private */\n"; } } diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm index 34e81a3a24..b0dced4897 100644 --- a/source4/build/smb_build/header.pm +++ b/source4/build/smb_build/header.pm @@ -39,16 +39,18 @@ sub _prepare_build_h($) $name =~ s/-/_/g; $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT"; $DEFINE->{KEY} = "STATIC_$name\_MODULES"; - $DEFINE->{VAL} = "{ \\\n"; + $DEFINE->{VAL} = "\\\n"; foreach (@{$key->{INIT_FUNCTIONS}}) { $DEFINE->{VAL} .= "\t$_, \\\n"; - my $fn = $key->{INIT_FUNCTION_TYPE}; - unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; } - $fn =~ s/\(\*\)/$_/; - $output .= "$fn;\n"; + unless (/{/) { + my $fn = $key->{INIT_FUNCTION_TYPE}; + unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; } + $fn =~ s/\(\*\)/$_/; + $output .= "$fn;\n"; + } } - $DEFINE->{VAL} .= "\tNULL \\\n }"; + $DEFINE->{VAL} =~ s/, \\\n$//g; # Remove the last comma push(@defines,$DEFINE); } diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 431fd3cb83..ae37a7602b 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -108,7 +108,7 @@ sub check_module($$$) my $sane_subsystem = lc($mod->{SUBSYSTEM}); $sane_subsystem =~ s/^lib//; $mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem"; - push (@{$mod->{PRIVATE_DEPENDENCIES}}, $mod->{SUBSYSTEM}); + push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM}); } if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) { push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION}); @@ -147,14 +147,14 @@ sub check_library($$$) add_libreplace($lib); } -sub check_python($$) +sub check_python($$$) { - my ($INPUT, $python) = @_; + my ($INPUT, $python, $default_ot) = @_; return if ($INPUT->{LIBPYTHON}{ENABLE} ne "YES"); $python->{INSTALLDIR} = "PYTHONDIR"; - push (@{$python->{PUBLIC_DEPENDENCIES}}, "LIBPYTHON"); + unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; } if (defined($python->{SWIG_FILE})) { my $dirname = dirname($python->{SWIG_FILE}); my $basename = basename($python->{SWIG_FILE}, ".i"); @@ -165,18 +165,20 @@ sub check_python($$) $python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"]; $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)"; $python->{PYTHON_FILES} = ["$dirname$basename.py"]; - unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; } push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_UNUSED_MACROS}); push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL}); + $python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }"; } else { my $basename = $python->{NAME}; $basename =~ s/^python_//g; $python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)"; + $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }"; } + push (@{$python->{CFLAGS}}, @{$INPUT->{EXT_LIB_PYTHON}->{CFLAGS}}); $python->{SUBSYSTEM} = "LIBPYTHON"; - check_module($INPUT, $python, ["SHARED_LIBRARY"]); + check_module($INPUT, $python, $default_ot); } sub check_binary($$) @@ -204,7 +206,8 @@ sub import_integrated($$) push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{TYPE}_$mod->{NAME}_FULL_OBJ_LIST)"); push (@{$lib->{LINK_FLAGS}}, "\$($mod->{TYPE}_$mod->{NAME}_LINK_FLAGS)"); - push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PUBLIC_DEPENDENCIES}}) if defined($mod->{PUBLIC_DEPENDENCIES}); + push (@{$lib->{CFLAGS}}, @{$mod->{CFLAGS}}) if defined($mod->{CFLAGS}); + push (@{$lib->{PUBLIC_DEPENDENCIES}}, @{$mod->{PUBLIC_DEPENDENCIES}}) if defined($mod->{PUBLIC_DEPENDENCIES}); push (@{$lib->{PRIVATE_DEPENDENCIES}}, @{$mod->{PRIVATE_DEPENDENCIES}}) if defined($mod->{PRIVATE_DEPENDENCIES}); $mod->{ENABLE} = "NO"; @@ -288,7 +291,7 @@ sub check($$$$$) } elsif ($part->{TYPE} eq "BINARY") { check_binary($INPUT, $part); } elsif ($part->{TYPE} eq "PYTHON") { - check_python($INPUT, $part); + check_python($INPUT, $part, $module_ot); } elsif ($part->{TYPE} eq "EXT_LIB") { } else { die("Unknown type $part->{TYPE}"); |