Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2001 13:16:41 +0200
From:      Ruslan Ermilov <ru@freebsd.org>
To:        Nik Clayton <nik@freebsd.org>
Cc:        Sheldon Hearn <sheldonh@starjuice.net>, The Anarcat <anarcat@anarcat.dyndns.org>, freebsd-arch@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: making /usr/share/mk apps PREFIX-independant???
Message-ID:  <20011221131641.A66666@sunbay.com>
In-Reply-To: <20011221100658.M51511@clan.nothing-going-on.org>
References:  <20011221093030.D39918@sunbay.com> <49864.1008924553@axl.seasidesoftware.co.za> <20011221100658.M51511@clan.nothing-going-on.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 21, 2001 at 10:06:58AM +0000, Nik Clayton wrote:
> On Fri, Dec 21, 2001 at 10:49:13AM +0200, Sheldon Hearn wrote:
> > On Fri, 21 Dec 2001 09:30:30 +0200, Ruslan Ermilov wrote:
> > > I'm against PREFIX in share/mk files.  Instead, just setting
> > > DESTDIR=${PREFIX} should (almost) be enough.
> > 
> > I agree.  See ports/mail/popd/Makefile for an example of a port that
> > uses a pure bsd.prog.mk-driven Makefile for ${PREFIX}-sensitive
> > installation.
> 
> Doesn't it strike anyone as being a bit, well, icky, that we have to do
> this for software developed on this platform, using this platform's
> standard infrastructure for defining Makefiles?
> 
> Perhaps just a "USES_BSD_MK=yes" flag to wrap this for other ports as
> well (I'm thinking specifically of the scr* stuff I wrote, but there may
> be others).
> 
You don't listen.  :-)

Just adding PREFIX won't solve anything, as you still need to supply the
correct BINDIR (which is, for the main src/ tree makefiles, initialized
by the root Makefile.inc in each subtree), and provide the correct MANDIR,
LIBDIR, etc.

In the port I maintain (ports/net/tcpmssd), the main program's Makefile
looks like this:

: PROG=           tcpmssd
: PREFIX?=        /usr/local
: BINDIR=         ${PREFIX}/bin
: MAN8=           tcpmssd.8
: MANDIR=         ${PREFIX}/man/man
: 
: .include <bsd.prog.mk>

If you modify it to look like this (that's the goal?):

: PROG=             tcpmssd
: MAN8=             tcpmssd.8
: 
: .include <bsd.prog.mk>

You still need to supply BINDIR and MANDIR somehow.

The following worked for my port flawlessly, but it's a
prototype only, and the complete version should cover all
bsd.own.mk defines:

--- bsd.port.mk~	Wed Nov 28 07:00:36 2001
+++ bsd.port.mk	Fri Dec 21 12:58:53 2001
@@ -1158,6 +1158,10 @@
 MAKE_ENV+=	${INSTALL_MACROS}
 SCRIPTS_ENV+=	${INSTALL_MACROS}
 
+.if defined(USE_BSD_MAKE)
+MAKE_ENV+=	BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/man/man
+.endif
+
 # The user can override the NO_PACKAGE by specifying this from
 # the make command line
 .if defined(FORCE_PACKAGE)

This should work for both /usr/local and /usr/X11R6 prefixes.

I don't pretend that this solution is ideal, as a port may
need different BINDIR settings for its different parts.  I
have given a little thinking to this, just to demonstrate
that the "fixes" should go into ports/Mk, not into the base
.mk files.


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

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




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