From 7e427bdbb76b032038e2061177820e3a7828c784 Mon Sep 17 00:00:00 2001 From: Pav Lucistnik Date: Wed, 3 Oct 2007 22:24:59 +0000 Subject: [PATCH] - Fix issues with actual-package-depends, most notably fix bad list when a third party package with invalid or missing pkgorigin is installed; this resulted in silently discarding dependency records for some people PR: ports/115010 Submitted by: netchild - Replace some calls to basename and dirname with make logic PR: ports/115994 Submitted by: netchild - Fix bsd.xorg.mk to work when USE_XORG is used below .include ; should allow conditional X.Org component dependencies with OPTIONS, etc Submitted by: flz - When installing as user, don't install any libdata/ldconfig entries Submitted by: flz PR: ports/106613 (in audit trail) - Introduce INSTALL_KLD; it's same as INSTALL_SCRIPT but the name is more obvious PR: ports/116200 Submitted by: edwin --- Mk/bsd.port.mk | 66 ++++++++++++++++++++++++++++++++------------------ Mk/bsd.xorg.mk | 14 ++++++++--- 2 files changed, 52 insertions(+), 28 deletions(-) diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 1e149d7c85ae..5d066c754298 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -579,6 +579,7 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # - A command to install binary executables. (By # default, also strips them, unless ${STRIP} is # overridden to be the empty string). +# INSTALL_KLD - As INSTALL_KLD, but without the STRIP. # INSTALL_SCRIPT # - A command to install executable scripts. # INSTALL_DATA - A command to install sharable data. @@ -707,7 +708,7 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # tree as recorded in the Makefiles of the ports # collection, not as recorded in the currently # installed ports. -# actual-package-depends-list +# actual-package-depends # - Like package-depends-list but with the difference # that the dependencies of the currently installed # ports are used instead of the dependencies as @@ -1747,9 +1748,9 @@ RC_SUBR_SUFFIX?= .sh .endif .if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32) -.if ( ${OSVERSION} < 504105 ) || \ +.if !defined(INSTALL_AS_USER) && ( ( ${OSVERSION} < 504105 ) || \ ( ${OSVERSION} >= 700000 && ${OSVERSION} < 700012 ) || \ - ( ${OSVERSION} >= 600000 && ${OSVERSION} < 600104 ) + ( ${OSVERSION} >= 600000 && ${OSVERSION} < 600104 ) ) RUN_DEPENDS+= ${LOCALBASE}/${LDCONFIG_DIR}:${PORTSDIR}/misc/ldconfig_compat NO_LDCONFIG_MTREE= yes .endif @@ -1939,6 +1940,12 @@ PLIST_SUB+= PERL_VERSION=${PERL_VERSION} \ .include "${PORTSDIR}/Mk/bsd.local.mk" .endif +.if defined(USE_XORG) || defined(XORG_CAT) +. if ${X_WINDOW_SYSTEM} == "xorg" +.include "${PORTSDIR}/Mk/bsd.xorg.mk" +. endif +.endif + .if defined(USE_MYSQL) || defined(WANT_MYSQL_VER) || \ defined(USE_PGSQL) || defined(WANT_PGSQL_VER) || \ defined(USE_BDB) || defined(USE_SQLITE) || defined(USE_FIREBIRD) @@ -2231,6 +2238,8 @@ _MANOWNGRP= # A few aliases for *-install targets INSTALL_PROGRAM= \ ${INSTALL} ${COPY} ${STRIP} ${_BINOWNGRP} -m ${BINMODE} +INSTALL_KLD= \ + ${INSTALL} ${COPY} ${_BINOWNGRP} -m ${BINMODE} INSTALL_SCRIPT= \ ${INSTALL} ${COPY} ${_BINOWNGRP} -m ${BINMODE} INSTALL_DATA= \ @@ -2317,7 +2326,7 @@ PKGINSTALLVER!= ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //' DISABLE_CONFLICTS= YES .endif .if !defined(PKG_ARGS) -PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} actual-package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} +PKG_ARGS= -v -c -${COMMENT:Q} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`cd ${.CURDIR} && ${MAKE} actual-package-depends | ${GREP} -v -E ${PKG_IGNORE_DEPENDS} | ${SORT} -u -t : -k 2`" ${EXTRA_PKG_ARGS} $${_LATE_PKG_ARGS} .if !defined(NO_MTREE) PKG_ARGS+= -m ${MTREE_FILE} .endif @@ -3341,15 +3350,15 @@ do-fetch: ${_MASTER_SITES_ENV} ; \ for _file in ${DISTFILES}; do \ file=$${_file%%:*}; \ - if [ $$_file = $$file ]; then \ + if [ $$_file = $$file ]; then \ select=''; \ else \ select=`${ECHO_CMD} $${_file##*:} | ${SED} -e 's/,/ /g'` ; \ fi; \ force_fetch=false; \ - filebasename=`${BASENAME} $$file`; \ + filebasename=$${file##*/}; \ for afile in ${FORCE_FETCH}; do \ - afile=`${BASENAME} $$afile`; \ + afile=$${afile##*/}; \ if [ "x$$afile" = "x$$filebasename" ]; then \ force_fetch=true; \ fi; \ @@ -3412,15 +3421,15 @@ do-fetch: file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \ force_fetch=false; \ - filebasename=`${BASENAME} $$file`; \ + filebasename=$${file##*/}; \ for afile in ${FORCE_FETCH}; do \ - afile=`${BASENAME} $$afile`; \ + afile=$${afile##*/}; \ if [ "x$$afile" = "x$$filebasename" ]; then \ force_fetch=true; \ fi; \ done; \ if [ ! -f $$file -a ! -f $$filebasename -o "$$force_fetch" = "true" ]; then \ - if [ -L $$file -o -L `${BASENAME} $$file` ]; then \ + if [ -L $$file -o -L $${file##*/} ]; then \ ${ECHO_MSG} "=> ${_DISTDIR}/$$file is a broken symlink."; \ ${ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ ${ECHO_MSG} "=> Please correct this problem and try again."; \ @@ -3845,7 +3854,7 @@ install-ldconfig-file: @${ECHO_MSG} "===> Running ldconfig (errors are ignored)" -${LDCONFIG} -m ${USE_LDCONFIG} .endif -.if ${USE_LDCONFIG} != "${PREFIX}/lib" +.if ${USE_LDCONFIG} != "${PREFIX}/lib" && !defined(INSTALL_AS_USER) @${ECHO_MSG} "===> Installing ldconfig configuration file" .if defined(NO_LDCONFIG_MTREE) @${MKDIR} ${PREFIX}/${LDCONFIG_DIR} @@ -3867,6 +3876,7 @@ install-ldconfig-file: @${ECHO_MSG} "===> Running ldconfig (errors are ignored)" -${LDCONFIG} -32 -m ${USE_LDCONFIG32} .endif +.if !defined(INSTALL_AS_USER) @${ECHO_MSG} "===> Installing 32-bit ldconfig configuration file" .if defined(NO_LDCONFIG_MTREE) @${MKDIR} ${PREFIX}/${LDCONFIG_32DIR} @@ -3879,6 +3889,7 @@ install-ldconfig-file: @${ECHO_CMD} "@unexec rmdir ${LDCONFIG32_DIR} >/dev/null 2>&1" >> ${TMPPLIST} .endif .endif +.endif # This can be removed once all ports have been converted to USE_LDCONFIG. .if defined(INSTALLS_SHLIB) .if defined(USE_LDCONFIG) @@ -4384,7 +4395,7 @@ fetch-list: for _file in ${DISTFILES}; do \ file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \ - if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ + if [ ! -f $$file -a ! -f $${file##*/} ]; then \ if [ ! -z "$$select" ] ; then \ __MASTER_SITES_TMP= ; \ for group in $$select; do \ @@ -4421,7 +4432,7 @@ fetch-list: for _file in ${PATCHFILES}; do \ file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \ - if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ + if [ ! -f $$file -a ! -f $${file##*/} ]; then \ if [ ! -z "$$select" ] ; then \ __PATCH_SITES_TMP= ; \ for group in $$select; do \ @@ -4977,7 +4988,7 @@ CLEAN-DEPENDS-FULL= \ for child in $$children; do \ case $$state in \ 0) \ - if [ -d $$child ]; then \ + if [ -d $$child ]; then \ ${ECHO_CMD} $$d; \ fi; \ state=1;; \ @@ -5016,7 +5027,7 @@ CLEAN-DEPENDS-LIMITED= \ for child in $$children; do \ case $$state in \ 0) \ - if [ ! -d $$child ]; then \ + if [ ! -d $$child ]; then \ break; \ fi; \ state=1; \ @@ -5219,6 +5230,10 @@ ACTUAL-PACKAGE-DEPENDS?= \ dir=$${tmp\#\#*/}/$${dir\#\#*/}; \ set -- $$origins; \ while [ $$\# -gt 1 ]; do \ + if [ ! -d "${PORTSDIR}/$$2" ]; then \ + shift; \ + continue; \ + fi; \ if [ "$$dir" = "$$2" ]; then \ ${ECHO_CMD} $$1:$$dir; \ if [ -e ${PKG_DBDIR}/$$1/+CONTENTS -a -z "${EXPLICIT_PACKAGE_DEPENDS}" ]; then \ @@ -5756,13 +5771,15 @@ config: @exit 1 .endif .if ${UID} != 0 && !defined(INSTALL_AS_USER) - @${ECHO_MSG} "===> Switching to root credentials to create `${DIRNAME} ${_OPTIONSFILE}`" - @(${SU_CMD} "${SH} -c \"${MKDIR} `${DIRNAME} ${_OPTIONSFILE}` 2> /dev/null\"") || \ - (${ECHO_MSG} "===> Cannot create `${DIRNAME} ${_OPTIONSFILE}`, check permissions"; exit 1) - @${ECHO_MSG} "===> Returning to user credentials" + @optionsdir=${_OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ + ${ECHO_MSG} "===> Switching to root credentials to create $${optionsdir}"; \ + (${SU_CMD} "${SH} -c \"${MKDIR} $${optionsdir} 2> /dev/null\"") || \ + (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \ + ${ECHO_MSG} "===> Returning to user credentials" .else - @(${MKDIR} `${DIRNAME} ${_OPTIONSFILE}` 2> /dev/null) || \ - (${ECHO_MSG} "===> Cannot create `${DIRNAME} ${_OPTIONSFILE}`, check permissions"; exit 1) + @(optionsdir=${_OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ + ${MKDIR} $${optionsdir} 2> /dev/null) || \ + (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1) .endif -@if [ -e ${_OPTIONSFILE} ]; then \ . ${_OPTIONSFILE}; \ @@ -5898,14 +5915,15 @@ showconfig: rmconfig: .if defined(OPTIONS) && exists(${_OPTIONSFILE}) -@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \ + optionsdir=${_OPTIONSFILE}; optionsdir=$${optionsdir%/*}; \ if [ `${ID} -u` != 0 -a "x${INSTALL_AS_USER}" = "x" ]; then \ - ${ECHO_MSG} "===> Switching to root credentials to remove ${_OPTIONSFILE} and `${DIRNAME} ${_OPTIONSFILE}`"; \ + ${ECHO_MSG} "===> Switching to root credentials to remove ${_OPTIONSFILE} and $${optionsdir}"; \ ${SU_CMD} "${RM} -f ${_OPTIONSFILE} ; \ - ${RMDIR} `${DIRNAME} ${_OPTIONSFILE}`"; \ + ${RMDIR} $${optionsdir}"; \ ${ECHO_MSG} "===> Returning to user credentials"; \ else \ ${RM} -f ${_OPTIONSFILE}; \ - ${RMDIR} `${DIRNAME} ${_OPTIONSFILE}`; \ + ${RMDIR} $${optionsdir}; \ fi .else @${ECHO_MSG} "===> No user-specified options configured for ${PKGNAME}" diff --git a/Mk/bsd.xorg.mk b/Mk/bsd.xorg.mk index dce9a5785050..f9815209d44f 100644 --- a/Mk/bsd.xorg.mk +++ b/Mk/bsd.xorg.mk @@ -16,7 +16,10 @@ # $FreeBSD$ # -XORG_Include_MAINTAINER= x11@FreeBSD.org +.if !defined(_POSTMKINCLUDED) && !defined(Xorg_Pre_Include) + +Xorg_Include_MAINTAINER= x11@FreeBSD.org +Xorg_Pre_Include= bsd.xorg.mk # Some notes: # @@ -141,11 +144,12 @@ CONFIGURE_ARGS+= --with-xkb-path=${X11BASE}/share/X11/xkb .endif -# Might not be useful, need to check this later. -.if defined(USE_XORG) -USE_GNOME+= pkgconfig .endif +.if defined(_POSTMKINCLUDED) && !defined(Xorg_Post_Include) + +Xorg_Post_Include= bsd.xorg.mk + # Register all xorg .pc files here. # foo_LIB_PC_DEPENDS means it should go to BUILD_DEPENDS *and* RUN_DEPENDS. @@ -259,3 +263,5 @@ check-latest: fi; \ done .endif + +.endif