This lets us eliminate the extra arguments on CC and CXX for ports that
care about CC and CXX pointing to actual filenames they can invoke
realpath or basename on.
While `core.autocrlf=false` should be the default, there will certainly
be users that have changed the default setting in their global
configuration.
Ensure that the setting is disabled to avoid accidentally mangling or
not applying our patches.
Some ports may have more than one `config.sub` that is in use (vendored
dependencies, etc.). Instead of fiddling about with space-delimited
strings, let's just make that setting into an array right away.
This keeps users from leaking their host environment variables (CFLAGS,
etc.) into Ports, and it keeps us from leaking Port-specific settings
into their dependencies.
Previously it would commit with the current user's git identity, this
commit makes it ask the user if they want to retain the original
author(s) of the patch as commit authors and co-authors, as well as the
original commit date.
Previously `git am` could fail on patches with Windows line endings
(CRLF). By supplying `--keep-cr`, we prevent git from stripping the CR
from our patches.
The path of the temporary directory should be an absolute path to
account for the patches directory being a symlink like in the upcoming
LLVM port update.
There was a bug in the way the `.port_include.sh` script handled
installing dependencies. According to the
[documentation](https://github.com/SerenityOS/serenity/tree/master/Ports#depends)
the depends array should have port names in it. The port system allows
for the name of the port to be different from the folder where port
lives. Previously the `installdepends` function would cd to the name
of the port, now it will find and run the `package.sh` that has the
line `port=$depend` in it.
The config.guess file needs to know about the SerenityOS `uname -m`
system name if we want to build ports inside Serenity. Support was only
added in January 2022, so most ports don't have a new enough version
yet.
This commit adds facilities for fetching a fresh config.guess file that
supports SerenityOS, similarly to what we do for config.sub. As its
first user, we make the bash port buildable inside the system.
We don't have a perl port, so let's use GNU sed's in-place option for
doing substitutions when running inside Serenity.
Note that we can't do this unconditionally, as `sed -i` is not portable
and works differently on BSD systems.
Relying on host tools working correctly is not a good idea, as they may
be outdated (and therefore not support features like RELR relocations)
or may not exist at all (like objcopy on macOS).
When a git patch that doesn't apply is encountered, start a git am
session and _then_ drop the user in it instead of expeting the user to
start the session on their own.
Also prompt for leftover files and delete them if the user does not want
them.
All of these patches did the same thing, which is already in upstream
config.sub.
With this change, we need only add `use_fresh_config_sub=true` to
the package.sh file.
Note that this is not done automatically in case the port has a modified
config.sub file.
Running `./package.sh interactive` in a port directory will
spawn a new shell with the serenity build environment set up.
This makes porting software much easier as build commands can
be run interactively instead of having to modify package.sh
just to test things.
Ports such as python require a distinction between host readelf and
target readelf. Set a toolchain-specific varaible for these, but be sure
save off the host readelf binary in case anyone needs it later.
This is part of allowing python to build with the Clang toolchain.
Previously, only `manual` installs would register dependencies of an
installed port package. Since in the future we might want to check all
dependents, not only those for manually installed packages, we should
take care to register dependencies for `auto` installs as well.
Additionally, this surpresses some unnecessary verbose output from the
package management and fixes warnings when the package DB directory did
not yet exist.
This commit introduces the changes needed in the port build system that
will allow us to compile ports with Clang. Note that many ports still
don't build, especially due to linker differences. Fixing these is
outside the scope of this PR.
For now, building bash, ncurses and nano is known to work. Bash runs
fine, while nano crashes due to DT_VERSYM not being supported by our
dynamic loader.
We may need entries with spaces in makeopts, installopts, and
configopts, and at that point we should also convert depends and
auth_opts to avoid confusion.
This is too much bash magic for a simple "Use this value if the script
doesn't set anything", especially since only one default setting depends
on values from the script.
When building a port as a dependency for another port the HOST_*
variables were previously initialized with values referring to the
SerenityOS toolchain.
Fixes#9168.
When installing an icon, we fall back to a resizing strategy when an
exact match on the image dimensions is missing. However, if we are
dealing with an `.ico` file with multiple indices, `convert` will
resize every separate index and will create multiple files.
This changes makes sure we only resize the first index. A future
improvement could be to select an index most closely matching the
requested dimensions.
This adds an overridable pre_fetch method which is called from the fetch
method at the very beginning.
The pre_fetch method can be overridden in your package.sh script so that
you can do any necessary preparations before the fetch method is called.