Previously we relied on the presence of a `python3` binary in the
PATH that has the correct minor version to build the port.
We now first check for the presence of a `python3.minor` binary
in the PATH and use that if found.
This allows users that have multiple Python versions installed
simultaneously (like from a PPA) to build the port without having
to change their main version.
This now requires `--host` and `--with-build-python` to be passed to the
configure script when cross compiling; the former we simply do like in
many other package.sh scripts as well, the latter we point to `python3`,
which is expected to match the port's version anyway.
Add two patches to allow Python's package manager to work on Serenity:
- The first one enables zlib module, which is needed for `ensurepip`
command;
- The second patch fixes pip downloads, so it's possible to install
packages from the PyPI repository.
Following the pattern for qemu, mold, and clang, we should install the
host python required to build the python port into its own install tree
rather than forcing it into the GNU compiler's bindir.
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.
The --enable-optimizations flag attempts to enable PGO. Profile-guided
optimization is great in general, but will not work at all when doing a
cross-compile. If there's a more fine-grained flag for generic
optimization levels that doesn't try to do PGO, we should enable that
instead. The flag also enables `-fno-semantic-interposition`, but our
GCC patches enable that by default for -fPIC anyway, so that's not
necessary.
The old patch to define `HAVE_SIGSET_T` is no longer needed, as we now
have implementations for `sigwaitinfo` and `sigtimedwait`.
Instead, for the same reason, we now have to remove a reference to
`si_errno`, which we haven't implemented yet but is just assumed to be
there.
It appears that the patch still applied partially, which led to me
believing our changes were fully upstreamed. Only the _uuid module
specific changes didn't apply and are no longer needed, so simply
restore the other ones that I removed.
This was released a couple of days ago, on 2021-12-06 and contains
various changes that we previously needed custom patches for, so we are
now able to remove those and compile more unchanged upstream sources.
Thanks to Rodrigo for making that effort! :^)
The xmlrpc.client module has some trial-and-error logic at module import
time to figure out how to properly format years using strftime. There
have already been problems in the past with this code in Python (see
https://bugs.python.org/issue13305, which is still open), and Serenity
only adds to that.
This problem has been reported at https://bugs.python.org/issue45386, so
hopefully in time we won't need this patch anymore.
Compiling against an OpenSSL thread-enabled shared library (see #10207)
lets Python compile its _ssl module, which yields an importable ssl
module.
The ssl module suffers from the same problem described in #10014 though,
namely that python crashes when importing different modules results in
multiple libcrypto.so loads, and its functions are later invoked by one
of the modules. Once #10277 is merged though the module becomes quite
usable.
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.
Neither the _curses nor the termios module builds to completion
currently due to some missing functions, but we can let it try
nonetheless - it'll likely get fixed at some point :^)
This is used in the setup.py file when adding include and lib paths to
the list when crosscompiling, if it's not found in any of the checked
environment variables they don't get added.
This is used for `sys.platform`, so it's important to get it right and
ideally never change it again. When not cross-compiling this would
append the `uname -r` version number, so let's explicitly override the
generated value and set it to `serenityos`. Various other systems do
this as well.
This makes the following work:
>>> import webbrowser
>>> webbrowser.open("http://serenityos.org")
As well as this well-known easter egg:
>>> import antigravity
Pretty cool! :^)
I have my environment configured to use https://pre-commit.com/.
I guess the scripts were changed recently to lint all ports, and
the python port was barfing on my system because of this bug.
we need to link against LibCrypt and subsubsequently LibCore (which
LibCrypt does not link against itself due to a circular dependency
issue).
Not sure why this broke, it worked when I last updated the port.