Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2006 03:44:14 +0400
From:      Dmitry Marakasov <amdmi3@mail.ru>
To:        freebsd-ports@FreeBSD.org
Subject:   ATTENTION: is the way DESTDIR was introduced completely wrong?
Message-ID:  <20060814234414.GA57035@hades.panopticon>

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

I'm now exploring new DESTDIR-related stuff, and I find it far from
being useable. More of that, DESTDIR-related changes seem dangerous
to me.

As far as I understand, for port to support DESTDIR, it's files
should be installed into ${DESTDIR}/${PREFIX}/foo (aka ${TARGETDIR}/foo),
but all paths compiled into binaries (or config files) should remain
`local' (i.e. ${PREFIX}/foo). Thus, when DESTDIR used, port will
be installed into (for example) jail environment specified in
DESTDIR, and will correctly work in that environment after chroot'ing
into in. Am I right?

Now, I think the way DESTDIR-related changes were done to bsd.port.mk is
absolutely wrong. For example, X11BASE, LOCALBASE, DATADIR now contain
DESTDIR. But, these variables are frequently used when changing paths
hardcoded in port's sources (see many of my ports, for example
games/fishsupper:

@${REINPLACE_CMD} -e 's|data/|${DATADIR}/|' ${WRKSRC}/src/getreadydisplay.cc

After change, all these ports will not support DESTDIR automatically.
Incomplete list of such ports:

find /usr/ports -name Makefile -exec grep -E \
	"REINPLACE_CMD.*(DATADIR|LOCALBASE|X11BASE)" {}

Now, if we want to fix these, we'll need to change variables in
REINPLACE_CMD lines: LOCALBASE to LOCALBASE_REL, X11BASE to X11BASE_REL
and DATADIR... hmm, we have no DATADIR_REL, so all is left is
${PREFIX}/share/${PORTNAME}. That's unforgivable.

Also I see that new TARGETDIR/DESTDIR/...DIR scheme brings confusion.
Latest DESTDIR-related port update that I see:

http://www.freshports.org/x11-wm/jwm/files.php?message_id=200608141657.k7EGvce2008218@repoman.freebsd.org

notice this:

(http://www.freebsd.org/cgi/cvsweb.cgi/ports/x11-wm/jwm/Makefile.diff?r1=1.11&r2=1.12)

-@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' ${WRKSRC}/example.jwmrc
+@${REINPLACE_CMD} -e 's|%%PREFIX%%|${TARGETDIR}|' ${WRKSRC}/example.jwmrc

Now example.jwmrc will contain GLOBAL system path, not jail-local one,
which is of course wrong.

Please tell that I'm stupid if I am wrong somewhere, but I think
DESTDIR support, being introduced into ports collection in a way it's
currently introduced, will bring much pain.

What I propose is:
- Change variable naming scheme.
All *BASE and *DIR vars should be reverted to their original meanings
(i.e. local paths). Instead, INSTALL_ vars should be introduced:
INSTALL_LOCALBASE=${DESTDIR}/${LOCALBASE}
INSTALL_X11BASE=${DESTDIR}/${X11BASE}
INSTALL_PREFIX=${DESTDIR}/${PREFIX}
INSTALL_DATADIR=${DESTDIR}/${DATADIR}

etc. These should be used in do-install target.

* This is far more clean and understandable, 
* This allows us to make all ports (around 5k) that define do-install target
  DESTDIR-compatible (there still may be issues, but nevertheless).

- Introduce variable DESTDIR_COMPATIBLE to explititely mark
  DESTDIR-compatible ports.
* I don't think DESTDIR compatibility can be tested automatically, so
  this would make freebsd user's life easier (user will be sure that after he
  installs ports into [jail|other freebsd installation mounted via
  nfs|locally] being set corresponging DESTDIR, nothing will break).
  Without such variable, he'll never be sure.
* Port maintainers will know what ports still are to be converted.
  Nothing will be forgotten.

-- 
Best regards,
 Dmitry                          mailto:amdmi3@mail.ru



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