- Extract command variable definitions from bsd.port.mk, they are now stored in

bsd.commands.mk and can be easily reused within the infrastructure.
- Revert old DESTDIR implementation.
- Add a new, fully chrooted DESTDIR implementation as bsd.destdir.mk.

Sponsored by:	Google Summer of Code 2007
Approved by:	portmgr (pav)
This commit is contained in:
Gabor Kovesdan 2007-08-04 11:37:24 +00:00
parent 04d8dc46d4
commit 4c9cd257fd
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=197074
13 changed files with 587 additions and 550 deletions

16
CHANGES
View File

@ -10,6 +10,22 @@ in the release notes.
All ports committers are allowed to commit to this file.
20070804:
AUTHOR: gabor@FreeBSD.org
The following functional changes were made to bsd.*.mk and to
Tools/scripts/security-check.awk:
* The variable definitions that cover command line tools, e.g. MKDIR, were
extracted from bsd.port.mk into bsd.commands.mk, so that we can
reuse them within the infrastructure later.
* The old DESTDIR implementation was removed both from the infrastructure,
and from the individual ports. Variables like TARGETDIR should not longer
be used.
* A new DESTDIR implementation has been added, implemented in bsd.destdir.mk.
The new implementation puts no requirements on the individual ports.
20070730:
AUTHOR: python@FreeBSD.org

99
Mk/bsd.commands.mk Normal file
View File

@ -0,0 +1,99 @@
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# bsd.commands.mk - Common commands used within the ports infrastructure
#
# Created by: Gabor Kovesdan <gabor@FreeBSD.org>
#
# $FreeBSD$
#
# DO NOT COMMIT CHANGES TO THIS FILE BY YOURSELF, EVEN IF YOU DID NOT GET
# A RESPONSE FROM THE MAINTAINER(S) WITHIN A REASONABLE TIMEFRAME! ALL
# UNAUTHORISED CHANGES WILL BE UNCONDITIONALLY REVERTED!
#
COMMANDS_Include_MAINTAINER= portmgr@FreeBSD.org
.if !defined(_COMMANDSMKINCLUDED)
_COMMANDSMKINCLUDED= yes
AWK?= /usr/bin/awk
BASENAME?= /usr/bin/basename
BRANDELF?= /usr/bin/brandelf
BZCAT?= /usr/bin/bzcat
BZIP2_CMD?= /usr/bin/bzip2
CAT?= /bin/cat
CHGRP?= /usr/bin/chgrp
CHMOD?= /bin/chmod
CHOWN?= /usr/sbin/chown
CHROOT?= /usr/sbin/chroot
COMM?= /usr/bin/comm
CP?= /bin/cp
CPIO?= /usr/bin/cpio
CUT?= /usr/bin/cut
DC?= /usr/bin/dc
DIALOG?= /usr/bin/dialog
DIFF?= /usr/bin/diff
DIRNAME?= /usr/bin/dirname
EGREP?= /usr/bin/egrep
EXPR?= /bin/expr
FALSE?= false # Shell builtin
FILE?= /usr/bin/file
FIND?= /usr/bin/find
FMT?= /usr/bin/fmt
GREP?= /usr/bin/grep
GUNZIP_CMD?= /usr/bin/gunzip -f
GZCAT?= /usr/bin/gzcat
GZIP?= -9
GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
HEAD?= /usr/bin/head
ID?= /usr/bin/id
IDENT?= /usr/bin/ident
LDCONFIG?= /sbin/ldconfig
LN?= /bin/ln
LS?= /bin/ls
MKDIR?= /bin/mkdir -p
MKTEMP?= /usr/bin/mktemp
MOUNT?= /sbin/mount
MOUNT_DEVFS?= ${MOUNT} -t devfs devfs
# XXX: this is a work-around for an obscure bug where
# mount -t nullfs returns zero status on errors within
# a make target
MOUNT_NULLFS?= /sbin/mount_nullfs
MV?= /bin/mv
OBJCOPY?= /usr/bin/objcopy
OBJDUMP?= /usr/bin/objdump
PASTE?= /usr/bin/paste
PAX?= /bin/pax
PRINTF?= /usr/bin/printf
REALPATH?= /bin/realpath
RM?= /bin/rm
RMDIR?= /bin/rmdir
SED?= /usr/bin/sed
SETENV?= /usr/bin/env
SH?= /bin/sh
SORT?= /usr/bin/sort
STRIP_CMD?= /usr/bin/strip
SU_CMD?= /usr/bin/su root -c
SYSCTL?= /sbin/sysctl
TAIL?= /usr/bin/tail
TEST?= test # Shell builtin
TR?= LANG=C /usr/bin/tr
TRUE?= true # Shell builtin
UMOUNT?= /sbin/umount
UNAME?= /usr/bin/uname
UNZIP_CMD?= ${LOCALBASE}/bin/unzip
WHICH?= /usr/bin/which
XARGS?= /usr/bin/xargs
YACC?= /usr/bin/yacc
# ECHO is defined in /usr/share/mk/sys.mk, which can either be "echo",
# or "true" if the make flag -s is given. Use ECHO_CMD where you mean
# the echo command.
ECHO_CMD?= echo # Shell builtin
# Used to print all the '===>' style prompts - override this to turn them off.
ECHO_MSG?= ${ECHO_CMD}
.endif

222
Mk/bsd.destdir.mk Normal file
View File

@ -0,0 +1,222 @@
#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# bsd.destdir.mk - Support for chrooted installation
#
# Created by: Gabor Kovesdan <gabor@FreeBSD.org>
#
# $FreeBSD$
#
# Please make sure all changes to this file are passed through the maintainer.
DESTDIR_Include_MAINTAINER= portmgr@FreeBSD.org
#
# The target order is always: pre-chroot do-chroot post-chroot
#
# pre-chroot
# - You can use this for special preparation work, that
# want to do before chrooting into the destination
# environment and doing the real build. At default
# this target is empty.
#
# do-chroot
# - This is the main target for doing the chrooted
# operations. It mounts the ports tree and devfs into
# the destination environment and starts make(1)
# by calling chroot(1).
#
# post-chroot
# - This target runs chrooted just after chroot(1) was
# called. You can use this for special preparation
# work for the chrooted build if necessary. At
# default, this target is empty.
#
# DESTDIR_ENV_LIST
# - Contains names of the variables in host environ(7),
# which should be imported into the chrooted environ
# along with their values.
# Default: empty.
#
# DESTDIR_MOUNT_LIST
# - Contains the directories to mount into the
# destination. This is to make PORTSDIR, DISTDIR, etc.
# available in the destination environment. Three
# forms of entries are allowed:
# VAR
# - Mounts the path contained by VAR into
# a temporary directory and sets VAR to that
# directory in the destination environ(7).
# VAR:HOST_PATH
# - Mounts HOST_PATH to a a temporary directory
# and sets VAR to that directory in the
# destination environ(7).
# VAR:HOST_PATH:DEST_PATH
# - Mounts HOST_PATH to DEST_PATH and sets VAR
# to DEST_PATH in the destination environ(7).
# Default: PORTSDIR DISTDIR
#
# You can use something like this in host /etc/make.conf to
# customize per-chroot environment:
# .if ${DESTDIR}=/foo/bar
# PREFIX=/opt
# CFLAGS=-O3 -pipe
# DESTDIR_ENV_LIST=PREFIX CFLAGS
# .endif
#
.if !defined(_DESTDIRMKINCLUDED)
_DESTDIRMKINCLUDED= yes
.if defined(WITH_DESTDIR_DEBUG)
DEBUG_MSG= ${ECHO_MSG} "DEBUG:"
.else
DEBUG_MSG= ${TRUE}
.endif
DESTDIR_ENV_LIST?=
DESTDIR_ENV= CHROOTED=yes
.for _var in ${DESTDIR_ENV_LIST:NDESTDIR:NCHROOTED:NPORTSDIR}
DESTDIR_ENV+= ${_var}="${${_var}}"
.endfor
# Processing DESTDIR_MOUNT_LIST into something more machine-readable
# VAR:HOST_PATH:DEST_PATH
# VAR -> VAR:${VAR}:TMP
# VAR:HOST_PATH -> VAR:HOST_PATH:TMP
DESTDIR_MOUNT_LIST?= PORTSDIR DISTDIR
_DESTDIR_MOUNT_LIST=
.for _entry in ${DESTDIR_MOUNT_LIST}
__entry=${_entry}
.if ${__entry:M*\:*\:*}
_DESTDIR_MOUNT_LIST+= ${_entry}
.elif ${__entry:M*\:*}
_DESTDIR_MOUNT_LIST+= ${_entry}:___temp___
.else
.if defined(${_entry}) && !empty(${_entry})
_DESTDIR_MOUNT_LIST+= ${_entry}:${${_entry}}:___temp___
.endif
.endif
.endfor
.MAIN: all
.for _target in ${.TARGETS}
${_target}: pre-chroot do-chroot
@${TRUE}
.endfor
.if !target(pre-chroot)
pre-chroot:
@${TRUE}
.endif
.if !target(do-chroot)
do-chroot:
@if [ ! -d ${DESTDIR} ]; then \
${ECHO_MSG} "===> Directory ${DESTDIR} does not exist"; \
${ECHO_MSG} "===> Please set DESTDIR to a valid jail environment."; \
exit 1; \
fi; \
_destdir=`${REALPATH} ${DESTDIR}`; \
_mounted_entries_list=""; \
_created_mountpoints_list=""; \
_var_path_list=""; \
${ECHO_MSG} "===> Creating some important subdirectories"; \
for _dir in tmp dev; do \
[ -d $${_destdir}/$${_dir} ] || \
if ${MKDIR} $${_destdir}/$${_dir}; then \
${ECHO_MSG} "===> /$${_dir} subdirectory has been successfully created"; \
_created_mountpoints_list="$${_destdir}/$${_dir} $${_created_mountpoints_list}"; \
else \
${ECHO_MSG} "===> /$${_dir} subdirectory could not be created"; \
exit 2; \
fi; \
done; \
${DEBUG_MSG} "_DESTDIR_MOUNT_LIST=${_DESTDIR_MOUNT_LIST}"; \
for _entry in ${_DESTDIR_MOUNT_LIST}; do \
${DEBUG_MSG} "Processing $${_entry}"; \
_mount_var=$${_entry%%:*}; \
_tp=$${_entry#*:}; \
_host_path=`${REALPATH} $${_tp%:*}`; \
_dest_path=$${_entry##*:}; \
_full_dest_path=`${REALPATH} $${_destdir}/$${_dest_path}`; \
_entry_was_created=0; \
_entry_should_mount=0; \
${DEBUG_MSG} "$${_mount_var}:$${_host_path}:$${_full_dest_path}"; \
if [ "$${_dest_path}" = "___temp___" ]; then \
${DEBUG_MSG} "Creating temporary mount point"; \
if _full_dest_path=`${MKTEMP} -d $${_destdir}/tmp/mountpoint.XXXXXX`; then \
${DEBUG_MSG} "Temporary mount point $${_full_dest_path} created successfully"; \
_entry_was_created=1; \
_entry_should_mount=1; \
_dest_path=$${_full_dest_path#$${_destdir}}; \
_created_mountpoints_list="$${_full_dest_path} $${_created_mountpoints_list}"; \
else \
${ECHO_MSG} "===> Failed to create temporary mount point"; \
exit 9; \
fi; \
else \
${DEBUG_MSG} "Checking if already mounted"; \
if ${MOUNT}|${GREP} -qs "^$${_host_path} on $${_full_dest_path} ("; then \
${DEBUG_MSG} "$${_host_path} is already mounted on $${_full_dest_path}"; \
_var_path_list="$${_var_path_list} $${_mount_var}=$${_dest_path}"; \
else \
${DEBUG_MSG} "$${_host_path} is not mounted on $${_full_dest_path}"; \
_entry_should_mount=1; \
fi; \
fi; \
[ -d $${_full_dest_path} ] || \
if ${MKDIR} $${_full_dest_path}; then \
${DEBUG_MSG} "Mount point $${_full_dest_path} created"; \
_entry_was_created=1; \
_created_mountpoints_list="$${_created_mountpoints_list} ${_full_dest_path}"; \
else \
${ECHO_MSG} "===> Mount point $${_full_dest_path} could not be created"; \
exit 7; \
fi; \
[ "$${_entry_should_mount}" = "0" ] || \
if ${MOUNT_NULLFS} $${_host_path} $${_full_dest_path}; then \
${DEBUG_MSG} "Directory $${_host_path} mounted"; \
_mounted_entries_list="$${_full_dest_path} $${_mounted_entries_list}"; \
_var_path_list="$${_var_path_list} $${_mount_var}=$${_dest_path}"; \
else \
${ECHO_MSG} "===> Dir $${_host_path} could not be mounted"; \
[ "$${_entry_was_created}" = "0" ] || \
${RMDIR} $${_full_dest_path} || ${TRUE}; \
exit 8; \
fi; \
done; \
${DEBUG_MSG} "Handling devfs separately"; \
_full_dest_path=$${_destdir}/dev; \
${MOUNT}|${GREP} -qs "^devfs on $${_full_dest_path} (" || \
if ${MOUNT_DEVFS} $${_full_dest_path}; then \
${DEBUG_MSG} "devfs mounted"; \
_mounted_entries_list="$${_full_dest_path} $${_mounted_entries_list}"; \
else \
${ECHO_MSG} "===> devfs could not be mounted"; \
[ -n "$${_created_mountpoints_list%%* $${_destdir}/dev *}" ] || \
${RMDIR} $${_destdir}/dev || ${TRUE}; \
exit 9; \
fi; \
_var_path_list="$${_var_path_list} DEVFS=/dev"; \
${DEBUG_MSG} "Things we mounted: $${_mounted_entries_list}"; \
${DEBUG_MSG} "Things we created: $${_created_mountpoints_list}"; \
${DEBUG_MSG} "_var_path_list: $${_var_path_list}"; \
${ECHO_MSG} "===> Starting chrooted make in ${DESTDIR}..."; \
export $${_var_path_list}; \
${CHROOT} $${_destdir} ${SH} -c "\
cd $${PORTSDIR}${.CURDIR:S|^${PORTSDIR}||}; \
${SETENV} -i ${DESTDIR_ENV} $${_var_path_list} ${MAKE} ${.TARGETS}" && \
${ECHO_MSG} "===> Chrooted make in ${DESTDIR} succeeded" || \
${ECHO_MSG} "===> Chrooted make in ${DESTDIR} failed"; \
${ECHO_MSG} "===> Cleaning up..."; \
for _entry in $${_mounted_entries_list}; do \
${UMOUNT} -f $${_entry} || ${TRUE}; \
done; \
for _entry in $${_created_mountpoints_list}; do \
${RMDIR} $${_entry} || ${TRUE}; \
done; \
exit 0
.endif # !target(do-chroot)
.endif # !defined(_DESTDIRMKINCLUDED)

View File

@ -1,5 +1,5 @@
#
# $FreeBSD: /tmp/pcvs/ports/Mk/bsd.emacs.mk,v 1.67 2007-07-16 18:05:18 nobutaka Exp $
# $FreeBSD: /tmp/pcvs/ports/Mk/bsd.emacs.mk,v 1.68 2007-08-04 11:37:23 gabor Exp $
#
# bsd.emacs.mk - 19990829 Shigeyuki Fukushima.
#
@ -255,8 +255,8 @@ check-makevars::
# find where emacsen is installed
# look for it in PREEFIX first and fall back to LOCALBASE then
.if exists(${TARGETDIR}/bin/${EMACS_NAME}-${EMACS_VER})
EMACS_BASE?= ${TARGETDIR}
.if exists(/bin/${EMACS_NAME}-${EMACS_VER})
EMACS_BASE?= ${PREFIX}
.else
EMACS_BASE?= ${LOCALBASE}
.endif

View File

@ -108,13 +108,13 @@ gnomehier_RUN_DEPENDS= ${gnomehier_DETECT}:${PORTSDIR}/misc/gnomehier
GNOME_HTML_DIR?= ${PREFIX}/share/doc
GCONF_CONFIG_OPTIONS?= merged
GCONF_CONFIG_DIRECTORY?=etc/gconf/gconf.xml.defaults
GCONF_CONFIG_SOURCE?=xml:${GCONF_CONFIG_OPTIONS}:${TARGETDIR}/${GCONF_CONFIG_DIRECTORY}
GCONF_CONFIG_SOURCE?=xml:${GCONF_CONFIG_OPTIONS}:${PREFIX}/${GCONF_CONFIG_DIRECTORY}
GNOME_LOCALSTATEDIR?= ${PREFIX}/share/gnome
gnomeprefix_CONFIGURE_ENV=GTKDOC="false"
gnomeprefix_CONFIGURE_ARGS=--localstatedir=${DESTDIR}${GNOME_LOCALSTATEDIR} \
--datadir=${TARGETDIR}/share/gnome \
--with-html-dir=${DESTDIR}${GNOME_HTML_DIR} \
--with-help-dir=${TARGETDIR}/share/gnome/help \
gnomeprefix_CONFIGURE_ARGS=--localstatedir=${GNOME_LOCALSTATEDIR} \
--datadir=${PREFIX}/share/gnome \
--with-html-dir=${GNOME_HTML_DIR} \
--with-help-dir=${PREFIX}/share/gnome/help \
--disable-gtk-doc \
--with-gconf-source=${GCONF_CONFIG_SOURCE}
gnomeprefix_USE_GNOME_IMPL=gnomehier
@ -769,10 +769,10 @@ post-install: gnome-post-install
gnome-pre-su-install:
.if defined(_USE_GNOME) && ${_USE_GNOME:Mgnomeprefix}!="" && !defined(NO_MTREE)
@${MTREE_CMD} ${MTREE_ARGS:S/${MTREE_FILE}/${GNOME_MTREE_FILE}/} ${TARGETDIR}/ >/dev/null
@${MTREE_CMD} ${MTREE_ARGS:S/${MTREE_FILE}/${GNOME_MTREE_FILE}/} ${PREFIX}/ >/dev/null
.endif
.if defined(GCONF_SCHEMAS)
@${MKDIR} ${TARGETDIR}/etc/gconf/gconf.xml.defaults/
@${MKDIR} ${PREFIX}/etc/gconf/gconf.xml.defaults/
.else
@${DO_NADA}
.endif

View File

@ -51,9 +51,9 @@ IGNORE= Invalid QMAIL_SLAVEPORT value. Only one can be set, valid values are: ${
.endif
.if defined(QMAIL_SLAVEPORT)
QMAIL_DEPENDS= ${DESTDIR}${QMAIL_PREFIX}/bin/qmail-send:${PORTSDIR}/mail/qmail-${QMAIL_SLAVEPORT:L}
QMAIL_DEPENDS= ${QMAIL_PREFIX}/bin/qmail-send:${PORTSDIR}/mail/qmail-${QMAIL_SLAVEPORT:L}
.else
QMAIL_DEPENDS= ${DESTDIR}${QMAIL_PREFIX}/bin/qmail-send:${PORTSDIR}/mail/qmail
QMAIL_DEPENDS= ${QMAIL_PREFIX}/bin/qmail-send:${PORTSDIR}/mail/qmail
.endif
.if defined(USE_QMAIL) || defined(USE_QMAIL_RUN)

View File

@ -2,7 +2,7 @@
# Date created: 31 May 2002
# Whom: dinoex
#
# $FreeBSD: /tmp/pcvs/ports/Mk/bsd.openssl.mk,v 1.34 2006-10-08 09:38:38 dinoex Exp $
# $FreeBSD: /tmp/pcvs/ports/Mk/bsd.openssl.mk,v 1.35 2007-08-04 11:37:23 gabor Exp $
#
# Use of 'USE_OPENSSL=yes' includes this Makefile after bsd.ports.pre.mk
#
@ -59,10 +59,10 @@ WITH_OPENSSL_BASE=yes
.endif
.if defined(WITH_OPENSSL_BASE)
OPENSSLBASE= ${DESTDIR}/usr
OPENSSLDIR= ${DESTDIR}/etc/ssl
OPENSSLBASE= /usr
OPENSSLDIR= /etc/ssl
.if !exists(${DESTDIR}/usr/lib/libcrypto.so)
.if !exists(/usr/lib/libcrypto.so)
check-depends::
@${ECHO_CMD} "Dependency error: this port requires the OpenSSL library, which is part of"
@${ECHO_CMD} "the FreeBSD crypto distribution but not installed on your"
@ -98,7 +98,7 @@ OPENSSL_CFLAGS+= -DNO_IDEA
.endif
MAKE_ARGS+= OPENSSL_CFLAGS="${OPENSSL_CFLAGS}"
.endif
OPENSSLRPATH= ${DESTDIR}/usr/lib:${LOCALBASE}/lib
OPENSSLRPATH= /usr/lib:${LOCALBASE}/lib
.else
@ -121,11 +121,11 @@ OPENSSL_SHLIBVER?= 3
.if !defined(OPENSSL_PORT) && \
exists(${LOCALBASE}/lib/libcrypto.so)
# find installed port and use it for dependency
PKG_DBDIR?= ${DESTDIR}/var/db/pkg
PKG_DBDIR?= /var/db/pkg
OPENSSL_INSTALLED!= grep -l -r "^lib/libssl.so." "${PKG_DBDIR}" | \
while read contents; do \
sslprefix=`grep "^@cwd " "$${contents}" | ${HEAD} -n 1`; \
if test "$${sslprefix}" = "@cwd ${LOCALBASE_REL}" ; then \
if test "$${sslprefix}" = "@cwd ${LOCALBASE}" ; then \
echo "$${contents}"; break; fi; done
OPENSSL_PORT!= grep "^@comment ORIGIN:" "${OPENSSL_INSTALLED}" | ${CUT} -d : -f 2
OPENSSL_SHLIBFILE!= grep "^lib/libssl.so." "${OPENSSL_INSTALLED}"

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,6 @@
# own install script so that the entire system can be made
# stripped/not-stripped using a single knob. [-s]
#
# ECHO_MSG - Used to print all the '===>' style prompts - override this
# to turn them off [echo].
#
# OPSYS - Get the operating system type [`uname -s`]
#
# SUBDIR - A list of subdirectories that should be built as well.
@ -43,6 +40,7 @@
# Search for ports using either 'make search key=<keyword>'
# or 'make search name=<keyword>'.
.include "${PORTSDIR}/Mk/bsd.commands.mk"
.MAIN: all
@ -52,37 +50,34 @@ STRIP?= -s
.if !defined(NOPRECIOUSMAKEVARS)
.if !defined(ARCH)
ARCH!= ${DESTDIR}/usr/bin/uname -p
ARCH!= ${UNAME} -p
.endif
.if !defined(OSREL)
OSREL!= ${DESTDIR}/usr/bin/uname -r | sed -e 's/[-(].*//'
OSREL!= ${UNAME} -r | ${SED} -e 's/[-(].*//'
.endif
.if !defined(OSVERSION)
.if exists(/sbin/sysctl)
OSVERSION!= /sbin/sysctl -n kern.osreldate
.if exists(/usr/include/sys/param.h)
OSVERSION!= ${AWK} '/^\#define __FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h
.elif exists(/usr/src/sys/sys/param.h)
OSVERSION!= ${AWK} '/^\#define __FreeBSD_version/ {print $$3}' < /usr/src/sys/sys/param.h
.else
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
OSVERSION!= ${SYSCTL} -n kern.osreldate
.endif
.endif
.endif
ID?= ${DESTDIR}/usr/bin/id
UID!= ${ID} -u
LOCALBASE?= ${DESTDIR}${LOCALBASE_REL}
.if exists(${LOCALBASE}/sbin/pkg_info)
PKG_INFO?= ${LOCALBASE}/sbin/pkg_info
.else
PKG_INFO?= ${DESTDIR}/usr/sbin/pkg_info
PKG_INFO?= /usr/sbin/pkg_info
.endif
SED?= ${DESTDIR}/usr/bin/sed
PKGINSTALLVER!= ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //'
.if !defined(OPSYS)
OPSYS!= ${DESTDIR}/usr/bin/uname -s
OPSYS!= ${UNAME} -s
.endif
ECHO_MSG?= echo
# local customization of the ports tree
.if exists(${.CURDIR}/Makefile.local)
.include "${.CURDIR}/Makefile.local"
@ -193,13 +188,13 @@ checksubdir:
fi; \
done; \
if [ $$found = 0 ]; then \
${ECHO} "Warning: directory $$d not in SUBDIR"; \
${ECHO_MSG} "Warning: directory $$d not in SUBDIR"; \
fi; \
fi; \
done
@for s in ${SUBDIR}; do \
if ! [ -d ${.CURDIR}/$$s ]; then \
${ECHO} "Warning: directory $$s in SUBDIR does not exist"; \
${ECHO_MSG} "Warning: directory $$s in SUBDIR does not exist"; \
fi \
done
.endif
@ -225,11 +220,11 @@ describe: ${SUBDIR:S/^/_/:S/$/.describe/}
.else
describe:
@for sub in ${SUBDIR}; do \
if test -d ${.CURDIR}/$${sub}; then \
if ${TEST} -d ${.CURDIR}/$${sub}; then \
${ECHO_MSG} "===> ${DIRPRFX}$${sub}"; \
cd ${.CURDIR}/$${sub}; \
${MAKE} -B describe || \
(echo "===> ${DIRPRFX}$${sub} failed" >&2; \
(${ECHO_CMD} "===> ${DIRPRFX}$${sub} failed" >&2; \
exit 1) ;\
else \
${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
@ -242,7 +237,7 @@ describe:
.if defined(PORTSTOP)
readmes: readme ${SUBDIR:S/^/_/:S/$/.readmes/}
@${ECHO_MSG} "===> Creating README.html for all ports"
@perl ${PORTSDIR}/Tools/make_readmes < ${INDEXDIR}/${INDEXFILE}
@${PERL} ${PORTSDIR}/Tools/make_readmes < ${INDEXDIR}/${INDEXFILE}
.else
readmes: readme
.endif
@ -250,8 +245,8 @@ readmes: readme
.if !target(readme)
readme:
@rm -f README.html
@make README.html
@${RM} -f README.html
@${MAKE} README.html
.endif
.if (${OPSYS} == "NetBSD")
@ -276,32 +271,32 @@ INDEXFILE?= INDEX
MOVEDDIR?= ${PORTSDIR}
MOVEDFILE?= MOVED
HTMLIFY= sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
HTMLIFY= ${SED} -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
package-name:
@echo ${.CURDIR} | sed -e 's^.*/^^'
@${ECHO_CMD} ${.CURDIR} | ${SED} -e 's^.*/^^'
README.html:
@echo "===> Creating README.html"
@${ECHO_CMD} "===> Creating README.html"
@> $@.tmp
.for entry in ${SUBDIR}
.if exists(${entry})
.if defined(PORTSTOP)
@echo -n '<a href="'${entry}/README.html'">'"`echo ${entry} | ${HTMLIFY}`"'</a>: ' >> $@.tmp
@${ECHO_CMD} -n '<a href="'${entry}/README.html'">'"`${ECHO_CMD} ${entry} | ${HTMLIFY}`"'</a>: ' >> $@.tmp
.else
@echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name | ${HTMLIFY}`</a>: " >> $@.tmp
@${ECHO_CMD} -n '<a href="'${entry}/README.html'">'"`cd ${entry}; ${MAKE} package-name | ${HTMLIFY}`</a>: " >> $@.tmp
.endif
@echo `cd ${entry}; make -V COMMENT` | ${HTMLIFY} >> $@.tmp
@${ECHO_CMD} `cd ${entry}; ${MAKE} -V COMMENT` | ${HTMLIFY} >> $@.tmp
.endif
.endfor
@sort -t '>' +1 -2 $@.tmp > $@.tmp2
@${SORT} -t '>' +1 -2 $@.tmp > $@.tmp2
.if exists(${DESCR})
@${HTMLIFY} ${DESCR} > $@.tmp3
.else
@> $@.tmp3
.endif
.if defined(COMMENT)
@echo "${COMMENT}" | ${HTMLIFY} > $@.tmp4
@${ECHO_CMD} "${COMMENT}" | ${HTMLIFY} > $@.tmp4
.else
.if exists(${COMMENTFILE})
@${HTMLIFY} ${COMMENTFILE} > $@.tmp4
@ -309,8 +304,8 @@ README.html:
@> $@.tmp4
.endif
.endif
@cat ${README} | \
sed -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
@${CAT} ${README} | \
${SED} -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
-e '/%%COMMENT%%/r$@.tmp4' \
-e '/%%COMMENT%%/d' \
-e '/%%DESCR%%/r$@.tmp3' \
@ -318,7 +313,7 @@ README.html:
-e '/%%SUBDIR%%/r$@.tmp2' \
-e '/%%SUBDIR%%/d' \
> $@
@rm -f $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
@${RM} -f $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
.if !defined(NOPRECIOUSMAKEVARS)
.MAKEFLAGS: \
@ -339,7 +334,7 @@ PORTSEARCH_MOVED?=1
_PORTSEARCH= \
here=${.CURDIR}; \
if [ ! -r ${INDEXDIR}/${INDEXFILE} ] ; then \
echo "The ${.TARGET} target requires ${INDEXFILE}. Please run make index or make fetchindex."; \
${ECHO_MSG} "The ${.TARGET} target requires ${INDEXFILE}. Please run make index or make fetchindex."; \
else \
cd ${PORTSDIR}; \
if [ -z "$$key" -a -z "$$xkey" -a \
@ -352,12 +347,12 @@ _PORTSEARCH= \
-z "$$rdeps" -a -z "$$xrdeps" -a \
-z "$$www" -a -z "$$xwww" ]; \
then \
echo "The ${.TARGET} target requires a keyword parameter or name parameter,"; \
echo "e.g.: \"make ${.TARGET} key=somekeyword\""; \
echo "or \"make ${.TARGET} name=somekeyword\""; \
${ECHO_MSG} "The ${.TARGET} target requires a keyword parameter or name parameter,"; \
${ECHO_MSG} "e.g.: \"make ${.TARGET} key=somekeyword\""; \
${ECHO_MSG} "or \"make ${.TARGET} name=somekeyword\""; \
exit; \
fi; \
awk -F\| -v there="$$here/" -v top="$$(pwd -P)" \
${AWK} -F\| -v there="$$here/" -v top="$$(pwd -P)" \
-v key="$$key" -v xkey="$$xkey" \
-v name="$$name" -v xname="$$xname" \
-v path="$$path" -v xpath="$$xpath" \
@ -451,7 +446,7 @@ _PORTSEARCH= \
}' ${INDEXDIR}/${INDEXFILE}; \
if [ "$$name" -o "$$xname" ] && [ ${PORTSEARCH_MOVED} -gt 0 ]; \
then \
awk -F\| -v name="$$name" -v xname="$$xname" \
${AWK} -F\| -v name="$$name" -v xname="$$xname" \
-v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \
'BEGIN { \
if (icase) { \

View File

@ -508,7 +508,7 @@ check-makevars::
@${ECHO} "Legal values are: 2.7 (default), 2.8, 2.9, 2.10, 3.2"
@${FALSE}
.endif
ZOPEBASEDIR?= ${TARGETDIR}/${SZOPEBASEDIR}
ZOPEBASEDIR?= ${PREFIX}/${SZOPEBASEDIR}
ZOPEPRODUCTDIR?= Products
.endif

View File

@ -138,7 +138,7 @@ RUBY_DEFAULT_VER?= 1.8
RUBY_VER?= ${RUBY_DEFAULT_VER}
.if defined(RUBY)
.if !exists(${DESTDIR}${RUBY})
.if !exists(${RUBY})
IGNORE= cannot install: you set the variable RUBY to "${RUBY}", but it does not seem to exist. Please specify an already installed ruby executable.
.endif
@ -147,7 +147,7 @@ _RUBY_TEST!= ${RUBY} -e 'begin; require "rbconfig"; rescue LoadError; puts "err
IGNORE= cannot install: you set the variable RUBY to "${RUBY}", but it failed to include rbconfig. Please specify a properly installed ruby executable.
.endif
_RUBY_CONFIG= ${DESTDIR}${RUBY} -r rbconfig -e 'C = Config::CONFIG' -e
_RUBY_CONFIG= ${RUBY} -r rbconfig -e 'C = Config::CONFIG' -e
RUBY_VERSION!= ${_RUBY_CONFIG} 'puts VERSION'
RUBY_SUFFIX?= # empty

View File

@ -34,18 +34,10 @@ FILENAME ~ /\.writable$/ { writable_files[$0] = 1; }
function print_header() {
if (header_printed)
return;
if (audit != "") {
if (destdir == "")
print "===> SECURITY REPORT (PARANOID MODE): ";
else
print "===> SECURITY REPORT FOR", destdir, "(PARANOID MODE): ";
}
else {
if (destdir == "")
print "===> SECURITY REPORT: ";
else
print "===> SECURITY REPORT FOR", destdir, ": ";
}
if (audit != "")
print "===> SECURITY REPORT (PARANOID MODE): ";
else
print "===> SECURITY REPORT: ";
header_printed = 1;
}
function note_for_the_stupid(file) { return (file in stupid_binaries) ? (" (USES POSSIBLY INSECURE FUNCTIONS:" stupid_binaries[file] ")") : ""; }
@ -54,14 +46,8 @@ END {
for (file in setuid_binaries) {
if (!note_printed) {
print_header();
if (destdir == "") {
print " This port has installed the following binaries, which execute with";
print " increased privileges.";
}
else {
print " This port has installed the following binaries into", destdir, ", which";
print " execute with increased privileges.";
}
print " This port has installed the following binaries which execute with";
print " increased privileges.";
note_printed = 1;
}
print file note_for_the_stupid(file);
@ -72,15 +58,8 @@ END {
for (file in network_binaries) {
if (!note_printed) {
print_header();
if (destdir == "") {
print " This port has installed the following files, which may act as network";
print " servers and may therefore pose a remote security risk to the system.";
}
else {
print " This port has installed the following files into", destdir, ", which may";
print " act as network servers and may therefore pose a remote security risk to";
print " the system.";
}
print " This port has installed the following files which may act as network";
print " servers and may therefore pose a remote security risk to the system.";
note_printed = 1;
}
print file note_for_the_stupid(file);
@ -91,14 +70,8 @@ END {
for (file in startup_scripts) {
if (!note_printed) {
print_header();
if (destdir == "") {
print " This port has installed the following startup scripts, which may cause";
print " This port has installed the following startup scripts which may cause";
print " these network services to be started at boot time.";
}
else {
print " This port has installed the following startup scripts into", destdir, ", which";
print " may cause these network services to be started at boot time.";
}
note_printed = 1;
}
print file;
@ -110,10 +83,7 @@ END {
for (file in writable_files) {
if (!note_printed) {
print_header();
if (destdir == "")
print " This port has installed the following world-writable files/directories.";
else
print " This port has installed the following world-writable files/directories into", destdir, ".";
print " This port has installed the following world-writable files/directories.";
note_printed = 1;
}
print file;

View File

@ -6,6 +6,23 @@ You should get into the habit of checking this file for changes each
time you update your ports collection, before attempting any port
upgrades.
20070804:
AFFECTS: users of DESTDIR
AUTHOR: gabor@FreeBSD.org
DESTDIR is a feature, that allows installation of ports into separate
environments, like jails. The previous implementation, introduced in the
August 2006, had some problems and was very expensive to maintain. It was
completely rolled back, and replaced with a brand new implementation utilizing
chroot.
When DESTDIR is set, the system will chroot into the specified directory, mount
devfs, null mount the ports tree, then proceed with building and installing.
Your kernel must support nullfs (is available as loadable kernel module on
default installation). The target environment must be a full FreeBSD
installation. For advanced use, read comments at the beginning of
bsd.destdir.mk.
20070730:
AFFECTS: users of py-*
AUTHOR: python@FreeBSD.org