Re: Confused by what make package should do

From: Matthew Phillips <matthew_at_matthewphillips.info>
Date: Fri, 12 Apr 2024 19:50:01 UTC
On Fri, Apr 12, 2024 at 09:30:14PM +0200, Dag-Erling Smørgrav wrote:
> Kurt Hackenberg <kh@panix.com> writes:
> > Matthew Phillips <matthew@matthewphillips.info> writes:
> > > It's trying to install the port itself. To /usr/local/bin specifically.
> > > It seems like it's running `make install` on the ports Makefile.
> > From man ports(7): "package   Make a binary package for the port.  The
> > port will be installed if it has not already been."
> 
> This is both true, in that the `package` target implies the `stage`
> target with does run `make install` in $WRKSRC, and highly misleading,
> because the `stage` target does not install the port to your machine,
> which would require superuser privileges, but to a staging directory,
> which does not.  The `install` target, which implies the `package`
> target, uses `pkg add` to install the package to your machine.

Thank you! This is the missing piece I didn't understand. It's starting
to come together for me.

So now I think it's a problem with the port's Makefile `install` target.
The install target does this:

        install -m 755 snac $(PREFIX)/bin/snac

So I think what I need to do is patch the Makefile to include DESTDIR
like so:

        install -m 755 snac $(DESTDIR)$(PREFIX)/bin/snac

Does that sound right?