summaryrefslogtreecommitdiff
path: root/source4/build/smb_build
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-05-13 16:15:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:42 -0500
commitd5ba19d0088f65e308443a32dd39c11d6ba8983d (patch)
tree9bc4462909f0cfd73d572c801115a357ad859aa2 /source4/build/smb_build
parent3f564db67d9ffca599b1885ad2c6379830cd0aaf (diff)
downloadsamba-d5ba19d0088f65e308443a32dd39c11d6ba8983d.tar.gz
samba-d5ba19d0088f65e308443a32dd39c11d6ba8983d.tar.bz2
samba-d5ba19d0088f65e308443a32dd39c11d6ba8983d.zip
r690: - ignore source/tags
- add support for shared libraries - enable libldb shared lib when --enable-experimental metze (This used to be commit dcef69dc54a2575e7f57d67d1983482b4ff57bdb)
Diffstat (limited to 'source4/build/smb_build')
-rw-r--r--source4/build/smb_build/config_mk.pl4
-rw-r--r--source4/build/smb_build/depend.pl2
-rw-r--r--source4/build/smb_build/input.pl11
-rw-r--r--source4/build/smb_build/makefile.pl47
-rw-r--r--source4/build/smb_build/output.pl68
-rw-r--r--source4/build/smb_build/public.m432
6 files changed, 138 insertions, 26 deletions
diff --git a/source4/build/smb_build/config_mk.pl b/source4/build/smb_build/config_mk.pl
index ba580c7c65..7a85bfa24b 100644
--- a/source4/build/smb_build/config_mk.pl
+++ b/source4/build/smb_build/config_mk.pl
@@ -188,9 +188,9 @@ sub _fetch_var_from_config_mk($$$)
}
if (defined($result->{$section}{$key})) {
- $val = $result->{$section}{$key}{VAL};
+ $val = strtrim($result->{$section}{$key}{VAL});
} elsif (defined($result->{DEFAULT}{$key})) {
- $val = $result->{DEFAULT}{$key}{VAL};
+ $val = strtrim($result->{DEFAULT}{$key}{VAL});
}
return $val;
diff --git a/source4/build/smb_build/depend.pl b/source4/build/smb_build/depend.pl
index 23525c0f62..a5a95eb547 100644
--- a/source4/build/smb_build/depend.pl
+++ b/source4/build/smb_build/depend.pl
@@ -353,7 +353,7 @@ sub _do_depend_libraries($)
#
# if it's not a library skip it
#
- if ($CTX->{INPUT}{LIBRARIES}{$key}{BUILD} ne "SHARED" ) {
+ if ($CTX->{INPUT}{LIBRARIES}{$key}{ENABLE} ne "YES" ) {
next;
}
diff --git a/source4/build/smb_build/input.pl b/source4/build/smb_build/input.pl
index 8b5b904f1e..91ce42bdc8 100644
--- a/source4/build/smb_build/input.pl
+++ b/source4/build/smb_build/input.pl
@@ -6,6 +6,17 @@
### Released under the GNU GPL ###
###########################################################
+sub strtrim($)
+{
+ my $str = shift;
+ my @ar = ();
+
+ $str =~ s/^[\t\n ]*//g;
+
+ $str =~ s/[\t\n ]*$//g;
+
+ return $str;
+}
sub str2array($)
{
diff --git a/source4/build/smb_build/makefile.pl b/source4/build/smb_build/makefile.pl
index e3cfc17bd7..6f4c20af69 100644
--- a/source4/build/smb_build/makefile.pl
+++ b/source4/build/smb_build/makefile.pl
@@ -383,13 +383,18 @@ sub _prepare_library_obj_list($)
#
# $library_ctx - the library context
#
-# $library_ctx->{LIBRARY} - the library name
-# $library_ctx->{STATIC_LIBRARY} - the static library name
-# $library_ctx->{SHARED_LIBRARY} - the shared library name
+# $library_ctx->{NAME} - the library name
+#
# $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
+#
+# $library_ctx->{STATIC_LIBRARY_NAME} - the static library name
# $library_ctx->{STATIC_LINK_LIST} - the list of objectfiles which sould be linked
# to this static library
# $library_ctx->{STATIC_LINK_FLAGS} - linker flags used by this static library
+#
+# $library_ctx->{SHARED_LIBRARY_NAME} - the shared library name
+# $library_ctx->{SHARED_LIBRARY_REALNAME} - the shared library real name
+# $library_ctx->{SHARED_LIBRARY_SONAME} - the shared library soname
# $library_ctx->{SHARED_LINK_LIST} - the list of objectfiles and external libraries
# which sould be linked to this shared library
# $library_ctx->{SHARED_LINK_FLAGS} - linker flags used by this shared library
@@ -403,6 +408,7 @@ sub _prepare_library_rule($)
my $tmpstflag;
my $tmpshlink;
my $tmpshflag;
+ my $tmprules;
my $output;
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
@@ -413,9 +419,11 @@ sub _prepare_library_rule($)
$tmpshlink = array2oneperline($ctx->{SHARED_LINK_LIST});
$tmpshflag = array2oneperline($ctx->{SHARED_LINK_FLAGS});
+ $tmprules = "bin/$ctx->{STATIC_LIBRARY_NAME}";
+
$output = "
###################################
-# Start Library $ctx->{LIBRARY}
+# Start Library $ctx->{NAME}
#
LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
#
@@ -425,24 +433,37 @@ LIBRARY_$ctx->{NAME}_STATIC_LINK_FLAGS =$tmpstflag
LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
#
-# Static $ctx->{STATIC_LIBRARY}
-bin/$ctx->{STATIC_LIBRARY}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+# Static $ctx->{STATIC_LIBRARY_NAME}
+bin/$ctx->{STATIC_LIBRARY_NAME}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
\@echo Linking \$\@
\@\$(STLD) \$(STLD_FLAGS) \$\@ \\
\$(LIBRARY_$ctx->{NAME}_STATIC_LINK_FLAGS) \\
- \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)";
+ \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
+";
- if (defined($ctx->{SHARED_LIBRARY})) {
+ if (defined($ctx->{SHARED_LIBRARY_NAME})) {
$output .= "
-# Shared $ctx->{SHARED_LIBRARY}
-bin/$ctx->{SHARED_LIBRARY}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+# Shared $ctx->{SHARED_LIBRARY_REALNAME}
+bin/$ctx->{SHARED_LIBRARY_REALNAME}: \$(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)";
+ \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
+# Symlink $ctx->{SHARED_LIBRARY_SONAME}
+bin/$ctx->{SHARED_LIBRARY_SONAME}: bin/$ctx->{SHARED_LIBRARY_REALNAME} bin/.dummy
+ \@echo Symlink \$\@
+ \@ln -sf $ctx->{SHARED_LIBRARY_REALNAME} \$\@
+# Symlink $ctx->{SHARED_LIBRARY_NAME}
+bin/$ctx->{SHARED_LIBRARY_NAME}: bin/$ctx->{SHARED_LIBRARY_SONAME} bin/.dummy
+ \@echo Symlink \$\@
+ \@ln -sf $ctx->{SHARED_LIBRARY_SONAME} \$\@
+";
+ $tmprules .= " bin/$ctx->{SHARED_LIBRARY_NAME}"
}
-$output .= "
-# End Library $ctx->{LIBRARY}
+
+ $output .= "
+$ctx->{NAME}: $tmprules
+# End Library $ctx->{NAME}
###################################
";
diff --git a/source4/build/smb_build/output.pl b/source4/build/smb_build/output.pl
index f458c3b04a..84f822aaa9 100644
--- a/source4/build/smb_build/output.pl
+++ b/source4/build/smb_build/output.pl
@@ -107,6 +107,74 @@ sub _generate_shared_modules($)
sub _generate_libraries($)
{
+ my $CTX = shift;
+
+ #
+ # loop over all binaries
+ #
+ foreach my $key (sort keys %{$CTX->{DEPEND}{LIBRARIES}}) {
+ my $NAME = $CTX->{INPUT}{LIBRARIES}{$key}{NAME};
+ my @OBJ_LIST = @{$CTX->{INPUT}{LIBRARIES}{$key}{OBJ_FILES}};
+ my $MAJOR_VERSION = $CTX->{INPUT}{LIBRARIES}{$key}{MAJOR_VERSION};
+ my $MINOR_VERSION = $CTX->{INPUT}{LIBRARIES}{$key}{MINOR_VERSION};
+ my $RELEASE_VERSION = $CTX->{INPUT}{LIBRARIES}{$key}{RELEASE_VERSION};
+ #
+ my @DEPEND_LIST = ("\$(LIBRARY_$NAME\_OBJS)");
+
+ my $STATIC_LIBRARY_NAME = $NAME.".a";
+ my @STATIC_LINK_LIST = ("\$(LIBRARY_$NAME\_OBJS)");
+ my @STATIC_LINK_FLAGS = ();
+
+ my $SHARED_LIBRARY_NAME = $NAME.".so";
+ my $SHARED_LIBRARY_SONAME = $SHARED_LIBRARY_NAME.".$MAJOR_VERSION";
+ my $SHARED_LIBRARY_REALNAME = $SHARED_LIBRARY_SONAME.".$MINOR_VERSION.$RELEASE_VERSION";
+ my @SHARED_LINK_LIST = ("\$(LIBRARY_$NAME\_OBJS)");
+ my @SHARED_LINK_FLAGS = ("\@SONAMEFLAG\@$SHARED_LIBRARY_SONAME");
+
+ push(@{$CTX->{OUTPUT}{PROTO}{OBJ_LIST}},"\$(LIBRARY_$key\_OBJS)");
+
+ #
+ # not add to 'make all' for now
+ #
+
+ foreach my $elem (@{$CTX->{DEPEND}{LIBRARIES}{$key}{SUBSYSTEMS_LIST}}) {
+ if (!defined($CTX->{DEPEND}{SUBSYSTEMS}{$elem})) {
+ die("Library[$NAME] depends on unkown Subsystem[$elem]!\n");
+ }
+ push(@DEPEND_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ push(@STATIC_LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ push(@SHARED_LINK_LIST,"\$(SUBSYSTEM_$elem\_OBJS)");
+ }
+
+ foreach my $elem (@{$CTX->{DEPEND}{LIBRARIES}{$key}{LIBRARIES_LIST}}) {
+ if (!defined($CTX->{DEPEND}{EXT_LIBS}{$elem})) {
+ die("Library[$NAME] depends on unkown External Library[$elem]!\n");
+ }
+ push(@STATIC_LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}});
+ push(@STATIC_LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}});
+ push(@SHARED_LINK_LIST,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LIBS}});
+ push(@SHARED_LINK_FLAGS,@{$CTX->{DEPEND}{EXT_LIBS}{$elem}{LDFLAGS}});
+ }
+
+ #
+ # set the lists
+ #
+ $CTX->{OUTPUT}{LIBRARIES}{$key}{NAME} = $NAME;
+ @{$CTX->{OUTPUT}{LIBRARIES}{$key}{OBJ_LIST}} = @OBJ_LIST;
+ #
+ @{$CTX->{OUTPUT}{LIBRARIES}{$key}{DEPEND_LIST}} = @DEPEND_LIST;
+
+ $CTX->{OUTPUT}{LIBRARIES}{$key}{STATIC_LIBRARY_NAME} = $STATIC_LIBRARY_NAME;
+ @{$CTX->{OUTPUT}{LIBRARIES}{$key}{STATIC_LINK_LIST}} = @STATIC_LINK_LIST;
+ @{$CTX->{OUTPUT}{LIBRARIES}{$key}{STATIC_LINK_FLAGS}} = @STATIC_LINK_FLAGS;
+
+ $CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LIBRARY_NAME} = $SHARED_LIBRARY_NAME;
+ $CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LIBRARY_REALNAME} = $SHARED_LIBRARY_REALNAME;
+ $CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LIBRARY_SONAME} = $SHARED_LIBRARY_SONAME;
+ @{$CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LINK_LIST}} = @SHARED_LINK_LIST;
+ @{$CTX->{OUTPUT}{LIBRARIES}{$key}{SHARED_LINK_FLAGS}} = @SHARED_LINK_FLAGS;
+ }
+
return;
}
diff --git a/source4/build/smb_build/public.m4 b/source4/build/smb_build/public.m4
index 839c16f1a9..94c4792d2f 100644
--- a/source4/build/smb_build/public.m4
+++ b/source4/build/smb_build/public.m4
@@ -67,9 +67,12 @@ dnl )
dnl
dnl SMB_LIBRARY(
dnl 1:name,
-dnl 2:obj_files,
-dnl 3:required_libs,
-dnl 4:required_subsystems
+dnl 2:major_version
+dnl 3:minor_version
+dnl 4:release_version
+dnl 5:obj_files,
+dnl 6:required_libs,
+dnl 7:required_subsystems
dnl )
dnl
dnl SMB_LIBRARY_MK(
@@ -354,9 +357,12 @@ AC_DEFUN([SMB_LIBRARY_ENABLE],
dnl SMB_LIBRARY(
dnl 1:name,
-dnl 2:obj_files,
-dnl 3:required_libs,
-dnl 4:required_subsystems
+dnl 2:major_version
+dnl 3:minor_version
+dnl 4:release_version
+dnl 5:obj_files,
+dnl 6:required_libs,
+dnl 7:required_subsystems
dnl )
AC_DEFUN([SMB_LIBRARY],
[
@@ -369,9 +375,12 @@ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
###################################
# Start Library $1
\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{NAME} = \"$1\";
-@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{OBJ_FILES}} = str2array(\"$2\");
-@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$3\");
-@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$4\");
+\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{MAJOR_VERSION} = \"$2\";
+\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{MINOR_VERSION} = \"$3\";
+\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{RELEASE_VERSION} = \"$4\";
+@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{OBJ_FILES}} = str2array(\"$5\");
+@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_LIBRARIES}} = str2array(\"$6\");
+@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_SUBSYSTEMS}} = str2array(\"$7\");
#
\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{ENABLE} = \"$[SMB_LIBRARY_ENABLE_][$1]\";
# End Library $1
@@ -387,13 +396,16 @@ AC_DEFUN([SMB_LIBRARY_MK],
[
if test -z "$[SMB_LIBRARY_ENABLE_][$1]"; then
- [SMB_LIBRARY_ENABLE_][$1]="YES";
+ [SMB_LIBRARY_ENABLE_][$1]="NO";
fi
SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
###################################
# Start Library $1
\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{NAME} = \"$1\";
+\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{MAJOR_VERSION} = library_get_var(\"$2\", \"$1\", \"MAJOR_VERSION\");
+\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{MINOR_VERSION} = library_get_var(\"$2\", \"$1\", \"MINOR_VERSION\");
+\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{RELEASE_VERSION} = library_get_var(\"$2\", \"$1\", \"RELEASE_VERSION\");
@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{OBJ_FILES}} = library_get_array(\"$2\", \"$1\", \"OBJ_FILES\");
@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_LIBRARIES}} = library_get_array(\"$2\", \"$1\", \"REQUIRED_LIBRARIES\");
@{\$SMB_BUILD_CTX->{INPUT}{LIBRARIES}{$1}{REQUIRED_SUBSYSTEMS}} = library_get_array(\"$2\", \"$1\", \"REQUIRED_SUBSYSTEMS\");