[PATCH] Shared samba build
Peter Novodvorsky
nidd at myxomop.com
Wed Oct 26 11:50:56 GMT 2005
Hi,
I've prepared a patch that allows different types of building
samba.
-------------- next part --------------
Index: static_build.mk
===================================================================
--- static_build.mk (revision 0)
+++ static_build.mk (revision 0)
@@ -0,0 +1,255 @@
+[LIBRARY::libsmb]
+MAJOR_VERSION = 0
+MINOR_VERSION = 0
+RELEASE_VERSION = 1
+LINK_NAME = smb
+DOLINK = YES
+BUILD_TYPE = STATIC
+REQUIRED_SUBSYSTEMS = \
+ AUTH \
+ CHARSET \
+ CLDAPD \
+ COM \
+ CONFIG \
+ CREDENTIALS \
+ DCERPC_COMMON \
+ DCERPC \
+ DCOM \
+ DCOM_PROXY_DCOM \
+ EJS \
+ EJSRPC \
+ ESP \
+ GENSEC \
+ HEIMDAL_ASN1 \
+ HEIMDAL_COM_ERR \
+ HEIMDAL_DES \
+ HEIMDAL_GLUE \
+ HEIMDAL_GSSAPI \
+ HEIMDAL_HDB \
+ HEIMDAL_KDC \
+ HEIMDAL_KRB5 \
+ HEIMDAL_ROKEN \
+ HEIMDAL_VERS \
+ KDC \
+ KERBEROS \
+ LDAP \
+ LDBSAMBA \
+ LIBBASIC \
+ LIBCLI_AUTH \
+ LIBCLI_CLDAP \
+ LIBCLI_COMPOSITE \
+ LIBCLI_DGRAM \
+ LIBCLI_LDAP \
+ LIBCLI_LSA \
+ LIBCLI_NBT \
+ LIBCLI_RAW \
+ LIBCLI_RESOLVE \
+ LIBCLI_SMB_COMPOSITE \
+ LIBCLI_UTILS \
+ LIBCLI_WREPL \
+ LIBCMDLINE_CREDENTIALS \
+ LIBCMDLINE \
+ LIBCOMPRESSION \
+ LIBCRYPTO \
+ LIBEVENTS \
+ LIBLDB_CMDLINE \
+ LIBLDB \
+ LIBNETIF \
+ LIBNET \
+ LIBREPLACE \
+ LIBSAMBA3 \
+ LIB_SECURITY_NDR_HELPER \
+ LIB_SECURITY_NDR \
+ LIB_SECURITY \
+ LIBSMB \
+ LIBTALLOC \
+ LIBTDB \
+ LIBTLS \
+ LIB_WINBIND_CLIENT \
+ MESSAGING \
+ MPR \
+ NBTD_DGRAM \
+ NBTD \
+ NBTD_WINS \
+ NDR_ATSVC \
+ NDR_AUDIOSRV \
+ NDR_BROWSER \
+ NDR_COMPRESSION \
+ NDR_DBGIDL \
+ NDR_DCERPC \
+ NDR_DCOM \
+ NDR_DFS \
+ NDR_DRSBLOBS \
+ NDR_DRSUAPI \
+ NDR_DRSUAPI_PRINT \
+ NDR_DSBACKUP \
+ NDR_DSSETUP \
+ NDR_ECHO \
+ NDR_EFS \
+ NDR_EPMAPPER \
+ NDR_EVENTLOG \
+ NDR_EXCHANGE \
+ NDR_INITSHUTDOWN \
+ NDR_IRPC \
+ NDR_KEYSVC \
+ NDR_KRB5PAC \
+ NDR_KRB5PAC_UTIL \
+ NDR_LSA \
+ NDR_MGMT \
+ NDR_MISC \
+ NDR_MSGSVC \
+ NDR_NBT \
+ NDR_NETLOGON \
+ NDR_NTSVCS \
+ NDR_ORPC_MANUAL \
+ NDR_ORPC \
+ NDR_OXIDRESOLVER \
+ NDR_POLICYAGENT \
+ NDR_PROTECTED_STORAGE \
+ NDR_RAW \
+ NDR_REMACT \
+ NDR_ROT \
+ NDR_SAMR \
+ NDR_SCERPC \
+ NDR_SCHANNEL \
+ NDR_SPOOLSS_BUF \
+ NDR_SPOOLSS \
+ NDR_SRVSVC \
+ NDR_SVCCTL \
+ NDR_TRKWKS \
+ NDR_UNIXINFO \
+ NDR_W32TIME \
+ NDR_WINREG \
+ NDR_WINS \
+ NDR_WINSREPL \
+ NDR_WKSSVC \
+ NDR_WZCSVC \
+ NDR_XATTR \
+ NTPTR \
+ ntvfs_common \
+ NTVFS \
+ PAM_ERRORS \
+ PIDFILE \
+ PROCESS_MODEL \
+ REGISTRY \
+ RPC_EJS_ECHO \
+ RPC_EJS_INITSHUTDOWN \
+ RPC_EJS_IRPC \
+ RPC_EJS_LSA \
+ RPC_EJS_MISC \
+ RPC_EJS_SAMR \
+ RPC_EJS_SECURITY \
+ RPC_EJS_SRVSVC \
+ RPC_EJS_SVCCTL \
+ RPC_EJS_WINREG \
+ RPC_NDR_ATSVC \
+ RPC_NDR_DFS \
+ RPC_NDR_DRSUAPI \
+ RPC_NDR_DSSETUP \
+ RPC_NDR_ECHO \
+ RPC_NDR_EPMAPPER \
+ RPC_NDR_EVENTLOG \
+ RPC_NDR_INITSHUTDOWN \
+ RPC_NDR_LSA \
+ RPC_NDR_MGMT \
+ RPC_NDR_NETLOGON \
+ RPC_NDR_OXIDRESOLVER \
+ RPC_NDR_REMACT \
+ RPC_NDR_ROT \
+ RPC_NDR_SAMR \
+ RPC_NDR_SPOOLSS \
+ RPC_NDR_SRVSVC \
+ RPC_NDR_SVCCTL \
+ RPC_NDR_UNIXINFO \
+ RPC_NDR_WINREG \
+ RPC_NDR_WKSSVC \
+ RPC_RAW \
+ SAMDB \
+ SCHANNELDB \
+ SERVER_SERVICE \
+ SMBCALLS \
+ SMB \
+ SOCKET \
+ SOCKET_WRAPPER \
+ TDR \
+ TDR_REGF \
+ UNIX_PRIVS \
+ WEB \
+ WINSDB \
+ WREPL_SRV \
+ auth_anonymous \
+ auth_developer \
+ auth_domain \
+ auth_sam \
+ auth_unix \
+ auth_winbind \
+ com_simple \
+ dcerpc_drsuapi \
+ dcerpc_dssetup \
+ dcerpc_epmapper \
+ dcerpc_lsarpc \
+ dcerpc_netlogon \
+ dcerpc_remote \
+ dcerpc_rpcecho \
+ dcerpc_samr \
+ dcerpc_spoolss \
+ dcerpc_srvsvc \
+ dcerpc_unixinfo \
+ dcerpc_winreg \
+ dcerpc_wkssvc \
+ gensec_gssapi \
+ gensec_krb5 \
+ gensec_ntlmssp \
+ gensec_schannel \
+ gensec_spnego \
+ libldb_ildap \
+ libldb_map \
+ libldb_objectguid \
+ libldb_operational \
+ libldb_proxy \
+ libldb_rdn_name \
+ libldb_samba3sam \
+ libldb_samldb \
+ libldb_schema \
+ libldb_tdb \
+ ntptr_simple_ldb \
+ ntvfs_cifs \
+ ntvfs_ipc \
+ ntvfs_nbench \
+ ntvfs_posix \
+ ntvfs_print \
+ ntvfs_simple \
+ ntvfs_unixuid \
+ process_model_single \
+ process_model_standard \
+ registry_dir \
+ registry_ldb \
+ registry_nt4 \
+ registry_rpc \
+ registry_w95 \
+ server_service_winbind \
+ socket_ipv4 \
+ socket_ipv6 \
+ socket_unix
+
+[LIBRARY::libtorture]
+MAJOR_VERSION = 0
+MINOR_VERSION = 0
+RELEASE_VERSION = 1
+LINK_NAME = torture
+BUILD_TYPE = STATIC
+DOLINK = YES
+REQUIRED_SUBSYSTEMS = \
+ TORTURE_BASIC \
+ TORTURE_RAW \
+ TORTURE_COM \
+ TORTURE_RPC \
+ TORTURE_RAP \
+ TORTURE_AUTH \
+ TORTURE_LOCAL \
+ TORTURE_NBENCH \
+ TORTURE_LDAP \
+ TORTURE_NBT \
+ TORTURE_NET
+
+
Index: main.mk
===================================================================
--- main.mk (revision 11298)
+++ main.mk (working copy)
@@ -29,8 +29,10 @@
include libcli/config.mk
include scripting/config.mk
include kdc/config.mk
+include shared_build.mk
binaries: $(BIN_PROGS) $(SBIN_PROGS)
+doinst_libraries: $(LIBRARIES_LIST)
manpages: $(MANPAGES)
everything: all
@@ -55,7 +57,7 @@
@echo " SHLD_FLAGS = $(SHLD_FLAGS)"
@echo " LIBS = $(LIBS)"
-install: showlayout installbin installdat installswat installmisc
+install: showlayout installbin installlibs installdat installswat installmisc
# DESTDIR is used here to prevent packagers wasting their time
# duplicating the Makefile. Remove it and you will have the privilege
@@ -72,6 +74,9 @@
@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
+installlibs: doinst_libraries installdirs
+ @$(SHELL) $(srcdir)/script/installlibs.sh $(DESTDIR)$(LIBDIR) $(LIBRARIES_LIST)
+
installdat: installdirs
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
@@ -84,7 +89,7 @@
installmisc: installdirs
@$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR)
-uninstall: uninstallbin uninstallman uninstallmisc
+uninstall: uninstallbin uninstallllibs uninstallman uninstallmisc
uninstallmisc:
#FIXME
@@ -93,6 +98,9 @@
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
+uninstalllibs:
+ @$(SHELL) $(srcdir)/script/uninstalllibs.sh $(DESTDIR)$(LIBDIR) $(LIBRARIES_LIST)
+
uninstallman:
@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
Index: shared_build.mk
===================================================================
--- shared_build.mk (revision 0)
+++ shared_build.mk (revision 0)
@@ -0,0 +1,257 @@
+[LIBRARY::libsmb]
+MAJOR_VERSION = 0
+MINOR_VERSION = 0
+RELEASE_VERSION = 1
+LINK_NAME = smb
+DOLINK = YES
+DOINSTALL = YES
+BUILD_TYPE = SHARED
+REQUIRED_SUBSYSTEMS = \
+ AUTH \
+ CHARSET \
+ CLDAPD \
+ COM \
+ CONFIG \
+ CREDENTIALS \
+ DCERPC_COMMON \
+ DCERPC \
+ DCOM \
+ DCOM_PROXY_DCOM \
+ EJS \
+ EJSRPC \
+ ESP \
+ GENSEC \
+ HEIMDAL_ASN1 \
+ HEIMDAL_COM_ERR \
+ HEIMDAL_DES \
+ HEIMDAL_GLUE \
+ HEIMDAL_GSSAPI \
+ HEIMDAL_HDB \
+ HEIMDAL_KDC \
+ HEIMDAL_KRB5 \
+ HEIMDAL_ROKEN \
+ HEIMDAL_VERS \
+ KDC \
+ KERBEROS \
+ LDAP \
+ LDBSAMBA \
+ LIBBASIC \
+ LIBCLI_AUTH \
+ LIBCLI_CLDAP \
+ LIBCLI_COMPOSITE \
+ LIBCLI_DGRAM \
+ LIBCLI_LDAP \
+ LIBCLI_LSA \
+ LIBCLI_NBT \
+ LIBCLI_RAW \
+ LIBCLI_RESOLVE \
+ LIBCLI_SMB_COMPOSITE \
+ LIBCLI_UTILS \
+ LIBCLI_WREPL \
+ LIBCMDLINE_CREDENTIALS \
+ LIBCMDLINE \
+ LIBCOMPRESSION \
+ LIBCRYPTO \
+ LIBEVENTS \
+ LIBLDB_CMDLINE \
+ LIBLDB \
+ LIBNETIF \
+ LIBNET \
+ LIBREPLACE \
+ LIBSAMBA3 \
+ LIB_SECURITY_NDR_HELPER \
+ LIB_SECURITY_NDR \
+ LIB_SECURITY \
+ LIBSMB \
+ LIBTALLOC \
+ LIBTDB \
+ LIBTLS \
+ LIB_WINBIND_CLIENT \
+ MESSAGING \
+ MPR \
+ NBTD_DGRAM \
+ NBTD \
+ NBTD_WINS \
+ NDR_ATSVC \
+ NDR_AUDIOSRV \
+ NDR_BROWSER \
+ NDR_COMPRESSION \
+ NDR_DBGIDL \
+ NDR_DCERPC \
+ NDR_DCOM \
+ NDR_DFS \
+ NDR_DRSBLOBS \
+ NDR_DRSUAPI \
+ NDR_DRSUAPI_PRINT \
+ NDR_DSBACKUP \
+ NDR_DSSETUP \
+ NDR_ECHO \
+ NDR_EFS \
+ NDR_EPMAPPER \
+ NDR_EVENTLOG \
+ NDR_EXCHANGE \
+ NDR_INITSHUTDOWN \
+ NDR_IRPC \
+ NDR_KEYSVC \
+ NDR_KRB5PAC \
+ NDR_KRB5PAC_UTIL \
+ NDR_LSA \
+ NDR_MGMT \
+ NDR_MISC \
+ NDR_MSGSVC \
+ NDR_NBT \
+ NDR_NETLOGON \
+ NDR_NTSVCS \
+ NDR_ORPC_MANUAL \
+ NDR_ORPC \
+ NDR_OXIDRESOLVER \
+ NDR_POLICYAGENT \
+ NDR_PROTECTED_STORAGE \
+ NDR_RAW \
+ NDR_REMACT \
+ NDR_ROT \
+ NDR_SAMR \
+ NDR_SCERPC \
+ NDR_SCHANNEL \
+ NDR_SPOOLSS_BUF \
+ NDR_SPOOLSS \
+ NDR_SRVSVC \
+ NDR_SVCCTL \
+ NDR_TRKWKS \
+ NDR_UNIXINFO \
+ NDR_W32TIME \
+ NDR_WINREG \
+ NDR_WINS \
+ NDR_WINSREPL \
+ NDR_WKSSVC \
+ NDR_WZCSVC \
+ NDR_XATTR \
+ NTPTR \
+ ntvfs_common \
+ NTVFS \
+ PAM_ERRORS \
+ PIDFILE \
+ PROCESS_MODEL \
+ REGISTRY \
+ RPC_EJS_ECHO \
+ RPC_EJS_INITSHUTDOWN \
+ RPC_EJS_IRPC \
+ RPC_EJS_LSA \
+ RPC_EJS_MISC \
+ RPC_EJS_SAMR \
+ RPC_EJS_SECURITY \
+ RPC_EJS_SRVSVC \
+ RPC_EJS_SVCCTL \
+ RPC_EJS_WINREG \
+ RPC_NDR_ATSVC \
+ RPC_NDR_DFS \
+ RPC_NDR_DRSUAPI \
+ RPC_NDR_DSSETUP \
+ RPC_NDR_ECHO \
+ RPC_NDR_EPMAPPER \
+ RPC_NDR_EVENTLOG \
+ RPC_NDR_INITSHUTDOWN \
+ RPC_NDR_LSA \
+ RPC_NDR_MGMT \
+ RPC_NDR_NETLOGON \
+ RPC_NDR_OXIDRESOLVER \
+ RPC_NDR_REMACT \
+ RPC_NDR_ROT \
+ RPC_NDR_SAMR \
+ RPC_NDR_SPOOLSS \
+ RPC_NDR_SRVSVC \
+ RPC_NDR_SVCCTL \
+ RPC_NDR_UNIXINFO \
+ RPC_NDR_WINREG \
+ RPC_NDR_WKSSVC \
+ RPC_RAW \
+ SAMDB \
+ SCHANNELDB \
+ SERVER_SERVICE \
+ SMBCALLS \
+ SMB \
+ SOCKET \
+ SOCKET_WRAPPER \
+ TDR \
+ TDR_REGF \
+ UNIX_PRIVS \
+ WEB \
+ WINSDB \
+ WREPL_SRV \
+ auth_anonymous \
+ auth_developer \
+ auth_domain \
+ auth_sam \
+ auth_unix \
+ auth_winbind \
+ com_simple \
+ dcerpc_drsuapi \
+ dcerpc_dssetup \
+ dcerpc_epmapper \
+ dcerpc_lsarpc \
+ dcerpc_netlogon \
+ dcerpc_remote \
+ dcerpc_rpcecho \
+ dcerpc_samr \
+ dcerpc_spoolss \
+ dcerpc_srvsvc \
+ dcerpc_unixinfo \
+ dcerpc_winreg \
+ dcerpc_wkssvc \
+ gensec_gssapi \
+ gensec_krb5 \
+ gensec_ntlmssp \
+ gensec_schannel \
+ gensec_spnego \
+ libldb_ildap \
+ libldb_map \
+ libldb_objectguid \
+ libldb_operational \
+ libldb_proxy \
+ libldb_rdn_name \
+ libldb_samba3sam \
+ libldb_samldb \
+ libldb_schema \
+ libldb_tdb \
+ ntptr_simple_ldb \
+ ntvfs_cifs \
+ ntvfs_ipc \
+ ntvfs_nbench \
+ ntvfs_posix \
+ ntvfs_print \
+ ntvfs_simple \
+ ntvfs_unixuid \
+ process_model_single \
+ process_model_standard \
+ registry_dir \
+ registry_ldb \
+ registry_nt4 \
+ registry_rpc \
+ registry_w95 \
+ server_service_winbind \
+ socket_ipv4 \
+ socket_ipv6 \
+ socket_unix
+
+[LIBRARY::libtorture]
+MAJOR_VERSION = 0
+MINOR_VERSION = 0
+RELEASE_VERSION = 1
+LINK_NAME = torture
+BUILD_TYPE = SHARED
+DOLINK = YES
+DOINSTALL = YES
+REQUIRED_SUBSYSTEMS = \
+ TORTURE_BASIC \
+ TORTURE_RAW \
+ TORTURE_COM \
+ TORTURE_RPC \
+ TORTURE_RAP \
+ TORTURE_AUTH \
+ TORTURE_LOCAL \
+ TORTURE_NBENCH \
+ TORTURE_LDAP \
+ TORTURE_NBT \
+ TORTURE_NET
+
+
Index: build/smb_build/config_mk.pm
===================================================================
--- build/smb_build/config_mk.pm (revision 11298)
+++ build/smb_build/config_mk.pm (working copy)
@@ -72,10 +72,14 @@
"TARGET_DEPS" => "list",
"ENABLE" => "bool",
+ "DOINSTALL" => "bool",
+ "DOLINK" => "bool",
"NOPROTO" => "bool",
"MANPAGE" => "string",
"INSTALLDIR" => "string",
+ "LINK_NAME" => "string",
+ "BUILD_TYPE" => "string",
}
};
Index: build/smb_build/makefile.pm
===================================================================
--- build/smb_build/makefile.pm (revision 11298)
+++ build/smb_build/makefile.pm (working copy)
@@ -47,6 +47,7 @@
$self->_prepare_dummy_MAKEDIR($CTX);
$self->_prepare_manpages($CTX);
$self->_prepare_binaries($CTX);
+ $self->_prepare_libraries($CTX);
$self->_prepare_target_settings($CTX);
$self->_prepare_rule_lists($CTX);
$self->_prepare_clean_rules();
@@ -143,13 +144,13 @@
CPPFLAGS=$self->{config}->{CPPFLAGS}
LD=$self->{config}->{LD}
-LD_FLAGS=$self->{config}->{LDFLAGS}
+LD_FLAGS=$self->{config}->{LDFLAGS} -Lbin/
STLD=$self->{config}->{AR}
STLD_FLAGS=-rc
SHLD=$self->{config}->{CC}
-SHLD_FLAGS=$self->{config}->{LDSHFLAGS}
+SHLD_FLAGS=$self->{config}->{LDSHFLAGS} -Lbin/
SONAMEFLAG=$self->{config}->{SONAMEFLAG}
SHLIBEXT=$self->{config}->{SHLIBEXT}
@@ -247,6 +248,27 @@
$self->output("MANPAGES = $mp\n");
}
+sub _prepare_libraries($$)
+{
+ my ($self,$ctx) = shift;
+
+ my @lib_list = ();
+
+ foreach (values %$ctx) {
+ next unless (($_->{OUTPUT_TYPE} eq "STATIC_LIBRARY") or ($_->{OUTPUT_TYPE} eq "SHARED_LIBRARY"));
+ next unless ($_->{DOINSTALL} eq "YES");
+
+ push(@lib_list, $_->{TARGET}) if defined ($_->{TARGET});
+ push(@lib_list, "bin/".$_->{LIBRARY_SONAME}) if defined ($_->{LIBRARY_SONAME});
+ if ($_->{OUTPUT_TYPE} eq "SHARED_LIBRARY") {
+ push(@lib_list, "bin/".$_->{LIBRARY_NAME}) if defined ($_->{LIBRARY_NAME});
+ }
+ }
+
+ $self->output("LIBRARIES_LIST = " . array2oneperline(\@lib_list) . "\n");
+}
+
+
sub _prepare_dummy_MAKEDIR($$)
{
my ($self,$ctx) = @_;
@@ -542,9 +564,9 @@
#
bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
\@echo Linking \$\@
- \@\$(CC) \$(LD_FLAGS) -o \$\@ \\
+ \$(CC) \$(LD_FLAGS) -o \$\@ \\
\$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
- \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
+ -Wl,-\\( \$\(BINARY_$ctx->{NAME}_LINK_LIST) -Wl,-\\) \\
\$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
Index: build/smb_build/input.pm
===================================================================
--- build/smb_build/input.pm (revision 11298)
+++ build/smb_build/input.pm (working copy)
@@ -101,9 +101,13 @@
if ($lib->{ENABLE} ne "YES") {
printf("Library: %s...disabled\n",$lib->{NAME});
return;
+
}
-
- $lib->{OUTPUT_TYPE} = "SHARED_LIBRARY";
+ if ($lib->{BUILD_TYPE} ne "STATIC") {
+ $lib->{OUTPUT_TYPE} = "SHARED_LIBRARY";
+ } else {
+ $lib->{OUTPUT_TYPE} = "STATIC_LIBRARY";
+ }
}
sub check_binary($$)
@@ -172,6 +176,7 @@
my %depend = %$INPUT;
+
foreach my $part (values %depend) {
# Generate list of dependencies
@@ -186,10 +191,48 @@
}
foreach my $part (values %depend) {
+ if (($part->{TYPE} eq "LIBRARY") and ($part->{DOLINK} eq "YES")) {
+ foreach my $elem (@{$part->{DEPENDENCIES}}) {
+ $$elem->{INCLUDED} = $part;
+ }
+ }
+ }
+
+ foreach my $part (values %depend) {
$part->{UNIQUE_DEPENDENCIES} = {};
calc_unique_deps($part->{DEPENDENCIES}, $part->{UNIQUE_DEPENDENCIES});
}
+
+ foreach my $part (values %depend) {
+ if ($part->{TYPE} eq "BINARY") {
+ foreach my $elem (values %{$part->{UNIQUE_DEPENDENCIES}}) {
+ if ((($elem->{TYPE} eq "SUBSYSTEM") or
+ ($elem->{TYPE} eq "MODULE")) and
+ defined ($elem->{INCLUDED})) {
+ $part->{UNIQUE_DEPENDENCIES2}{$elem->{INCLUDED}{NAME}} = $elem->{INCLUDED};
+ } else {
+ $part->{UNIQUE_DEPENDENCIES2}{$elem->{NAME}} = $part->{UNIQUE_DEPENDENCIES}{$elem->{NAME}}
+ }
+ }
+ $part->{UNIQUE_DEPENDENCIES} = $part->{UNIQUE_DEPENDENCIES2};
+ }
+ if (($part->{TYPE} eq "LIBRARY") and ($part->{DOLINK} eq "YES")) {
+ foreach my $elem (values %{$part->{UNIQUE_DEPENDENCIES}}) {
+ if ((($elem->{TYPE} eq "SUBSYSTEM") or
+ ($elem->{TYPE} eq "MODULE")) and
+ defined ($elem->{INCLUDED}) and
+ not ($elem->{INCLUDED}{NAME} eq $part->{NAME})) {
+# $part->{UNIQUE_DEPENDENCIES2}{$elem->{INCLUDED}{NAME}} = $elem->{INCLUDED};
+ } else {
+ $part->{UNIQUE_DEPENDENCIES2}{$elem->{NAME}} = $part->{UNIQUE_DEPENDENCIES}{$elem->{NAME}}
+ }
+ }
+ $part->{UNIQUE_DEPENDENCIES} = $part->{UNIQUE_DEPENDENCIES2};
+ }
+
+ }
+
return \%depend;
}
Index: build/smb_build/output.pm
===================================================================
--- build/smb_build/output.pm (revision 11298)
+++ build/smb_build/output.pm (working copy)
@@ -47,15 +47,18 @@
@{$lib->{DEPEND_LIST}} = ();
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
- $lib->{LIBRARY_NAME} = lc($lib->{NAME}).".so";
- $lib->{TARGET} = "bin/lib$lib->{LIBRARY_NAME}";
+ if (not defined($lib->{LINK_NAME})) {
+ $lib->{LINK_NAME} = $lib->{NAME};
+ }
+ $lib->{LIBRARY_NAME} = "lib".lc($lib->{LINK_NAME}).".so";
+ $lib->{TARGET} = "bin/$lib->{LIBRARY_NAME}";
if (defined($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->{TARGET} = "bin/lib$lib->{LIBRARY_REALNAME}";
+ $lib->{TARGET} = "bin/$lib->{LIBRARY_REALNAME}";
@{$lib->{LINK_FLAGS}} = ("\$(SONAMEFLAG)$lib->{LIBRARY_SONAME}");
}
- $lib->{OUTPUT} = "-l".lc($lib->{NAME});
+ $lib->{OUTPUT} = "-l".lc($lib->{LINK_NAME});
}
sub generate_static_library($)
@@ -64,12 +67,16 @@
@{$lib->{DEPEND_LIST}} = ();
- $lib->{LIBRARY_NAME} = lc($lib->{NAME}).".a";
+ if (not defined($lib->{LINK_NAME})) {
+ $lib->{LINK_NAME} = $lib->{NAME};
+ }
+
+ $lib->{LIBRARY_NAME} = "lib".lc($lib->{LINK_NAME}).".a";
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
@{$lib->{LINK_FLAGS}} = ();
- $lib->{TARGET} = "bin/lib$lib->{LIBRARY_NAME}";
- $lib->{OUTPUT} = "-l".lc($lib->{NAME});
+ $lib->{TARGET} = "bin/$lib->{LIBRARY_NAME}";
+ $lib->{OUTPUT} = "-l".lc($lib->{LINK_NAME});
}
sub generate_binary($)
-------------- next part --------------
The idea is to incorporate different subsystems in libraries and build
them as static or as shared. By default it will build everything
static (as usual), however if you change inclusion of static_build.mk
to shared_build.mk in main.mk it will build libsmb.so and
libtorture.so and all binaries will be linked againt them.
Currently you can do shared build only on GCC/GNU binutils systems
because it uses -( and -) flags to resolve dependencies between
libraries.
Peter.
--
n?gemiseni,
peter.
More information about the samba-technical
mailing list