Bug 234554 - sysutils/chyves: Not prefix-safe
Summary: sysutils/chyves: Not prefix-safe
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Lars Engels
URL:
Keywords: patch-ready
Depends on:
Blocks:
 
Reported: 2019-01-02 00:22 UTC by Mikhail Teterin
Modified: 2019-01-09 13:06 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (lme)
koobs: merge-quarterly?


Attachments
Add -e to MAKE_ARGS for PREFIX from the environment to overwrite the value set inside Makefile (301 bytes, patch)
2019-01-03 03:28 UTC, Mikhail Teterin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Teterin freebsd_committer 2019-01-02 00:22:18 UTC
My PREFIX is /opt, but trying to build the port displayed errors related to /usr/local

It looks like the port uses a do-patch target to replace references to PREFIX with the values of the PREFIX. Seems like it does not get them all.

The better way of achieving the same is to simply tell make(1) to prefer values of environment variables over those found in the Makefile:

--- Makefile    (revision 489054)
+++ Makefile    (working copy)
@@ -16,7 +16,6 @@
 NO_BUILD=      yes
 NO_ARCH=       yes
 
-do-patch:
-       ${REINPLACE_CMD} 's%\$$(PREFIX)%${STAGEDIR}/$$(PREFIX)%g' ${WRKSRC}/Makefile
+MAKE_ARGS+=    -e
 
 .include <bsd.port.mk>

With the above change, PREFIX used by make will be that found in the MAKE_ENV...
Comment 1 Mikhail Teterin freebsd_committer 2019-01-02 00:26:04 UTC
I apologize, the do-patch is still necessary (though, maybe, it should be post-patch -- in case any real patches are added to the port later).

Adding MAKE_ARGS=-e makes the port PREFIX-safe - and is necessary too.
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-01-02 05:11:38 UTC
Thank you for the report Mikhail

Please include the proposed changes as an attachment, that way we (I) can set maintainer-approval on it as it is a blanket approved change
Comment 3 Mikhail Teterin freebsd_committer 2019-01-03 03:28:30 UTC
Created attachment 200734 [details]
Add -e to MAKE_ARGS for PREFIX from the environment to overwrite the value set inside Makefile
Comment 4 Lars Engels freebsd_committer 2019-01-03 10:41:45 UTC
Mikhail,

thanks for the patch!
But I think it is not necessary:

Try:

$ make PREFIX=/opt
# make PREFIX=/opt install

chyves will get installed into /opt then.
Comment 5 Mikhail Teterin freebsd_committer 2019-01-05 03:13:40 UTC
(In reply to Lars Engels from comment #4)
> $ make PREFIX=/opt

That's because you have it on command line (which seems to be passed to the child make).

If you have it set in /etc/make.conf, you'll get the error I got...
Comment 6 commit-hook freebsd_committer 2019-01-09 13:05:37 UTC
A commit references this bug:

Author: lme
Date: Wed Jan  9 13:05:32 UTC 2019
New revision: 489777
URL: https://svnweb.freebsd.org/changeset/ports/489777

Log:
  sysutils/chyves: Fix installation to custom PREFIX

  PR:		234554
  Submitted by:	mi@

Changes:
  head/sysutils/chyves/Makefile
Comment 7 Lars Engels freebsd_committer 2019-01-09 13:06:07 UTC
I see. Thanks for your patch!