[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha4-119-g97b7244

Jelmer Vernooij jelmer at samba.org
Thu Jun 26 09:51:48 GMT 2008


The branch, v4-0-test has been updated
       via  97b724417fc8110f7c591779b0c17bd072be304f (commit)
       via  3fb35fc03d5cfb48d0d4f51564ef76e99e74f81c (commit)
      from  c9b2e2aa861ccc01e5d92cfe468be1f6324ed294 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 97b724417fc8110f7c591779b0c17bd072be304f
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Jun 26 11:51:22 2008 +0200

    Use make magic for installing/uninstalling binaries.

commit 3fb35fc03d5cfb48d0d4f51564ef76e99e74f81c
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Jun 26 11:39:59 2008 +0200

    Use make template for installing binaries.

-----------------------------------------------------------------------

Summary of changes:
 source/Makefile                    |   31 ++++++++++++--------------
 source/build/make/rules.mk         |    2 -
 source/build/make/templates.mk     |   30 +++++++++++++++++++++++++
 source/build/smb_build/makefile.pm |    9 +++----
 source/script/installbin.sh        |   40 ----------------------------------
 source/script/uninstallbin.sh      |   42 ------------------------------------
 6 files changed, 48 insertions(+), 106 deletions(-)
 delete mode 100755 source/script/installbin.sh
 delete mode 100755 source/script/uninstallbin.sh


Changeset truncated at 500 lines:

diff --git a/source/Makefile b/source/Makefile
index 8a8eef7..3c2efe3 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -106,8 +106,6 @@ ntp_signdsrcdir := ntp_signd
 
 include data.mk
 
-BINARIES += $(BIN_PROGS) $(SBIN_PROGS)
-
 pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
 
 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
@@ -136,7 +134,6 @@ endif
 DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
 		  $(srcdir)/version.h
 
-binaries:: $(BINARIES)
 libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
 modules:: $(PLUGINS)
 headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
@@ -213,20 +210,6 @@ installdirs::
 		$(DESTDIR)$(sysconfdir) \
 
 installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
-	@$(SHELL) $(srcdir)/script/installbin.sh \
-		$(INSTALLPERMS) \
-		$(DESTDIR)$(BASEDIR) \
-		$(DESTDIR)$(sbindir) \
-		$(DESTDIR)$(libdir) \
-		$(DESTDIR)$(localstatedir) \
-		$(SBIN_PROGS)
-	@$(SHELL) $(srcdir)/script/installbin.sh \
-		$(INSTALLPERMS) \
-		$(DESTDIR)$(BASEDIR) \
-		$(DESTDIR)$(bindir) \
-		$(DESTDIR)$(libdir) \
-		$(DESTDIR)$(localstatedir) \
-		$(BIN_PROGS)
 	@$(SHELL) $(srcdir)/script/installtorture.sh \
 		$(INSTALLPERMS) \
 		$(DESTDIR)$(TORTUREDIR) \
@@ -263,6 +246,20 @@ uninstall:: uninstallbin uninstallman uninstallmisc uninstalllib uninstallheader
 uninstallmisc::
 	#FIXME
 
+$(DESTDIR)$(bindir)/%: bin/% installdirs
+	@mkdir -p $(@D)
+	@echo Installing $(@F) as $@
+	@if test -f $@; then; rm -f $@.old; mv $@ $@.old; fi
+	@cp $< $@
+	@chmod $(INSTALLPERMS) $@
+
+$(DESTDIR)$(sbindir)/%: bin/% installdirs
+	@mkdir -p $(@D)
+	@echo Installing $(@F) as $@
+	@if test -f $@; then; rm -f $@.old; mv $@ $@.old; fi
+	@cp $< $@
+	@chmod $(INSTALLPERMS) $@
+
 uninstallbin::
 	@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(SBIN_PROGS)
 	@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(BIN_PROGS)
diff --git a/source/build/make/rules.mk b/source/build/make/rules.mk
index 27a2144..f8df8f0 100644
--- a/source/build/make/rules.mk
+++ b/source/build/make/rules.mk
@@ -43,8 +43,6 @@ clean:: clean_pch
 	@-find . -name '*.o' -exec rm -f '{}' \;
 	@echo Removing hostcc objects
 	@-find . -name '*.ho' -exec rm -f '{}' \;
-	@echo Removing binaries
-	@-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
 	@echo Removing libraries
 	@-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
 	@-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
diff --git a/source/build/make/templates.mk b/source/build/make/templates.mk
index 25bdde0..d4973e7 100644
--- a/source/build/make/templates.mk
+++ b/source/build/make/templates.mk
@@ -22,6 +22,12 @@ define binary_link_template
 $(1): $(2) ;
 	@echo Linking $$@
 	@$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+clean::
+	@rm -f $(1)
+
+binaries:: $(1)
+
 endef
 
 # Link a host-machine binary
@@ -30,6 +36,12 @@ define host_binary_link_template
 $(1): $(2) ;
 	@echo Linking $$@
 	@$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+clean::
+	rm -f $(1)
+
+binaries:: $(1)
+
 endef
 
 # Create a prototype header
@@ -109,3 +121,21 @@ endef
 
 # abspath for older makes
 abspath := $(shell cd $(1); pwd)
+
+# Install a binary
+# Arguments: path to binary to install
+define binary_install_template
+installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))
+
+uninstallbin::
+	@echo "Removing $(notdir $(1))"
+	@rm -f $$(DESTDIR)$$(bindir)/$(1)
+endef
+
+define sbinary_install_template
+installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1)) installdirs
+				
+uninstallsbin::
+	@echo "Removing $(notdir $(1))"
+	@rm -f $$(DESTDIR)$$(sbindir)/$(1)
+endef
diff --git a/source/build/smb_build/makefile.pm b/source/build/smb_build/makefile.pm
index 0ea3106..d9cbca0 100644
--- a/source/build/smb_build/makefile.pm
+++ b/source/build/smb_build/makefile.pm
@@ -196,11 +196,10 @@ sub Binary($$)
 	my ($self,$ctx) = @_;
 
 	unless (defined($ctx->{INSTALLDIR})) {
-		$self->output("BINARIES += $ctx->{TARGET_BINARY}\n");
 	} elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
-		$self->output("SBIN_PROGS += $ctx->{RESULT_BINARY}\n");
+		$self->output("\$(eval \$(call sbinary_install_template,$ctx->{RESULT_BINARY}))\n");
 	} elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
-		$self->output("BIN_PROGS += $ctx->{RESULT_BINARY}\n");
+		$self->output("\$(eval \$(call binary_install_template,$ctx->{RESULT_BINARY}))\n");
 	}
 
 	$self->_prepare_list($ctx, "FULL_OBJ_LIST");
@@ -208,9 +207,9 @@ sub Binary($$)
 	$self->_prepare_list($ctx, "LINK_FLAGS");
 
 	if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") {
-$self->output("\$(call host_binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n");
+$self->output("\$(eval \$(call host_binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS)))\n");
 	} else {
-$self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n");
+$self->output("\$(eval \$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_FULL_OBJ_LIST) \$($ctx->{NAME}_DEPEND_LIST), \$($ctx->{NAME}_LINK_FLAGS)))\n");
 	}
 }
 
diff --git a/source/script/installbin.sh b/source/script/installbin.sh
deleted file mode 100755
index c2f3408..0000000
--- a/source/script/installbin.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-INSTALLPERMS=$1
-BASEDIR=$2
-BINDIR=$3
-LIBDIR=$4
-VARDIR=$5
-shift
-shift
-shift
-shift
-shift
-
-for p in $*; do
- p2=`basename $p`
- echo Installing $p as $BINDIR/$p2
- if [ -f $BINDIR/$p2 ]; then
-   rm -f $BINDIR/$p2.old
-   mv $BINDIR/$p2 $BINDIR/$p2.old
- fi
- cp $p $BINDIR/
- chmod $INSTALLPERMS $BINDIR/$p2
-
- # this is a special case, mount needs this in a specific location
- if [ $p2 = smbmount ]; then
-   ln -sf $BINDIR/$p2 /sbin/mount.smbfs
- fi
-done
-
-
-cat << EOF
-======================================================================
-The binaries are installed. You may restore the old binaries (if there
-were any) using the command "make revert". You may uninstall the binaries
-using the command "make uninstallbin" or "make uninstall" to uninstall
-binaries, man pages and shell scripts.
-======================================================================
-EOF
-
-exit 0
diff --git a/source/script/uninstallbin.sh b/source/script/uninstallbin.sh
deleted file mode 100755
index a8bbdea..0000000
--- a/source/script/uninstallbin.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-#4 July 96 Dan.Shearer at UniSA.edu.au   
-
-INSTALLPERMS=$1
-BASEDIR=$2
-BINDIR=$3
-LIBDIR=$4
-VARDIR=$5
-shift
-shift
-shift
-shift
-shift
-
-if [ ! -d $BINDIR ]; then
-  echo Directory $BINDIR does not exist!
-  echo Do a "make installbin" or "make install" first.
-  exit 1
-fi
-
-for p in $*; do
-  p2=`basename $p`
-  if [ -f $BINDIR/$p2 ]; then
-    echo Removing $BINDIR/$p2
-    rm -f $BINDIR/$p2
-    if [ -f $BINDIR/$p2 ]; then
-      echo Cannot remove $BINDIR/$p2 ... does $USER have privileges?
-    fi
-  fi
-done
-
-
-cat << EOF
-======================================================================
-The binaries have been uninstalled. You may restore the binaries using
-the command "make installbin" or "make install" to install binaries, 
-man pages, modules and shell scripts. You can restore a previous
-version of the binaries (if there were any) using "make revert".
-======================================================================
-EOF
-
-exit 0


-- 
Samba Shared Repository


More information about the samba-cvs mailing list