summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/idl.pm2
-rw-r--r--source4/build/pidl/idl.yp2
-rwxr-xr-xsource4/build/pidl/pidl.pl16
-rw-r--r--source4/build/pidl/test.pm2
-rw-r--r--source4/build/pidl/util.pm1
-rw-r--r--source4/build/smb_build/config_mk.pm134
-rw-r--r--source4/build/smb_build/input.pm50
-rw-r--r--source4/build/smb_build/main.pm16
-rw-r--r--source4/build/smb_build/makefile.pm19
-rw-r--r--source4/build/smb_build/output.pm4
-rw-r--r--source4/build/smb_build/smb_build_h.pm7
11 files changed, 78 insertions, 175 deletions
diff --git a/source4/build/pidl/idl.pm b/source4/build/pidl/idl.pm
index 636bcfb51c..53c06f22d8 100644
--- a/source4/build/pidl/idl.pm
+++ b/source4/build/pidl/idl.pm
@@ -2400,7 +2400,7 @@ sub parse_idl($$)
}
}
- return $idl;
+ return util::CleanData($idl);
}
1;
diff --git a/source4/build/pidl/idl.yp b/source4/build/pidl/idl.yp
index 775e1fbd38..186f003396 100644
--- a/source4/build/pidl/idl.yp
+++ b/source4/build/pidl/idl.yp
@@ -388,5 +388,5 @@ sub parse_idl($$)
}
}
- return $idl;
+ return util::CleanData($idl);
}
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index b80832dd99..2305d9243b 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -4,6 +4,7 @@
# package to parse IDL files and generate code for
# rpc functions in Samba
# Copyright tridge@samba.org 2000-2003
+# Copyright jelmer@samba.org 2005
# released under the GNU GPL
use strict;
@@ -13,9 +14,9 @@ use lib "$RealBin";
use lib "$RealBin/lib";
use Getopt::Long;
use File::Basename;
-use idl;
use dump;
use ndr_client;
+use idl;
use ndr_header;
use ndr_parser;
use server;
@@ -50,16 +51,6 @@ my($opt_output);
my $idl_parser = new idl;
-#####################################################################
-# parse an IDL file returning a structure containing all the data
-sub IdlParse($)
-{
- my $filename = shift;
- my $idl = $idl_parser->parse_idl($filename);
- util::CleanData($idl);
- return $idl;
-}
-
#########################################
# display help text
sub ShowHelp()
@@ -137,7 +128,7 @@ sub process_file($)
unless ($opt_quiet) { print "Compiling $idl_file\n"; }
if ($opt_parse) {
- $pidl = IdlParse($idl_file);
+ $pidl = $idl_parser->parse_idl($idl_file);
defined @$pidl || die "Failed to parse $idl_file";
typelist::LoadIdl($pidl);
IdlValidator::Validate($pidl);
@@ -271,7 +262,6 @@ $dcom
}
}
-
foreach my $filename (@ARGV) {
process_file($filename);
}
diff --git a/source4/build/pidl/test.pm b/source4/build/pidl/test.pm
index 5f25d4195c..920db52aa5 100644
--- a/source4/build/pidl/test.pm
+++ b/source4/build/pidl/test.pm
@@ -87,7 +87,7 @@ sub link_files($$)
{
my ($exe_name,$objs) = @_;
- return system($cc, @ldflags, '-Lbin', '-lrpc', '-o', $exe_name, @$objs);
+ return system($cc, @ldflags, '-Lbin', '-o', $exe_name, @$objs, '-lrpc', '-ldl', '-lldap');
}
sub test_idl($$$$)
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 5adbea3859..0037de8713 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -83,6 +83,7 @@ sub CleanData($)
if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; }
}
}
+ return $v;
}
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index 464f1674eb..36ce80a8eb 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -11,6 +11,21 @@ use input;
use strict;
+my %attribute_types = (
+ "NOPROTO" => "string",
+ "REQUIRED_SUBSYSTEMS" => "list",
+ "OUTPUT_TYPE" => "string",
+ "INIT_OBJ_FILES" => "list",
+ "ADD_OBJ_FILES" => "list",
+ "OBJ_FILES" => "list",
+ "SUBSYSTEM" => "string",
+ "INIT_FUNCTION" => "string",
+ "MAJOR_VERSION" => "string",
+ "MINOR_VERSION" => "string",
+ "RELEASE_VERSION" => "string",
+ "ENABLE" => "bool"
+);
+
###########################################################
# The parsing function which parses the file
#
@@ -135,109 +150,6 @@ sub _parse_config_mk($)
return $result;
}
-###########################################################
-# A caching function to avoid to parse
-# a file twice or more
-#
-# $result = _get_parse_results($filename)
-#
-# $filename - the path of the config.mk file
-# which should be parsed
-#
-# $result - the resulting structure
-#
-# $result->{ERROR_CODE} - the error_code, '0' means success
-# $result->{ERROR_STR} - the error string
-#
-# $result->{$key}{KEY} - the key == the variable which was parsed
-# $result->{$key}{VAL} - the value of the variable
-my $_get_parse_results_cache;
-sub _get_parse_results($)
-{
- my $filename = shift;
-
- if ((!defined($_get_parse_results_cache->{$filename}{ERROR_CODE}))
- ||($_get_parse_results_cache->{$filename}{ERROR_CODE} != 0)) {
- $_get_parse_results_cache->{$filename} = _parse_config_mk($filename);
- }
-
- return $_get_parse_results_cache->{$filename};
-}
-
-###########################################################
-# The fetching function to fetch the value of a variable
-# out of the file
-#
-# $value = _fetch_var_from_config_mk($filename,$section,$variable)
-#
-# $filename - the path of the config.mk file
-# which should be parsed
-#
-# $section - the section name of the variable
-#
-# $variable - the variable name of which we want the value
-#
-# $value - the value of the variable
-sub _fetch_var_from_config_mk($$$)
-{
- my $filename = shift;
- my $section = shift;
- my $key = shift;
- my $val = "";
- my $result;
-
- $result = _get_parse_results($filename);
-
- if ($result->{ERROR_CODE} != 0) {
- die ($result->{ERROR_STR});
- }
-
- if (defined($result->{$section}{$key})) {
- $val = input::strtrim($result->{$section}{$key}{VAL});
- } elsif (defined($result->{DEFAULT}{$key})) {
- $val = input::strtrim($result->{DEFAULT}{$key}{VAL});
- }
-
- return $val;
-}
-
-###########################################################
-# The fetching function to fetch the array of values of a variable
-# out of the file
-#
-# $array = _fetch_array_from_config_mk($filename,$section,$variable)
-#
-# $filename - the path of the config.mk file
-# which should be parsed
-#
-# $section - the section name of the variable
-#
-# $variable - the variable name of which we want the value
-#
-# $array - the array of values of the variable
-sub _fetch_array_from_config_mk($$$)
-{
- my $filename = shift;
- my $section = shift;
- my $key = shift;
- my $result;
- my $val = "";
-
- $result = _get_parse_results($filename);
-
- if ($result->{ERROR_CODE} != 0) {
- die ($result->{ERROR_STR});
- }
-
- if (defined($result->{$section}{$key})) {
- $val = $result->{$section}{$key}{VAL};
- } elsif (defined($result->{DEFAULT}{$key})) {
- $val = $result->{DEFAULT}{$key}{VAL};
- }
-
- return input::str2array($val);
-}
-
sub import_file($$)
{
my $input = shift;
@@ -255,7 +167,21 @@ sub import_file($$)
$input->{$name}{TYPE} = $type;
foreach my $key (values %{$result->{$section}}) {
- $input->{$name}{$key->{KEY}} = [input::str2array($key->{VAL})];
+ $key->{VAL} = input::strtrim($key->{VAL});
+ my $vartype = $attribute_types{$key->{KEY}};
+ if (not defined($vartype)) {
+ die("Unknown attribute $key->{KEY}");
+ }
+ if ($vartype eq "string") {
+ $input->{$name}{$key->{KEY}} = $key->{VAL};
+ } elsif ($vartype eq "list") {
+ $input->{$name}{$key->{KEY}} = [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}");
+ }
+ $input->{$name}{$key->{KEY}} = $key->{VAL};
+ }
}
}
}
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 72e978dfc5..e8d98d060b 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -47,7 +47,7 @@ sub str2array($)
sub check_subsystem($$)
{
- my $CTX = shift;
+ my $INPUT = shift;
my $subsys = shift;
if ($subsys->{ENABLE} ne "YES") {
printf("Subsystem: %s disabled!\n",$subsys->{NAME});
@@ -56,14 +56,12 @@ sub check_subsystem($$)
unless(defined($subsys->{OUTPUT_TYPE})) {
$subsys->{OUTPUT_TYPE} = $subsystem_default_output_type;
- } else {
- $subsys->{OUTPUT_TYPE} = join('', @{$subsys->{OUTPUT_TYPE}});
}
}
sub check_module($$)
{
- my $CTX = shift;
+ my $INPUT = shift;
my $mod = shift;
die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
@@ -72,9 +70,7 @@ sub check_module($$)
my $use_default = 0;
- $mod->{SUBSYSTEM} = join(' ', @{$mod->{SUBSYSTEM}});
-
- if (!(defined($CTX->{INPUT}{$mod->{SUBSYSTEM}}))) {
+ if (!(defined($INPUT->{$mod->{SUBSYSTEM}}))) {
$mod->{BUILD} = "NOT";
$mod->{ENABLE} = "NO";
printf("Module: %s...PARENT SUBSYSTEM ($mod->{SUBSYSTEM}) DISABLED\n",$mod->{NAME});
@@ -97,7 +93,7 @@ sub check_module($$)
printf("Module: %s...shared\n",$mod->{NAME});
} elsif ($mod->{CHOSEN_BUILD} eq "STATIC") {
$mod->{ENABLE} = "YES";
- push (@{$CTX->{INPUT}{$mod->{SUBSYSTEM}}{REQUIRED_SUBSYSTEMS}}, $mod->{NAME});
+ push (@{$INPUT->{$mod->{SUBSYSTEM}}{REQUIRED_SUBSYSTEMS}}, $mod->{NAME});
printf("Module: %s...static\n",$mod->{NAME});
$mod->{OUTPUT_TYPE} = $subsystem_default_output_type;
} else {
@@ -109,7 +105,7 @@ sub check_module($$)
sub check_library($$)
{
- my $CTX = shift;
+ my $INPUT = shift;
my $lib = shift;
if ($lib->{ENABLE} ne "YES") {
@@ -118,21 +114,11 @@ sub check_library($$)
}
$lib->{OUTPUT_TYPE} = "SHARED_LIBRARY";
-
- if (defined($lib->{MAJOR_VERSION})) {
- $lib->{MAJOR_VERSION} = join('', @{$lib->{MAJOR_VERSION}});
- }
- if (defined($lib->{MINOR_VERSION})) {
- $lib->{MINOR_VERSION} = join('', @{$lib->{MINOR_VERSION}});
- }
- if (defined($lib->{RELEASE_VERSION})) {
- $lib->{RELEASE_VERSION} = join('', @{$lib->{RELEASE_VERSION}});
- }
}
sub check_binary($$)
{
- my $CTX = shift;
+ my $INPUT = shift;
my $bin = shift;
if ($bin->{ENABLE} ne "YES") {
@@ -164,29 +150,29 @@ sub calc_unique_deps
###########################################################
# This function checks the input from the configure script
#
-# check_input($SMB_BUILD_CTX)
+# check_input($INPUT)
#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
+# $INPUT - the global INPUT context
sub check($)
{
- my $CTX = shift;
+ my $INPUT = shift;
($subsystem_default_output_type = $ENV{SUBSYSTEM_OUTPUT_TYPE}) if (defined($ENV{"SUBSYSTEM_OUTPUT_TYPE"}));
- foreach my $part (values %{$CTX->{INPUT}}) {
+ foreach my $part (values %$INPUT) {
($part->{ENABLE} = "YES") if not defined($part->{ENABLE});
}
- foreach my $k (keys %{$CTX->{INPUT}}) {
- my $part = $CTX->{INPUT}->{$k};
+ foreach my $k (keys %$INPUT) {
+ my $part = $INPUT->{$k};
if (not defined($part->{TYPE})) {
print STDERR "$k does not have a type set.. Perhaps it's only mentioned in a .m4 but not in a .mk file?\n";
next;
}
- check_subsystem($CTX, $part) if ($part->{TYPE} eq "SUBSYSTEM");
- check_module($CTX, $part) if ($part->{TYPE} eq "MODULE");
- check_library($CTX, $part) if ($part->{TYPE} eq "LIBRARY");
- check_binary($CTX, $part) if ($part->{TYPE} eq "BINARY");
+ check_subsystem($INPUT, $part) if ($part->{TYPE} eq "SUBSYSTEM");
+ check_module($INPUT, $part) if ($part->{TYPE} eq "MODULE");
+ check_library($INPUT, $part) if ($part->{TYPE} eq "LIBRARY");
+ check_binary($INPUT, $part) if ($part->{TYPE} eq "BINARY");
#FIXME: REQUIRED_LIBRARIES needs to go
if (defined($part->{REQUIRED_LIBRARIES})) {
@@ -195,7 +181,7 @@ sub check($)
}
}
- my %depend = %{$CTX->{INPUT}};
+ my %depend = %$INPUT;
foreach my $part (values %depend) {
@@ -215,7 +201,7 @@ sub check($)
calc_unique_deps($part->{DEPENDENCIES}, $part->{UNIQUE_DEPENDENCIES});
}
- return %depend;
+ return \%depend;
}
1;
diff --git a/source4/build/smb_build/main.pm b/source4/build/smb_build/main.pm
index 2fcd4594ac..c13fa2cb23 100644
--- a/source4/build/smb_build/main.pm
+++ b/source4/build/smb_build/main.pm
@@ -17,9 +17,6 @@ use strict;
sub smb_build_main($)
{
my $INPUT = shift;
- my %SMB_BUILD_CTX = (
- INPUT => $INPUT
- );
my @mkfiles = (
"dsdb/config.mk",
@@ -71,19 +68,20 @@ sub smb_build_main($)
$| = 1;
for my $mkfile (@mkfiles) {
- config_mk::import_file($SMB_BUILD_CTX{INPUT}, $mkfile);
+ config_mk::import_file($INPUT, $mkfile);
}
- %{$SMB_BUILD_CTX{DEPEND}} = input::check(\%SMB_BUILD_CTX);
+ my $DEPEND = input::check($INPUT);
- %{$SMB_BUILD_CTX{OUTPUT}} = output::create_output($SMB_BUILD_CTX{DEPEND});
+ my $OUTPUT = output::create_output($DEPEND);
- makefile::create_makefile_in($SMB_BUILD_CTX{OUTPUT});
+ makefile::create_makefile_in($OUTPUT, "Makefile.in");
- smb_build_h::create_smb_build_h($SMB_BUILD_CTX{OUTPUT});
+ smb_build_h::create_smb_build_h($OUTPUT, "include/smb_build.h");
open DOTTY, ">samba4-deps.dot";
- print DOTTY dot::generate($SMB_BUILD_CTX{DEPEND});
+ 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 1d5b03b124..19ed201d81 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -597,7 +597,7 @@ sub _prepare_obj_lists($)
my $CTX = shift;
my $output = "";
- foreach my $key (values %{$CTX}) {
+ foreach my $key (values %$CTX) {
next if not defined($key->{OBJ_LIST});
$output .= _prepare_obj_list($key->{TYPE}, $key);
}
@@ -760,9 +760,9 @@ sub _prepare_rule_lists($)
###########################################################
# This function prepares the output for Makefile
#
-# $output = _prepare_makefile_in($SMB_BUILD_CTX)
+# $output = _prepare_makefile_in($OUTPUT)
#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
+# $OUTPUT - the global OUTPUT context
#
# $output - the resulting output buffer
sub _prepare_makefile_in($)
@@ -811,23 +811,24 @@ sub _prepare_makefile_in($)
}
###########################################################
-# This function creates Makefile.in from the SMB_BUILD
+# This function creates Makefile.in from the OUTPUT
# context
#
-# create_makefile_in($SMB_BUILD_CTX)
+# create_makefile_in($OUTPUT)
#
-# $SMB_BUILD_CTX - the global SMB_BUILD context
+# $OUTPUT - the global OUTPUT context
#
# $output - the resulting output buffer
-sub create_makefile_in($)
+sub create_makefile_in($$)
{
my $CTX = shift;
+ my $file = shift;
- open(MAKEFILE_IN,"> Makefile.in") || die ("Can't open Makefile.in\n");
+ open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
print MAKEFILE_IN _prepare_makefile_in($CTX);
close(MAKEFILE_IN);
- print "config.smb_build.pl: creating Makefile.in\n";
+ print "config.smb_build.pl: creating $file\n";
return;
}
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index f6a9fc6eb3..6972817ca9 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -100,7 +100,7 @@ sub create_output($)
push(@{$part->{LINK_FLAGS}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
- push(@{$part->{SUBSYSTEM_INIT_FUNCTIONS}}, @{$elem->{INIT_FUNCTION}}) if
+ push(@{$part->{SUBSYSTEM_INIT_FUNCTIONS}}, $elem->{INIT_FUNCTION}) if
$part->{OUTPUT_TYPE} eq "BINARY" and
defined($elem->{INIT_FUNCTION}) and
$elem->{INIT_FUNCTION} ne "" and
@@ -108,7 +108,7 @@ sub create_output($)
}
}
- return %{$depend};
+ return $depend;
}
1;
diff --git a/source4/build/smb_build/smb_build_h.pm b/source4/build/smb_build/smb_build_h.pm
index f3b0a2b837..e874c77ce8 100644
--- a/source4/build/smb_build/smb_build_h.pm
+++ b/source4/build/smb_build/smb_build_h.pm
@@ -97,20 +97,21 @@ sub _prepare_smb_build_h($)
# $SMB_BUILD_CTX - the global SMB_BUILD context
#
# $output - the resulting output buffer
-sub create_smb_build_h($)
+sub create_smb_build_h($$)
{
my $CTX = shift;
+ my $file = shift;
my $output = "/* autogenerated by config.smb_build.pl */\n";
$output .= _prepare_smb_build_h($CTX);
- open(SMB_BUILD_H,"> include/smb_build.h") || die ("Can't open include/smb_build.h\n");
+ open(SMB_BUILD_H,"> $file") || die ("Can't open $file\n");
print SMB_BUILD_H $output;
close(SMB_BUILD_H);
- print "config.smb_build.pl: creating include/smb_build.h\n";
+ print "config.smb_build.pl: creating $file\n";
return;
}
1;