Correct link metadata created when installing with -DNO_ROOT.

Explicitly specify owner/group/mode metadata when creating links.

More consistently use INSTALL_SYMLINK to install symlinks.

Reviewed by:	bdrewery
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11231
This commit is contained in:
Brooks Davis 2018-06-29 16:07:56 +00:00
parent 5b2b45a421
commit fa8c921e3f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335797
5 changed files with 78 additions and 7 deletions

View file

@ -225,6 +225,24 @@ MANMODE Manual mode.
MANOWN Manual owner.
INSTALL_LINK Command to install a hard link.
INSTALL_SYMLINK Command to install a symbolic link.
INSTALL_RSYMLINK Command to install a relative symbolic link.
LINKOWN Owner of hard links created by INSTALL_LINK.
LINKGRP Group of hard links created by INSTALL_LINK.
LINKMODE Mode of hard links created by INSTALL_LINK.
SYMLINKOWN Owner of hard links created by INSTALL_[R]SYMLINK.
SYMLINKGRP Group of hard links created by INSTALL_[R]SYMLINK.
SYMLINKMODE Mode of hard links created by INSTALL_[R]SYMLINK.
This file is generally useful when building your own Makefiles so that
they use the same default owners etc. as the rest of the tree.
@ -320,6 +338,13 @@ LINKS The list of binary links; should be full pathnames, the
LINKS= /bin/test /bin/[
LINKOWN Owner of links created with LINKS [${BINOWN}].
LINKGRP Group of links created with LINKS [${BINGRP}].
LINKMODE Mode of links created with LINKS [${BINMODE}].
MAN Manual pages. If no MAN variable is defined,
"MAN=${PROG}.1" is assumed. See bsd.man.mk for more details.
@ -529,6 +554,21 @@ LIB_CXX The name of the library to build. It also causes
will be built. NO_PIC can be set to only build a static
library.
LINKS The list of binary links; should be full pathnames, the
linked-to file coming first, followed by the linked
file. The files are hard-linked. For example, to link
/bin/test and /bin/[, use:
LINKS= /bin/test /bin/[
LINKOWN Owner of links created with LINKS [${LIBOWN}].
LINKGRP Group of links created with LINKS [${LIBGRP}].
LINKMODE Mode of links created with LINKS [${LIBMODE}].
LINTLIBDIR Target directory for lint libraries.
MAN The manual pages to be installed. See bsd.man.mk for more
details.

View file

@ -275,7 +275,7 @@ ${SHLIB_NAME_FULL}: ${SOBJS}
@${ECHO} building shared library ${SHLIB_NAME}
@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no"
@${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
@${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
.endif
${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
-o ${.TARGET} -Wl,-soname,${SONAME} \
@ -291,7 +291,7 @@ ${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \
${SHLIB_NAME_FULL} ${.TARGET}
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
@${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
@${INSTALL_LIBSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
.endif
${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL}
@ -398,7 +398,7 @@ _libinstall:
${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}
${INSTALL_SYMLINK} ${SHLIB_LINK} ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK}
${INSTALL_LIBSYMLINK} ${SHLIB_LINK} ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK}
.endfor
.else
.if ${_SHLIBDIR} == ${_LIBDIR}
@ -437,6 +437,11 @@ _libinstall:
.include <bsd.confs.mk>
.endif
LINKOWN?= ${LIBOWN}
LINKGRP?= ${LIBGRP}
LINKMODE?= ${LIBMODE}
SYMLINKOWN?= ${LIBOWN}
SYMLINKGRP?= ${LIBGRP}
.include <bsd.links.mk>
.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)

View file

@ -227,7 +227,7 @@ maninstall: ${MAN}
.endif
.for l t in ${_MANLINKS}
rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \
${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT}
${INSTALL_MANLINK} ${TAG_ARGS} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT}
.endfor
manlint:

View file

@ -124,6 +124,18 @@
#
# PKG_CMD Program for creating and manipulating packages.
# [pkg]
#
# LINKOWN Hard link owner [${BINOWN}]
#
# LINKGRP Hard link group [${BINGRP}]
#
# LINKMODE Hard link mode [${NOBINMODE}]
#
# SYMLINKOWN Symbolic link owner [${BINOWN} or ${LIBOWN}]
#
# SYMLINKGRP Symbolic link group [${BINGRP} or ${LIBGRP}]
#
# SYMLINKMODE Symbolic link mode [755]
.if !target(__<bsd.own.mk>__)
__<bsd.own.mk>__:
@ -217,12 +229,22 @@ INCLUDEDIR?= /usr/include
#
# install(1) parameters.
#
HRDLINK?= -l h
SYMLINK?= -l s
RSYMLINK?= -l rs
_LINKOWN?= ${LINKOWN:U${BINOWN}}
_LINKGRP?= ${LINKGRP:U${BINGRP}}
_LINKMODE?= ${LINKMODE:U${NOBINMODE}}
_SYMLINKOWN?= ${SYMLINKOWN:U${BINOWN}}
_SYMLINKGRP?= ${SYMLINKGRP:U${BINGRP}}
_SYMLINKMODE?= ${SYMLINKMODE:U755}
HRDLINK?= -l h -o ${_LINKOWN} -g ${_LINKGRP} -m ${_LINKMODE}
MANHRDLINK?= -l h -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
SYMLINK?= -l s -o ${_SYMLINKOWN} -g ${_SYMLINKGRP} -m ${_SYMLINKMODE}
LSYMLINK?= -l s -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE}
RSYMLINK?= -l rs -o ${_SYMLINKOWN} -g ${_SYMLINKGRP} -m ${_SYMLINKMODE}
INSTALL_LINK?= ${INSTALL} ${HRDLINK}
INSTALL_MANLINK?= ${INSTALL} ${MANHRDLINK}
INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK}
INSTALL_LIBSYMLINK?= ${INSTALL} ${LSYMLINK}
INSTALL_RSYMLINK?= ${INSTALL} ${RSYMLINK}
# Common variables

View file

@ -285,6 +285,10 @@ NLSNAME?= ${PROG}
.include <bsd.confs.mk>
.include <bsd.files.mk>
.include <bsd.incs.mk>
LINKOWN?= ${BINOWN}
LINKGRP?= ${BINGRP}
LINKMODE?= ${BINMODE}
.include <bsd.links.mk>
.if ${MK_MAN} != "no"