Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2018 12:20:35 -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:  <1532370035.3251993.1450222760.4825785F@webmail.messagingengine.com>
In-Reply-To: <1532364842.1344.164.camel@freebsd.org>
References:  <201807231611.w6NGB3gh074167@repo.freebsd.org> <1532362918.1344.145.camel@freebsd.org> <1532364494.2401755.1450115552.31CB163C@webmail.messagingengine.com> <1532364842.1344.164.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 23, 2018, at 10:54 AM, Ian Lepore wrote:
> On Mon, 2018-07-23 at 10:48 -0600, Brad Davis wrote:
> > On Mon, Jul 23, 2018, at 10:21 AM, Ian Lepore wrote:
> > >=20
> > > On Mon, 2018-07-23 at 16:11 +0000, Brad Davis wrote:
> > > >=20
> > > > 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
> > > > with 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/D1640
> > > > 5
> > > >=20
> > > > Added:
> > > > =C2=A0 head/share/mk/bsd.dirs.mk=C2=A0=C2=A0=C2=A0(contents, props =
changed)
> > > > 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=09
> > > > (r336639)
> > > > +++ head/share/mk/bsd.README	Mon Jul 23 16:11:03 2018=09
> > > > (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 target
> > > > =C2=A0bsd.files.mk		- install of general purpose files
> > > > @@ -291,6 +292,18 @@ CFLAGS		Flags to the compiler
> > > > when creating C objects.
> > > > =C2=A0CLEANDIRS	Additional files (CLEANFILES) and directories
> > > > (CLEANDIRS) 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 example:
> > > > +
> > > > +			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=A0Usually used for
> > > > =C2=A0		libraries.=C2=A0=C2=A0For example, to depend on the
> > > > compatibility 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=09
> > > > (r336640)
> > > > @@ -0,0 +1,42 @@
> > > > +# $FreeBSD$
> > > > +#
> > > > +# Directory permissions management.
> > > > +
> > > > +.if !target(____)
> > > > +____:
> > > > +# List of directory variable names to install.=C2=A0=C2=A0Each var=
iable
> > > > name's value
> > > > +# must be a full path.=C2=A0=C2=A0If non-default permissions are d=
esired,
> > > > _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) && !=
empty(${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=
}TAGS) || ! ${${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
> > > 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 CREATEDIRS, or anything else we might choose as well.=C2=A0=C2=A0=
Do you
> > have an example of someone using DIRS already?
> >=20
> > So I am kind of doubtful that changing this to something else would
> > avoid the problem entirely..
> >=20
> >=20
> > Regards,
> > Brad Davis
> >=20
>=20
> The only way to avoid it entirely would be to declare that anything
> starting with FREEBSD belongs to us and consistantly use it. That ship
> sailed about 30 years ago.
>=20
> My theory is that the longer the name is, the less likely it is to
> clash. Of course, any name you come up with that's good and sensible
> and self-documenting is exactly the kind of name that someone else is
> likely to come up with as well.

Good point.  But unless someone has an active example, I think I'll just le=
ave it for now.


Regards,
Brad Davis



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