diff options
-rw-r--r-- | CHANGES | 16 | ||||
-rw-r--r-- | Mk/bsd.commands.mk | 99 | ||||
-rw-r--r-- | Mk/bsd.destdir.mk | 222 | ||||
-rw-r--r-- | Mk/bsd.emacs.mk | 6 | ||||
-rw-r--r-- | Mk/bsd.gnome.mk | 14 | ||||
-rw-r--r-- | Mk/bsd.mail.mk | 4 | ||||
-rw-r--r-- | Mk/bsd.openssl.mk | 14 | ||||
-rw-r--r-- | Mk/bsd.port.mk | 616 | ||||
-rw-r--r-- | Mk/bsd.port.subdir.mk | 73 | ||||
-rw-r--r-- | Mk/bsd.python.mk | 2 | ||||
-rw-r--r-- | Mk/bsd.ruby.mk | 4 | ||||
-rw-r--r-- | Tools/scripts/security-check.awk | 50 | ||||
-rw-r--r-- | UPDATING | 17 |
13 files changed, 587 insertions, 550 deletions
@@ -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 diff --git a/Mk/bsd.commands.mk b/Mk/bsd.commands.mk new file mode 100644 index 0000000..c920e37 --- /dev/null +++ b/Mk/bsd.commands.mk @@ -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 diff --git a/Mk/bsd.destdir.mk b/Mk/bsd.destdir.mk new file mode 100644 index 0000000..fef7b96 --- /dev/null +++ b/Mk/bsd.destdir.mk @@ -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) diff --git a/Mk/bsd.emacs.mk b/Mk/bsd.emacs.mk index f0b85db..a13bac2 100644 --- a/Mk/bsd.emacs.mk +++ b/Mk/bsd.emacs.mk @@ -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 diff --git a/Mk/bsd.gnome.mk b/Mk/bsd.gnome.mk index 5f9db8a..b048c96 100644 --- a/Mk/bsd.gnome.mk +++ b/Mk/bsd.gnome.mk @@ -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 diff --git a/Mk/bsd.mail.mk b/Mk/bsd.mail.mk index 7877aaa..052fb07 100644 --- a/Mk/bsd.mail.mk +++ b/Mk/bsd.mail.mk @@ -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) diff --git a/Mk/bsd.openssl.mk b/Mk/bsd.openssl.mk index fae22dc..6640e4d 100644 --- a/Mk/bsd.openssl.mk +++ b/Mk/bsd.openssl.mk @@ -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}" diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index e0703de..89437be 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -498,7 +498,7 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # If this is set to a list of files, these files will be # automatically added to ${SUB_FILES}, some %%VAR%%'s will # automatically be expanded, they will be installed in -# ${TARGETDIR}/etc/rc.d and added to the packing list. +# ${PREFIX}/etc/rc.d and added to the packing list. # USE_RCORDER - List of rc.d startup scripts to be called early in the boot # process. This acts exactly like USE_RC_SUBR except that # scripts are installed in /etc/rc.d. @@ -524,46 +524,23 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # Various directory definitions and variables to control them. # You rarely need to redefine any of these except WRKSRC and NO_WRKSUBDIR. # -# TARGETDIR - The fully qualified path, where everything is installed. -# See the other variables below. -# Default: ${DESTDIR}${PREFIX} -# -# DESTDIR - The path to the environment we are installing to. Define -# this if you want to install packages into a jail -# or into an another FreeBSD environment mounted -# elsewhere than /. ${PREFIX} is relative to -# ${DESTDIR}. E.g. setting DESTDIR=/bla PREFIX=/opt will -# result packages installed under /bla/opt and registered -# under /bla/var/db/pkg. -# Default: not set (means /) -# # X11BASE - Where X11 ports install things. -# Default: ${DESTDIR}/${LOCALBASE} -# X11BASE_REL - Same as X11BASE, but relative to DESTDIR # Default: ${LOCALBASE} # LOCALBASE - Where non-X11 ports install things. -# Default: ${DESTDIR}/usr/local -# LOCALBASE_REL - Same as LOCALBASE, but relative to DESTDIR # Default: /usr/local # LINUXBASE - Where Linux ports install things. -# Default: ${DESTDIR}/compat/linux -# LINUXBASE_REL - Same as LINUXBASE, but relative to DESTDIR # Default: /compat/linux # PREFIX - Where *this* port installs its files. -# Default: ${X11BASE_REL} if USE_X_PREFIX is set, -# ${LINUXBASE_REL} if USE_LINUX_PREFIX is set, -# otherwise ${LOCALBASE_REL} +# Default: ${X11BASE} if USE_X_PREFIX is set, +# ${LINUXBASE} if USE_LINUX_PREFIX is set, +# otherwise ${LOCALBASE} # # IGNORE_PATH_CHECKS -# - There are some sanity checks against PREFIX and DESTDIR. +# - There are some sanity checks against PREFIX. # You can disable these checks with defining # this variable, but this is not recommended! # Only do this if you really know what you are # doing. These sanity checks are the following: -# - DESTDIR can't be /. Just leave it undefined -# if you want to install to /. -# - DESTDIR has to be an absolute path. -# - DESTDIR can't have a trailing slash. # - PREFIX has to be an absolute path. # - PREFIX can't have a trailing slash. # @@ -644,7 +621,7 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # installs its own manpage links so they will show up # correctly in ${PLIST}.) # MANPREFIX - The directory prefix for ${MAN<sect>} and ${MLINKS}. -# Default: ${TARGETDIR} +# Default: ${PREFIX} # MAN<sect>PREFIX # - If manual pages of some sections install in different # locations than others, use these. @@ -973,7 +950,7 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # rest of PLIST, so ${PLIST_SUB} substitutions also # apply here. It is recommended that you use # %%PREFIX%% for ${PREFIX}, %%LOCALBASE%% for -# ${LOCALBASE_REL} and %%X11BASE%% for ${X11BASE_REL}. +# ${LOCALBASE} and %%X11BASE%% for ${X11BASE}. # Default: %%PREFIX%%/lib # USE_LDCONFIG - If set to "yes", this subsumes the function of the # deprecated variable INSTALLS_SHLIB and adds ${PREFIX}/lib @@ -996,22 +973,22 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # internal to bsd.port.mk and must not be set in your Makefile. # # DOCSDIR - Name of the directory to install the packages docs in. -# Default: ${TARGETDIR}/share/doc/${PORTNAME} -# DOCSDIR_REL - The DOCSDIR relative to ${TARGETDIR} +# Default: ${PREFIX}/share/doc/${PORTNAME} +# DOCSDIR_REL - The DOCSDIR relative to ${PREFIX} # EXAMPLESDIR - Name of the directory to install the packages examples in. -# Default: ${TARGETDIR}/share/examples/${PORTNAME} +# Default: ${PREFIX}/share/examples/${PORTNAME} # EXAMPLESDIR_REL -# - The EXAMPLESDIR relative to ${TARGETDIR} +# - The EXAMPLESDIR relative to ${PREFIX} # DATADIR - Name of the directory to install the packages shared data in. -# Default: ${TARGETDIR}/share/${PORTNAME} -# DATADIR_REL - The DATADIR relative to ${TARGETDIR} +# Default: ${PREFIX}/share/${PORTNAME} +# DATADIR_REL - The DATADIR relative to ${PREFIX} # # WWWDIR - Name of the directory to install the packages www data in. -# Default: ${TARGETDIR}/www/${PORTNAME} -# WWWDIR_REL - The WWWDIR relative to ${TARGETDIR} +# Default: ${PREFIX}/www/${PORTNAME} +# WWWDIR_REL - The WWWDIR relative to ${PREFIX} # # DESKTOPDIR - Name of the directory to install ${DESKTOP_ENTRIES} in. -# Default: ${TARGETDIR}/share/applications +# Default: ${PREFIX}/share/applications # DESKTOP_ENTRIES # - List of desktop entry files to generate and install in # ${DESKTOPDIR}. The format is @@ -1080,9 +1057,9 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # it attempts to apply them. # PKG_DBDIR - Where package installation is recorded; this directory # must not contain anything else. -# Default: ${DESTDIR}/var/db/pkg +# Default: /var/db/pkg # PORT_DBDIR - Where port configuration options are recorded. -# Default: ${DESTDIR}/var/db/ports +# Default: /var/db/ports # NO_PKG_REGISTER # - Don't register a port installation as a package. # FORCE_PKG_REGISTER @@ -1112,6 +1089,19 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # Most port authors should not need to understand anything after this point. # +.include "${PORTSDIR}/Mk/bsd.commands.mk" + +# +# DESTDIR section to start a chrooted process if invoked with DESTDIR set +# + +.if defined(DESTDIR) && !empty(DESTDIR) && !defined(CHROOTED) && \ + !defined(BEFOREPORTMK) && !defined(INOPTIONSMK) + +.include "${PORTSDIR}/Mk/bsd.destdir.mk" + +.else + # Look for ${WRKSRC}/.../*.orig files, and (re-)create # ${FILEDIR}/patch-* files from them. @@ -1141,78 +1131,6 @@ NOPRECIOUSSOFTMAKEVARS= yes .endif .endif -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 -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 -UNAME?= /usr/bin/uname -UNZIP_CMD?= ${LOCALBASE}/bin/unzip -UNMAKESELF_CMD?= ${LOCALBASE}/bin/unmakeself -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} - # Get the default maintainer MAINTAINER?= ports@FreeBSD.org @@ -1236,10 +1154,10 @@ OSREL!= ${UNAME} -r | ${SED} -e 's/[-(].*//' # Get __FreeBSD_version .if !defined(OSVERSION) -.if exists(${DESTDIR}/usr/include/sys/param.h) -OSVERSION!= ${AWK} '/^\#define __FreeBSD_version/ {print $$3}' < ${DESTDIR}/usr/include/sys/param.h -.elif exists(${DESTDIR}/usr/src/sys/sys/param.h) -OSVERSION!= ${AWK} '/^\#define __FreeBSD_version/ {print $$3}' < ${DESTDIR}/usr/src/sys/sys/param.h +.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!= ${SYSCTL} -n kern.osreldate .endif @@ -1285,7 +1203,7 @@ USE_SUBMAKE= yes .endif # where 'make config' records user configuration options -PORT_DBDIR?= ${DESTDIR}/var/db/ports +PORT_DBDIR?= /var/db/ports LDCONFIG_DIR= libdata/ldconfig LDCONFIG32_DIR= libdata/ldconfig32 @@ -1383,24 +1301,16 @@ PORTSDIR?= /usr/ports LOCALBASE?= /usr/local X11BASE?= ${LOCALBASE} LINUXBASE?= /compat/linux -LOCALBASE_REL:= ${LOCALBASE} -X11BASE_REL:= ${X11BASE} -LINUXBASE_REL:= ${LINUXBASE} -LOCALBASE:= ${DESTDIR}${LOCALBASE_REL} -X11BASE:= ${DESTDIR}${X11BASE_REL} -LINUXBASE:= ${DESTDIR}${LINUXBASE_REL} DISTDIR?= ${PORTSDIR}/distfiles _DISTDIR?= ${DISTDIR}/${DIST_SUBDIR} INDEXDIR?= ${PORTSDIR} INDEXFILE?= INDEX-${OSVERSION:C/([0-9]).*/\1/} -TARGETDIR:= ${DESTDIR}${PREFIX} - -DOCSDIR?= ${TARGETDIR}/share/doc/${PORTNAME} -EXAMPLESDIR?= ${TARGETDIR}/share/examples/${PORTNAME} -DATADIR?= ${TARGETDIR}/share/${PORTNAME} -WWWDIR?= ${TARGETDIR}/www/${PORTNAME} -ETCDIR?= ${TARGETDIR}/etc/${PORTNAME} +DOCSDIR?= ${PREFIX}/share/doc/${PORTNAME} +EXAMPLESDIR?= ${PREFIX}/share/examples/${PORTNAME} +DATADIR?= ${PREFIX}/share/${PORTNAME} +WWWDIR?= ${PREFIX}/www/${PORTNAME} +ETCDIR?= ${PREFIX}/etc/${PORTNAME} .if defined(USE_LINUX_RPM) .include "${PORTSDIR}/Mk/bsd.linux-rpm.mk" @@ -1454,32 +1364,21 @@ USE_X_PREFIX= yes USE_XLIB= yes .endif .if defined(USE_X_PREFIX) -PREFIX?= ${X11BASE_REL} +PREFIX?= ${X11BASE} .elif defined(USE_LINUX_PREFIX) -PREFIX?= ${LINUXBASE_REL} +PREFIX?= ${LINUXBASE} NO_MTREE= yes .else -PREFIX?= ${LOCALBASE_REL} +PREFIX?= ${LOCALBASE} .endif .if defined(USE_LINUX_PREFIX) -.if !defined(DESTDIR) -LDCONFIG_CMD?= ${LINUXBASE_REL}/sbin/ldconfig -r ${LINUXBASE_REL} +LDCONFIG_CMD?= ${LINUXBASE}/sbin/ldconfig -r ${LINUXBASE} LDCONFIG_PLIST_EXEC_CMD?= ${LDCONFIG_CMD} LDCONFIG_PLIST_UNEXEC_CMD?= ${LDCONFIG_CMD} .else -LDCONFIG_CMD?= ${CHROOT} ${DESTDIR} ${LINUXBASE_REL}/sbin/ldconfig -r ${LINUXBASE_REL} -LDCONFIG_PLIST_EXEC_CMD?= ${LDCONFIG_CMD} -LDCONFIG_PLIST_UNEXEC_CMD?= ${LINUXBASE_REL}/sbin/ldconfig -r ${LINUXBASE_REL} -.endif -.else -.if !defined(DESTDIR) LDCONFIG_CMD?= ${LDCONFIG} -m ${LDCONFIG_RUNLIST} LDCONFIG_PLIST_EXEC_CMD?= ${LDCONFIG} -m ${LDCONFIG_PLIST} -.else -LDCONFIG_CMD?= ${CHROOT} ${DESTDIR} ${LDCONFIG} -m ${LDCONFIG_RUNLIST} -LDCONFIG_PLIST_EXEC_CMD?= ${CHROOT} ${DESTDIR} ${LDCONFIG} -m ${LDCONFIG_PLIST} -.endif LDCONFIG_PLIST_UNEXEC_CMD?= ${LDCONFIG} -R .endif @@ -1602,7 +1501,6 @@ PERL= ${LOCALBASE}/bin/perl .include "${PORTSDIR}/Mk/bsd.xfce.mk" .endif -# These do some path checks if DESTDIR is set correctly. # You can force skipping these test by defining IGNORE_PATH_CHECKS .if !defined(IGNORE_PATH_CHECKS) .if (${PREFIX:C,(^.).*,\1,} != "/") @@ -1611,27 +1509,6 @@ PERL= ${LOCALBASE}/bin/perl @${ECHO_MSG} "is invoked in the work area PREFIX points to the right place." @${FALSE} .endif -.if defined(DESTDIR) -.if (${DESTDIR:C,(^.).*,\1,} != "/") -.if ${DESTDIR} == "/" -.BEGIN: - @${ECHO_MSG} "You can't set DESTDIR to /. Please re-run make with" - @${ECHO_MSG} "DESTDIR unset." - @${FALSE} -.else -.BEGIN: - @${ECHO_MSG} "DESTDIR must be defined as an absolute path so that when 'make'" - @${ECHO_MSG} "is invoked in the work area DESTDIR points to the right place." - @${FALSE} -.endif -.endif -.if (${DESTDIR:C,^.*(/)$$,\1,} == "/") -.BEGIN: - @${ECHO_MSG} "DESTDIR can't have a trailing slash. Please remove the trailing" - @${ECHO_MSG} "slash and re-run 'make'" - @${FALSE} -.endif -.endif .endif X_WINDOW_SYSTEM ?= xorg @@ -1671,11 +1548,10 @@ CONFIGURE_WRKSRC?= ${WRKSRC} BUILD_WRKSRC?= ${WRKSRC} INSTALL_WRKSRC?=${WRKSRC} -PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE_REL} X11BASE=${X11BASE_REL} \ - DESTDIR=${DESTDIR} TARGETDIR=${TARGETDIR} -SUB_LIST+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE_REL} X11BASE=${X11BASE_REL} \ +PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} +SUB_LIST+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \ DATADIR=${DATADIR} DOCSDIR=${DOCSDIR} EXAMPLESDIR=${EXAMPLESDIR} \ - WWWDIR=${WWWDIR} ETCDIR=${ETCDIR} DESTDIR=${DESTDIR} TARGETDIR=${TARGETDIR} + WWWDIR=${WWWDIR} ETCDIR=${ETCDIR} PLIST_REINPLACE+= dirrmtry stopdaemon PLIST_REINPLACE_DIRRMTRY=s!^@dirrmtry \(.*\)!@unexec rmdir %D/\1 2>/dev/null || true! @@ -2059,10 +1935,10 @@ ALL_TARGET?= PL_BUILD?= Build CONFIGURE_ARGS+= \ create_packlist=0 \ - install_path=lib="${TARGETDIR}/${SITE_PERL_REL}" \ - install_path=arch="${TARGETDIR}/${SITE_PERL_REL}/${PERL_ARCH}" \ - install_path=script="${TARGETDIR}/bin" \ - install_path=bin="${TARGETDIR}/bin" \ + install_path=lib="${PREFIX}/${SITE_PERL_REL}" \ + install_path=arch="${PREFIX}/${SITE_PERL_REL}/${PERL_ARCH}" \ + install_path=script="${PREFIX}/bin" \ + install_path=bin="${PREFIX}/bin" \ install_path=libdoc="${MAN3PREFIX}/man/man3" \ install_path=bindoc="${MAN1PREFIX}/man/man1" .elif defined(PERL_CONFIGURE) @@ -2249,8 +2125,8 @@ MD5?= md5 .endif .if exists(/sbin/sha256) SHA256?= /sbin/sha256 -.elif exists(${LOCALBASE_REL}/sbin/sha256) -SHA256?= ${LOCALBASE_REL}/sbin/sha256 +.elif exists(${LOCALBASE}/sbin/sha256) +SHA256?= ${LOCALBASE}/sbin/sha256 .else SHA256?= NO .endif @@ -2261,8 +2137,8 @@ MD5_FILE?= ${MASTERDIR}/distinfo MAKE_FLAGS?= -f MAKEFILE?= Makefile -MAKE_ENV+= TARGETDIR=${TARGETDIR} DESTDIR=${DESTDIR} PREFIX=${PREFIX} \ - LOCALBASE=${LOCALBASE_REL} X11BASE=${X11BASE_REL} \ +MAKE_ENV+= PREFIX=${PREFIX} \ + LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \ MOTIFLIB="${MOTIFLIB}" LIBDIR="${LIBDIR}" CFLAGS="${CFLAGS}" \ CXXFLAGS="${CXXFLAGS}" MANPREFIX="${MANPREFIX}" @@ -2443,42 +2319,23 @@ PKGORIGIN?= ${PKGCATEGORY}/${PORTDIRNAME} .if (${OSVERSION} < 504105 || (${OSVERSION} >= 600000 && ${OSVERSION} < 600103) || (${OSVERSION} >= 700000 && ${OSVERSION} < 700012)) && ${PKGORIGIN} != "ports-mgmt/pkg_install" EXTRACT_DEPENDS+= ${LOCALBASE}/sbin/pkg_info:${PORTSDIR}/ports-mgmt/pkg_install .endif -.if !defined(DESTDIR) -PKG_CMD?= ${LOCALBASE_REL}/sbin/pkg_create -PKG_ADD?= ${LOCALBASE_REL}/sbin/pkg_add -PKG_DELETE?= ${LOCALBASE_REL}/sbin/pkg_delete -PKG_INFO?= ${LOCALBASE_REL}/sbin/pkg_info -PKG_VERSION?= ${LOCALBASE_REL}/sbin/pkg_version +PKG_CMD?= ${LOCALBASE}/sbin/pkg_create +PKG_ADD?= ${LOCALBASE}/sbin/pkg_add +PKG_DELETE?= ${LOCALBASE}/sbin/pkg_delete +PKG_INFO?= ${LOCALBASE}/sbin/pkg_info +PKG_VERSION?= ${LOCALBASE}/sbin/pkg_version .else -PKG_CMD?= ${LOCALBASE_REL}/sbin/pkg_create -PKG_ADD?= ${CHROOT} ${DESTDIR} ${LOCALBASE_REL}/sbin/pkg_add -PKG_DELETE?= ${CHROOT} ${DESTDIR} ${LOCALBASE_REL}/sbin/pkg_delete -PKG_INFO?= ${CHROOT} ${DESTDIR} ${LOCALBASE_REL}/sbin/pkg_info -.endif -.else -.if !defined(DESTDIR) PKG_CMD?= /usr/sbin/pkg_create PKG_ADD?= /usr/sbin/pkg_add PKG_DELETE?= /usr/sbin/pkg_delete PKG_INFO?= /usr/sbin/pkg_info PKG_VERSION?= /usr/sbin/pkg_version -.else -PKG_CMD?= /usr/sbin/pkg_create -PKG_ADD?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_add -PKG_DELETE?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_delete -PKG_INFO?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_info -PKG_VERSION?= ${CHROOT} ${DESTDIR} /usr/sbin/pkg_version -.endif .endif # Does the pkg_create tool support conflict checking? # XXX Slow? .if !defined(PKGINSTALLVER) -.if !defined(DESTDIR) PKGINSTALLVER!= ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //' -.else -PKGINSTALLVER!= ${CHROOT} ${DESTDIR} ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //' -.endif .endif .if ${PKGINSTALLVER} < 20030417 DISABLE_CONFLICTS= YES @@ -2501,7 +2358,7 @@ PKG_SUFX?= .tar PKG_SUFX?= .tbz .endif # where pkg_add records its dirty deeds. -PKG_DBDIR?= ${DESTDIR}/var/db/pkg +PKG_DBDIR?= /var/db/pkg MOTIFLIB?= -L${X11BASE}/lib -lXm -lXp @@ -2976,10 +2833,10 @@ LATEST_LINK?= ${PKGBASE} PKGLATESTFILE= ${PKGLATESTREPOSITORY}/${LATEST_LINK}${PKG_SUFX} .if defined(PERL_CONFIGURE) -CONFIGURE_ARGS+= CC="${CC}" CCFLAGS="${CFLAGS}" PREFIX="${TARGETDIR}" \ - INSTALLPRIVLIB="${TARGETDIR}/lib" INSTALLARCHLIB="${TARGETDIR}/lib" +CONFIGURE_ARGS+= CC="${CC}" CCFLAGS="${CFLAGS}" PREFIX="${PREFIX}" \ + INSTALLPRIVLIB="${PREFIX}/lib" INSTALLARCHLIB="${PREFIX}/lib" CONFIGURE_SCRIPT?= Makefile.PL -MAN3PREFIX?= ${TARGETDIR}/lib/perl5/${PERL_VERSION} +MAN3PREFIX?= ${PREFIX}/lib/perl5/${PERL_VERSION} .undef HAS_CONFIGURE .endif @@ -3014,16 +2871,16 @@ SCRIPTS_ENV+= CURDIR=${MASTERDIR} DISTDIR=${DISTDIR} \ WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \ SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \ PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} \ - X11BASE=${X11BASE} DESTDIR=${DESTDIR} TARGETDIR=${DESTDIR} + X11BASE=${X11BASE} .if defined(BATCH) SCRIPTS_ENV+= BATCH=yes .endif .if ${PREFIX} == /usr -MANPREFIX?= ${DESTDIR}/usr/share +MANPREFIX?= /usr/share .else -MANPREFIX?= ${TARGETDIR} +MANPREFIX?= ${PREFIX} .endif .for sect in 1 2 3 4 5 6 7 8 9 @@ -3119,9 +2976,9 @@ _TMLINKS= .if defined(_MANPAGES) .if defined(NOMANCOMPRESS) -__MANPAGES:= ${_MANPAGES:S%^${TARGETDIR}/%%} +__MANPAGES:= ${_MANPAGES:S%^${PREFIX}/%%} .else -__MANPAGES:= ${_MANPAGES:S%^${TARGETDIR}/%%:S%$%.gz%} +__MANPAGES:= ${_MANPAGES:S%^${PREFIX}/%%:S%$%.gz%} .endif .if ${MANCOMPRESSED} == "yes" @@ -3150,11 +3007,11 @@ BROKEN= only one subdirectory in INFO is allowed . endfor .endif -DOCSDIR_REL?= ${DOCSDIR:S,^${TARGETDIR}/,,} -EXAMPLESDIR_REL?= ${EXAMPLESDIR:S,^${TARGETDIR}/,,} -DATADIR_REL?= ${DATADIR:S,^${TARGETDIR}/,,} -WWWDIR_REL?= ${WWWDIR:S,^${TARGETDIR}/,,} -ETCDIR_REL?= ${ETCDIR:S,^${TARGETDIR}/,,} +DOCSDIR_REL?= ${DOCSDIR:S,^${PREFIX}/,,} +EXAMPLESDIR_REL?= ${EXAMPLESDIR:S,^${PREFIX}/,,} +DATADIR_REL?= ${DATADIR:S,^${PREFIX}/,,} +WWWDIR_REL?= ${WWWDIR:S,^${PREFIX}/,,} +ETCDIR_REL?= ${ETCDIR:S,^${PREFIX}/,,} PLIST_SUB+= DOCSDIR="${DOCSDIR_REL}" \ EXAMPLESDIR="${EXAMPLESDIR_REL}" \ @@ -3162,8 +3019,8 @@ PLIST_SUB+= DOCSDIR="${DOCSDIR_REL}" \ WWWDIR="${WWWDIR_REL}" \ ETCDIR="${ETCDIR_REL}" -DESKTOPDIR?= ${TARGETDIR}/share/applications -_DESKTOPDIR_REL= ${DESKTOPDIR:S,^${TARGETDIR}/,,}/ +DESKTOPDIR?= ${PREFIX}/share/applications +_DESKTOPDIR_REL= ${DESKTOPDIR:S,^${PREFIX}/,,}/ .if ${_DESKTOPDIR_REL} == ${DESKTOPDIR}/ # DESKTOPDIR is not beneath PREFIX @@ -3335,7 +3192,7 @@ all: @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \ DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \ PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} DESTDIR=${DESTDIR} PREFIX=${PREFIX} \ + FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ BUILD_DEPENDS="${BUILD_DEPENDS}" RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \ CONFLICTS="${CONFLICTS}" \ ${ALL_HOOK} @@ -3513,8 +3370,8 @@ DISTINFO_DATA?= if [ \( -n "${DISABLE_SIZE}" -a -n "${NO_CHECKSUM}" \) -o ! -f " do-fetch: @${MKDIR} ${_DISTDIR} @cd ${_DISTDIR};\ - ${_MASTER_SITES_ENV} ; \ - for _file in ${DISTFILES}; do \ + ${_MASTER_SITES_ENV} ; \ + for _file in ${DISTFILES}; do \ file=$${_file%%:*}; \ if [ $$_file = $$file ]; then \ select=''; \ @@ -3535,7 +3392,7 @@ do-fetch: ${ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ ${ECHO_MSG} "=> Please correct this problem and try again."; \ exit 1; \ - fi ; \ + fi; \ if [ -f ${MD5_FILE} -a "x${NO_CHECKSUM}" = "x" ]; then \ _md5sum=`alg=MD5; ${DISTINFO_DATA}`; \ if [ -z "$$_md5sum" ]; then \ @@ -3556,13 +3413,13 @@ do-fetch: if [ ! -z \$${_MASTER_SITES_$${group}} ] ; then \ eval ___MASTER_SITES_TMP="\$${_MASTER_SITES_$${group}}" ; \ __MASTER_SITES_TMP="$${__MASTER_SITES_TMP} $${___MASTER_SITES_TMP}" ; \ - fi \ + fi; \ done; \ ___MASTER_SITES_TMP= ; \ SORTED_MASTER_SITES_CMD_TMP="${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} $${__MASTER_SITES_TMP} | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP}" ; \ else \ SORTED_MASTER_SITES_CMD_TMP="${SORTED_MASTER_SITES_DEFAULT_CMD}" ; \ - fi ; \ + fi; \ for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \ ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \ @@ -3573,17 +3430,17 @@ do-fetch: esac; \ if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} ${FETCH_AFTER_ARGS}; then \ continue 2; \ - fi \ + fi; \ done; \ ${ECHO_MSG} "=> Couldn't fetch it - please try to retrieve this";\ ${ECHO_MSG} "=> port manually into ${_DISTDIR} and try again."; \ exit 1; \ - fi \ + fi; \ done .if defined(PATCHFILES) @cd ${_DISTDIR};\ ${_PATCH_SITES_ENV} ; \ - for _file in ${PATCHFILES}; do \ + for _file in ${PATCHFILES}; do \ file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \ force_fetch=false; \ @@ -3600,7 +3457,7 @@ do-fetch: ${ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ ${ECHO_MSG} "=> Please correct this problem and try again."; \ exit 1; \ - fi ; \ + fi; \ ${ECHO_MSG} "=> $$file doesn't seem to exist in ${_DISTDIR}."; \ if [ ! -z "$$select" ] ; then \ __PATCH_SITES_TMP= ; \ @@ -3608,13 +3465,13 @@ do-fetch: if [ ! -z \$${_PATCH_SITES_$${group}} ] ; then \ eval ___PATCH_SITES_TMP="\$${_PATCH_SITES_$${group}}" ; \ __PATCH_SITES_TMP="$${__PATCH_SITES_TMP} $${___PATCH_SITES_TMP}" ; \ - fi \ + fi; \ done; \ ___PATCH_SITES_TMP= ; \ SORTED_PATCH_SITES_CMD_TMP="${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} $${__PATCH_SITES_TMP} | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP}" ; \ else \ SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \ - fi ; \ + fi; \ for site in `eval $$SORTED_PATCH_SITES_CMD_TMP`; do \ ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \ @@ -3625,12 +3482,12 @@ do-fetch: esac; \ if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} ${FETCH_AFTER_ARGS}; then \ continue 2; \ - fi \ + fi; \ done; \ ${ECHO_MSG} "=> Couldn't fetch it - please try to retrieve this";\ ${ECHO_MSG} "=> port manually into ${_DISTDIR} and try again."; \ exit 1; \ - fi \ + fi; \ done .endif .endif @@ -3645,7 +3502,7 @@ do-extract: if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\ then \ exit 1; \ - fi \ + fi; \ done .if !defined(EXTRACT_PRESERVE_OWNERSHIP) @if [ `${ID} -u` = 0 ]; then \ @@ -3824,11 +3681,7 @@ check-conflicts: done; \ if [ -n "$${conflicts_with}" ]; then \ ${ECHO_MSG}; \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s) in ${DESTDIR}: "; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \ for entry in $${conflicts_with}; do \ ${ECHO_MSG} " $${entry}"; \ done; \ @@ -3956,12 +3809,8 @@ delete-package-list: delete-package-links-list .if !target(check-already-installed) check-already-installed: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) -.if !defined(DESTDIR) - @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed" -.else - @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed in ${DESTDIR}" -.endif - @${MKDIR} ${PKG_DBDIR}; \ + @${ECHO_MSG} "===> Checking if ${PKGORIGIN} already installed"; \ + ${MKDIR} ${PKG_DBDIR}; \ already_installed=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ if [ -n "$${already_installed}" ]; then \ for p in $${already_installed}; do \ @@ -3974,20 +3823,12 @@ check-already-installed: fi; \ fi; \ done; \ - fi ; \ + fi; \ if [ -d ${PKG_DBDIR}/${PKGNAME} -o -n "$${found_package}" ]; then \ if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} is already installed"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} is already installed in ${DESTDIR}"; \ - fi; \ + ${ECHO_CMD} "===> ${PKGNAME} is already installed"; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> An older version of ${PKGORIGIN} is already installed ($${found_package})"; \ - else \ - ${ECHO_MSG} "===> An older version of ${PKGORIGIN} is already installed in ${DESTDIR} ($${found_package})"; \ - fi; \ + ${ECHO_CMD} "===> An older version of ${PKGORIGIN} is already installed ($${found_package})"; \ fi; \ ${ECHO_MSG} " You may wish to \`\`make deinstall'' and install this port again"; \ ${ECHO_MSG} " by \`\`make reinstall'' to upgrade it properly."; \ @@ -4012,12 +3853,12 @@ check-umask: .if !target(install-mtree) install-mtree: - @${MKDIR} ${TARGETDIR} + @${MKDIR} ${PREFIX} @if [ `${ID} -u` != 0 ]; then \ - if [ -w ${TARGETDIR}/ ]; then \ + if [ -w ${PREFIX}/ ]; then \ ${ECHO_MSG} "Warning: not superuser, you may get some errors during installation."; \ else \ - ${ECHO_MSG} "Error: ${TARGETDIR}/ not writable."; \ + ${ECHO_MSG} "Error: ${PREFIX}/ not writable."; \ ${FALSE}; \ fi; \ fi @@ -4028,9 +3869,9 @@ install-mtree: ${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \ exit 1; \ else \ - ${MTREE_CMD} ${MTREE_ARGS} ${TARGETDIR}/ >/dev/null; \ - if [ ${PREFIX} = ${LOCALBASE_REL} ]; then \ - cd ${TARGETDIR}/share/nls; \ + ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/ >/dev/null; \ + if [ ${PREFIX} = ${LOCALBASE} ]; then \ + cd ${PREFIX}/share/nls; \ ${LN} -shf C POSIX; \ ${LN} -shf C en_US.US-ASCII; \ fi; \ @@ -4047,21 +3888,11 @@ install-ldconfig-file: .if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32) || defined(INSTALLS_SHLIB) .if defined(USE_LDCONFIG) .if !defined(INSTALL_AS_USER) -.if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig" ${LDCONFIG} -m ${USE_LDCONFIG} .else - @${ECHO_MSG} "===> Running ldconfig in ${DESTDIR}" - ${CHROOT} ${DESTDIR} ${LDCONFIG} -m ${USE_LDCONFIG} -.endif -.else -.if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig (errors are ignored)" -${LDCONFIG} -m ${USE_LDCONFIG} -.else - @${ECHO_MSG} "===> Running ldconfig in ${DESTDIR} (errors are ignored)" - ${CHROOT} ${DESTDIR} -${LDCONFIG} -m ${USE_LDCONFIG} -.endif .endif .if ${USE_LDCONFIG} != "${PREFIX}/lib" @${ECHO_MSG} "===> Installing ldconfig configuration file" @@ -4079,21 +3910,11 @@ install-ldconfig-file: .endif .if defined(USE_LDCONFIG32) .if !defined(INSTALL_AS_USER) -.if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig" ${LDCONFIG} -32 -m ${USE_LDCONFIG32} .else - @${ECHO_MSG} "===> Running ldconfig in ${DESTDIR}" - ${CHROOT} ${DESTDIR} ${LDCONFIG} -32 -m ${USE_LDCONFIG32} -.endif -.else -.if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig (errors are ignored)" -${LDCONFIG} -32 -m ${USE_LDCONFIG32} -.else - @${ECHO_MSG} "===> Running ldconfig in ${DESTDIR} (errors are ignored)" - ${CHROOT} ${DESTDIR} -${LDCONFIG} -32 -m ${USE_LDCONFIG32} -.endif .endif @${ECHO_MSG} "===> Installing 32-bit ldconfig configuration file" .if defined(NO_LDCONFIG_MTREE) @@ -4116,18 +3937,10 @@ install-ldconfig-file: @${ECHO_MSG} "===> INSTALLS_SHLIB and USE_LDCONFIG32 both defined." .endif .if !defined(INSTALL_AS_USER) -.if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig" -.else - @${ECHO_MSG} "===> Running ldconfig in ${DESTDIR}" -.endif ${LDCONFIG_CMD} .else -.if !defined(DESTDIR) @${ECHO_MSG} "===> Running ldconfig (errors are ignored)" -.else - @${ECHO_MSG} "===> Running ldconfig in ${DESTDIR} (errors are ignored)" -.endif -${LDCONFIG_CMD} .endif .endif @@ -4162,7 +3975,7 @@ security-check: | ${XARGS} -0 -J % ${FIND} % -prune ! -type l -type f -print0 2> /dev/null \ | ${XARGS} -0 -n 1 ${OBJDUMP} -R 2> /dev/null > ${WRKDIR}/.PLIST.objdump; \ if \ - ! ${AWK} -v audit="$${PORTS_AUDIT}" -v destdir="${DESTDIR}" -f ${PORTSDIR}/Tools/scripts/security-check.awk \ + ! ${AWK} -v audit="$${PORTS_AUDIT}" -f ${PORTSDIR}/Tools/scripts/security-check.awk \ ${WRKDIR}/.PLIST.flattened ${WRKDIR}/.PLIST.objdump ${WRKDIR}/.PLIST.setuid ${WRKDIR}/.PLIST.writable; \ then \ www_site=$$(cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} www-site); \ @@ -4229,57 +4042,30 @@ security-check: ${GREP} '^etc/rc.d/' ${TMPPLIST} > ${WRKDIR}/.PLIST.startup; \ if [ -s ${WRKDIR}/.PLIST.setuid -o -s ${WRKDIR}/.PLIST.network -o -s ${WRKDIR}/.PLIST.writable ]; then \ if [ -n "$$PORTS_AUDIT" ]; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> SECURITY REPORT (PARANOID MODE): "; \ - else \ - ${ECHO_MSG} "===> SECURITY REPORT FOR ${DESTDIR} (PARANOID MODE): "; \ - fi; \ + ${ECHO_MSG} "===> SECURITY REPORT (PARANOID MODE): "; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> SECURITY REPORT: "; \ - else \ - ${ECHO_MSG} "===> SECURITY REPORT FOR ${DESTDIR}: "; \ - fi; \ + ${ECHO_MSG} "===> SECURITY REPORT: "; \ fi; \ if [ -s ${WRKDIR}/.PLIST.setuid ] ; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} " This port has installed the following binaries,"; \ - else \ - ${ECHO_MSG} " This port has installed the following binaries into ${DESTDIR},"; \ - fi; \ + ${ECHO_MSG} " This port has installed the following binaries,"; \ ${ECHO_MSG} " which execute with increased privileges."; \ ${CAT} ${WRKDIR}/.PLIST.setuid; \ ${ECHO_MSG}; \ fi; \ if [ -s ${WRKDIR}/.PLIST.network ] ; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} " This port has installed the following files, which may act as network"; \ - ${ECHO_MSG} " servers and may therefore pose a remote security risk to the system."; \ - else \ - ${ECHO_MSG} " This port has installed the following files into ${DESTDIR}, which may"; \ - ${ECHO_MSG} " act as network servers and may therefore pose a remote security risk to"; \ - ${ECHO_MSG} " the system."; \ - fi; \ + ${ECHO_MSG} " This port has installed the following files, which may act as network"; \ + ${ECHO_MSG} " servers and may therefore pose a remote security risk to the system."; \ ${CAT} ${WRKDIR}/.PLIST.network; \ ${ECHO_MSG}; \ if [ -s ${WRKDIR}/.PLIST.startup ] ; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} " This port has installed the following startup scripts,"; \ - else \ - ${ECHO_MSG} " This port has installed the following startup scripts into ${DESTDIR},"; \ - fi; \ + ${ECHO_MSG} " This port has installed the following startup scripts,"; \ ${ECHO_MSG} " which may cause these network services to be started at boot time."; \ ${SED} s,^,${PREFIX}/, < ${WRKDIR}/.PLIST.startup; \ ${ECHO_MSG}; \ fi; \ fi; \ if [ -s ${WRKDIR}/.PLIST.writable ] ; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} " This port has installed the following world-writable files/directories."; \ - else \ - ${ECHO_MSG} " This port has installed the following world-writable files/directories"; \ - ${ECHO_MSG} " into ${DESTDIR}."; \ - fi; \ + ${ECHO_MSG} " This port has installed the following world-writable files/directories."; \ ${CAT} ${WRKDIR}/.PLIST.writable; \ ${ECHO_MSG}; \ fi; \ @@ -4310,7 +4096,12 @@ security-check: # Please note that the order of the following targets is important, and # should not be modified. -_SANITY_SEQ= pre-everything check-makefile check-categories \ +.if defined(CHROOTED) +_CHROOT_SEQ= post-chroot +.else +_CHROOT_SEQ= +.endif +_SANITY_SEQ= ${_CHROOT_SEQ} pre-everything check-makefile check-categories \ check-makevars check-desktop-entries check-depends \ check-deprecated check-vulnerable buildanyway-message \ options-message @@ -4345,6 +4136,11 @@ _PACKAGE_DEP= install _PACKAGE_SEQ= package-message pre-package pre-package-script \ do-package post-package-script +.if !target(post-chroot) +post-chroot: + @${DO_NADA} +.endif + .if !target(check-sanity) check-sanity: ${_SANITY_SEQ} .endif @@ -4422,11 +4218,7 @@ configure-message: build-message: @${ECHO_MSG} "===> Building for ${PKGNAME}" install-message: -.if !defined(DESTDIR) @${ECHO_MSG} "===> Installing for ${PKGNAME}" -.else - @${ECHO_MSG} "===> Installing for ${PKGNAME} into ${DESTDIR}" -.endif package-message: @${ECHO_MSG} "===> Building package for ${PKGNAME}" @@ -4508,22 +4300,14 @@ deinstall: ${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${.TARGET}" @${ECHO_MSG} "===> Returning to user credentials" .else -.if !defined(DESTDIR) @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" -.else - @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN} from ${DESTDIR}" -.endif @found_names=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ for p in $${found_names}; do \ check_name=`${ECHO_CMD} $${p} | ${SED} -e 's/-[^-]*$$//'`; \ if [ "$${check_name}" = "${PKGBASE}" ]; then \ prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${SED} -ne '1s|^@cwd ||p'`; \ if [ "x${PREFIX}" = "x$${prfx}" ]; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> Deinstalling $${p}"; \ - else \ - ${ECHO_MSG} "===> Deinstalling $${p} from ${DESTDIR}"; \ - fi; \ + ${ECHO_MSG} "===> Deinstalling $${p}"; \ ${PKG_DELETE} -f $${p}; \ else \ ${ECHO_MSG} "===> $${p} has a different PREFIX: $${prfx}, skipping"; \ @@ -4531,11 +4315,7 @@ deinstall: fi; \ done; \ if [ -z "$${found_names}" ]; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGBASE} not installed, skipping"; \ - else \ - ${ECHO_MSG} "===> ${PKGBASE} not installed in ${DESTDIR}, skipping"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGBASE} not installed, skipping"; \ fi @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif @@ -4553,30 +4333,18 @@ deinstall-all: ${SU_CMD} "${MAKE} ${__softMAKEFLAGS} ${.TARGET}" @${ECHO_MSG} "===> Returning to user credentials" .else -.if !defined(DESTDIR) @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}" -.else - @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN} from ${DESTDIR}" -.endif @deinstall_names=`${PKG_INFO} -q -O ${PKGORIGIN}`; \ for oldpkgorigin in $$(${GREP} "|${PKGORIGIN}|" ${PORTSDIR}/MOVED | ${CUT} -f 1 -d '|' | ${SORT} -u); do \ deinstall_names="$${deinstall_names} $$(${PKG_INFO} -q -O $${oldpkgorigin})"; \ done; \ if [ -n "$${deinstall_names}" ]; then \ for d in $${deinstall_names}; do \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> Deinstalling $${d}"; \ - else \ - ${ECHO_MSG} "===> Deinstalling $${d} from ${DESTDIR}"; \ - fi; \ + ${ECHO_MSG} "===> Deinstalling $${d}"; \ ${PKG_DELETE} -f $${d}; \ done; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGORIGIN} not installed, skipping"; \ - else \ - ${ECHO_MSG} "===> ${PKGORIGIN} not installed in ${DESTDIR}, skipping"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGORIGIN} not installed, skipping"; \ fi; \ ${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE} .endif @@ -4672,13 +4440,13 @@ fetch-list: if [ ! -z \$${_MASTER_SITES_$${group}} ] ; then \ eval ___MASTER_SITES_TMP=\$${_MASTER_SITES_$${group}} ; \ __MASTER_SITES_TMP="$${__MASTER_SITES_TMP} $${___MASTER_SITES_TMP}" ; \ - fi \ + fi; \ done; \ ___MASTER_SITES_TMP= ; \ SORTED_MASTER_SITES_CMD_TMP="${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} $${__MASTER_SITES_TMP} | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP}" ; \ else \ SORTED_MASTER_SITES_CMD_TMP="${SORTED_MASTER_SITES_DEFAULT_CMD}" ; \ - fi ; \ + fi; \ for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \ if [ ! -z "`${ECHO_CMD} ${NOFETCHFILES} | ${GREP} -w $${file}`" ]; then \ if [ -z "`${ECHO_CMD} ${MASTER_SITE_OVERRIDE} | ${GREP} -w $${site}`" ]; then \ @@ -4694,7 +4462,7 @@ fetch-list: ${ECHO_CMD} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} "${FETCH_AFTER_ARGS}" '|| ' ; \ done; \ ${ECHO_CMD} "${ECHO_CMD} $${file} not fetched" ; \ - fi \ + fi; \ done) .if defined(PATCHFILES) @(cd ${_DISTDIR}; \ @@ -4709,13 +4477,13 @@ fetch-list: if [ ! -z \$${_PATCH_SITES_$${group}} ] ; then \ eval ___PATCH_SITES_TMP=\$${_PATCH_SITES_$${group}} ; \ __PATCH_SITES_TMP="$${__PATCH_SITES_TMP} $${___PATCH_SITES_TMP}" ; \ - fi \ + fi; \ done; \ ___PATCH_SITES_TMP= ; \ SORTED_PATCH_SITES_CMD_TMP="${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} $${__PATCH_SITES_TMP} | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP}" ; \ else \ SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \ - fi ; \ + fi; \ for site in `eval $$SORTED_PATCH_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \ case $${file} in \ @@ -4725,7 +4493,7 @@ fetch-list: ${ECHO_CMD} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} "${FETCH_AFTER_ARGS}" '|| ' ; \ done; \ ${ECHO_CMD} "${ECHO_CMD} $${file} not fetched" ; \ - fi \ + fi; \ done) .endif .endif @@ -4972,7 +4740,7 @@ checksum: fetch check-checksum-algorithms OK="true"; \ fi; \ fi; \ - fi ; \ + fi; \ \ if [ "$$OK" != "true" -a ${FETCH_REGET} -eq 0 ]; then \ ${ECHO_MSG} "===> Giving up on fetching files: $$refetchlist"; \ @@ -4983,7 +4751,7 @@ checksum: fetch check-checksum-algorithms fi; \ if [ "$$OK" != "true" ]; then \ exit 1; \ - fi \ + fi; \ elif [ -n "${_CKSUMFILES:M*}" ]; then \ ${ECHO_MSG} "=> No checksum file (${MD5_FILE})."; \ fi @@ -5039,24 +4807,15 @@ _INSTALL_DEPENDS= \ if [ X${USE_PACKAGE_DEPENDS} != "X" ]; then \ subpkgfile=`(cd $$dir; ${MAKE} $$depends_args -V PKGFILE)`; \ if [ -r "$${subpkgfile}" -a "$$target" = "${DEPENDS_TARGET}" ]; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> Installing existing package $${subpkgfile}"; \ - ${PKG_ADD} $${subpkgfile}; \ - else \ - ${ECHO_MSG} "===> Installing existing package $${subpkgfile} into ${DESTDIR}"; \ - ${PKG_ADD} -C ${DESTDIR} $${subpkgfile}; \ - fi; \ + ${ECHO_MSG} "===> Installing existing package $${subpkgfile}"; \ + ${PKG_ADD} $${subpkgfile}; \ else \ (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \ fi; \ else \ (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \ fi; \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ - else \ - ${ECHO_MSG} "===> Returning to build of ${PKGNAME} for ${DESTDIR}"; \ - fi; + ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; .for deptype in EXTRACT PATCH FETCH BUILD RUN ${deptype:L}-depends: @@ -5086,11 +4845,7 @@ ${deptype:L}-depends: ${ECHO_MSG} "Error: ${NONEXISTENT} exists. Please remove it, and restart the build."; \ ${FALSE}; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} depends on file in ${DESTDIR}: $$prog - found"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \ if [ ${_DEPEND_ALWAYS} = 1 ]; then \ ${ECHO_MSG} " (but building it anyway)"; \ notfound=1; \ @@ -5099,11 +4854,7 @@ ${deptype:L}-depends: fi; \ fi; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} depends on file in ${DESTDIR}: $$prog - not found"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \ notfound=1; \ fi; \ else \ @@ -5113,11 +4864,7 @@ ${deptype:L}-depends: esac; \ if [ "$$pkg" != "" ]; then \ if ${PKG_INFO} "$$prog" > /dev/null 2>&1 ; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} depends on package: $$prog - found"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} depends on package in ${DESTDIR}: $$prog - found"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} depends on package: $$prog - found"; \ if [ ${_DEPEND_ALWAYS} = 1 ]; then \ ${ECHO_MSG} " (but building it anyway)"; \ notfound=1; \ @@ -5125,11 +4872,7 @@ ${deptype:L}-depends: notfound=0; \ fi; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} depends on package: $$prog - not found"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} depends on package in ${DESTDIR}: $$prog - not found"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} depends on package: $$prog - not found"; \ notfound=1; \ fi; \ if [ $$notfound != 0 ]; then \ @@ -5143,11 +4886,7 @@ ${deptype:L}-depends: fi; \ fi; \ elif ${WHICH} "$$prog" > /dev/null 2>&1 ; then \ - if [ -z "${PREFIX}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} depends on executable in ${DESTDIR}: $$prog - found"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \ if [ ${_DEPEND_ALWAYS} = 1 ]; then \ ${ECHO_MSG} " (but building it anyway)"; \ notfound=1; \ @@ -5155,11 +4894,7 @@ ${deptype:L}-depends: notfound=0; \ fi; \ else \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \ - else \ - ${ECHO_MSG} "===> ${PKGNAME} depends on executable in ${DESTDIR}: $$prog - not found"; \ - fi; \ + ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \ notfound=1; \ fi; \ fi; \ @@ -5195,34 +4930,18 @@ lib-depends: else \ dir=$${dir%%:*}; \ fi; \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $$lib"; \ - if ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ - ${ECHO_MSG} " - found"; \ - if [ ${_DEPEND_ALWAYS} = 1 ]; then \ - ${ECHO_MSG} " (but building it anyway)"; \ - notfound=1; \ - else \ - notfound=0; \ - fi; \ - else \ - ${ECHO_MSG} " - not found"; \ + ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $$lib"; \ + if ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ + ${ECHO_MSG} " - found"; \ + if [ ${_DEPEND_ALWAYS} = 1 ]; then \ + ${ECHO_MSG} " (but building it anyway)"; \ notfound=1; \ - fi; \ - else \ - ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library in ${DESTDIR}: $$lib"; \ - if ${CHROOT} ${DESTDIR} ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ - ${ECHO_MSG} " - found"; \ - if [ ${_DEPEND_ALWAYS} = 1 ]; then \ - ${ECHO_MSG} " (but building it anyway)"; \ - notfound=1; \ - else \ - notfound=0; \ - fi; \ else \ - ${ECHO_MSG} " - not found"; \ - notfound=1; \ + notfound=0; \ fi; \ + else \ + ${ECHO_MSG} " - not found"; \ + notfound=1; \ fi; \ if [ $$notfound != 0 ]; then \ ${ECHO_MSG} "===> Verifying $$target for $$lib in $$dir"; \ @@ -5580,7 +5299,7 @@ missing: installed=$$(${PKG_INFO} -qO $${THISORIGIN}); \ if [ -z "$$installed" ]; then \ ${ECHO_CMD} $$THISORIGIN; \ - fi \ + fi; \ done ################################################################ @@ -5709,7 +5428,7 @@ _PRETTY_PRINT_DEPENDS_LIST=\ ${ECHO_MSG} "${.TARGET} requires an INDEX file (${INDEXFILE}). Please run make index or make fetchindex."; \ else \ target=${.TARGET:C/pretty-print-(.*)-depends-list/\1/} ; \ - if [ "$$target" = "build" ] ; then fldnum=8 ; else fldnum=9 ; fi ; \ + if [ "$$target" = "build" ] ; then fldnum=8 ; else fldnum=9 ; fi; \ ${ECHO_MSG} -n 'This port requires package(s) "' ; \ ${ECHO_MSG} -n `${AWK} -F\| "\\$$1 ~ /^${PKGNAME}/ {print \\$$$${fldnum};}" ${INDEXDIR}/${INDEXFILE}` ; \ ${ECHO_MSG} "\" to $$target."; \ @@ -5839,9 +5558,9 @@ add-plist-docs: fi;fi .endfor @${FIND} -P ${PORTDOCS:S/^/${DOCSDIR}\//} ! -type d 2>/dev/null | \ - ${SED} -ne 's,^${TARGETDIR}/,,p' >> ${TMPPLIST} + ${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST} @${FIND} -P -d ${PORTDOCS:S/^/${DOCSDIR}\//} -type d 2>/dev/null | \ - ${SED} -ne 's,^${TARGETDIR}/,@dirrm ,p' >> ${TMPPLIST} + ${SED} -ne 's,^${PREFIX}/,@dirrm ,p' >> ${TMPPLIST} @${ECHO_CMD} "@dirrm ${DOCSDIR_REL}" >> ${TMPPLIST} .else @${DO_NADA} @@ -5901,10 +5620,10 @@ add-plist-info: # Process GNU INFO files at package install/deinstall time .if defined(INFO) .for i in ${INFO} - install-info --quiet ${TARGETDIR}/${INFO_PATH}/$i.info ${TARGETDIR}/${INFO_PATH}/dir + install-info --quiet ${PREFIX}/${INFO_PATH}/$i.info ${PREFIX}/${INFO_PATH}/dir @${ECHO_CMD} "@unexec install-info --quiet --delete %D/${INFO_PATH}/$i.info %D/${INFO_PATH}/dir" \ >> ${TMPPLIST} - @${LS} ${TARGETDIR}/${INFO_PATH}/$i.info* | ${SED} -e s:${TARGETDIR}/::g >> ${TMPPLIST} + @${LS} ${PREFIX}/${INFO_PATH}/$i.info* | ${SED} -e s:${PREFIX}/::g >> ${TMPPLIST} @${ECHO_CMD} "@exec install-info --quiet %D/${INFO_PATH}/$i.info %D/${INFO_PATH}/dir" \ >> ${TMPPLIST} .endfor @@ -5913,7 +5632,7 @@ add-plist-info: .endif .if (${PREFIX} != "/usr") @${ECHO_CMD} "@unexec if [ -f %D/${INFO_PATH}/dir ]; then if sed -e '1,/Menu:/d' %D/${INFO_PATH}/dir | grep -q '^[*] '; then true; else rm %D/${INFO_PATH}/dir; fi; fi" >> ${TMPPLIST} -.if (${PREFIX} != ${LOCALBASE_REL} && ${PREFIX} != ${X11BASE_REL} && ${PREFIX} != ${LINUXBASE_REL}) +.if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${X11BASE} && ${PREFIX} != ${LINUXBASE}) @${ECHO_CMD} "@unexec rmdir %D/${INFO_PATH} 2>/dev/null || true" >> ${TMPPLIST} .endif .endif @@ -5924,7 +5643,7 @@ add-plist-info: # deinstall-time .if !target(add-plist-post) add-plist-post: -.if (${PREFIX} != ${LOCALBASE_REL} && ${PREFIX} != ${X11BASE_REL} && ${PREFIX} != ${LINUXBASE_REL} && ${PREFIX} != "/usr") +.if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${X11BASE} && ${PREFIX} != ${LINUXBASE} && ${PREFIX} != "/usr") @${ECHO_CMD} "@unexec rmdir %D 2> /dev/null || true" >> ${TMPPLIST} .else @${DO_NADA} @@ -5938,7 +5657,7 @@ install-rc-script: @${ECHO_MSG} "===> Installing early rc.d startup script(s)" @${ECHO_CMD} "@cwd /" >> ${TMPPLIST} @for i in ${USE_RCORDER}; do \ - ${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${DESTDIR}/etc/rc.d/$${i%.sh}; \ + ${INSTALL_SCRIPT} ${WRKDIR}/$${i} /etc/rc.d/$${i%.sh}; \ ${ECHO_CMD} "etc/rc.d/$${i%.sh}" >> ${TMPPLIST}; \ done @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST} @@ -5947,7 +5666,7 @@ install-rc-script: @${ECHO_MSG} "===> Installing rc.d startup script(s)" @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST} @for i in ${USE_RC_SUBR}; do \ - ${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${TARGETDIR}/etc/rc.d/$${i%.sh}${RC_SUBR_SUFFIX}; \ + ${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${PREFIX}/etc/rc.d/$${i%.sh}${RC_SUBR_SUFFIX}; \ ${ECHO_CMD} "etc/rc.d/$${i%.sh}${RC_SUBR_SUFFIX}" >> ${TMPPLIST}; \ done .endif @@ -6001,11 +5720,7 @@ fake-pkg: @${RM} -rf ${PKG_DBDIR}/${PKGNAME} .endif @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \ - if [ -z "${DESTDIR}" ] ; then \ - ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ - else \ - ${ECHO_MSG} "===> Registering installation for ${PKGNAME} in ${DESTDIR}"; \ - fi; \ + ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \ ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \ ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \ @@ -6433,3 +6148,6 @@ install-desktop-entries: .endif # End of post-makefile section. + +.endif +# End of the DESTDIR if statement diff --git a/Mk/bsd.port.subdir.mk b/Mk/bsd.port.subdir.mk index 951362d..0a3cecb 100644 --- a/Mk/bsd.port.subdir.mk +++ b/Mk/bsd.port.subdir.mk @@ -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/&/\&/g' -e 's/>/\>/g' -e 's/</\</g' +HTMLIFY= ${SED} -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</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) { \ diff --git a/Mk/bsd.python.mk b/Mk/bsd.python.mk index 39ce692..134cbf5 100644 --- a/Mk/bsd.python.mk +++ b/Mk/bsd.python.mk @@ -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 diff --git a/Mk/bsd.ruby.mk b/Mk/bsd.ruby.mk index 1f19751..81d6435 100644 --- a/Mk/bsd.ruby.mk +++ b/Mk/bsd.ruby.mk @@ -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 diff --git a/Tools/scripts/security-check.awk b/Tools/scripts/security-check.awk index 7d6ff1b..48746cd 100644 --- a/Tools/scripts/security-check.awk +++ b/Tools/scripts/security-check.awk @@ -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; @@ -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 |