Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 May 2001 01:36:06 -0600
From:      "John E. Hein" <jhein@timing.com>
To:        freebsd-ports@FreeBSD.ORG
Subject:   DESTDIR is handled wrong in bsd.port.mk [patch included]
Message-ID:  <15115.26726.458413.73942@Daffy.timing.com>

next in thread | raw e-mail | index | archive | help
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




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