summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2016-11-19 14:22:06 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2016-11-19 14:22:06 +0000
commit530d8b82adcf5fd2188eb04a5dd2c9cbc0f72188 (patch)
treef93851e60d6beb1b49d087d6c4cb854e228012f6
parent74ae99d10bfb08c6a302b549dfad077035e1b960 (diff)
Enable builds with a dedicated user for xenocara as well.
"push forward" deraadt; no objections matthieu; testing, input & ok rpe
-rw-r--r--Makefile7
-rw-r--r--share/mk/bsd.xorg.mk24
2 files changed, 20 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 5f207f5b2..d28f3f6d2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.76 2016/11/19 08:56:27 tb Exp $
+# $OpenBSD: Makefile,v 1.77 2016/11/19 14:22:05 tb Exp $
.include <bsd.own.mk>
.include <bsd.xconf.mk>
@@ -23,7 +23,10 @@ build:
@echo "Cannot run ${MAKE} build with DESTDIR set"
@exit 2
.else
-build:
+build:
+ umask ${WOBJUMASK}; exec ${MAKE} do-build
+
+do-build:
@if [[ `id -u` -ne 0 ]]; then \
echo $@ must be called by root >&2; \
false; \
diff --git a/share/mk/bsd.xorg.mk b/share/mk/bsd.xorg.mk
index 6fee795aa..92452bbc5 100644
--- a/share/mk/bsd.xorg.mk
+++ b/share/mk/bsd.xorg.mk
@@ -1,4 +1,4 @@
-# $OpenBSD: bsd.xorg.mk,v 1.56 2016/10/14 10:14:00 natano Exp $ -*- makefile -*-
+# $OpenBSD: bsd.xorg.mk,v 1.57 2016/11/19 14:22:05 tb Exp $ -*- makefile -*-
#
# Copyright © 2006,2012 Matthieu Herrb
#
@@ -226,18 +226,23 @@ _SUBDIRUSE:
_xenocara_obj! _SUBDIRUSE
@cd $(.CURDIR); \
+ umask ${WOBJUMASK}; \
+ here=`/bin/pwd`; xsrcdir=`cd $(XSRCDIR); /bin/pwd`; \
+ subdir=$${here#$${xsrcdir}/}; \
if [[ `id -u` -eq 0 && ${BUILDUSER} != root ]]; then \
- SETOWNER="chown -h ${BUILDUSER}"; \
- _mkdirs() { \
- su ${BUILDUSER} -c "mkdir -p $$1"; \
- }; \
- MKDIRS=_mkdirs; \
+ SETOWNER="chown -h ${BUILDUSER}:${WOBJGROUP}"; \
+ if [[ $$here != $$subdir ]]; then \
+ _mkdirs() { \
+ su ${BUILDUSER} -c "mkdir -p $$1"; \
+ }; \
+ MKDIRS=_mkdirs; \
+ fi; \
+ elif [[ $$here == $$subdir ]]; then \
+ SETOWNER="chown :${WOBJGROUP}"; \
else \
- MKDIRS="mkdir -p"; \
SETOWNER=:; \
fi; \
- here=`/bin/pwd`; xsrcdir=`cd $(XSRCDIR); /bin/pwd`; \
- subdir=$${here#$${xsrcdir}/}; \
+ [[ -z $$MKDIRS ]] && MKDIRS="mkdir -p"; \
if test $$here != $$subdir ; then \
dest=${XOBJDIR}/$$subdir; \
echo "$$here/${__objdir} -> $$dest"; \
@@ -261,6 +266,7 @@ _xenocara_obj! _SUBDIRUSE
if test ! -d ${__objdir}; then \
echo "making $$dest"; \
$$MKDIRS $$dest; \
+ $$SETOWNER $$dest; \
fi ; \
fi
. endif