Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2018 10:48:14 -0600
From:      Brad Davis <brd@FreeBSD.org>
To:        Ian Lepore <ian@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r336640 - head/share/mk
Message-ID:  <1532364494.2401755.1450115552.31CB163C@webmail.messagingengine.com>
In-Reply-To: <1532362918.1344.145.camel@freebsd.org>
References:  <201807231611.w6NGB3gh074167@repo.freebsd.org> <1532362918.1344.145.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 23, 2018, at 10:21 AM, Ian Lepore wrote:
> On Mon, 2018-07-23 at 16:11 +0000, Brad Davis wrote:
> > Author: brd
> > Date: Mon Jul 23 16:11:03 2018
> > New Revision: 336640
> > URL: https://svnweb.freebsd.org/changeset/base/336640
> >=20
> > Log:
> > =C2=A0 Add the initial DIRS infrastructure for creating directories wit=
h the
> > =C2=A0 necessary owner, group, mode and flags.
> > =C2=A0=C2=A0
> > =C2=A0 Approved by:	bapt (mentor)
> > =C2=A0 Differential Revision:	https://reviews.freebsd.org/D16405
> >=20
> > Added:
> > =C2=A0 head/share/mk/bsd.dirs.mk=C2=A0=C2=A0=C2=A0(contents, props chan=
ged)
> > Modified:
> > =C2=A0 head/share/mk/bsd.README
> >=20
> > Modified: head/share/mk/bsd.README
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/share/mk/bsd.README	Mon Jul 23 15:36:55 2018	(r336639)
> > +++ head/share/mk/bsd.README	Mon Jul 23 16:11:03 2018	(r336640)
> > @@ -22,6 +22,7 @@ bsd.confs.mk		- install of configuration files
> > =C2=A0bsd.cpu.mk		- sets CPU/arch-related variables (included from sys.=
mk)
> > =C2=A0bsd.crunchgen.mk	- building crunched binaries using crunchgen(1)
> > =C2=A0bsd.dep.mk		- handle Makefile dependencies
> > +bsd.dirs.mk		- handle directory creation
> > =C2=A0bsd.doc.mk		- building troff system documents
> > =C2=A0bsd.endian.mk		- TARGET_ENDIAN=3D1234(little) or 4321 (big) for t=
arget
> > =C2=A0bsd.files.mk		- install of general purpose files
> > @@ -291,6 +292,18 @@ CFLAGS		Flags to the compiler when creating C obje=
cts.
> > =C2=A0CLEANDIRS	Additional files (CLEANFILES) and directories (CLEANDIR=
S) to
> > =C2=A0CLEANFILES	remove during clean and cleandir targets.=C2=A0=C2=A0"=
rm -rf" and
> > =C2=A0		"rm -f" are used, respectively.
> > +
> > +DIRS		A list of variables referring to directories.=C2=A0=C2=A0For exa=
mple:
> > +
> > +			DIRS+=3D	FOO
> > +			FOO=3D	/usr/share/foo
> > +
> > +		Owner, Group, Mode and Flags are handled by FOO_OWN,
> > +		FOO_GRP, FOO_MODE and FOO_FLAGS, respectively.
> > +
> > +		This allows FILESDIR to be set to FOO, and the directory
> > +		will be created before the files are installed and the
> > +		dependencies will be set correctly.
> > =C2=A0
> > =C2=A0DPADD		Additional dependencies for the program.=C2=A0=C2=A0Usuall=
y used for
> > =C2=A0		libraries.=C2=A0=C2=A0For example, to depend on the compatibili=
ty and
> >=20
> > Added: head/share/mk/bsd.dirs.mk
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> > +++ head/share/mk/bsd.dirs.mk	Mon Jul 23 16:11:03 2018	(r336640)
> > @@ -0,0 +1,42 @@
> > +# $FreeBSD$
> > +#
> > +# Directory permissions management.
> > +
> > +.if !target(____)
> > +____:
> > +# List of directory variable names to install.=C2=A0=C2=A0Each variabl=
e name's value
> > +# must be a full path.=C2=A0=C2=A0If non-default permissions are desir=
ed, _MODE,
> > +# _OWN, and _GRP may be specified.
> > +DIRS?=3D
> > +
> > +.=C2=A0=C2=A0for dir in ${DIRS:O:u}
> > +.=C2=A0=C2=A0=C2=A0=C2=A0if defined(${dir}) && !empty(${dir})
> > +# Set default permissions for a directory
> > +${dir}_MODE?=3D	0755
> > +${dir}_OWN?=3D	root
> > +${dir}_GRP?=3D	wheel
> > +.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if defined(${dir}_FLAGS) && !empt=
y(${dir}_FLAGS)
> > +${dir}_FLAG=3D	-f ${${dir}_FLAGS}
> > +.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0endif
> > +
> > +.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if defined(NO_ROOT)
> > +.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if !defined(${dir}TAG=
S) || ! ${${dir}TAGS:Mpackage=3D*}
> > +${dir}TAGS+=3D		package=3D${${dir}PACKAGE:Uruntime}
> > +.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0endif
> > +${dir}TAG_ARGS=3D	-T ${${dir}TAGS:[*]:S/ /,/g}
> > +.=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0endif
> > +
> > +installdirs: installdirs-${dir}
> > +
> > +installdirs-${dir}: ${DESTDIR}${${dir}}
> > +
> > +${DESTDIR}${${dir}}:
> > +	@${ECHO} installing DIRS ${dir}
> > +	${INSTALL} ${${dir}TAG_ARGS} -d -m ${${dir}_MODE} -o ${${dir}_OWN} \
> > +		-g ${${dir}_GRP} ${${dir}_FLAG} ${DESTDIR}${${dir}}
> > +.=C2=A0=C2=A0=C2=A0=C2=A0endif
> > +
> > +realinstall: installdirs-${dir}
> > +.=C2=A0=C2=A0endfor
> > +
> > +.endif
> >=20
>=20
> Having a variable named DIRS seems like asking for name clashes with
> peoples' existing makefiles (people do use the freebsd build
> infrastructure to build out-of-tree code). Could it be named maybe
> CREATEDIRS (taking a precedent-clue from CLEANDIRS)?

I suppose that is possible, but it seems like other people could be using C=
REATEDIRS, or anything else we might choose as well.  Do you have an exampl=
e of someone using DIRS already?

So I am kind of doubtful that changing this to something else would avoid t=
he problem entirely..


Regards,
Brad Davis



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1532364494.2401755.1450115552.31CB163C>