svn commit: samba r14072 - in branches/SAMBA_4_0/source: . build/smb_build

metze at samba.org metze at samba.org
Thu Mar 9 14:39:36 GMT 2006


Author: metze
Date: 2006-03-09 14:39:36 +0000 (Thu, 09 Mar 2006)
New Revision: 14072

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14072

Log:
- only add the 'lib' prefix to libraries not modules
- fix installation of plugins (and make it a bit more verbose
- get rid of the '#define libfoo_module_init init_module'
  and genereated a wrapper function in bin/libfoo_module_init_module.c
- change the standard visibility for modules to hidden
- a few make clean fixes

metze
Modified:
   branches/SAMBA_4_0/source/build/smb_build/header.pm
   branches/SAMBA_4_0/source/build/smb_build/input.pm
   branches/SAMBA_4_0/source/build/smb_build/makefile.pm
   branches/SAMBA_4_0/source/build/smb_build/output.pm
   branches/SAMBA_4_0/source/main.mk


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/header.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/header.pm	2006-03-09 13:42:13 UTC (rev 14071)
+++ branches/SAMBA_4_0/source/build/smb_build/header.pm	2006-03-09 14:39:36 UTC (rev 14072)
@@ -48,26 +48,6 @@
 	}
 
 	#
-	# Shared modules
-	#
-	foreach my $key (values %{$depend}) {
-		next if $key->{TYPE} ne "MODULE";
-		next if $key->{ENABLE} ne "YES";
-		next if $key->{OUTPUT_TYPE} ne "SHARED_LIBRARY";
-
-		my $name = $key->{NAME};
-		next if not defined($key->{INIT_FUNCTION});
-
-		my $DEFINE = ();
-		
-		$DEFINE->{COMMENT} = "$name is built shared";
-		$DEFINE->{KEY} = $key->{INIT_FUNCTION};
-		$DEFINE->{VAL} = "init_module";
-
-		push(@defines,$DEFINE);
-	}
-
-	#
 	# loop over all BUILD_H define sections
 	#
 	foreach (@defines) { $output .= _add_define_section($_); }

Modified: branches/SAMBA_4_0/source/build/smb_build/input.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/input.pm	2006-03-09 13:42:13 UTC (rev 14071)
+++ branches/SAMBA_4_0/source/build/smb_build/input.pm	2006-03-09 14:39:36 UTC (rev 14072)
@@ -66,6 +66,12 @@
 		return;
 	}
 
+	if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) {
+		$mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE};
+	} else {
+		$mod->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)";
+	}
+
 	if (defined($mod->{CHOSEN_BUILD}) and $mod->{CHOSEN_BUILD} ne "DEFAULT") 
 	{
 		$mod->{OUTPUT_TYPE} = $mod->{CHOSEN_BUILD};
@@ -160,7 +166,7 @@
 		}
 
 		unless (defined($part->{STANDARD_VISIBILITY})) {
-			if ($part->{TYPE} eq "BINARY") {
+			if ($part->{TYPE} eq "MODULE" or $part->{TYPE} eq "BINARY") {
 				$part->{STANDARD_VISIBILITY} = "hidden";
 			} else {
 				$part->{STANDARD_VISIBILITY} = "default";

Modified: branches/SAMBA_4_0/source/build/smb_build/makefile.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2006-03-09 13:42:13 UTC (rev 14071)
+++ branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2006-03-09 14:39:36 UTC (rev 14072)
@@ -24,6 +24,8 @@
 	$self->{static_libs} = [];
 	$self->{shared_libs} = [];
 	$self->{headers} = [];
+	$self->{shared_modules} = [];
+	$self->{plugins} = [];
 	$self->{install_plugins} = "";
 	$self->{uninstall_plugins} = "";
 	$self->{pc_files} = [];
@@ -259,6 +261,7 @@
 	my ($self,$ctx) = @_;
 
 	my $installdir;
+	my $init_obj = "";
 	
 	if ($self->{duplicate_build}) {
 		$installdir = "bin/install";
@@ -270,8 +273,12 @@
 		push (@{$self->{shared_libs}}, "bin/$ctx->{LIBRARY_REALNAME}");
 	} elsif ($ctx->{TYPE} eq "MODULE") {
 		push (@{$self->{shared_modules}}, "bin/$ctx->{LIBRARY_REALNAME}");
+		push (@{$self->{plugins}}, "$installdir/$ctx->{LIBRARY_REALNAME}");
 
+		$self->{install_plugins} .= "\t\@echo Install $installdir/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)/\n";
+		$self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/\n";
 		$self->{install_plugins} .= "\t\@cp $installdir/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
+		$self->{uninstall_plugins} .= "\t\@echo Uninstall \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
 		$self->{uninstall_plugins} .= "\t\@rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{NAME}.\$(SHLIBEXT)\n";
 	}
 
@@ -282,20 +289,37 @@
 	$self->_prepare_list($ctx, "LINK_FLAGS");
 
 	push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
-		
+
 	if ($ctx->{NOPROTO} eq "NO") {
 		push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)");
 	}
 
+	if ($ctx->{TYPE} eq "MODULE" and defined($ctx->{INIT_FUNCTION})) {
+		my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
+		$init_fn =~ s/\(\*\)/init_module/;
+		my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
+		$proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/;
+
+		$self->output(<< "__EOD__"
+bin/$ctx->{NAME}_init_module.c:
+	\@echo Creating \$\@
+	\@echo \"#include \\\"includes.h\\\"\" > \$\@
+	\@echo \"$proto_fn;\" >> \$\@
+	\@echo -e \"_PUBLIC_ $init_fn \\n{\\n\\treturn $ctx->{INIT_FUNCTION}();\\n}\\n\" >> \$\@
+__EOD__
+);
+		$init_obj = "bin/$ctx->{NAME}_init_module.o";
+	}
+
 	if ($self->{duplicate_build}) {
 		$self->output(<< "__EOD__"
 #
 
-bin/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
+bin/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
 	\@echo Linking \$\@
 	\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \\
 		\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
-		\$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+		$init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
 
 __EOD__
 );
@@ -318,11 +342,11 @@
 	$self->output(<< "__EOD__"
 #
 
-$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
+$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
 	\@echo Linking \$\@
 	\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
 		\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
-		\$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+		$init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
 
 __EOD__
 );
@@ -559,8 +583,9 @@
 	$self->output("PROTO_OBJS = " . array2oneperline($self->{proto_objs}) .  "\n");
 	$self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) .  "\n");
 	$self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
+	$self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
 
-	$self->output("\ninstallplugins: \$(SHARED_MODULES)\n".$self->{install_plugins}."\n");
+	$self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
 	$self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
 
 	$self->_prepare_mk_files();

Modified: branches/SAMBA_4_0/source/build/smb_build/output.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/output.pm	2006-03-09 13:42:13 UTC (rev 14071)
+++ branches/SAMBA_4_0/source/build/smb_build/output.pm	2006-03-09 14:39:36 UTC (rev 14072)
@@ -43,15 +43,23 @@
 {
 	my $lib = shift;
 	my $link_name;
+	my $lib_name;
 
 	@{$lib->{DEPEND_LIST}} = ();
 	@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJ_LIST)");
 
-	$link_name = $lib->{NAME};
-	$link_name =~ s/^LIB//;
-	$link_name = lc($link_name);
+	$link_name = lc($lib->{NAME});
+	$lib_name = $link_name;
 
-	$lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_NAME} = "lib$link_name.\$(SHLIBEXT)";
+	if ($lib->{TYPE} eq "LIBRARY") {
+		$link_name = $lib->{NAME};
+		$link_name =~ s/^LIB//;
+		$link_name = lc($link_name);
+		$lib_name = "lib$link_name";
+		$lib->{OUTPUT} = "-l$link_name";
+	}
+
+	$lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_NAME} = "$lib_name.\$(SHLIBEXT)";
 	$lib->{TARGET} = "bin/$lib->{LIBRARY_NAME}";
 	if (defined($lib->{MAJOR_VERSION})) {
 		$lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}";
@@ -59,7 +67,6 @@
 		$lib->{TARGET} = "bin/$lib->{LIBRARY_REALNAME}";
 		@{$lib->{LINK_FLAGS}} = ("\$(SONAMEFLAG)$lib->{LIBRARY_SONAME}");
 	}
-	$lib->{OUTPUT} = "-l$link_name";
 }
 
 sub generate_static_library($)

Modified: branches/SAMBA_4_0/source/main.mk
===================================================================
--- branches/SAMBA_4_0/source/main.mk	2006-03-09 13:42:13 UTC (rev 14071)
+++ branches/SAMBA_4_0/source/main.mk	2006-03-09 14:39:36 UTC (rev 14072)
@@ -268,12 +268,17 @@
 	@echo Removing hostcc objects
 	@-find . -name '*.ho' -exec rm -f '{}' \;
 	@echo Removing binaries
-	@-rm -f $(BIN_PROGS) $(SBIN_PROGS)
+	@-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES)
 	@echo Removing libraries
-	@-rm -f bin/*.$(SHLIBEXT).*
+	@-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
+	@-rm -f bin/*.$(SHLIBEXT)*
+	@echo Removing modules
+	@-rm -f $(SHARED_MODULES) $(PLUGINS)
+	@-rm -f bin/*_init_module.c
 	@echo Removing dummy targets
 	@-rm -f bin/.*_*
 	@echo Removing generated files
+	@-rm -f bin/*_init_module.c
 	@-rm -rf librpc/gen_* 
 	@-rm -f lib/registry/regf.h lib/registry/tdr_regf*
 	@echo Removing proto headers
@@ -286,6 +291,7 @@
 	-rm -f config.log config.cache
 	-rm -f samba4-deps.dot
 	-rm -f config.pm config.mk
+	-rm -f $(PC_FILES)
 
 removebackup:
 	-rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~



More information about the samba-cvs mailing list