Bug 245637 - Mk/bsd.java.mk: Allow ports to override make targets and include <bsd.port.pre.mk>
Summary: Mk/bsd.java.mk: Allow ports to override make targets and include <bsd.port.pr...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-java (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-15 12:12 UTC by Angelo Polo
Modified: 2020-07-25 22:35 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Angelo Polo 2020-04-15 12:12:32 UTC
Currently, if a port has USES_JAVA=yes, .include <bsd.port.pre.mk>, and overrides a make target (e.g. do-build:), then the following warnings are produced when invoking make on the port:

make: "/usr/ports/c/p/Makefile" line XX: warning: duplicate script for target "do-build" ignored
make: "/usr/ports/Mk/bsd.java.mk" line 400: warning: using previous script for "do-build" defined here

See bug #224948 for corresponding fixed issue in Mk/Uses/go.mk.
Comment 1 Greg Lewis freebsd_committer 2020-07-19 05:24:17 UTC
I think it's more specific than this.  From what I can see, you not only have to have USE_JAVA=yes, you also have to have USE_ANT=yes.  In that case, if you define do-build that will cause problems.

I guess you'd have to move things around in bsd.java.mk to fix this.  In particular, you'd need to move the do-build section and associated .if into something which was only included after bsd.port.post.mk was.  I tried something like the change to go.mk and it didn't work for me, so maybe there is more to move.

Do you have a port that needs to build with ant for which the default do-build doesn't work?
Comment 2 Angelo Polo 2020-07-19 11:20:38 UTC
(In reply to Greg Lewis from comment #1)

Yes, I think you're right, it's really because of USE_ANT=yes. Check out the databases/cassandra4 Makefile for a future release:

https://github.com/polo-language/cassandra4/blob/604340c7be44b7cc6686c7911fa1f506938c6f0e/Makefile

The current release has the same problem, just 'less' of it:
https://svnweb.freebsd.org/ports/head/databases/cassandra4/Makefile?revision=534966&view=markup

I've started to wonder if I should drop USE_ANT and manage the tooling in the port script. But obviously a general fix would be even better.