Port the de-escalation mechanism we have in src to xenocara's make
bootstrap/obj/build. This is now possible due to a normal build not writing to the source tree anymore. ok deraadt
This commit is contained in:
parent
9a3b6b7fd4
commit
97b021efa8
21
Makefile
21
Makefile
@ -1,4 +1,4 @@
|
|||||||
# $OpenBSD: Makefile,v 1.74 2016/10/10 13:34:43 matthieu Exp $
|
# $OpenBSD: Makefile,v 1.75 2016/10/14 10:14:00 natano Exp $
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
.include <bsd.xconf.mk>
|
.include <bsd.xconf.mk>
|
||||||
|
|
||||||
@ -24,18 +24,27 @@ build:
|
|||||||
@exit 2
|
@exit 2
|
||||||
.else
|
.else
|
||||||
build:
|
build:
|
||||||
exec ${SUDO} ${MAKE} bootstrap-root
|
@if [[ `id -u` -ne 0 ]]; then \
|
||||||
cd util/macros && exec ${MAKE} -f Makefile.bsd-wrapper
|
echo $@ must be called by root >&2; \
|
||||||
exec ${SUDO} ${MAKE} beforebuild
|
false; \
|
||||||
|
fi
|
||||||
|
exec ${MAKE} bootstrap-root
|
||||||
|
cd util/macros && \
|
||||||
|
exec su ${BUILDUSER} -c 'exec ${MAKE} -f Makefile.bsd-wrapper'
|
||||||
|
exec ${MAKE} beforebuild
|
||||||
exec ${MAKE} realbuild
|
exec ${MAKE} realbuild
|
||||||
exec ${SUDO} ${MAKE} afterbuild
|
exec ${MAKE} afterbuild
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
realbuild: _SUBDIRUSE
|
realbuild: _SUBDIRUSE
|
||||||
# that's all folks
|
# that's all folks
|
||||||
|
|
||||||
bootstrap:
|
bootstrap:
|
||||||
exec ${SUDO} ${MAKE} bootstrap-root
|
@if [[ `id -u` -ne 0 ]]; then \
|
||||||
|
echo $@ must be called by root >&2; \
|
||||||
|
false; \
|
||||||
|
fi
|
||||||
|
exec ${MAKE} bootstrap-root
|
||||||
|
|
||||||
bootstrap-root:
|
bootstrap-root:
|
||||||
exec ${MAKE} distrib-dirs
|
exec ${MAKE} distrib-dirs
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $OpenBSD: bsd.xorg.mk,v 1.55 2016/10/11 22:36:53 matthieu Exp $ -*- makefile -*-
|
# $OpenBSD: bsd.xorg.mk,v 1.56 2016/10/14 10:14:00 natano Exp $ -*- makefile -*-
|
||||||
#
|
#
|
||||||
# Copyright © 2006,2012 Matthieu Herrb
|
# Copyright © 2006,2012 Matthieu Herrb
|
||||||
#
|
#
|
||||||
@ -186,10 +186,11 @@ build:
|
|||||||
@exit 2
|
@exit 2
|
||||||
.else
|
.else
|
||||||
build:
|
build:
|
||||||
cd ${.CURDIR} && exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} cleandir
|
cd ${.CURDIR} && \
|
||||||
cd ${.CURDIR} && exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} depend
|
su ${BUILDUSER} -c 'exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} cleandir' && \
|
||||||
cd ${.CURDIR} && exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} all
|
su ${BUILDUSER} -c 'exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} depend' && \
|
||||||
cd ${.CURDIR} && exec ${SUDO} ${MAKE} ${MAKE_FLAGS} ${_wrapper} install
|
su ${BUILDUSER} -c 'exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} all' && \
|
||||||
|
exec ${MAKE} ${MAKE_FLAGS} ${_wrapper} install
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
@ -225,6 +226,16 @@ _SUBDIRUSE:
|
|||||||
|
|
||||||
_xenocara_obj! _SUBDIRUSE
|
_xenocara_obj! _SUBDIRUSE
|
||||||
@cd $(.CURDIR); \
|
@cd $(.CURDIR); \
|
||||||
|
if [[ `id -u` -eq 0 && ${BUILDUSER} != root ]]; then \
|
||||||
|
SETOWNER="chown -h ${BUILDUSER}"; \
|
||||||
|
_mkdirs() { \
|
||||||
|
su ${BUILDUSER} -c "mkdir -p $$1"; \
|
||||||
|
}; \
|
||||||
|
MKDIRS=_mkdirs; \
|
||||||
|
else \
|
||||||
|
MKDIRS="mkdir -p"; \
|
||||||
|
SETOWNER=:; \
|
||||||
|
fi; \
|
||||||
here=`/bin/pwd`; xsrcdir=`cd $(XSRCDIR); /bin/pwd`; \
|
here=`/bin/pwd`; xsrcdir=`cd $(XSRCDIR); /bin/pwd`; \
|
||||||
subdir=$${here#$${xsrcdir}/}; \
|
subdir=$${here#$${xsrcdir}/}; \
|
||||||
if test $$here != $$subdir ; then \
|
if test $$here != $$subdir ; then \
|
||||||
@ -234,9 +245,10 @@ _xenocara_obj! _SUBDIRUSE
|
|||||||
X`readlink ${__objdir}` != X$$dest; then \
|
X`readlink ${__objdir}` != X$$dest; then \
|
||||||
if test -e ${__objdir}; then rm -rf ${__objdir}; fi; \
|
if test -e ${__objdir}; then rm -rf ${__objdir}; fi; \
|
||||||
ln -sf $$dest ${__objdir}; \
|
ln -sf $$dest ${__objdir}; \
|
||||||
|
$$SETOWNER ${__objdir}; \
|
||||||
fi; \
|
fi; \
|
||||||
if test -d ${XOBJDIR}; then \
|
if test -d ${XOBJDIR}; then \
|
||||||
test -d $$dest || mkdir -p $$dest; \
|
test -d $$dest || $$MKDIRS $$dest; \
|
||||||
else \
|
else \
|
||||||
if test -e ${XOBJDIR}; then \
|
if test -e ${XOBJDIR}; then \
|
||||||
echo "${XOBJDIR} is not a directory"; \
|
echo "${XOBJDIR} is not a directory"; \
|
||||||
@ -248,7 +260,7 @@ _xenocara_obj! _SUBDIRUSE
|
|||||||
dest=$$here/${__objdir}; \
|
dest=$$here/${__objdir}; \
|
||||||
if test ! -d ${__objdir}; then \
|
if test ! -d ${__objdir}; then \
|
||||||
echo "making $$dest"; \
|
echo "making $$dest"; \
|
||||||
mkdir $$dest; \
|
$$MKDIRS $$dest; \
|
||||||
fi ; \
|
fi ; \
|
||||||
fi
|
fi
|
||||||
. endif
|
. endif
|
||||||
@ -261,3 +273,4 @@ obj: _xenocara_obj
|
|||||||
.PHONY: _xenocara_obj
|
.PHONY: _xenocara_obj
|
||||||
|
|
||||||
.include <bsd.subdir.mk>
|
.include <bsd.subdir.mk>
|
||||||
|
.include <bsd.own.mk>
|
||||||
|
Loading…
Reference in New Issue
Block a user