From owner-freebsd-arch@FreeBSD.ORG Tue Jun 26 06:33:17 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 675BE106564A for ; Tue, 26 Jun 2012 06:33:17 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from exprod7og111.obsmtp.com (exprod7og111.obsmtp.com [64.18.2.175]) by mx1.freebsd.org (Postfix) with ESMTP id 112BF8FC0A for ; Tue, 26 Jun 2012 06:33:17 +0000 (UTC) Received: from P-EMHUB03-HQ.jnpr.net ([66.129.224.36]) (using TLSv1) by exprod7ob111.postini.com ([64.18.6.12]) with SMTP ID DSNKT+lXrCHr7+eCmfrycxWSw64OEZGZdkbI@postini.com; Mon, 25 Jun 2012 23:33:17 PDT Received: from magenta.juniper.net (172.17.27.123) by P-EMHUB03-HQ.jnpr.net (172.24.192.33) with Microsoft SMTP Server (TLS) id 8.3.213.0; Mon, 25 Jun 2012 23:30:31 -0700 Received: from chaos.jnpr.net (chaos.jnpr.net [172.24.29.229]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id q5Q6UIh41763; Mon, 25 Jun 2012 23:30:19 -0700 (PDT) (envelope-from sjg@juniper.net) Received: from chaos.jnpr.net (localhost [127.0.0.1]) by chaos.jnpr.net (Postfix) with ESMTP id D05DA58081; Mon, 25 Jun 2012 23:30:17 -0700 (PDT) To: X-Mailer: MH-E 7.82+cvs; nmh 1.3; GNU Emacs 22.3.1 Date: Mon, 25 Jun 2012 23:30:17 -0700 From: Simon Gerraty Message-ID: <20120626063017.D05DA58081@chaos.jnpr.net> MIME-Version: 1.0 Content-Type: text/plain Cc: sjg@juniper.net Subject: Allow user install X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 06:33:17 -0000 The patch below is a step towards supporting unprivileged buildworld etc. Eg. $ cd bin/cat $ make -n install DESTDIR=/tmp install -s -o root -g wheel -m 555 cat /tmp/bin install -o root -g wheel -m 444 cat.1.gz /tmp/usr/share/man/man1 $ make -n install -DWITHOUT_INSTALL_OWN DESTDIR=/tmp install -s -m 555 cat /tmp/bin install -m 444 cat.1.gz /tmp/usr/share/man/man1 $ This is similar to the approach used in my generic mk-files, but leveraging the -DWITHOUT_* stuff in bsd.own.mk --sjg Index: share/mk/bsd.files.mk =================================================================== --- share/mk/bsd.files.mk (revision 237026) +++ share/mk/bsd.files.mk (working copy) @@ -23,6 +23,11 @@ ${group}MODE?= ${SHAREMODE} ${group}DIR?= ${BINDIR} +.if ${MK_INSTALL_OWN} != "no" +${group}_INSTALL_OWN ?= -o ${${group}OWN} -g ${${group}GRP} +${group}_INSTALL_OWN.ALLSRC ?= -o ${${group}OWN_${.ALLSRC:T}} -g ${${group}GRP_${.ALLSRC:T}} +.endif + _${group}FILES= .for file in ${${group}} .if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \ @@ -39,8 +44,8 @@ .endif installfiles: _${group}INS_${file:T} _${group}INS_${file:T}: ${file} - ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \ - -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ + ${INSTALL} ${${group}_INSTALL_OWN.ALLSRC} \ + -m ${${group}MODE_${.ALLSRC:T}} \ ${.ALLSRC} \ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} .else @@ -51,11 +56,11 @@ installfiles: _${group}INS _${group}INS: ${_${group}FILES} .if defined(${group}NAME) - ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \ + ${INSTALL} ${${group}_INSTALL_OWN} \ -m ${${group}MODE} ${.ALLSRC} \ ${DESTDIR}${${group}DIR}/${${group}NAME} .else - ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \ + ${INSTALL} ${${group}_INSTALL_OWN} \ -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR} .endif .endif Index: share/mk/bsd.own.mk =================================================================== --- share/mk/bsd.own.mk (revision 237026) +++ share/mk/bsd.own.mk (working copy) @@ -353,6 +353,7 @@ INET6 \ INFO \ INSTALLLIB \ + INSTALL_OWN \ IPFILTER \ IPFW \ IPX \ @@ -645,6 +646,13 @@ CTFCONVERT_CMD= @: .endif + +.if ${MK_INSTALL_OWN} != "no" +.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE +$x_INSTALL_OWN ?= -o ${$xOWN} -g ${$xGRP} +.endfor +.endif + .endif # !_WITHOUT_SRCCONF .endif # !target(____) Index: share/mk/bsd.lib.mk =================================================================== --- share/mk/bsd.lib.mk (revision 237026) +++ share/mk/bsd.lib.mk (working copy) @@ -259,15 +259,15 @@ .ORDER: beforeinstall _libinstall _libinstall: .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${INSTALL} -C ${LIB_INSTALL_OWN} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR} .endif .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) - ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${INSTALL} -C ${LIB_INSTALL_OWN} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR} .endif .if defined(SHLIB_NAME) - ${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${INSTALL} ${STRIP} ${LIB_INSTALL_OWN} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} .if defined(SHLIB_LINK) @@ -287,7 +287,7 @@ sed -e 's,@@SHLIB@@,${_LDSCRIPTROOT}${SHLIBDIR}/${SHLIB_NAME},g' \ -e 's,@@LIBDIR@@,${_LDSCRIPTROOT}${LIBDIR},g' \ ${.CURDIR}/${SHLIB_LDSCRIPT} > lib${LIB}.ld - ${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${INSTALL} -S -C ${LIB_INSTALL_OWN} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}.ld ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .else .if ${SHLIBDIR} == ${LIBDIR} @@ -304,11 +304,11 @@ .endif # SHLIB_LINK .endif # SHIB_NAME .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${INSTALL} ${LIB_INSTALL_OWN} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR} .endif .if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB) - ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${INSTALL} ${LIB_INSTALL_OWN} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR} .endif .endif # !defined(INTERNALLIB) Index: share/mk/bsd.prog.mk =================================================================== --- share/mk/bsd.prog.mk (revision 237026) +++ share/mk/bsd.prog.mk (working copy) @@ -157,10 +157,10 @@ _proginstall: .if defined(PROG) .if defined(PROGNAME) - ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${INSTALL} ${STRIP} ${BIN_INSTALL_OWN} -m ${BINMODE} \ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME} .else - ${INSTALL} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${INSTALL} ${STRIP} ${BIN_INSTALL_OWN} -m ${BINMODE} \ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} .endif .endif @@ -185,10 +185,15 @@ SCRIPTSOWN_${script:T}?= ${SCRIPTSOWN} SCRIPTSGRP_${script:T}?= ${SCRIPTSGRP} SCRIPTSMODE_${script:T}?= ${SCRIPTSMODE} + +.if ${MK_INSTALL_OWN} != "no" +SCRIPTS_INSTALL_OWN.ALLSRC ?= -o ${SCRIPTSOWN_${.ALLSRC:T}} -g ${SCRIPTSGRP_${.ALLSRC:T}} +.endif + _scriptsinstall: _SCRIPTSINS_${script:T} _SCRIPTSINS_${script:T}: ${script} - ${INSTALL} -o ${SCRIPTSOWN_${.ALLSRC:T}} \ - -g ${SCRIPTSGRP_${.ALLSRC:T}} -m ${SCRIPTSMODE_${.ALLSRC:T}} \ + ${INSTALL} ${SCRIPTS_INSTALL_OWN.ALLSRC} \ + -m ${SCRIPTSMODE_${.ALLSRC:T}} \ ${.ALLSRC} \ ${DESTDIR}${SCRIPTSDIR_${.ALLSRC:T}}/${SCRIPTSNAME_${.ALLSRC:T}} .endfor Index: share/mk/bsd.doc.mk =================================================================== --- share/mk/bsd.doc.mk (revision 237026) +++ share/mk/bsd.doc.mk (working copy) @@ -135,11 +135,11 @@ realinstall: .for _dev in ${PRINTERDEVICE:Mhtml} cd ${SRCDIR}; \ - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${INSTALL} ${BIN_INSTALL_OWN} -m ${BINMODE} \ ${DOC}*.html ${DESTDIR}${BINDIR}/${VOLUME} .endfor .for _dev in ${PRINTERDEVICE:Nhtml} - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ + ${INSTALL} ${BIN_INSTALL_OWN} -m ${BINMODE} \ ${DFILE.${_dev}} ${DESTDIR}${BINDIR}/${VOLUME} .endfor Index: share/mk/bsd.man.mk =================================================================== --- share/mk/bsd.man.mk (revision 237026) +++ share/mk/bsd.man.mk (working copy) @@ -53,7 +53,7 @@ .error bsd.man.mk cannot be included directly. .endif -MINSTALL?= ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} +MINSTALL?= ${INSTALL} ${MAN_INSTALL_OWN} -m ${MANMODE} CATDIR= ${MANDIR:H:S/$/\/cat/} CATEXT= .cat Index: share/mk/bsd.info.mk =================================================================== --- share/mk/bsd.info.mk (revision 237026) +++ share/mk/bsd.info.mk (working copy) @@ -180,11 +180,11 @@ .if ${MK_INFO} != "no" && defined(INFO) install: ${INSTALLINFODIRS} .if !empty(IFILES:N*.html) - ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \ + ${INSTALL} ${INFO_INSTALL_OWN} -m ${INFOMODE} \ ${IFILES:N*.html} ${DESTDIR}${INFODIR} .endif .if !empty(FORMATS:Mhtml) - ${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \ + ${INSTALL} ${INFO_INSTALL_OWN} -m ${INFOMODE} \ ${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR} .endif .else Index: share/mk/bsd.incs.mk =================================================================== --- share/mk/bsd.incs.mk (revision 237026) +++ share/mk/bsd.incs.mk (working copy) @@ -25,6 +25,11 @@ ${group}MODE?= ${NOBINMODE} ${group}DIR?= ${INCLUDEDIR} +.if ${MK_INSTALL_OWN} != "no" +${group}_INSTALL_OWN ?= -o ${${group}OWN} -g ${${group}GRP} +${group}_INSTALL_OWN.ALLSRC ?= -o ${${group}OWN_${.ALLSRC:T}} -g ${${group}GRP_${.ALLSRC:T}} +.endif + _${group}INCS= .for header in ${${group}} .if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \ @@ -41,8 +46,8 @@ .endif installincludes: _${group}INS_${header:T} _${group}INS_${header:T}: ${header} - ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ - -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ + ${INSTALL} -C ${${group}_INSTALL_OWN.ALLSRC} \ + -m ${${group}MODE_${.ALLSRC:T}} \ ${.ALLSRC} \ ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} .else @@ -53,10 +58,10 @@ installincludes: _${group}INS _${group}INS: ${_${group}INCS} .if defined(${group}NAME) - ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ + ${INSTALL} -C ${${group}_INSTALL_OWN} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} .else - ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ + ${INSTALL} -C ${${group}_INSTALL_OWN} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR} .endif .endif