svn commit: r249654 - in projects/bmake: include share/mk usr.bin/kdump

Simon J. Gerraty sjg at FreeBSD.org
Fri Apr 19 18:45:05 UTC 2013


Author: sjg
Date: Fri Apr 19 18:45:03 2013
New Revision: 249654
URL: http://svnweb.freebsd.org/changeset/base/249654

Log:
  Add stage-install.sh so we can do away with the need to have
  $STAGE_OBJTOP/include for src/include.

Added:
  projects/bmake/share/mk/stage-install.sh   (contents, props changed)
Modified:
  projects/bmake/include/Makefile
  projects/bmake/share/mk/local.sys.mk
  projects/bmake/share/mk/meta.stage.mk
  projects/bmake/usr.bin/kdump/Makefile
  projects/bmake/usr.bin/kdump/Makefile.depend

Modified: projects/bmake/include/Makefile
==============================================================================
--- projects/bmake/include/Makefile	Fri Apr 19 18:39:17 2013	(r249653)
+++ projects/bmake/include/Makefile	Fri Apr 19 18:45:03 2013	(r249654)
@@ -135,9 +135,6 @@ stage_includes:
 .if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD)
 .if make(all)
 DESTDIR= ${STAGE_OBJTOP}
-# we want to keep this separate from the folk who
-# do staging "normally"
-INCLUDEDIR=	/include
 
 all:	stage_includes
 installincludes: buildincludes
@@ -148,11 +145,6 @@ stage_prep:
 	@touch $@
 
 stage_includes: .dirdep installincludes
-	@find ${DESTDIR}${INCLUDEDIR} -type d | while read d; do \
-		rm -f $$d/.dirdep; \
-		{ ln .dirdep $$d/.dirdep 2> /dev/null || \
-		cp -p .dirdep $$d/.dirdep; }; \
-	done
 	@touch $@
 .endif
 .endif

Modified: projects/bmake/share/mk/local.sys.mk
==============================================================================
--- projects/bmake/share/mk/local.sys.mk	Fri Apr 19 18:39:17 2013	(r249653)
+++ projects/bmake/share/mk/local.sys.mk	Fri Apr 19 18:45:03 2013	(r249654)
@@ -156,7 +156,7 @@ STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}
 .if ${MACHINE} != "host"
 CFLAGS_LAST+= -nostdinc
 .endif
-CFLAGS_LAST+= -isystem ${STAGE_OBJTOP}/usr/include -isystem ${STAGE_OBJTOP}/include
+CFLAGS_LAST+= -isystem ${STAGE_OBJTOP}/usr/include 
 CFLAGS_LAST += ${CFLAGS_LAST.${COMPILER_TYPE}}
 LDFLAGS_LAST+= -B${STAGE_LIBDIR} -L${STAGE_LIBDIR}
 CXXFLAGS_LAST += -isystem ${STAGE_OBJTOP}/usr/include/c++/${GCCVER:U4.2}
@@ -166,10 +166,10 @@ CFLAGS_LAST.clang += -isystem ${STAGE_OB
 CXXFLAGS_LAST += ${CFLAGS_LAST.${COMPILER_TYPE}}
 .else
 # if ld suppored sysroot, this would suffice
-CFLAGS_LAST+= --sysroot=${STAGE_OBJTOP} -isystem ${STAGE_OBJTOP}/include
+CFLAGS_LAST+= --sysroot=${STAGE_OBJTOP}
 .endif
 .endif
-STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/include
+STAGED_INCLUDE_DIR= ${STAGE_OBJTOP}/usr/include
 .if ${USE_META:Uyes} == "yes"
 .include "meta.sys.mk"
 .endif

Modified: projects/bmake/share/mk/meta.stage.mk
==============================================================================
--- projects/bmake/share/mk/meta.stage.mk	Fri Apr 19 18:39:17 2013	(r249653)
+++ projects/bmake/share/mk/meta.stage.mk	Fri Apr 19 18:45:03 2013	(r249654)
@@ -1,4 +1,4 @@
-# $Id: meta.stage.mk,v 1.24 2013/03/23 02:25:19 sjg Exp $
+# $Id: meta.stage.mk,v 1.30 2013/04/19 16:32:57 sjg Exp $
 #
 #	@(#) Copyright (c) 2011, Simon J. Gerraty
 #
@@ -228,4 +228,17 @@ STAGING_WAIT ?= .WAIT
 
 all: ${STAGING_WAIT} staging
 
+.if exists(${.PARSEDIR}/stage-install.sh) && !defined(STAGE_INSTALL)
+# this will run install(1) and then followup with .dirdep files.
+STAGE_INSTALL := sh ${.PARSEDIR:tA}/stage-install.sh INSTALL="${INSTALL}" OBJDIR=${.OBJDIR:tA}
+.endif
+
+# if ${INSTALL} gets run during 'all' assume it is for staging?
+.if ${.TARGETS:Nall} == "" && defined(STAGE_INSTALL)
+INSTALL := ${STAGE_INSTALL}
+.if target(beforeinstall)
+beforeinstall: .dirdep
+.endif
+.endif
+
 .endif

Added: projects/bmake/share/mk/stage-install.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/bmake/share/mk/stage-install.sh	Fri Apr 19 18:45:03 2013	(r249654)
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+# NAME:
+#	stage-install.sh - wrapper around install
+#
+# SYNOPSIS:
+#	stage-install.sh [variable="value"] "args" "dest"
+#
+# DESCRIPTION:
+#	This script is a wrapper around the normal install(1).
+#	Its role is to add '.dirdep' files to the destination.
+#	The variables we might use are:
+#
+#	INSTALL
+#		Path to actual install(1), default is
+#		$REAL_INSTALL
+#
+#	OBJDIR
+#		Path to the dir where '.dirdep' was generated,
+#		default is '.'
+#
+#	_DIRDEP
+#		Path to actual '.dirdep' file, default is
+#		$OBJDIR/.dirdep
+#
+#	The "args" and "dest" are passed as is to install(1), and if a
+#	'.dirdep' file exists it will be linked or copied to each
+#	"file".dirdep placed in "dest" or "dest".dirdep if it happed
+#	to be a file rather than a directory.
+#
+# SEE ALSO:
+#	meta.stage.mk
+#	
+
+# RCSid:
+#	$Id: stage-install.sh,v 1.5 2013/04/19 16:32:24 sjg Exp $
+#
+#	@(#) Copyright (c) 2013, Simon J. Gerraty
+#
+#	This file is provided in the hope that it will
+#	be of use.  There is absolutely NO WARRANTY.
+#	Permission to copy, redistribute or otherwise
+#	use this file is hereby granted provided that 
+#	the above copyright notice and this notice are
+#	left intact. 
+#      
+#	Please send copies of changes and bug-fixes to:
+#	sjg at crufty.net
+#
+
+INSTALL=${REAL_INSTALL:-install}
+OBJDIR=.
+
+while :
+do
+    case "$1" in
+    *=*) eval "$1"; shift;;
+    *) break;;
+    esac
+done
+
+# if .dirdep doesn't exist, just run install and be done
+_DIRDEP=${_DIRDEP:-$OBJDIR/.dirdep}
+[ -s $_DIRDEP ] && EXEC= || EXEC=exec
+$EXEC $INSTALL "$@" || exit 1
+
+# from meta.stage.mk
+LnCp() {
+    rm -f $2 2> /dev/null
+    ln $1 $2 2> /dev/null || cp -p $1 $2
+}
+
+StageDirdep() {
+  t=$1
+  if [ -s $t.dirdep ]; then
+      cmp -s $_DIRDEP $t.dirdep && return
+      echo "ERROR: $t installed by `cat $t.dirdep` not `cat $_DIRDEP`" >&2
+      exit 1
+  fi
+  LnCp $_DIRDEP $t.dirdep || exit 1
+}
+
+args="$@"
+while [ $# -gt 8 ]
+do
+    shift 8
+done
+eval dest=\$$#
+if [ -f $dest ]; then
+    # a file, there can be only one .dirdep needed
+    StageDirdep $dest
+elif [ -d $dest ]; then
+    for f in $args
+    do
+        test -f $f || continue
+        StageDirdep $dest/${f##*/}
+    done
+fi

Modified: projects/bmake/usr.bin/kdump/Makefile
==============================================================================
--- projects/bmake/usr.bin/kdump/Makefile	Fri Apr 19 18:39:17 2013	(r249653)
+++ projects/bmake/usr.bin/kdump/Makefile	Fri Apr 19 18:45:03 2013	(r249654)
@@ -38,8 +38,3 @@ linux_syscalls.c:
 	    >> linux_syscalls.c
 
 .include <bsd.prog.mk>
-
-.if ${MK_STAGING} != ""
-# we are interested in the files put in ${STAGE_OBJTOP}/include
-INCLUDEDIR= /include
-.endif

Modified: projects/bmake/usr.bin/kdump/Makefile.depend
==============================================================================
--- projects/bmake/usr.bin/kdump/Makefile.depend	Fri Apr 19 18:39:17 2013	(r249653)
+++ projects/bmake/usr.bin/kdump/Makefile.depend	Fri Apr 19 18:45:03 2013	(r249654)
@@ -6,6 +6,7 @@ DIRDEPS = \
 	gnu/lib/libgcc \
 	include \
 	include/arpa \
+	include/rpc \
 	include/xlocale \
 	lib/${CSU_DIR} \
 	lib/libc \


More information about the svn-src-projects mailing list