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/config_mk.pm4
-rwxr-xr-xsource4/build/smb_build/dot.pl2
-rw-r--r--source4/build/smb_build/input.pm86
-rw-r--r--source4/build/smb_build/main.pl17
-rw-r--r--source4/build/smb_build/makefile.pm109
-rw-r--r--source4/build/smb_build/output.pm48
-rw-r--r--source4/build/smb_build/summary.pm5
7 files changed, 124 insertions, 147 deletions
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index aa075490bc..4d8db8a04e 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -18,7 +18,6 @@ my $section_types = {
"CFLAGS" => "list",
"CPPFLAGS" => "list",
"LDFLAGS" => "list",
- "PC_NAME" => "string",
},
"PYTHON" => {
SWIG_FILE => "string",
@@ -90,7 +89,6 @@ my $section_types = {
"SO_VERSION" => "string",
"LIBRARY_REALNAME" => "string",
- "PC_NAME" => "string",
"PC_FILE" => "string",
"INIT_FUNCTION_TYPE" => "string",
@@ -241,7 +239,7 @@ sub run_config_mk($$$$)
}
# include
- if ($line =~ /^include (.*)$/) {
+ if ($line =~ /^mkinclude (.*)$/) {
my $subfile= $1;
my $subdir = dirname($filename);
$subdir =~ s/^\.$//g;
diff --git a/source4/build/smb_build/dot.pl b/source4/build/smb_build/dot.pl
index 82f89c081a..e50ee50f95 100755
--- a/source4/build/smb_build/dot.pl
+++ b/source4/build/smb_build/dot.pl
@@ -44,7 +44,7 @@ my $name = "samba4";
my $only;
if (defined($subsys)) {
my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
- "STATIC_LIBRARY", "SHARED_LIBRARY", "SHARED_LIBRARY");
+ "MERGED_OBJ", "SHARED_LIBRARY", "SHARED_LIBRARY");
die("No such subsystem $subsys") unless (defined($DEPEND->{$subsys}));
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 51c89a834f..da90e9db48 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -5,13 +5,10 @@
# Copyright (C) Jelmer Vernooij 2004
# Released under the GNU GPL
-use smb_build::config;
use strict;
package smb_build::input;
use File::Basename;
-my $srcdir = $config::config{srcdir};
-
sub strtrim($)
{
$_ = shift;
@@ -60,14 +57,9 @@ sub check_subsystem($$$)
my ($INPUT, $subsys, $default_ot) = @_;
return if ($subsys->{ENABLE} ne "YES");
- unless(defined($subsys->{OUTPUT_TYPE})) {
- $subsys->{OUTPUT_TYPE} = $default_ot;
- }
-
+ unless (defined($subsys->{OUTPUT_TYPE})) { $subsys->{OUTPUT_TYPE} = $default_ot; }
unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- add_libreplace($subsys);
}
sub check_module($$$)
@@ -76,18 +68,16 @@ 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";
- return;
+ die("Unknown subsystem $mod->{SUBSYSTEM} for module $mod->{NAME}");
}
if ($INPUT->{$mod->{SUBSYSTEM}} eq "NO") {
+ warn("Disabling module $mod->{NAME} because subsystem $mod->{SUBSYSTEM} is disabled");
$mod->{ENABLE} = "NO";
return;
}
@@ -102,7 +92,7 @@ sub check_module($$$)
if (not defined($mod->{OUTPUT_TYPE})) {
if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") {
- $mod->{OUTPUT_TYPE} = ["SHARED_LIBRARY"];
+ $mod->{OUTPUT_TYPE} = undef;
} else {
$mod->{OUTPUT_TYPE} = $default_ot;
}
@@ -113,11 +103,12 @@ sub check_module($$$)
$sane_subsystem =~ s/^lib//;
$mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
+ add_libreplace($mod);
}
- if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
+ if (grep(/MERGED_OBJ/, @{$mod->{OUTPUT_TYPE}})) {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
+ unshift (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME});
}
- add_libreplace($mod);
}
sub check_library($$$)
@@ -126,9 +117,7 @@ sub check_library($$$)
return if ($lib->{ENABLE} ne "YES");
- unless (defined($lib->{OUTPUT_TYPE})) {
- $lib->{OUTPUT_TYPE} = $default_ot;
- }
+ unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
@@ -141,12 +130,8 @@ sub check_library($$$)
}
unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
-
unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- unless(defined($lib->{INSTALLDIR})) {
- $lib->{INSTALLDIR} = "LIBDIR";
- }
+ unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
add_libreplace($lib);
}
@@ -169,8 +154,8 @@ sub check_python($$$)
$python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"];
$python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
$python->{PYTHON_FILES} = ["$dirname$basename.py"];
- push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_UNUSED_MACROS});
- push (@{$python->{CFLAGS}}, $config::config{CFLAG_NO_CAST_QUAL});
+ push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)");
+ push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_CAST_QUAL)");
$python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }";
} else {
my $basename = $python->{NAME};
@@ -178,7 +163,7 @@ sub check_python($$$)
$python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)";
$python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }";
}
- push (@{$python->{CFLAGS}}, @{$INPUT->{EXT_LIB_PYTHON}->{CFLAGS}});
+ push (@{$python->{CFLAGS}}, "\$(EXT_LIB_PYTHON_CFLAGS)");
$python->{SUBSYSTEM} = "LIBPYTHON";
@@ -197,25 +182,20 @@ sub check_binary($$)
add_libreplace($bin);
}
-sub import_integrated($$)
+sub add_implicit($$)
{
- my ($lib, $depend) = @_;
-
- foreach my $mod (values %$depend) {
- next if(not defined($mod->{OUTPUT_TYPE}));
- next if(not grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}}));
- next if(not defined($mod->{SUBSYSTEM}));
- next if($mod->{SUBSYSTEM} ne $lib->{NAME});
- next if($mod->{ENABLE} ne "YES");
-
- push (@{$lib->{FULL_OBJ_LIST}}, "\$($mod->{NAME}_OBJ_LIST)");
- push (@{$lib->{LINK_FLAGS}}, "\$($mod->{NAME}_LINK_FLAGS)");
- 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";
- }
+ my ($INPUT, $n) = @_;
+
+ $INPUT->{$n} = {
+ TYPE => "MAKE_RULE",
+ NAME => $n,
+ TARGET => "",
+ OUTPUT_TYPE => undef,
+ LIBS => ["\$(".uc($n)."_LIBS)"],
+ LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"],
+ CFLAGS => ["\$(".uc($n)."_CFLAGS)"],
+ CPPFLAGS => ["\$(".uc($n)."_CPPFLAGS)"]
+ };
}
sub calc_unique_deps($$$$$$$$)
@@ -224,16 +204,19 @@ sub calc_unique_deps($$$$$$$$)
my ($name, $INPUT, $deps, $udeps, $withlibs, $forward, $pubonly, $busy) = @_;
foreach my $n (@$deps) {
- die("Dependency unknown: $n (for $name)") unless (defined($INPUT->{$n}));
- die("Recursive dependency: $n, list: " . join(',', @$busy)) if (grep (/^$n$/, @$busy));
- next if (grep /^$n$/, @$udeps);
+ add_implicit($INPUT, $n) unless (defined($INPUT->{$n}));
my $dep = $INPUT->{$n};
+ if (grep (/^$n$/, @$busy)) {
+ next if (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ");
+ die("Recursive dependency: $n, list: " . join(',', @$busy));
+ }
+ next if (grep /^$n$/, @$udeps);
push (@{$udeps}, $dep->{NAME}) if $forward;
if (defined ($dep->{OUTPUT_TYPE}) &&
($withlibs or
- (@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or
+ (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or
(@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
push (@$busy, $dep->{NAME});
calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy);
@@ -280,9 +263,7 @@ sub check($$$$$)
}
}
- foreach my $k (keys %$INPUT) {
- my $part = $INPUT->{$k};
-
+ foreach my $part (values %$INPUT) {
$part->{LINK_FLAGS} = [];
$part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"];
@@ -306,7 +287,6 @@ sub check($$$$$)
if (defined($part->{INIT_FUNCTIONS})) {
push (@{$part->{LINK_FLAGS}}, "\$(DYNEXP)");
}
- import_integrated($part, $INPUT);
}
foreach my $part (values %$INPUT) {
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index a85eab32de..3ed0327d6d 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -19,8 +19,7 @@ use strict;
my $INPUT = {};
my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
-my $subsys_output_type;
-$subsys_output_type = ["STATIC_LIBRARY"];
+my $subsys_output_type = ["MERGED_OBJ"];
my $library_output_type;
if ($config::config{USESHARED} eq "true") {
@@ -35,7 +34,7 @@ my $module_output_type;
if ($config::config{USESHARED} eq "true") {
$module_output_type = ["SHARED_LIBRARY"];
} else {
- $module_output_type = ["INTEGRATED"];
+ $module_output_type = ["MERGED_OBJ"];
}
my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
@@ -43,22 +42,18 @@ my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
$library_output_type,
$module_output_type);
my $OUTPUT = output::create_output($DEPEND, \%config::config);
-$config::config{SUBSYSTEM_OUTPUT_TYPE} = $subsys_output_type;
-$config::config{LIBRARY_OUTPUT_TYPE} = $library_output_type;
-$config::config{MODULE_OUTPUT_TYPE} = $module_output_type;
my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
+my $shared_libs_used = 0;
foreach my $key (values %$OUTPUT) {
- next unless defined $key->{OUTPUT_TYPE};
-
- $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
+ $mkenv->_prepare_list($key, "OBJ_LIST");
+ push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)");
}
-my $shared_libs_used = 0;
-
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
+ $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
$mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if (defined($key->{PC_FILE})) {
push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}");
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 7fd31a5114..d11e761ce1 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -28,12 +28,8 @@ sub new($$$)
$self->{python_dsos} = [];
$self->{python_pys} = [];
$self->{shared_libs} = [];
- $self->{installable_shared_libs} = [];
$self->{headers} = [];
- $self->{shared_modules} = [];
$self->{plugins} = [];
- $self->{install_plugins} = "";
- $self->{uninstall_plugins} = "";
$self->{pc_files} = [];
$self->{proto_headers} = [];
$self->{output} = "";
@@ -103,14 +99,12 @@ sub array2oneperline($)
return $output;
}
-sub _prepare_list_ex($$$$$)
+sub _prepare_list($$$)
{
- my ($self,$ctx,$var,$pre,$post) = @_;
+ my ($self,$ctx,$var) = @_;
my @tmparr = ();
- push(@tmparr, $pre) if defined($pre);
push(@tmparr, @{$ctx->{$var}}) if defined($ctx->{$var});
- push(@tmparr, $post) if defined($post);
my $tmplist = array2oneperline(\@tmparr);
return if ($tmplist eq "");
@@ -118,20 +112,6 @@ sub _prepare_list_ex($$$$$)
$self->output("$ctx->{NAME}_$var =$tmplist\n");
}
-sub _prepare_list($$$)
-{
- my ($self,$ctx,$var) = @_;
-
- $self->_prepare_list_ex($ctx, $var, undef, undef);
-}
-
-sub Integrated($$)
-{
- my ($self,$ctx) = @_;
-
- $self->_prepare_list($ctx, "OBJ_LIST");
-}
-
sub SharedModulePrimitives($$)
{
my ($self,$ctx) = @_;
@@ -152,30 +132,34 @@ sub SharedModule($$)
push (@{$self->{python_dsos}},
"$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
} else {
- push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
- $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n";
- $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$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\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+ $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");
+
if (defined($ctx->{ALIASES})) {
foreach (@{$ctx->{ALIASES}}) {
- $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
- $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+ $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
}
}
}
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
- push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
-
if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") {
my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
$init_fn =~ s/\(\*\)/init_module/;
@@ -227,7 +211,6 @@ sub SharedLibraryPrimitives($$)
if (not grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}})) {
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
}
}
@@ -236,14 +219,10 @@ sub SharedLibrary($$)
{
my ($self,$ctx) = @_;
- push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
- push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
+ push (@{$self->{shared_libs}}, $ctx->{RESULT_SHARED_LIBRARY}) if (defined($ctx->{SO_VERSION}));
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
-# $self->_prepare_list_ex($ctx, "LINK_FLAGS", "-Wl,--whole-archive", "-Wl,--no-whole-archive");
-
- push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
my $soarg = "";
my $lns = "";
@@ -260,8 +239,7 @@ sub SharedLibrary($$)
$self->output(<< "__EOD__"
#
-
-$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
\@mkdir -p $ctx->{SHAREDDIR}
\@\$(SHLD) \$(SHLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
@@ -273,23 +251,38 @@ __EOD__
$self->output("\n");
}
+sub MergedObj($$)
+{
+ my ($self, $ctx) = @_;
+
+ return unless defined($ctx->{OUTPUT});
+
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+ $self->output(<< "__EOD__"
+#
+$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_LIST)
+ \@echo Partially linking \$@
+ \@mkdir -p bin/mergedobj
+ \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_LIST)
+
+__EOD__
+);
+}
+
sub StaticLibrary($$)
{
my ($self,$ctx) = @_;
return unless (defined($ctx->{OBJ_FILES}));
- push (@{$self->{static_libs}}, $ctx->{TARGET_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
+ push (@{$self->{static_libs}}, $ctx->{RESULT_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
- push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
-
$self->output(<< "__EOD__"
#
-$ctx->{TARGET_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$@
\@rm -f \$@
\@mkdir -p $ctx->{STATICDIR}
@@ -312,31 +305,23 @@ sub Binary($$)
{
my ($self,$ctx) = @_;
- my $installdir;
my $extradir = "";
- my $localdir = "bin$extradir";
-
- $installdir = "bin$extradir";
-
- push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
-
unless (defined($ctx->{INSTALLDIR})) {
} elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
- push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
+ push (@{$self->{sbin_progs}}, $ctx->{RESULT_BINARY});
} elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
- push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
+ push (@{$self->{bin_progs}}, $ctx->{RESULT_BINARY});
}
- push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
+ $self->output("binaries:: $ctx->{TARGET_BINARY}\n");
- $self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
$self->output(<< "__EOD__"
-$installdir/$ctx->{BINARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
+$ctx->{RESULT_BINARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST)
\@echo Linking \$\@
__EOD__
);
@@ -425,22 +410,16 @@ sub write($$)
$self->output("MANPAGES = " . array2oneperline($self->{manpages})."\n");
$self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
$self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
- $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
$self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
$self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
$self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
$self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
- $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
$self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
$self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
$self->output("ALL_OBJS = " . array2oneperline($self->{all_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: \$(PLUGINS)\n".$self->{install_plugins}."\n");
- $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
-
$self->_prepare_mk_files();
$self->output($self->{mkfile});
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 4350370fbf..ff9afe8e8c 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -85,8 +85,26 @@ sub generate_shared_library($)
$lib->{LIBRARY_REALNAME} = "$lib->{LIBRARY_REALNAME}.\$($lib->{NAME}_VERSION)";
}
- $lib->{TARGET_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
- $lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
+ $lib->{RESULT_SHARED_LIBRARY} = "$lib->{SHAREDDIR}/$lib->{LIBRARY_REALNAME}";
+ $lib->{OUTPUT_SHARED_LIBRARY} = "-l$link_name";
+ $lib->{TARGET_SHARED_LIBRARY} = $lib->{RESULT_SHARED_LIBRARY};
+}
+
+sub generate_merged_obj($)
+{
+ my $lib = shift;
+
+ my $link_name = $lib->{NAME};
+ $link_name =~ s/^LIB//;
+
+ if (defined($lib->{OBJ_FILES})) {
+ $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+ $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+ $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ};
+ } else {
+ $lib->{TARGET_MERGED_OBJ} = "";
+ $lib->{RESULT_MERGED_OBJ} = "";
+ }
}
sub generate_static_library($)
@@ -102,10 +120,12 @@ sub generate_static_library($)
$lib->{LIBRARY_NAME} = "lib".lc($link_name).".a";
if (defined($lib->{OBJ_FILES})) {
- $lib->{TARGET_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+ $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+ $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY};
$lib->{STATICDIR} = 'bin/static';
$lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name);
} else {
+ $lib->{RESULT_STATIC_LIBRARY} = "";
$lib->{TARGET_STATIC_LIBRARY} = "";
$lib->{OUTPUT_STATIC_LIBRARY} = "";
}
@@ -116,10 +136,11 @@ sub generate_binary($)
my $bin = shift;
$bin->{DEPEND_LIST} = [];
- push(@{$bin->{LINK_FLAGS}}, "\$($bin->{NAME}\_OBJ_LIST)");
+ push(@{$bin->{LINK_FLAGS}}, "\$($bin->{NAME}\_FULL_OBJ_LIST)");
- $bin->{DEBUGDIR} = "bin/";
- $bin->{TARGET_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+ $bin->{DEBUGDIR} = "bin";
+ $bin->{RESULT_BINARY} = $bin->{OUTPUT_BINARY} = "$bin->{DEBUGDIR}/$bin->{NAME}";
+ $bin->{TARGET_BINARY} = $bin->{RESULT_BINARY};
$bin->{BINARY} = $bin->{NAME};
}
@@ -153,6 +174,7 @@ sub create_output($$)
generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+ generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}});
$part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
$part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
}
@@ -163,7 +185,7 @@ sub create_output($$)
merge_array(\$part->{FINAL_CFLAGS}, $part->{CPPFLAGS});
merge_array(\$part->{FINAL_CFLAGS}, $part->{CFLAGS});
- foreach (@{$part->{UNIQUE_DEPENDENCIES_COMPILE}}) {
+ foreach (@{$part->{UNIQUE_DEPENDENCIES_ALL}}) {
my $elem = $depend->{$_};
next if $elem == $part;
@@ -176,15 +198,19 @@ sub create_output($$)
my $elem = $depend->{$_};
next if $elem == $part;
- push(@{$part->{LINK_FLAGS}}, "\$($elem->{NAME}_OUTPUT)") if defined($elem->{OUTPUT});
push(@{$part->{LINK_FLAGS}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
- push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
- push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+ push(@{$part->{LINK_FLAGS}}, @{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
+ if (defined($elem->{OUTPUT_TYPE}) and @{$elem->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") {
+ push (@{$part->{FULL_OBJ_LIST}}, $elem->{TARGET});
+ } else {
+ push(@{$part->{LINK_FLAGS}}, "\$($elem->{NAME}_OUTPUT)") if defined($elem->{OUTPUT});
+ push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+ }
}
}
foreach $part (values %{$depend}) {
- if (($part->{STANDARD_VISIBILITY} ne "default") and
+ if (defined($part->{STANDARD_VISIBILITY}) and ($part->{STANDARD_VISIBILITY} ne "default") and
($config->{visibility_attribute} eq "yes")) {
push(@{$part->{FINAL_CFLAGS}}, "-fvisibility=$part->{STANDARD_VISIBILITY}");
}
diff --git a/source4/build/smb_build/summary.pm b/source4/build/smb_build/summary.pm
index 52817f3597..4ea1ad525e 100644
--- a/source4/build/smb_build/summary.pm
+++ b/source4/build/smb_build/summary.pm
@@ -5,6 +5,7 @@
# Released under the GNU GPL
package summary;
+use smb_build::config;
use strict;
sub enabled($)
@@ -21,9 +22,7 @@ sub showitem($$$)
my @need = ();
foreach (@$items) {
- if (!enabled($output->{$_}->{ENABLE})) {
- push (@need, $_);
- }
+ push (@need, $_) if (enabled($config::enable{$_}));
}
print "Support for $desc: ";