1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-05 19:34:52 +00:00
Commit Graph

157 Commits

Author SHA1 Message Date
Jelle Raaijmakers
5bfc61bc69 Ports: Actually clean port build directory
The functionality for `./package.sh clean` was a bit weird: based on
whether you were working in dev mode, it would try to delete either
`$workdir` or `$nongit_workdir` and `*.out` from your `pwd`.

The new functionality is pretty clear: `./package.sh clean` deletes the
entire build directory for the port regardless of what mode you're in,
`./package.sh clean_dist` removes all `$files`, and
`./package.sh clean_all` does both.
2022-09-13 13:44:01 -04:00
Tim Schumacher
75a1442aac Ports: Move build directories into Build/ 2022-07-13 21:22:52 +01:00
Tim Schumacher
5bbd5e7322 Ports: Don't create ccache symlinks for tools we don't have 2022-07-07 19:32:33 +02:00
Andrew Kaster
ad0a001f0a Ports: Use $arch-serenity-pc-clang{++} for CC and CXX
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.
2022-06-19 09:05:35 +02:00
Andrew Kaster
8c877664f7 Ports: Add variables for Toolchain binary directory and cxxfilt 2022-06-19 09:05:35 +02:00
Tim Schumacher
e29e4e6c1f Ports: Ensure that core.autocrlf is disabled before handling patches
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.
2022-06-17 09:47:57 +01:00
Timur Sultanov
35d31dec7e Ports: Add option to disable ccache 2022-06-12 00:28:26 +01:00
Tim Schumacher
d426c5a4b2 Ports: Format patches without numbering, commit hash or version number 2022-06-08 17:58:36 +01:00
Tim Schumacher
d69a79b03b Ports: Automatically enter the work directory when running dev 2022-06-08 17:58:36 +01:00
Tim Schumacher
8a5941e294 Ports: Force-add all files when entering dev
This keeps us from accidentally excluding files that are listed in the
`.gitignore` but that are included in the tarball anyways.
2022-06-01 11:02:34 +01:00
Tim Schumacher
f81e47eea8 Ports: Allow selecting multiple config_{sub,guess}_paths
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.
2022-05-25 22:54:04 +01:00
Tim Schumacher
ff90647958 Ports: Fix a typo in get_new_config_guess
While we're at it, we might as well replace the download arguments in
`get_new_config_{sub,guess}` with the variable we defined earlier.
2022-05-25 22:54:04 +01:00
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
Gunnar Beutner
e72235b981 Ports: Add launchers for some of the ports 2021-04-23 11:33:57 +02:00
Gunnar Beutner
4115fcc933 Ports: Build ports only once when running build_all.sh
Previously we'd end up building some ports multiple times, e.g.
as a dependency for another port. This changes the build_all.sh
script so that it builds ports only once.
2021-04-21 23:41:48 +02:00
Gunnar Beutner
6eedb570a2 Ports: Enable building ports with ccache 2021-04-18 10:42:41 +02:00
Gunnar Beutner
28b3c8bc1d Port: Support running some configure/build commands with the host toolchain
This is useful for ports which depend on running tools on the host system.
In this case we can build the port twice - once for the host and once for
the target system.
2021-04-14 21:46:20 +02:00
Gunnar Beutner
8874b4b4fe Ports: Make sure pkg-config only picks up packages from the target 2021-04-14 21:46:20 +02:00
Peter Elliott
fbbb4b3395 Ports: fallback to pro when curl is not installed 2021-04-12 14:06:24 +02:00
Peter Elliott
f71102a474 Ports: Require less commands in .port_include.sh
- fallback to http with curl when https fails
- add --no-gpg-verification, which will skip gpg signature verification
2021-04-12 14:06:24 +02:00
Peter Elliott
938924f36d Meta: Add install-ports CMake target
install-ports copys the necessary files from Ports/ to /usr/Ports. Also
refactor the compiler and destiation variables from .port_include.sh
into .hosted_defs.sh. .hosted_defs.sh does not exists when ports are
built in serenity
2021-04-12 14:06:24 +02:00
Linus Groh
15a820e9ad Ports: Use SERENITY_ARCH in .port_include.sh if already defined
Instead of always hardcoding i686, only use it as fallback value as we
already do in other scripts.
2021-03-13 13:13:03 +01:00
Linus Groh
4c497228a9 Ports: Use SERENITY_ARCH in --target/--host
Recent ports already do this, let's update the others as well. One step
closer to multi-arch support for ports! :^)
2021-03-13 13:13:03 +01:00
Linus Groh
7cb9237be9 Ports: Remove/replace hardcoded i686-pc-serenity-{gcc,g++,ar,ranlib}
Except in the Lua port's Makefile patch, I couldn't figure this out...
2021-03-13 13:13:03 +01:00
Linus Groh
f318ab6bed Ports: Replace hardcoded Build/ paths with SERENITY_BUILD_DIR
Fixes #5710.
2021-03-11 21:01:29 +01:00
Linus Groh
92ca22a5e1 Ports: Add post_configure function
There's pre_configure to do things required by the configure script,
let's also add post_configure for things not covered by the configure
script.
The specific use case is overwriting a file created by python3's
configure script.
2021-02-02 16:53:06 +01:00
Linus Groh
02520f16e3 Ports: Move packages.db from Ports/ to Build/
When removing and recreating the Build directory, it's quite annoying
having to edit/remove Ports/packages.db as the installer won't install
previously installed port dependencies again if they're still listed.
This problem is easily solved by just considering packages.db a
build-specific file.
2021-02-01 19:40:34 +01:00
TheMorc
d4668507d4 Ports: Improve configure script
Just a small modification so that ports that are configured e.g.
using cmake don't need a dummy configure file anymore.
2021-01-25 22:34:43 +01:00
Linus Groh
a4fbdb97c7 Ports: Install dependencies in separate "installdepends" step
Calling installdepends in do_fetch seems kinda silly and unexpected.
Let's add a separate step with the same name instead.
2021-01-23 08:28:25 +01:00
Jonathan Turner
0bf5669ba3
Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
Linus Groh
2bc9726e3c Ports: Rename a few .diff files to .patch
Let's keep things consistent, .diff is the name we use pretty much
everywhere. Also tweak the glob in .port_includes.sh to be
'patches/*.patch' rather than just 'patches/*'.
2021-01-17 08:43:46 +01:00
Dan MacDonald
b7fd5315e5
Ports: Hard-code SERENITY_ARCH=i686 until other architectures work (#4688) 2020-12-31 21:54:51 +01:00
meme
23b23cee5a Build: Support non-i686 toolchains
* Add SERENITY_ARCH option to CMake for selecting the target toolchain
* Port all build scripts but continue to use i686
* Update GitHub Actions cache to include BuildIt.sh
2020-12-29 17:42:04 +01:00
Nico Weber
33d6d640d3
Ports: Use keyserver.ubuntu.com as .sig keyserver (#2535)
Increases the number of successfully building ports from
27 to 36 (of 56) on my system.
2020-06-09 21:10:00 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Linus Groh
7feb48b1da Ports: Support pre_configure script
This is useful if we want to do something after patching but before
running the configure script - e.g. creating the configure script using
another script :^)
2020-04-15 16:39:09 +02:00
Andreas Kling
f5418f40cc Ports/bash: Make a /bin/bash symlink to /usr/local/bin/bash
I've added a post_install step to the system that allows you to run
arbitrary commands after the regular install step.

This allows scripts that start with "#!/bin/bash" to work in Serenity.
2020-03-25 15:55:28 +01:00
Emanuel Sprung
991953ab0a Ports: Improve port build sript
* Add authenticity methods: sig, asc, md5sum, sha1sum, sha256sum
* Split patch into own step
* Improve extraction and patching: only do it, if it hasn't already be done,
  to do that, hidden files are created when a file is extracted or a patch is
  applied
* Patch function is named patched_internal to not overwrite patch command in /usr/bin
2020-02-06 14:06:23 +01:00
Sergey Bugaev
ccfc9d8923 Ports: Do not download sources if they're already present
When running ./package.sh to rebuild an already installed port, we would not
want to spend time re-downlodaing the same tarball again. Ideally, this should
use some sort of hash checking to ensure the file is not truncated or something,
but this is good enough for now.
2019-12-23 14:55:17 +01:00
joshua stein
73c953b674 Build: get rid of UseIt.sh
The build system uses relative paths to the toolchain binaries, so
modifying $PATH is no longer necessary, and nothing needs
$SERENITY_ROOT anymore.
2019-12-20 23:55:08 +01:00
Larkin
e5e0924c0b Ports: Use unzip to extract zips if bsdtar unavailable (#855) 2019-12-06 19:45:57 +01:00
Dan MacDonald
d76fb99403 Ports: Add support for zip files and ensure configure is executable (#773) 2019-11-13 17:22:24 +01:00
Andreas Kling
3d239be7b4 Ports: Undo POSIX sh compliance changes for now
Partial revert of 704f48d7f3.
These changes made the ports system unusable.
2019-11-03 10:05:02 +01:00
George Pickering
704f48d7f3 POSIX compliance: (most) shell scripts converted to generic shell
Ports/.port_include.sh, Toolchain/BuildIt.sh, Toolchain/UseIt.sh
have been left largely untouched due to use of Bash-exclusive
functions and variables such as $BASH_SOURCE, pushd and popd.
2019-11-03 09:26:22 +01:00
Larkin Nickle
8060749d04 Ports: Update uninstall function to use $SERENITY_ROOT
Now uninstalling should just work once we have plists in place.
2019-09-24 15:39:35 +02:00
Larkin
18249b5996 Ports: Switch to new ports system (#594)
Much redundancy is removed from package scripts with this system.
It also supports simple dependency management, uninstalling (through
BSD ports style plist files), cleaning up after itself (with clean,
clean_dist, clean_all commands), etc.
2019-09-24 08:56:39 +02:00
Andreas Kling
bc2bd1e64a Ports: Always export Serenity's GCC and G++ in the build environment
Export the appropriate CC and CXX to all port commands.
2019-09-06 20:33:18 +02:00
Dan MacDonald
362ac8f1ba Ports: Force curl to follow redirects in run_fetch_web() (#266)
This fixes downloading files from github when building ports.
2019-07-01 20:57:46 +02:00
Andreas Kling
2daf89e2f7 Ports: Fix SDL2 port trying to build against PulseAudio for some reason.
I didn't look into why, but for some reason the SDL2 cmake build system
thinks it should build against PulseAudio which we definitely don't have.
So just tell it explicitly not to do that.

Fixes #265.
2019-07-01 14:08:15 +02:00
Larkin Nickle
d080f6e8dd Ports: Remove bashisms and switch all scripts to /bin/sh. 2019-06-05 14:00:01 +02:00
Robin Burchell
b7d315319d Ports: Add links
Doesn't actually run yet. in_term's read() fails with EFAULT for reasons that
are presently beyond me, points to a bug in Serenity.
2019-05-28 20:06:47 +02:00