summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/m4/rewrite.m42
-rw-r--r--source4/build/smb_build/config_mk.pm24
-rw-r--r--source4/build/smb_build/dot.pm23
-rw-r--r--source4/build/smb_build/input.pm16
-rw-r--r--source4/build/smb_build/main.pm11
-rw-r--r--source4/build/smb_build/makefile.pm9
-rw-r--r--source4/build/smb_build/output.pm20
-rw-r--r--source4/build/smb_build/public.m4205
8 files changed, 89 insertions, 221 deletions
diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4
index b0c694b1a0..ee73451697 100644
--- a/source4/build/m4/rewrite.m4
+++ b/source4/build/m4/rewrite.m4
@@ -281,7 +281,7 @@ AC_CHECK_TYPES(intptr_t)
############################################
# we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
-AC_SEARCH_LIBS(dlopen, [dl])
+AC_SEARCH_LIBS(dlopen, [dl], [SMB_EXT_LIB(DL, [-ldl])])
# dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
############################################
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index 7b8fbd93c3..11ef8cf7b1 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -61,7 +61,7 @@ sub _parse_config_mk($)
}
#
- # 1.) lines with an aplhanumeric character indicate
+ # 1.) lines with an alphanumeric character indicate
# a new variable,
# 2.) followed by zero or more whitespaces or tabs
# 3.) then one '=' character
@@ -437,4 +437,26 @@ sub binary_get_array($$$)
return _fetch_array_from_config_mk($filename,$section,$var);
}
+
+sub import_file($$)
+{
+ my $input = shift;
+ my $filename = shift;
+
+ my $result = _parse_config_mk($filename);
+
+ die ($result->{ERROR_STR}) unless $result->{ERROR_CODE} == 0;
+
+ foreach my $section (keys %{$result}) {
+ next if ($section eq "ERROR_CODE");
+ my ($type, $name) = split(/::/, $section, 2);
+
+ $input->{$name}{NAME} = $name;
+ $input->{$name}{TYPE} = $type;
+
+ foreach my $key (values %{$result->{$section}}) {
+ $input->{$name}{$key->{KEY}} = [input::str2array($key->{VAL})];
+ }
+ }
+}
1;
diff --git a/source4/build/smb_build/dot.pm b/source4/build/smb_build/dot.pm
new file mode 100644
index 0000000000..c8720f1a8d
--- /dev/null
+++ b/source4/build/smb_build/dot.pm
@@ -0,0 +1,23 @@
+# Samba4 Dependency Graph Generator
+# (C) 2004 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GNU GPL
+
+package dot;
+use strict;
+
+sub generate($)
+{
+ my $depend = shift;
+ my $res = "digraph samba4 {\n";
+
+ foreach my $part (values %{$depend}) {
+ foreach my $elem (@{$part->{DEPENDENCIES}}) {
+ next if $part == $elem;
+ $res .= "\t\"$part->{NAME}\" -> \"$$elem->{NAME}\";\n";
+ }
+ }
+
+ return $res . "}\n";
+}
+
+1;
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index c4a4052d8f..b94586d2c2 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -60,17 +60,23 @@ sub check_module($$)
{
my $CTX = shift;
my $mod = shift;
+
+ 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;
+ $mod->{SUBSYSTEM} = join(' ', @{$mod->{SUBSYSTEM}});
+
if (!(defined($CTX->{INPUT}{$mod->{SUBSYSTEM}}))) {
$mod->{BUILD} = "NOT";
$mod->{ENABLE} = "NO";
- printf("Module: %s...PARENT SUBSYSTEM DISABLED\n",$mod->{NAME});
+ printf("Module: %s...PARENT SUBSYSTEM ($mod->{SUBSYSTEM}) DISABLED\n",$mod->{NAME});
return;
}
- if ($mod->{CHOSEN_BUILD} eq "DEFAULT") {
+ if (not defined($mod->{CHOSEN_BUILD}) or $mod->{CHOSEN_BUILD} eq "DEFAULT") {
$mod->{CHOSEN_BUILD} = $mod->{DEFAULT_BUILD};
}
@@ -114,6 +120,8 @@ sub check_binary($$)
return;
}
+ ($bin->{BINARY} = (lc $bin->{NAME})) if not defined($bin->{BINARY});
+
$bin->{OUTPUT_TYPE} = "BINARY";
}
@@ -144,6 +152,10 @@ sub check($)
my $CTX = shift;
foreach my $part (values %{$CTX->{INPUT}}) {
+ ($part->{ENABLE} = "YES") if not defined($part->{ENABLE});
+ }
+
+ foreach my $part (values %{$CTX->{INPUT}}) {
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");
diff --git a/source4/build/smb_build/main.pm b/source4/build/smb_build/main.pm
index 50aae15fdc..324b8adc61 100644
--- a/source4/build/smb_build/main.pm
+++ b/source4/build/smb_build/main.pm
@@ -12,6 +12,7 @@ use input;
use config_mk;
use output;
use direct;
+use dot;
use strict;
sub smb_build_main($)
@@ -21,6 +22,12 @@ sub smb_build_main($)
INPUT => $INPUT
);
+ my @mkfiles = split /\n/, `find -name "*.mk"`;
+
+ for my $mkfile (@mkfiles) {
+ config_mk::import_file($SMB_BUILD_CTX{INPUT}, $mkfile);
+ }
+
%{$SMB_BUILD_CTX{DEPEND}} = input::check(\%SMB_BUILD_CTX);
%{$SMB_BUILD_CTX{OUTPUT}} = output::create_output($SMB_BUILD_CTX{DEPEND});
@@ -28,5 +35,9 @@ sub smb_build_main($)
makefile::create_makefile_in($SMB_BUILD_CTX{OUTPUT});
smb_build_h::create_smb_build_h($SMB_BUILD_CTX{OUTPUT});
+
+ open DOTTY, ">samba4-deps.dot";
+ print DOTTY dot::generate($SMB_BUILD_CTX{DEPEND});
+ close DOTTY;
}
1;
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 21e2100fb2..bfc3aa7bf0 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -357,16 +357,20 @@ LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
#
# Shared $ctx->{LIBRARY_REALNAME}
-bin/$ctx->{LIBRARY_REALNAME}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+$ctx->{OUTPUT}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
\$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
\$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
+";
+
+ if (defined($ctx->{LIBRARY_SONAME})) {
+ $output .= "
# Symlink $ctx->{LIBRARY_SONAME}
bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
\@echo Symlink \$\@
\@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
-# Symlink $ctx->{_LIBRARY_NAME}
+# Symlink $ctx->{LIBRARY_NAME}
bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
\@echo Symlink \$\@
\@ln -sf $ctx->{LIBRARY_SONAME} \$\@
@@ -374,6 +378,7 @@ library_$ctx->{NAME}: basics $ctx->{LIBRARY_SONAME}
# End Library $ctx->{NAME}
###################################
";
+ }
return $output;
}
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index b40c566077..7d310670f6 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -25,10 +25,12 @@ sub generate_shared_library($)
@{$lib->{DEPEND_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
$lib->{LIBRARY_NAME} = $lib->{NAME}.".so";
- $lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}";
- $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_SONAME}.".$lib->{MINOR_VERSION}.$lib->{RELEASE_VERSION}";
-
- $lib->{OUTPUT} = "bin/$lib->{LIBRARY_SONAME}";
+ $lib->{OUTPUT} = "bin/$lib->{LIBRARY_NAME}";
+ if ($lib->{MAJOR_VERSION}) {
+ $lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}";
+ $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_SONAME}.".$lib->{MINOR_VERSION}.$lib->{RELEASE_VERSION}";
+ $lib->{OUTPUT} = "bin/$lib->{LIBRARY_REALNAME}";
+ }
}
sub generate_static_library($)
@@ -71,8 +73,8 @@ sub create_output($)
generate_binary($part) if $part->{OUTPUT_TYPE} eq "BINARY";
generate_objlist($part) if $part->{OUTPUT_TYPE} eq "OBJLIST";
- generate_shared_library($part) if $part->{TYPE} eq "SHARED_LIBRARY";
- generate_static_library($part) if $part->{TYPE} eq "STATIC_LIBRARY";
+ generate_shared_library($part) if $part->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
+ generate_static_library($part) if $part->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
# Combine object lists
push(@{$part->{OBJ_LIST}}, @{$part->{INIT_OBJ_FILES}}) if defined($part->{INIT_OBJ_FILES});
@@ -96,13 +98,13 @@ sub create_output($)
push(@{$part->{LINK_LIST}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});
- push(@{$part->{MODULE_INIT_FUNCTIONS}}, $elem->{INIT_FUNCTION}) if
+ push(@{$part->{MODULE_INIT_FUNCTIONS}}, @{$elem->{INIT_FUNCTION}}) if
$elem->{TYPE} eq "MODULE" and
defined($elem->{INIT_FUNCTION}) and
$elem->{INIT_FUNCTION} ne "" and
$elem->{SUBSYSTEM} eq $part->{NAME};
- push(@{$part->{SUBSYSTEM_INIT_FUNCTIONS}}, $elem->{INIT_FUNCTION}) if
+ push(@{$part->{SUBSYSTEM_INIT_FUNCTIONS}}, @{$elem->{INIT_FUNCTION}}) if
$part->{OUTPUT_TYPE} eq "BINARY" and
$elem->{TYPE} eq "SUBSYSTEM" and
defined($elem->{INIT_FUNCTION}) and
@@ -110,8 +112,6 @@ sub create_output($)
}
}
- print Data::Dumper::Dumper($depend);
-
return %{$depend};
}
diff --git a/source4/build/smb_build/public.m4 b/source4/build/smb_build/public.m4
index add6d18f36..de805e6085 100644
--- a/source4/build/smb_build/public.m4
+++ b/source4/build/smb_build/public.m4
@@ -19,25 +19,6 @@ dnl 6:required_libraries,
dnl 7:required_subsystems
dnl )
dnl
-dnl SMB_MODULE_MK(
-dnl 1:name,
-dnl 2:subsystem,
-dnl 3:default_build,
-dnl 4:config_mk_file
-dnl [MODULE::test]
-dnl INIT_OBJ_FILES = \
-dnl test.o
-dnl ADD_OBJ_FILES = \
-dnl test_utils1.o \
-dnl test_utils2.o
-dnl REQUIRED_LIBRARIES = \
-dnl LIB_EXT_TEST1 \
-dnl LIB_EXT_TEST2
-dnl REQUIRED_SUBSYSTEMS = \
-dnl OTHER_SUBSYSTEM1 \
-dnl OTHER_SUBSYSTEM2
-dnl )
-dnl
dnl SMB_SUBSYSTEM_ENABLE(
dnl 1:name,
dnl 2:default_build
@@ -55,23 +36,6 @@ dnl 4:required_libraries,
dnl 5:required_subsystems
dnl )
dnl
-dnl SMB_SUBSYSTEM_MK(
-dnl 1:name,
-dnl 2:config_mk_file
-dnl [SUBSYSTEM::test]
-dnl INIT_OBJ_FILES = \
-dnl test.o
-dnl ADD_OBJ_FILES = \
-dnl test_utils1.o \
-dnl test_utils2.o
-dnl REQUIRED_LIBRARIES = \
-dnl LIB_EXT_TEST1 \
-dnl LIB_EXT_TEST2
-dnl REQUIRED_SUBSYSTEMS = \
-dnl OTHER_SUBSYSTEM1 \
-dnl OTHER_SUBSYSTEM2
-dnl )
-dnl
dnl SMB_EXT_LIB_ENABLE(
dnl 1:name,
dnl 2:default_build
@@ -105,24 +69,6 @@ dnl 6:required_libraries,
dnl 7:required_subsystems
dnl )
dnl
-dnl SMB_LIBRARY_MK(
-dnl 1:name,
-dnl 2:config_mk_file
-dnl [LIBRARY::test]
-dnl MAJOR_VERSION = 0
-dnl MINOR_VERSION = 0
-dnl RELEASE_VERSION = 1
-dnl OBJ_FILES = \
-dnl test1.o \
-dnl test2.o
-dnl REQUIRED_LIBRARIES = \
-dnl LIB_EXT_TEST1 \
-dnl LIB_EXT_TEST2
-dnl REQUIRED_SUBSYSTEMS = \
-dnl OTHER_SUBSYSTEM1 \
-dnl OTHER_SUBSYSTEM2
-dnl )
-dnl
dnl SMB_BINARY_ENABLE(
dnl 1:name,
dnl 2:default_build
@@ -137,23 +83,6 @@ dnl 5:required_libraries,
dnl 6:required_subsystems
dnl )
dnl
-dnl SMB_BINARY_MK(
-dnl 1:name,
-dnl 2:config_mk_file
-dnl [BINARY::test]
-dnl BUILD_TARGETS =
-dnl INSTALL_PATH =
-dnl OBJ_FILES = \
-dnl test1.o \
-dnl test2.o
-dnl REQUIRED_LIBRARIES = \
-dnl LIB_EXT_TEST1 \
-dnl LIB_EXT_TEST2
-dnl REQUIRED_SUBSYSTEMS = \
-dnl OTHER_SUBSYSTEM1 \
-dnl OTHER_SUBSYSTEM2
-dnl )
-dnl
dnl SMB_MAKE_TARGET(
dnl 1:name
dnl 2:calledname
@@ -234,47 +163,6 @@ SMB_INFO_MODULES="$SMB_INFO_MODULES
"
])
-dnl SMB_MODULE_MK(
-dnl 1:name,
-dnl 2:subsystem,
-dnl 3:default_build,
-dnl 4:config_mk_file
-dnl )
-AC_DEFUN([SMB_MODULE_MK],
-[
-
- if test -z "$[SMB_MODULE_DEFAULT_][$1]"; then
- [SMB_MODULE_DEFAULT_][$1]=$3
- fi
-
- if test "$[SMB_MODULE_][$1]"; then
- [SMB_MODULE_][$1]=$[SMB_MODULE_][$1]
- elif test "$[SMB_MODULE_]translit([$2], [A-Z], [a-z])" -a x"$[SMB_MODULE_DEFAULT_][$1]" != xNOT; then
- [SMB_MODULE_][$1]=$[SMB_MODULE_]translit([$2], [A-Z], [a-z])
- else
- [SMB_MODULE_][$1]="DEFAULT";
- fi
-
-SMB_INFO_MODULES="$SMB_INFO_MODULES
-###################################
-# Start MODULE $1
-\$INPUT{$1} = {
- TYPE => \"MODULE\",
- NAME => \"$1\",
- SUBSYSTEM => \"$2\",
- DEFAULT_BUILD => \"$[SMB_MODULE_DEFAULT_][$1]\",
- INIT_OBJ_FILES => @<:@ config_mk::module_get_array(\"$4\", \"$1\", \"INIT_OBJ_FILES\") @:>@,
- ADD_OBJ_FILES => @<:@ config_mk::module_get_array(\"$4\", \"$1\", \"ADD_OBJ_FILES\") @:>@,
- REQUIRED_LIBRARIES => @<:@ config_mk::module_get_array(\"$4\", \"$1\", \"REQUIRED_LIBRARIES\") @:>@,
- REQUIRED_SUBSYSTEMS => @<:@ config_mk::module_get_array(\"$4\", \"$1\", \"REQUIRED_SUBSYSTEMS\") @:>@,
- INIT_FUNCTION => config_mk::module_get_var(\"$4\", \"$1\", \"INIT_FUNCTION\"),
- CHOSEN_BUILD => \"$[SMB_MODULE_][$1]\"
-};
-# End MODULE $1
-###################################
-"
-])
-
dnl SMB_SUBSYSTEM_ENABLE(
dnl 1:name,
dnl 2:default_build
@@ -328,40 +216,6 @@ SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
"
])
-dnl SMB_SUBSYSTEM_MK(
-dnl 1:name,
-dnl 2:config_mk_file
-dnl )
-AC_DEFUN([SMB_SUBSYSTEM_MK],
-[
-
- if test -z "$[SMB_SUBSYSTEM_ENABLE_][$1]"; then
- [SMB_SUBSYSTEM_ENABLE_][$1]="YES";
- fi
-
- if test -z "$[SMB_SUBSYSTEM_NOPROTO_][$1]"; then
- [SMB_SUBSYSTEM_NOPROTO_][$1]="NO";
- fi
-
-SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
-###################################
-# Start Subsystem $1
-\$INPUT{$1} = {
- TYPE => \"SUBSYSTEM\",
- NAME => \"$1\",
- INIT_OBJ_FILES => @<:@ config_mk::subsystem_get_array(\"$2\", \"$1\", \"INIT_OBJ_FILES\") @:>@,
- ADD_OBJ_FILES => @<:@ config_mk::subsystem_get_array(\"$2\", \"$1\", \"ADD_OBJ_FILES\") @:>@,
- REQUIRED_LIBRARIES => @<:@ config_mk::subsystem_get_array(\"$2\", \"$1\", \"REQUIRED_LIBRARIES\") @:>@,
- REQUIRED_SUBSYSTEMS => @<:@ config_mk::subsystem_get_array(\"$2\", \"$1\", \"REQUIRED_SUBSYSTEMS\") @:>@,
- INIT_FUNCTION => config_mk::subsystem_get_var(\"$2\", \"$1\", \"INIT_FUNCTION\"),
- ENABLE => \"$[SMB_SUBSYSTEM_ENABLE_][$1]\",
- NOPROTO => \"$[SMB_SUBSYSTEM_NOPROTO_][$1]\"
-};
-# End Subsystem $1
-###################################
-"
-])
-
dnl SMB_EXT_LIB_ENABLE(
dnl 1:name,
dnl 2:default_build
@@ -495,36 +349,6 @@ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
"
])
-dnl SMB_LIBRARY_MK(
-dnl 1:name,
-dnl 2:config_mk_file
-dnl )
-AC_DEFUN([SMB_LIBRARY_MK],
-[
-
- if test -z "$[SMB_LIBRARY_ENABLE_][$1]"; then
- [SMB_LIBRARY_ENABLE_][$1]="NO";
- fi
-
-SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
-###################################
-# Start Library $1
-\$INPUT{$1} = {
- TYPE => \"LIBRARY\",
- NAME => \"$1\",
- MAJOR_VERSION => config_mk::library_get_var(\"$2\", \"$1\", \"MAJOR_VERSION\"),
- MINOR_VERSION => config_mk::library_get_var(\"$2\", \"$1\", \"MINOR_VERSION\"),
- RELEASE_VERSION => config_mk::library_get_var(\"$2\", \"$1\", \"RELEASE_VERSION\"),
- OBJ_FILES => @<:@ config_mk::library_get_array(\"$2\", \"$1\", \"OBJ_FILES\") @:>@,
- REQUIRED_LIBRARIES => @<:@ config_mk::library_get_array(\"$2\", \"$1\", \"REQUIRED_LIBRARIES\") @:>@,
- REQUIRED_SUBSYSTEMS => @<:@ config_mk::library_get_array(\"$2\", \"$1\", \"REQUIRED_SUBSYSTEMS\") @:>@,
- ENABLE => \"$[SMB_LIBRARY_ENABLE_][$1]\"
-};
-# End Library $1
-###################################
-"
-])
-
dnl SMB_BINARY_ENABLE(
dnl 1:name,
dnl 2:default_build
@@ -567,35 +391,6 @@ SMB_INFO_BINARIES="$SMB_INFO_BINARIES
"
])
-dnl SMB_BINARY_MK(
-dnl 1:name,
-dnl 2:config_mk_file
-dnl )
-AC_DEFUN([SMB_BINARY_MK],
-[
-
- if test -z "$[SMB_BINARY_ENABLE_][$1]"; then
- [SMB_BINARY_ENABLE_][$1]="YES";
- fi
-
-SMB_INFO_BINARIES="$SMB_INFO_BINARIES
-###################################
-# Start Binary $1
-\$INPUT{$1} = {
- TYPE => \"BINARY\",
- NAME => \"$1\",
- BUILD_TARGETS => @<:@ config_mk::binary_get_array(\"$2\", \"$1\", \"BUILD_TARGETS\") @:>@,
- INSTALL_PATH => @<:@ config_mk::binary_get_array(\"$2\", \"$1\", \"INSTALL_PATH\") @:>@,
- OBJ_FILES => @<:@ config_mk::binary_get_array(\"$2\", \"$1\", \"OBJ_FILES\") @:>@,
- REQUIRED_LIBRARIES => @<:@ config_mk::binary_get_array(\"$2\", \"$1\",\"REQUIRED_LIBRARIES\") @:>@,
- REQUIRED_SUBSYSTEMS => @<:@ config_mk::binary_get_array(\"$2\", \"$1\",\"REQUIRED_SUBSYSTEMS\") @:>@,
- ENABLE => \"$[SMB_BINARY_ENABLE_][$1]\"
-};
-# End Binary $1
-###################################
-"
-])
-
dnl SMB_MAKE_TARGET(
dnl 1:name
dnl 2:calledname