diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-07-28 11:51:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:09 -0500 |
commit | 930e624d816a175d5ca4448e6ed40bc7dd8ec5b7 (patch) | |
tree | cefd60a954d828902c8fde6a6e8a69954e0baa63 /source4/build/smb_build | |
parent | d0496a4ee626f829f1b5032122d2daf53e0bd2e2 (diff) | |
download | samba-930e624d816a175d5ca4448e6ed40bc7dd8ec5b7.tar.gz samba-930e624d816a175d5ca4448e6ed40bc7dd8ec5b7.tar.bz2 samba-930e624d816a175d5ca4448e6ed40bc7dd8ec5b7.zip |
r8826: Make configure generate config.mk files (with the external libraries
that were found) and a config.pm file (with all substitution variables)
(This used to be commit 52bb1374bbcfc9b9a6d098687bafe9021a1ee858)
Diffstat (limited to 'source4/build/smb_build')
-rw-r--r-- | source4/build/smb_build/config_mk.pm | 24 | ||||
-rw-r--r-- | source4/build/smb_build/input.pm | 32 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 31 | ||||
-rw-r--r-- | source4/build/smb_build/main.pm | 47 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 20 |
5 files changed, 82 insertions, 72 deletions
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index ba8badc3d1..d26d85f5b9 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -19,6 +19,10 @@ my %attribute_types = ( "ADD_OBJ_FILES" => "list", "OBJ_FILES" => "list", "SUBSYSTEM" => "string", + "CFLAGS" => "list", + "CPPFLAGS" => "list", + "LDFLAGS" => "list", + "LIBS" => "list", "INIT_FUNCTION" => "string", "MAJOR_VERSION" => "string", "MINOR_VERSION" => "string", @@ -168,7 +172,7 @@ sub import_file($$) $input->{$name}{TYPE} = $type; foreach my $key (values %{$result->{$section}}) { - $key->{VAL} = input::strtrim($key->{VAL}); + $key->{VAL} = smb_build::input::strtrim($key->{VAL}); my $vartype = $attribute_types{$key->{KEY}}; if (not defined($vartype)) { die("Unknown attribute $key->{KEY}"); @@ -176,7 +180,7 @@ sub import_file($$) if ($vartype eq "string") { $input->{$name}{$key->{KEY}} = $key->{VAL}; } elsif ($vartype eq "list") { - $input->{$name}{$key->{KEY}} = [input::str2array($key->{VAL})]; + $input->{$name}{$key->{KEY}} = [smb_build::input::str2array($key->{VAL})]; } elsif ($vartype eq "bool") { if (($key->{VAL} ne "YES") and ($key->{VAL} ne "NO")) { die("Invalid value for bool attribute $key->{KEY}: $key->{VAL}"); @@ -186,4 +190,20 @@ sub import_file($$) } } } + +sub import_files($$) +{ + my ($input, $config_list) = @_; + + open(IN, $config_list) or die("Can't open $config_list: $!"); + my @mkfiles = grep{!/^#/} <IN>; + close(IN); + + $| = 1; + + foreach (@mkfiles) { + s/\n//g; + import_file($input, $_); + } +} 1; diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index d469550a76..fc14c1d2e9 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -8,7 +8,7 @@ ########################################################### use strict; -package input; +package smb_build::input; my $subsystem_default_output_type = "OBJLIST"; my $srcdir = "."; @@ -51,6 +51,7 @@ sub check_module($$) die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM}); + ($mod->{DEFAULT_BUILD} = "STATIC") if not defined($mod->{DEFAULT_BUILD}); my $use_default = 0; @@ -62,12 +63,17 @@ sub check_module($$) return; } - if ($mod->{ENABLE} ne "YES") + if (($mod->{ENABLE} eq "STATIC") or + ($mod->{ENABLE} eq "NOT") or + ($mod->{ENABLE} eq "SHARED")) { + $mod->{DEFAULT_BUILD} = $mod->{ENABLE}; + } elsif ($mod->{ENABLE} ne "YES") { $mod->{CHOSEN_BUILD} = "NOT"; } - if (not defined($mod->{CHOSEN_BUILD}) or $mod->{CHOSEN_BUILD} eq "DEFAULT") { + if (not defined($mod->{CHOSEN_BUILD}) or $mod->{CHOSEN_BUILD} eq "DEFAULT") + { $mod->{CHOSEN_BUILD} = $mod->{DEFAULT_BUILD}; } @@ -145,14 +151,22 @@ sub calc_unique_deps($$) # check_input($INPUT) # # $INPUT - the global INPUT context -sub check($) +# $enabled - list of enabled subsystems/libs +sub check($$) { - my $INPUT = shift; + my ($INPUT, $enabled) = @_; ($subsystem_default_output_type = $ENV{SUBSYSTEM_OUTPUT_TYPE}) if (defined($ENV{"SUBSYSTEM_OUTPUT_TYPE"})); foreach my $part (values %$INPUT) { - ($part->{ENABLE} = "YES") if not defined($part->{ENABLE}); + if (defined($enabled->{$part->{NAME}})) { + $part->{ENABLE} = $enabled->{$part->{NAME}}; + next; + } + + unless(defined($part->{ENABLE})) { + $part->{ENABLE} = "YES"; + } } foreach my $k (keys %$INPUT) { @@ -166,12 +180,6 @@ sub check($) check_library($INPUT, $part) if ($part->{TYPE} eq "LIBRARY"); check_binary($INPUT, $part) if ($part->{TYPE} eq "BINARY"); check_target($INPUT, $part) if ($part->{TYPE} eq "TARGET"); - - #FIXME: REQUIRED_LIBRARIES needs to go - if (defined($part->{REQUIRED_LIBRARIES})) { - push(@{$part->{REQUIRED_SUBSYSTEMS}}, @{$part->{REQUIRED_LIBRARIES}}); - delete ($part->{REQUIRED_LIBRARIES}); - } } my %depend = %$INPUT; diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl new file mode 100644 index 0000000000..abe63ffaba --- /dev/null +++ b/source4/build/smb_build/main.pl @@ -0,0 +1,31 @@ +########################################################### +### SMB Build System ### +### - the main program ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Copyright (C) Jelmer Vernooij 2005 +### Released under the GNU GPL ### +########################################################### + +use smb_build::makefile; +use smb_build::smb_build_h; +use smb_build::input; +use smb_build::config_mk; +use smb_build::output; +use smb_build::dot; +use config; +use strict; + +my $INPUT = {}; + +config_mk::import_files($INPUT, "config.list"); +my $DEPEND = smb_build::input::check($INPUT, \%config::enabled); +my $OUTPUT = output::create_output($DEPEND); +makefile::create_makefile_in($OUTPUT, "Makefile.in"); +smb_build_h::create_smb_build_h($OUTPUT, "include/smb_build.h"); + +open DOTTY, ">samba4-deps.dot"; +print DOTTY dot::generate($DEPEND); +close DOTTY; + +1; diff --git a/source4/build/smb_build/main.pm b/source4/build/smb_build/main.pm deleted file mode 100644 index 950d02a2f6..0000000000 --- a/source4/build/smb_build/main.pm +++ /dev/null @@ -1,47 +0,0 @@ -########################################################### -### SMB Build System ### -### - the main program ### -### ### -### Copyright (C) Stefan (metze) Metzmacher 2004 ### -### Released under the GNU GPL ### -########################################################### - -use smb_build::makefile; -use smb_build::smb_build_h; -use smb_build::input; -use smb_build::config_mk; -use smb_build::output; -use smb_build::dot; -use strict; - -my $config_list = "config.list"; - -sub smb_build_main($$) -{ - my ($INPUT, $settings) = @_; - - open(IN, $config_list) or die("Can't open $config_list: $!"); - my @mkfiles = grep{!/^#/} <IN>; - close(IN); - - $| = 1; - - foreach (@mkfiles) { - s/\n//g; - config_mk::import_file($INPUT, $_); - } - - my $DEPEND = input::check($INPUT); - - my $OUTPUT = output::create_output($DEPEND); - - makefile::create_makefile_in($OUTPUT, $settings, "Makefile.in"); - - smb_build_h::create_smb_build_h($OUTPUT, "include/smb_build.h"); - - open DOTTY, ">samba4-deps.dot"; - print DOTTY dot::generate($DEPEND); - close DOTTY; -} - -1; diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 38d93f636c..a720ea3069 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -509,9 +509,8 @@ bin/.TARGET_$ctx->{NAME}: "; } -sub _prepare_proto_rules($) +sub _prepare_proto_rules() { - my $settings = shift; my $output = ""; $output .= << '__EOD__'; @@ -761,10 +760,9 @@ __EOD__ return $output; } -sub _prepare_rule_lists($$) +sub _prepare_rule_lists($) { my $depend = shift; - my $settings = shift; my $output = ""; foreach my $key (values %{$depend}) { @@ -779,7 +777,7 @@ sub _prepare_rule_lists($$) my $idl_ctx; $output .= _prepare_IDL($idl_ctx); - $output .= _prepare_proto_rules($settings); + $output .= _prepare_proto_rules(); $output .= _prepare_install_rules($depend); return $output; @@ -793,9 +791,9 @@ sub _prepare_rule_lists($$) # $OUTPUT - the global OUTPUT context # # $output - the resulting output buffer -sub _prepare_makefile_in($$) +sub _prepare_makefile_in($) { - my ($CTX, $settings) = @_; + my ($CTX) = @_; my $output; $output = "########################################\n"; @@ -828,7 +826,7 @@ sub _prepare_makefile_in($$) $output .= _prepare_man_rule("7"); $output .= _prepare_manpages($CTX); $output .= _prepare_target_settings($CTX); - $output .= _prepare_rule_lists($CTX, $settings); + $output .= _prepare_rule_lists($CTX); my @all = (); @@ -850,12 +848,12 @@ sub _prepare_makefile_in($$) # $OUTPUT - the global OUTPUT context # # $output - the resulting output buffer -sub create_makefile_in($$$) +sub create_makefile_in($$) { - my ($CTX, $settings,$file) = @_; + my ($CTX, $file) = @_; open(MAKEFILE_IN,">$file") || die ("Can't open $file\n"); - print MAKEFILE_IN _prepare_makefile_in($CTX, $settings); + print MAKEFILE_IN _prepare_makefile_in($CTX); close(MAKEFILE_IN); print "config.smb_build.pl: creating $file\n"; |