2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 # This script builds the official interpreter for the python language,
7 # while also packing in a few default extra packages.
12 # Required fetch artifact
13 clang_bindir
=${MOZ_FETCHES_DIR}/clang
/bin
14 clang_libdir
=${MOZ_FETCHES_DIR}/clang
/lib
15 python_src
=${MOZ_FETCHES_DIR}/cpython-source
18 export PATH
=${clang_bindir}:${PATH}
21 export LDFLAGS
=-fuse-ld=lld
28 macosx_version_min
=11.0
31 macosx_version_min
=10.12
35 # NOTE: both CFLAGS and CPPFLAGS need to be set here, otherwise
36 # configure step fails.
37 sysroot_flags
="-isysroot ${MOZ_FETCHES_DIR}/MacOSX${macosx_sdk}.sdk -mmacosx-version-min=${macosx_version_min}"
38 export CPPFLAGS
=${sysroot_flags}
39 export CFLAGS
=${sysroot_flags}
40 export LDFLAGS
="${LDFLAGS} ${sysroot_flags}"
41 configure_flags_extra
=--with-openssl=/usr
/local
/opt
/openssl
43 # see https://bugs.python.org/issue44065
44 sed -i -e 's,$CC --print-multiarch,:,' ${python_src}/configure
48 # Patch Python to honor MOZPYTHONHOME instead of PYTHONHOME. That way we have a
49 # relocatable python for free, while not interfering with the system Python that
50 # already honors PYTHONHOME.
51 find ${python_src} -type f
-print0 |
xargs -0 perl
-i -pe "s,PYTHONHOME,MOZPYTHONHOME,g"
58 ${python_src}/configure --prefix=/${tardir} --enable-optimizations ${configure_flags_extra} || { exit_status=$? && cat config.log && exit $exit_status ; }
59 export MAKEFLAGS
=-j`nproc`
61 make DESTDIR
=${work_dir} install
64 ${work_dir}/python
/bin
/python3
-m pip
install --upgrade pip
==23.0
65 ${work_dir}/python/bin/python3 -m pip install -r ${GECKO_PATH}/build/psutil_requirements.txt -r ${GECKO_PATH}/build
/zstandard_requirements.txt
67 $
(dirname $0)/pack.sh
${tardir}