mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00:00
Ports: check for native python3 installation, add build script
For python3 cross compilation, a native installation of python3 is needed. This patch adds a build script for python3 to the toolchain and informs the user to run that script if the python port is build and no native python3 with the same major and minor version is being found.
This commit is contained in:
parent
794ca16cca
commit
3c8a1ea386
Notes:
sideshowbarker
2024-07-19 11:05:15 +09:00
Author: https://github.com/lnzero1dev Commit: https://github.com/SerenityOS/serenity/commit/3c8a1ea386f Pull-request: https://github.com/SerenityOS/serenity/pull/772 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bugaevc
3 changed files with 82 additions and 1 deletions
|
@ -1,4 +1,7 @@
|
|||
#!/bin/bash ../.port_include.sh
|
||||
|
||||
source version.sh
|
||||
|
||||
port=python-3.6
|
||||
version=3.6
|
||||
workdir=Python-3.6.0
|
||||
|
@ -6,6 +9,18 @@ useconfigure=true
|
|||
configopts="--build=i686 --without-threads --enable-optimizations"
|
||||
makeopts="-j$(nproc) build_all"
|
||||
installopts="-j$(nproc) build_all"
|
||||
files="https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz Python-3.6.0.tar.xz"
|
||||
files="${PYTHON_URL} ${PYTHON_ARCHIVE}"
|
||||
|
||||
export CONFIG_SITE=$(pwd)/config.site
|
||||
|
||||
if [ -x "$(command -v python3)" ]; then
|
||||
# check if major and minor version of python3 are matching
|
||||
if python3 -c "import sys;sys.exit('.'.join(str(n) for n in sys.version_info[:2]) in '$PYTHON_VERSION')"; then
|
||||
echo 'Error: python3 version does not match needed version to build:' $PYTHON_VERSION >&2
|
||||
echo 'Please build python3.6 with Toolchain/BuildPython.sh !' >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo 'Error: python3 is not installed, please build python3.6 with Toolchain/BuildPython.sh !' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
4
Ports/python-3.6/version.sh
Normal file
4
Ports/python-3.6/version.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
PYTHON_VERSION="3.6.0"
|
||||
PYTHON_MD5SUM="82b143ebbf4514d7e05876bed7a6b1f5"
|
||||
PYTHON_ARCHIVE="Python-$PYTHON_VERSION.tar.xz"
|
||||
PYTHON_URL="https://www.python.org/ftp/python/$PYTHON_VERSION/${PYTHON_ARCHIVE}"
|
62
Toolchain/BuildPython.sh
Executable file
62
Toolchain/BuildPython.sh
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# This file will need to be run in bash, for now.
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
echo "$DIR"
|
||||
|
||||
TARGET=i686-pc-serenity
|
||||
PREFIX="$DIR/Local"
|
||||
SYSROOT="$DIR/../Root"
|
||||
|
||||
source "$DIR/../Ports/python-3.6/version.sh"
|
||||
|
||||
echo PYTHON_VERSION is "$PYTHON_VERSION"
|
||||
echo PYTHON_URL is "$PYTHON_URL"
|
||||
|
||||
echo PREFIX is "$PREFIX"
|
||||
echo SYSROOT is "$SYSROOT"
|
||||
|
||||
mkdir -p "$DIR/Tarballs"
|
||||
|
||||
source "$DIR/UseIt.sh"
|
||||
|
||||
pushd "$DIR/Tarballs"
|
||||
if [ ! -e "$PYTHON_ARCHIVE" ]; then
|
||||
curl -O "$PYTHON_URL"
|
||||
else
|
||||
echo "Skipped downloading Python-$PYTHON_VERSION"
|
||||
fi
|
||||
|
||||
md5="$(md5sum $PYTHON_ARCHIVE | cut -f1 -d' ')"
|
||||
echo "python md5='$md5'"
|
||||
if [ "$md5" != "$PYTHON_MD5SUM" ] ; then
|
||||
echo "python md5 sum mismatching, please run script again."
|
||||
rm $PYTHON_ARCHIVE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "Python-$PYTHON_VERSION" ]; then
|
||||
echo "Extracting python..."
|
||||
tar -xf "$PYTHON_ARCHIVE"
|
||||
else
|
||||
echo "Skipped extracting python"
|
||||
fi
|
||||
popd
|
||||
|
||||
mkdir -p "$PREFIX"
|
||||
mkdir -p "$DIR/Build/python"
|
||||
|
||||
if [ -z "$MAKEJOBS" ]; then
|
||||
MAKEJOBS=$(nproc)
|
||||
fi
|
||||
|
||||
pushd "$DIR/Build/"
|
||||
pushd python
|
||||
"$DIR"/Tarballs/Python-$PYTHON_VERSION/configure --prefix="$PREFIX" || exit 1
|
||||
make -j "$MAKEJOBS" || exit 1
|
||||
make install || exit 1
|
||||
popd
|
||||
popd
|
Loading…
Reference in a new issue