Commit graph

95 commits

Author SHA1 Message Date
Tim Schumacher ee66ed6248 Ports: Fully delete Co-Authored-By lines from the ReadMe
Otherwise, this results in a number of empty lines where
Co-Authored-By would have been.
2022-05-22 00:11:16 +01:00
Tim Schumacher 7550017f97 Ports: Sanitize environment before handling Ports
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.
2022-05-21 18:12:07 +02:00
Ali Mohammad Pur 3a879faba6 Ports: Skip Co-Authored-By lines when generating patch ReadMes 2022-05-19 20:17:10 +04:30
Ali Mohammad Pur dcf8385e5b Ports: Make package.sh dev work with ports that have slashes in $workdir 2022-05-19 20:17:10 +04:30
Ali Mohammad Pur 527502494c Ports: Make the patch auto-import script care about the patch's authors
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.
2022-05-19 20:17:10 +04:30
Daniel Bertalan cccc001ded Ports: Add $STRIP and $HOST_STRIP variables
This fixes stripping the debug information from the gcc port when
building on macOS hosts.
2022-05-12 13:12:37 +02:00
Daniel Bertalan f123fd7af6 Ports: Enable ccache for SERENITY_TOOLCHAIN=Clang 2022-05-12 13:12:37 +02:00
Jelle Raaijmakers 37bbfc1b38 Ports: Improve newline support for ./package.sh dev
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.
2022-05-09 21:18:21 +02:00
Tim Schumacher d8ce2802e0 Ports: Make the number of compile jobs configurable 2022-05-03 22:18:20 +02:00
circl 2130a83640 Ports: Make .hosted_defs.sh usable outside of .port_include.sh
This commit moves some stuff around in order to isolate .hosted_defs.sh
from .port_include.sh
2022-04-26 22:45:48 +02:00
Daniel Bertalan 9a898df1cd Ports: Fix issue with the patches directory being a symlink
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.
2022-04-23 10:43:32 -07:00
Tim Schumacher 4c9fbea987 Revert "Ports: Fix dependency install if port name is not folder name"
This breaks ports whose name may come up in more than one port name.

This reverts commit cc08f82ddb.
2022-04-03 12:32:00 +01:00
EWouters cc08f82ddb Ports: Fix dependency install when port name is not port folder name
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.
2022-04-02 13:12:02 +01:00
Tim Schumacher 1cab2e54e1 Ports: Fail if config.{sub,guess} don't replace existing files
This should help with finding misconfigured config.sub and config.guess
settings.
2022-03-16 14:10:59 +00:00
Daniel Bertalan 4f89f47acb Ports: Download fresh config.guess if needed
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.
2022-03-08 23:30:47 +01:00
Daniel Bertalan aed2e214b6 Ports: Use sed -i for run_replace_in_file on Serenity hosts
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.
2022-03-08 23:30:47 +01:00
Daniel Bertalan 0be67ef12c Ports: Use the objcopy built as part of the toolchain
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).
2022-02-20 23:07:31 +00:00
Ali Mohammad Pur aaa52da97d Ports: Add a pre_install hook 2022-02-12 12:16:59 +01:00
Ali Mohammad Pur e79a766901 Ports: Make 'package.sh dev' a bit more friendly when importing patches
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.
2022-01-27 23:01:05 +01:00
Fragstiller 673e81b90b Ports: Relocate use_fresh_config_sub check to do_configure() 2022-01-22 00:31:57 +03:30
Ali Mohammad Pur 63b02859bc Meta+Ports: Make 'package.sh showproperty' report multiple properties
And use that to avoid shelling out multiple times for checking
properties in lint-ports.py.
2022-01-17 11:17:15 +01:00
Ali Mohammad Pur d543db0286 Ports: Add a 'dev' mode that uses git to autogenerate patches for ports 2022-01-16 10:32:50 +03:30
Ali Mohammad Pur cdd6d68b2a Ports: Remove some config.sub patches and download a fresh one if needed
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.
2022-01-16 10:32:50 +03:30
Noah Rosamilia 860d142c8c Ports: Add interactive mode to .port_include.sh
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.
2022-01-08 22:43:29 -08:00
Andrew Kaster 498d3d8537 Ports: Add $READELF and $HOST_READELF variables to include scripts
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.
2022-01-08 18:56:29 +01:00
Jelle Raaijmakers 28e0aa59a8 Ports: Register all dependencies of ports
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.
2021-10-21 14:48:21 +01:00
Jelle Raaijmakers 7ff99cb516 Ports: Return early in parse_arguments() in .port_include.sh 2021-10-21 14:48:21 +01:00
Daniel Bertalan dabd8dbedd Ports: Make it possible to build (some) ports with Clang
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.
2021-10-17 17:09:58 +01:00
Tim Schumacher c07f91474d Ports: Make array-like settings actual arrays
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.
2021-10-05 02:13:08 +02:00
Tim Schumacher e507cfcdb0 Ports: Set defaults before loading package.sh
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.
2021-10-05 02:13:08 +02:00
sin-ack 06a6b68690 Ports: Make the build step messages use ellipsis rather than excl. point
This stops the port build system from yelling at the user. This commit
also adds a "success" message after the "Adding to database" message.
2021-08-15 14:50:39 +01:00
Gunnar Beutner 6eee60de41 Ports: Make sure HOST_* variables are set correctly for nested builds
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.
2021-08-13 21:29:48 +02:00
Jelle Raaijmakers a76c208bae Ports: Support icons for launchers with arguments 2021-08-04 13:54:08 +01:00
Jelle Raaijmakers 8493477cc7 Ports: Convert only first index of ico files
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.
2021-08-04 13:54:08 +01:00
Jelle Raaijmakers 546af2d9ef Ports: Notify user of missing ImageMagick binaries 2021-08-04 13:54:08 +01:00
Kenneth Myhra f7161b03ca Ports: Add overridable pre_fetch method in .port_include.sh
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.
2021-07-22 22:30:55 +02:00
Linus Groh 6b9e0d98d9 Ports: Add launcher_run_in_terminal package.sh variable
This is being used to generate the RunInTerminal entry in launcher app
files.
2021-07-20 00:58:26 +01:00
pancake f1266335e7 Ports: Add './package.sh shell' to get a shell with the build env set 2021-07-08 15:42:51 +02:00
Gunnar Beutner 8ba0533138 Ports: Add port for DungeonRush 2021-06-16 20:08:13 +02:00
Egor Ananyin 142f9db5bd Ports: Add pre_fetch to .port_include.sh 2021-06-10 20:21:08 +01:00
Max Trussell b889bfe0f6 Ports: .port_include.sh add install_icon function 2021-06-09 17:37:56 +04:30
Gunnar Beutner 46de51f467 Ports: Create launchers for the stpuzzles port
This changes the .port_include.sh script so that ports can more easily
create more than one launcher by making the install_launcher function
available to the port's package.sh script.

This creates launchers for the stpuzzles port in the Games/Puzzles
category.
2021-06-04 09:38:25 +02:00
Gunnar Beutner 101e4233b8 Ports: Don't set the current working directory in the launcher script
This removes the hack for launching Super Mario.
2021-06-04 09:38:25 +02:00
Linus Groh c1b2813ddf Ports: Only do build check for configure, build, and install steps
This was breaking ports linting, which runs the script with the
'showproperty' option. This check is not needed for some other options
as well, so let's do it conditionally.
2021-05-20 20:04:58 +01:00
Linus Groh 068ddf4513 Ports: Add build completion sanity check to .port_include.sh
Simply by checking whether a built libc.so exists, we should be able to
avoid strange build errors where that's not the case and just tell the
user upfront.

Fixes #7309.
2021-05-20 19:41:45 +01:00
Gunnar Beutner 0b47ea408c Ports: Change how we invoke ccache because some ports didn't use it
This prepends ccache to the PATH instead of setting CC/CXX. Doing it
this way ensures all ports use ccache because some of them didn't
before.
2021-04-27 18:01:43 +02:00
Gunnar Beutner 64d05152f7 Ports: Try to download files again when verification fails 2021-04-25 13:30:18 +02:00
Gunnar Beutner 5a3f63ea00 Ports: Remove support for algos other than sha256 and sig 2021-04-25 13:30:18 +02:00
Jelle Raaijmakers 4c26e318a3 Ports: Pass along any command arguments in package.sh
Commit b3db01e20 broke simple commands without arguments like:

  ./package.sh clean

Now, all available arguments are passed along, even if there are none.
2021-04-25 00:38:27 +02:00
Gunnar Beutner b3db01e20e Ports: Detect more types of errors in the AvailablePorts.md file
This adds support for detecting incorrect version numbers and links
in the ports list.

Also, unlike before it doesn't parse the package.sh script but executes
it instead which allows us to detect syntax errors.
2021-04-23 16:11:48 +02:00