1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

r690: - ignore source/tags

- add support for shared libraries

- enable libldb shared lib when --enable-experimental

metze
(This used to be commit dcef69dc54a2575e7f57d67d1983482b4ff57bdb)
This commit is contained in:
Stefan Metzmacher 2004-05-13 16:15:46 +00:00 committed by Gerald (Jerry) Carter
parent 3f564db67d
commit d5ba19d008
8 changed files with 155 additions and 26 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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($)
{

View File

@ -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}
###################################
";

View File

@ -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;
}

View File

@ -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\");

View File

@ -8,6 +8,12 @@ SMB_MODULE_MK(libldb_tdb,LIBLDB,STATIC,lib/ldb/config.mk)
SMB_SUBSYSTEM_MK(LIBLDB,lib/ldb/config.mk)
if test x"$experimental" = x"yes"; then
SMB_LIBRARY_ENABLE(libldb,YES)
fi
SMB_LIBRARY_MK(libldb,lib/ldb/config.mk)
SMB_BINARY_MK(ldbadd,lib/ldb/config.mk)
SMB_BINARY_MK(ldbdel,lib/ldb/config.mk)

View File

@ -37,6 +37,17 @@ ADD_OBJ_FILES = \
# End SUBSYSTEM LIBLDB
################################################
################################################
# Start LIBRARY LIBLDB
[LIBRARY::libldb]
MAJOR_VERSION = 0
MINOR_VERSION = 0
RELEASE_VERSION = 1
REQUIRED_SUBSYSTEMS = LIBLDB
#
# End LIBRARY LIBLDB
################################################
################################################
# Start BINARY ldbadd
[BINARY::ldbadd]