This has two parts:
1. Bottles are temporarily relocated on bottling and tested if that is
sufficient for them to contain no longer reference the prefix or
cellar. If so, they are marked as relocatable.
2. On installation if bottles are marked as relocatable they will be
relocated using install_name_tool to the current prefix and cellar.
ClosesHomebrew/homebrew#18374.
Currently we handle options in several ways, and it is hard to remember
what code needs an option string ("--foo"), what needs only the name
("foo") and what needs an Option object.
Now that Option objects can act as strings and be converted to JSON, we
can start using them instead of passing around strings between Formula
objects, Tab objects, and ARGV-style arrays.
The Options class is a special collection that can be queried for the
inclusion of options in any form: '--foo', 'foo', or Option.new("foo").
We want to be able to use Option objects in place of strings and have
this be transparent. Defining to_str means that methods like
Kernel#system and Kernel#exec will be able to perform an implicit
conversion.
While at it, make it use class methods instead; no reason to instantiate
an object for this.
Eventually there should be some functional tests for the individual
strategies as well.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Simplify access to the different forms of a formula's build options by
making options into real objects rather than strings, and expose both
the 'name' and 'flag' form.
A version scheme is a class that inherits from Version and reimplements
Version#<=>. This will allow formulae to specify a custom comparison
method that will be used instead of the default, for cases where the
default is insufficient.
As options are stored in an object owned by the eigenclass of a formula,
options defined in the Formula#options method can be added multiple
times if the formula is instantiated multiple times.
Store them in a set to prevent duplicates.
FixesHomebrew/homebrew#14133.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Tools like `brew create` need to create and manipulate SoftwareSpec
objects. It is useful to be able to do this directly, rather than by
proxy through the special methods that serve the main formula DSL.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Now that a URL, version, and the (for lack of a better term) "specs"
associated with said URL (e.g. the VCS revision, or a download strategy
hint) are neatly bundled up in a SoftwareSpec object, it doesn't make
sense to pass them individually to download strategy constructors. These
constructors now take only the formula name and a SoftwareSpec as
parameters.
This allows us to move mirror handling out out of Formula#fetch and into
the download strategies themselves. While doing so, we adjust the mirror
implementation a bit; mirrors now assume the same "specs" as their
owner's URL. They are still only useable by the CurlDownloadStrategy,
but this provides a basis for extending mirror support to other
strategies.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
- Formulae can now declare failures on any compiler.
- FailsWithLLVM and associated formula elements have been moved to
compat.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>