Serenity Operating System
at master 60 lines 2.2 kB view raw
1#!/usr/bin/env -S bash ../.port_include.sh 2 3source version.sh 4 5export PATH="${SERENITY_SOURCE_DIR}/Toolchain/Local/python/bin:${PATH}" 6 7port='python3' 8version="${PYTHON_VERSION}" 9workdir="Python-${version}" 10useconfigure='true' 11use_fresh_config_sub='true' 12files="${PYTHON_ARCHIVE_URL} ${PYTHON_ARCHIVE} ${PYTHON_ARCHIVE_SHA256SUM} 13https://raw.githubusercontent.com/python/cpython/942dd9f3f77eef08fabddbd9fb883a866ad6d4cb/PC/pycon.ico launcher.ico 55c1e1fcabc2f254a6d02242912359d29f141d11c4892c20375d58b6dcd89ac0" 14auth_type='sha256' 15launcher_name='Python' 16launcher_category='Development' 17launcher_command='/usr/local/bin/python3' 18launcher_run_in_terminal='true' 19icon_file='../launcher.ico' # This is an older icon that's downloaded separately, so we need to go outside of $workdir 20depends=( 21 'bzip2' 22 'libffi' 23 'libuuid' 24 'ncurses' 25 'openssl' 26 'readline' 27 'sqlite' 28 'termcap' 29 'zlib' 30) 31configopts=( 32 '--disable-ipv6' 33 '--enable-shared' 34 '--without-ensurepip' 35 '--with-build-python=python3' 36 'ac_cv_file__dev_ptmx=no' 37 'ac_cv_file__dev_ptc=no' 38) 39 40export BLDSHARED="${CC} -shared" 41 42configure() { 43 run ./configure --host="${SERENITY_ARCH}-pc-serenity" --build="$($workdir/config.guess)" "${configopts[@]}" 44} 45 46# Note: The showproperty command is used when linting ports, we don't actually need python at this time. 47if [ "$1" != "showproperty" ]; then 48 if [ -x "$(command -v python3)" ]; then 49 # Check if major and minor version of python3 are matching 50 if ! python3 -c "import sys; major, minor = map(int, '${PYTHON_VERSION}'.split('.')[:2]); sys.exit(not (sys.version_info.major == major and sys.version_info.minor == minor))"; then 51 echo "Error: python3 version does not match needed version to build ${PYTHON_VERSION}" >&2 52 echo "Build this Python version on your host using Toolchain/BuildPython.sh or install it otherwise and try again." >&2 53 exit 1 54 fi 55 else 56 echo "Error: python3 is not installed but is required to build ${PYTHON_VERSION}" >&2 57 echo "Build this Python version on your host using Toolchain/BuildPython.sh or install it otherwise and try again." >&2 58 exit 1 59 fi 60fi