Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Dec 2000 00:51:59 -0500 (EST)
From:      matt@gsicomp.on.ca
To:        FreeBSD-gnats-submit@freebsd.org, asami@freebsd.org
Subject:   ports/23581: Updates to bsd.port.mk to detect changing values of ${PREFIX}
Message-ID:  <200012160551.AAA52571@gabby.gsicomp.on.ca>
Resent-Message-ID: <200012160600.eBG605222495@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         23581
>Category:       ports
>Synopsis:       Updates to bsd.port.mk to detect changing values of ${PREFIX}
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 15 22:00:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Matt Emmerton
>Release:        FreeBSD 4.1-RELEASE i386
>Organization:
GSI Computer Services
>Environment:

FreeBSD 4.1-RELEASE (GABBY.20001124.01) #0: Fri Nov 24 00:46:27 EST 2000

>Description:

	Any port which uses GNU configure, Perl's MakeMaker, IMake, 
	or a custom 'configure' script in order to generate Makefiles
	will be passed ${PREFIX}, which will then be hardcoded into
	the resulting Makefiles.

	Many such ports also rely on post-install targets to install
	documentation, sample configurations or startup scripts which
	are not installed by the Makefiles generated above.

	In these cases, most components of the port will be installed
	under the ${PREFIX} given during the initial make, with any
	files installed by the post-install target using the ${PREFIX}
	given during installation.

	Unfortunately, there is no mechanism to prevent ports being
	built with one choice of ${PREFIX}, and then being installed
	with another.

	This patch addresses this issue.

>How-To-Repeat:

	1.  Select a port that uses one of the above configuration
	    mechanisms. (I used ftp/cftp during testing of this patch).
	2.  Do a 'make PREFIX=/some/dir'
	3.  Do a 'make install PREFIX=/some/other/dir' 

>Fix:

--- bsd.port.mk.orig	Sat Dec 16 00:03:42 2000
+++ bsd.port.mk	Sat Dec 16 00:33:58 2000
@@ -1760,6 +1760,9 @@
 
 .if !target(do-configure)
 do-configure:
+.if defined(GNU_CONFIGURE) || defined(PERL_CONFIGURE) || defined(USE_IMAKE) 
+	@echo ${PREFIX} > ${WRKDIR}/.configure_dir
+.endif
 .if defined(USE_AUTOMAKE)
 	@(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOMAKE_ENV} ${AUTOMAKE} \
 		${AUTOMAKE_ARGS})
@@ -1769,6 +1772,7 @@
 		${AUTOCONF_ARGS})
 .endif
 	@if [ -f ${SCRIPTDIR}/configure ]; then \
+		@echo ${PREFIX} > ${WRKDIR}/.configure_dir; \
 		cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
 		  ${SCRIPTDIR}/configure; \
 	fi
@@ -2057,6 +2061,15 @@
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} configure
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} real-build
 ${INSTALL_COOKIE}:
+	if [ -f ${WRKDIR}/.configure_dir ]; then \
+		if [ "x${PREFIX}" != "x`${CAT} ${WRKDIR}/.configure_dir`" ]; then \
+			${ECHO} "===>  ${PKGNAME} has already been configured to install into `${CAT} ${WRKDIR}/.configure_dir`."; \
+			${ECHO} "      If you wish to install into another directory, you must first do a"; \
+			${ECHO} "      \`\`make clean'' followed by \`\`make PREFIX=${PREFIX}'' in order"; \
+			${ECHO} "      to install into ${PREFIX}."; \
+			exit 1; \
+		fi; \
+	fi
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} build
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} real-install
 # Scan PLIST for setugid files and startup scripts

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012160551.AAA52571>