diff options
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/m4/check_path.m4 | 16 | ||||
-rw-r--r-- | source4/build/m4/check_perl.m4 | 2 | ||||
-rw-r--r-- | source4/build/m4/core.m4 | 68 | ||||
-rw-r--r-- | source4/build/m4/env.m4 | 2 | ||||
-rw-r--r-- | source4/build/m4/public.m4 | 179 | ||||
-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 |
10 files changed, 125 insertions, 296 deletions
diff --git a/source4/build/m4/check_path.m4 b/source4/build/m4/check_path.m4 index a6e9ab258d..55f04dee9a 100644 --- a/source4/build/m4/check_path.m4 +++ b/source4/build/m4/check_path.m4 @@ -14,16 +14,16 @@ AC_PREFIX_DEFAULT(/usr/local/samba) AC_ARG_WITH(fhs, [ --with-fhs Use FHS-compliant paths (default=no)], configdir="${sysconfdir}/samba" - lockdir="\${VARDIR}/cache/samba" - piddir="\${VARDIR}/run/samba" - logfilebase="\${VARDIR}/log/samba" + lockdir="\${localstatedir}/cache/samba" + piddir="\${localstatedir}/run/samba" + logfilebase="\${localstatedir}/log/samba" privatedir="\${CONFIGDIR}/private" libdir="\${prefix}/lib/samba" swatdir="\${DATADIR}/samba/swat", - configdir="\${LIBDIR}" - logfilebase="\${VARDIR}" - lockdir="\${VARDIR}/locks" - piddir="\${VARDIR}/locks" + configdir="\${libdir}" + logfilebase="\${localstatedir}" + lockdir="\${localstatedir}/locks" + piddir="\${localstatedir}/locks" privatedir="\${prefix}/private" swatdir="\${prefix}/swat") @@ -152,8 +152,6 @@ AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings a CFLAGS="${CFLAGS} -g -Wall" developer=yes DEVELOPER_CFLAGS="-Wshadow -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -Wmissing-format-attribute -Wformat=2 -Wno-format-y2k -DDEBUG_PASSWORD -DDEVELOPER" - SMB_INFO_BUILD_ENV="$SMB_INFO_BUILD_ENV - \$SETTINGS{DEVELOPER} = \"YES\";" fi]) debug=no diff --git a/source4/build/m4/check_perl.m4 b/source4/build/m4/check_perl.m4 index 5e493db875..34a7e5e769 100644 --- a/source4/build/m4/check_perl.m4 +++ b/source4/build/m4/check_perl.m4 @@ -8,7 +8,7 @@ dnl AC_PATH_PROG(PERL, perl) if test x"$PERL" = x""; then AC_MSG_WARN([No version of perl was not found!]) - AC_MSG_ERROR([Please Install perl from http://www.perl.com/]) + AC_MSG_ERROR([Please install perl from http://www.perl.com/]) fi if test x"$debug" = x"yes";then PERL="$PERL -W" diff --git a/source4/build/m4/core.m4 b/source4/build/m4/core.m4 deleted file mode 100644 index 6471fc9e64..0000000000 --- a/source4/build/m4/core.m4 +++ /dev/null @@ -1,68 +0,0 @@ -dnl SMB Build Core System -dnl ------------------------------------------------------- -dnl Copyright (C) Stefan (metze) Metzmacher 2004 -dnl Copyright (C) Jelmer Vernooij 2004 -dnl Released under the GNU GPL -dnl ------------------------------------------------------- -dnl -dnl _SMB_BUILD_CORE( -dnl 1: outputfile -dnl ) - -dnl ####################################################### -dnl ### And now the implementation ### -dnl ####################################################### - -dnl _SMB_BUILD_CORE( -dnl 1: outputfile -dnl ) -AC_DEFUN([_SMB_BUILD_CORE], -[ - -$PERL -I$srcdir/build <<\_SMB_ACEOF -use strict; - -my %SETTINGS; -my %INPUT; - -use smb_build::main; - -########################################################### -### First we list all info from configure ### -########################################################### -# -######################################### -## Start Build Env -$SMB_INFO_BUILD_ENV -## End Build Env -######################################### -######################################### -## Start Ext Libs -$SMB_INFO_EXT_LIBS -## End Ext Libs -######################################### -######################################### -## Start Modules -$SMB_INFO_MODULES -## End Modules -######################################### -## Start Subsystems -$SMB_INFO_SUBSYSTEMS -## End Subsystems -######################################### -## Start Libraries -$SMB_INFO_LIBRARIES -## End Libraries -######################################### -## Start Binaries -$SMB_INFO_BINARIES -## End Binaries -######################################### - -$SMB_INFO_ENABLES - -smb_build_main(\%INPUT, \%SETTINGS); - -_SMB_ACEOF - -]) diff --git a/source4/build/m4/env.m4 b/source4/build/m4/env.m4 index 7d43f920dd..7ab6dc61b0 100644 --- a/source4/build/m4/env.m4 +++ b/source4/build/m4/env.m4 @@ -13,8 +13,6 @@ if test -n "${SAMBA_VERSION_SVN_REVISION}";then echo "BUILD REVISION: ${SAMBA_VERSION_SVN_REVISION}" fi -SMB_INFO_BUILD_ENV="" - sinclude(build/m4/check_path.m4) sinclude(build/m4/check_perl.m4) sinclude(build/m4/check_cc.m4) diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 2a6b4e3893..c70514bdb6 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -1,104 +1,46 @@ dnl SMB Build System dnl ---------------- dnl Copyright (C) 2004 Stefan Metzmacher -dnl Copyright (C) 2004 Jelmer Vernooij +dnl Copyright (C) 2004-2005 Jelmer Vernooij dnl Published under the GPL dnl -dnl SMB_MODULE_DEFAULT( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_MODULE_DEFAULT(name,default_build) dnl -dnl SMB_SUBSYSTEM_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_SUBSYSTEM_ENABLE(name,default_build) dnl -dnl SMB_SUBSYSTEM( -dnl 1:name, -dnl 2:init_obj_files, -dnl 3:add_obj_files, -dnl 4:required_libraries, -dnl 5:required_subsystems -dnl ) +dnl SMB_SUBSYSTEM(name,init_obj_files,add_obj_files,required_subsystems) dnl -dnl SMB_EXT_LIB_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_EXT_LIB_ENABLE(name,default_build) dnl -dnl SMB_EXT_LIB_FROM_PKGCONFIG( -dnl 1:name, -dnl 2:pkg-config name -dnl ) +dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name) dnl -dnl SMB_EXT_LIB( -dnl 1:name, -dnl 2:libs, -dnl 3:cflags, -dnl 4:cppflags, -dnl 5:ldflags -dnl ) +dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags) dnl -dnl SMB_LIBRARY_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_LIBRARY_ENABLE(name,default_build) dnl -dnl SMB_BINARY_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_BINARY_ENABLE(name,default_build) dnl -dnl SMB_MAKE_TARGET( -dnl 1:name -dnl 2:calledname -dnl ) -dnl -dnl SMB_ENV_CHECK( -dnl 1:dummy -dnl ) -dnl -dnl SMB_AC_OUTPUT( -dnl 1: outputfile -dnl ) - dnl ####################################################### dnl ### And now the implementation ### dnl ####################################################### -AC_DEFUN([STR2ARRAY], [@<:@ input::str2array(\"$1\") @:>@]) - - -dnl SMB_MODULE_DEFAULT( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_MODULE_DEFAULT(name,default_build) AC_DEFUN([SMB_MODULE_DEFAULT], [ [SMB_MODULE_DEFAULT][$1]="$2" -SMB_INFO_MODULES="$SMB_INFO_MODULES -\$INPUT{$1}{DEFAULT_BUILD} = \"$2\";" +SMB_INFO_ENABLES="$SMB_INFO_ENABLES +\$enabled{$1} = \"$2\";" ]) -dnl SMB_SUBSYSTEM_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_SUBSYSTEM_ENABLE(name,default_build) AC_DEFUN([SMB_SUBSYSTEM_ENABLE], [ [SMB_SUBSYSTEM_ENABLE_][$1]="$2" -SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS -\$INPUT{$1}{ENABLE} = \"$2\";" +SMB_INFO_ENABLES="$SMB_INFO_ENABLES +\$enabled{$1} = \"$2\";" ]) -dnl SMB_SUBSYSTEM( -dnl 1:name, -dnl 2:init_obj_files, -dnl 3:add_obj_files, -dnl 4:required_libs, -dnl 5:required_subsystems -dnl ) +dnl SMB_SUBSYSTEM(name,init_obj_files,add_obj_files,required_subsystems) AC_DEFUN([SMB_SUBSYSTEM], [ @@ -113,35 +55,25 @@ AC_DEFUN([SMB_SUBSYSTEM], SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS ################################### # Start Subsystem $1 -\$INPUT{$1} = { - TYPE => \"SUBSYSTEM\", - NAME => \"$1\", - INIT_OBJ_FILES => ][STR2ARRAY([$2])][, - ADD_OBJ_FILES => ][STR2ARRAY([$3])][, - REQUIRED_LIBRARIES => ][STR2ARRAY([$4])][, - REQUIRED_SUBSYSTEMS => ][STR2ARRAY([$5])][, - ENABLE => \"YES\" -}; +@<:@SUBSYSTEM::$1@:>@ +INIT_OBJ_FILES = $2 +ADD_OBJ_FILES = $3 +REQUIRED_SUBSYSTEMS = $4 +ENABLE = YES # End Subsystem $1 ################################### " ]) -dnl SMB_EXT_LIB_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_EXT_LIB_ENABLE(name,default_build) AC_DEFUN([SMB_EXT_LIB_ENABLE], [ [SMB_EXT_LIB_ENABLE_][$1]="$2" SMB_INFO_ENABLES="$SMB_INFO_ENABLES -\$INPUT{EXT_LIB_$1}{ENABLE} = \"$2\";" +\$enabled{EXT_LIB_$1} = \"$2\";" ]) -dnl SMB_EXT_LIB_FROM_PKGCONFIG( -dnl 1:name, -dnl 2:pkg-config name -dnl ) +dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name) AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], [ dnl Figure out the correct variables and call SMB_EXT_LIB() @@ -201,76 +133,35 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], fi ]) -dnl SMB_EXT_LIB( -dnl 1:name, -dnl 2:libs, -dnl 3:cflags, -dnl 4:cppflags, -dnl 5:ldflags -dnl ) +dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags) AC_DEFUN([SMB_EXT_LIB], [ SMB_INFO_EXT_LIBS="$SMB_INFO_EXT_LIBS ################################### # Start Ext Lib $1 -\$INPUT{EXT_LIB_$1} = { - TYPE => \"EXT_LIB\", - NAME => \"EXT_LIB_$1\", - LIBS => ][STR2ARRAY([$2])][, - CFLAGS => ][STR2ARRAY([$3])][, - CPPFLAGS => ][STR2ARRAY([$4])][, - LDFLAGS => ][STR2ARRAY([$5])][ -}; +@<:@EXT_LIB::EXT_LIB_$1@:>@ +LIBS = $2 +CFLAGS = $3 +CPPFLAGS = $4 +LDFLAGS = $5 # End Ext Lib $1 ################################### " ]) - -dnl SMB_LIBRARY_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_LIBRARY_ENABLE(name,default_build) AC_DEFUN([SMB_LIBRARY_ENABLE], [ SMB_INFO_ENABLES="$SMB_INFO_ENABLES -\$INPUT{$1}{ENABLE} = \"$2\";" +\$enabled{$1} = \"$2\";" ]) -dnl SMB_BINARY_ENABLE( -dnl 1:name, -dnl 2:default_build -dnl ) +dnl SMB_BINARY_ENABLE(name,default_build) AC_DEFUN([SMB_BINARY_ENABLE], [ [SMB_BINARY_ENABLE_][$1]="$2"; -SMB_INFO_BINARIES="$SMB_INFO_BINARIES -\$INPUT{$1}{ENABLE} = \"$2\";" -]) - -dnl SMB_MAKE_TARGET( -dnl 1:name -dnl 2:calledname -dnl ) -AC_DEFUN([SMB_MAKE_TARGET], -[ - echo "#SMB_MAKE_TARGET TOTO" -]) - -dnl SMB_ENV_CHECK( -dnl 1:dummy -dnl ) -AC_DEFUN([SMB_ENV_CHECK], -[ - _SMB_BUILD_ENV($1) -]) - -dnl SMB_AC_OUTPUT( -dnl 1: outputfile -dnl ) -AC_DEFUN([SMB_AC_OUTPUT], -[ - AC_OUTPUT([$1],[],[_SMB_BUILD_CORE([[$1][.in]])]) +SMB_INFO_ENABLES="$SMB_INFO_ENABLES +\$enabled{$1} = \"$2\";" ]) 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"; |