Page MenuHomeFreeBSD

Add a simple way to have USES add targets.
ClosedPublic

Authored by mat on Jul 15 2015, 2:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 26, 9:50 AM
Unknown Object (File)
Mon, Nov 25, 7:54 PM
Unknown Object (File)
Mon, Nov 25, 12:53 PM
Unknown Object (File)
Sat, Nov 23, 10:58 PM
Unknown Object (File)
Sat, Nov 23, 2:48 AM
Unknown Object (File)
Sat, Nov 23, 1:31 AM
Unknown Object (File)
Sat, Nov 23, 12:42 AM
Unknown Object (File)
Thu, Nov 21, 10:00 AM

Details

Reviewers
None
Group Reviewers
portmgr
Commits
rP394503: Rewrite the target ordering code.
Summary

This allows USES to add targets easily and have them run whenever they want without touching bsd.port.mk.

To add a target that runs around the time post-configure run, do:

_USES_configure+=  700:my-post-configure
my-post-configure:
        do something

To fine tune when the target is ran, look at the values in the *_SEQ variables at the end of bsd.port.mk, and the other USES.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mat retitled this revision from to Add a simple way to have USES add targets..
mat updated this object.
mat edited the test plan for this revision. (Show Details)
mat edited edge metadata.

Convert a few other targets.

Note that libtool and autoreconf are now most likely not being run in the same
order as before, which is bad, obviously.

Convert to a numbering order scheme.

  • No real need to check if the target exists, it has a new name now.
  • dos2unix
  • erlang (and us real do-* targets)
  • uniquefiles.
  • webplugin
  • Add sanity to the list.
  • zope.
  • ncurses.
  • Always put the _USES_foo just before the target.

With a version that actually passes make -V *_SEQ

With the _EXTRACT_SEQ correctly numbered.

  • Correct documentation, wrap, and put additions at the end of the

I like it a lot!

code looks ok to me, I would like a file to list the targets so one can easily figure out which slots is available and in which order they are going to be run :)

Mk/Uses/display.mk
30 ↗(On Diff #7258)

why turning it in :: ?

Mk/Uses/zope.mk
83 ↗(On Diff #7258)

I suspect :: is not needed anymore

mat marked an inline comment as done.Jul 27 2015, 3:14 PM
In D3099#64349, @bapt wrote:

I like it a lot!

good :-)

I also did an exp-run, on friday/saturday with that, I have not looked at the result yet.

code looks ok to me, I would like a file to list the targets so one can easily figure out which slots is available and in which order they are going to be run :)

Well, maybe a target could be added, say, you run make all-targets or make targets, or something and it tells you all targets that can be run and the order, for the first, and the targets that will really be run, with the order, for the second ?

Or am I not getting what you are saying ?

Mk/Uses/display.mk
30 ↗(On Diff #7258)

Mmmm, no reason, I'll revert, I was under the impression that it was the same, but no need to change that.

Mk/Uses/zope.mk
83 ↗(On Diff #7258)

true.

mat marked an inline comment as done.

Targets don't need to be PHONY or :: any more.

code looks ok to me, I would like a file to list the targets so one can easily figure out which slots is available and in which order they are going to be run :)

Well, maybe a target could be added, say, you run make all-targets or make targets, or something and it tells you all targets that can be run and the order, for the first, and the targets that will really be run, with the order, for the second ?

it exists:

make -V.ALLTARGETS

But that is not what I am asking for :)

Or am I not getting what you are saying ?

I would like a files with the complete list of what exists (not only for my port)
because we have numbered them for a reason: always control in which order they will be run.
so haveing a target.list with <number>: name
will allow to have a quick view on the slots already used and what number I should pick because I'm about to add a new target in the Mk/Uses/*

In D3099#64712, @bapt wrote:

I would like a files with the complete list of what exists (not only for my port)
because we have numbered them for a reason: always control in which order they will be run.
so haveing a target.list with <number>: name
will allow to have a quick view on the slots already used and what number I should pick because I'm about to add a new target in the Mk/Uses/*

Well, this file would need to be generated anyway, because otherwise, it would mean it would have to be kept in sync with the code, which will never work.

It would work if the number was actually picked from that file instead of XXX:bla just use bla and if no number is assigned in targetlist.txt yell

In D3099#64732, @bapt wrote:

It would work if the number was actually picked from that file instead of XXX:bla just use bla and if no number is assigned in targetlist.txt yell

Been thinking about it some more on IRC, the only way I see it working is if targetlist.txt is a file that is not used for anything except as a reference of the existing targets, and that is regenerated by some script each time a target is added.

If something needs to be read from this file, then, it defeats the purpose of the _USES_* variables, which were here so that people would not touch bsd.port.mk when adding a target to USES, then, if it's a Makefile, it would replace all the _*_SEQ variables and be included here, so it would not be different than keeping it here, and if it's not a Makefile, it needs to be parsed, and it would mean adding a lot of cycles each time bsd.port.mk is parsed because it'd be some kind kind of run-this-command target.

  • Move the options target helper numbering in bsd.options.mk.
  • Allow the port's Makefile to override the priority of an option target
  • Make it work if the variable is not set.

With the latest addition, I can change the priority of an option target helper in each Makefile. For example, the default being:

$ make -V OPTIONS_TARGET_ORDER_OVERRIDE -V _PATCH_SEQ:M*PTHREAD* -V _PATCH_REAL_SEQ

300:pre-patch-PTHREAD-on 700:post-patch-PTHREAD-on
ask-license patch-message patch-depends do-patch post-patch post-patch-PTHREAD-on

can be changed:

$ make -V OPTIONS_TARGET_ORDER_OVERRIDE -V _PATCH_SEQ:M*PTHREAD* -V _PATCH_REAL_SEQ
690:post-patch-PTHREAD-on
300:pre-patch-PTHREAD-on 690:post-patch-PTHREAD-on
ask-license patch-message patch-depends do-patch post-patch-PTHREAD-on post-patch
mat marked 3 inline comments as done.
  • Remove ::, not needed any more.
  • Move the OPTIONS_TARGET_ORDER_OVERRIDE into a more generic TARGET_ORDER_OVERRIDE.
  • Make it work with fmake, and remove warning.
  • Document TARGET_ORDER_OVERRIDE.
antoine added inline comments.
Mk/bsd.port.mk
5607 ↗(On Diff #7716)

Shouldn't this be ${_OPTIONS_package} ?

Mk/bsd.port.mk
5607 ↗(On Diff #7716)

it should.

mat marked 2 inline comments as done.Aug 9 2015, 12:29 PM
  • Forgot to cleanup the _OPTIONS_*_package variables.
  • Change the way options targets are implemented, and add do- to the list
This revision was automatically updated to reflect the committed changes.