From owner-freebsd-ports Wed May 23 0:36:12 2001 Delivered-To: freebsd-ports@freebsd.org Received: from timingpdc.timing.com (timingpdc.timing.com [206.168.13.194]) by hub.freebsd.org (Postfix) with ESMTP id BC17537B42C for ; Wed, 23 May 2001 00:36:08 -0700 (PDT) (envelope-from jhein@timing.com) Received: from Daffy.timing.com ([206.168.13.218]) by timingpdc.timing.com (Post.Office MTA v3.1.2 release (PO205-101c) ID# 103-49575U100L2S100) with ESMTP id AAA268; Wed, 23 May 2001 01:38:06 -0600 Received: (from jhein@localhost) by Daffy.timing.com (8.9.3/8.9.3) id BAA80523; Wed, 23 May 2001 01:36:06 -0600 (MDT) (envelope-from jhein@Daffy.timing.com) X-Authentication-Warning: Daffy.timing.com: jhein set sender to jhein@Daffy.timing.com using -f MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15115.26726.458413.73942@Daffy.timing.com> Date: Wed, 23 May 2001 01:36:06 -0600 From: "John E. Hein" To: freebsd-ports@FreeBSD.ORG Subject: DESTDIR is handled wrong in bsd.port.mk [patch included] X-Mailer: VM 6.91 under Emacs 20.7.1 Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Setting DESTDIR should not affect PREFIX. In the current ports infrastructure, as many of you know, setting DESTDIR/PREFIX/etc. will cause unexpected things to happen. I think a first step to fixing ports is to treat DESTDIR right in bsd.port.mk. Right now, the only place it's used is: LOCALBASE?= ${DESTDIR}/usr/local X11BASE?= ${DESTDIR}/usr/X11R6 LINUXBASE?= ${DESTDIR}/compat/linux I vote we remove ${DESTDIR} here and pass it on untouched to the work dir at config/build/install time. Many ports handle DESTDIR correctly as is, but right now, bsd.port.mk interferes with this. Here's a quick example for purposes of illustration: Let's say I want to install glib on a mounted disk in a removable bay that is destined for another system (say it's /usr is mounted on /mnt). I would like to 'cd ports/devel/glib12 ; make DESTDIR=/mnt install' and have it install the "right stuff" to /mnt/usr/local/... Unfortunately, right now bsd.port.mk turns LOCALBASE into /mnt/usr/local which gets passed as the --prefix to the work dir's configure. This, in turn, creates a glib12-config that spits out the wrong thing after this disk is mounted as /usr in the destination system. For instance, 'glib12-config --cflags' will return the bogus '-I/mnt/usr/include/glib12'. The funny thing is that if bsd.port.mk didn't muck with DESTDIR and just pass it on unsullied to the glib12 Makefile, it would do the right thing. Granted, not all ports do the right thing here, but those that don't are broken. Anyone who sets DESTDIR has to deal with these headaches already, so removing the above "${DESTDIR}" instances won't break existing ports worse than they already are. If anyone wants the current behavior, set PREFIX instead. That's what it's for. DESTDIR is NOT meant to get used as part of the PREFIX for a port. It is meant to simply be the root of the installation destination. It should be handled in the same manner that installworld handles DESTDIR. If someone means to have it actually reside in and be used from that destination, they will set PREFIX instead of DESTDIR. Below is my proposed patch... I think it's a large step in the direction of allowing/forcing ports to properly obey DESTDIR & PREFIX. --- bsd.port.mk.1.366 Mon Apr 30 17:44:19 2001 +++ bsd.port.mk Wed May 23 01:25:44 2001 @@ -600,9 +600,12 @@ .else PORTSDIR?= /usr/ports .endif -LOCALBASE?= ${DESTDIR}/usr/local -X11BASE?= ${DESTDIR}/usr/X11R6 -LINUXBASE?= ${DESTDIR}/compat/linux +LOCALBASE?= /usr/local +X11BASE?= /usr/X11R6 +LINUXBASE?= /compat/linux +.if defined(DESTDIR) +MAKE_ARGS+= DESTDIR=${DESTDIR} +.endif DISTDIR?= ${PORTSDIR}/distfiles _DISTDIR?= ${DISTDIR}/${DIST_SUBDIR} .if defined(USE_BZIP2) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message