Add python3.11 in order to build Mozilla packages

I haven't modified all the reverse-depends to remove the
python-3.12 fixes (only firefox right now)
This commit is contained in:
Rahul Chandra 2023-12-26 02:33:08 -05:00
parent b146348077
commit 105d06c49a
4 changed files with 282 additions and 4 deletions

View File

@ -46,6 +46,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="php.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python3.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python311.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python-modules.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python-dependencies.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ruby.xml"/>

272
general/prog/python311.xml Normal file
View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!-- Remove once mozilla programs can use python 3.12 -->
<!ENTITY python311-download-http
"https://www.python.org/ftp/python/&python311-version;/Python-&python311-version;.tar.xz">
<!ENTITY python311-md5sum "4efe92adf28875c77d3b9b2e8d3bc44a">
<!ENTITY python311-size "19 MB">
<!ENTITY python311-buildsize "301 MB (add 53 MB for tests)">
<!ENTITY python311-time "1.1 SBU (add 3.9 SBU for tests; both using parallelism=4)">
]>
<sect1 id="python311" xreflabel="Python-&python311-version;">
<?dbhtml filename="python311.html" ?>
<title>Python-&python311-version;</title>
<indexterm zone="python311">
<primary sortas="a-Python3.11">Python3.11</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to Python 3.11</title>
<para>
The <application>Python 3.11</application> package contains an
older version of the <application>Python</application> development
environment. This is almost required for building any Mozilla program
(e.g <xref linkend="firefox"/>, <xref linkend="thunderbird"/>, and
<xref linkend="seamonkey"/>) or <xref linkend="qtwebengine"/>)
</para>
<note>
<para>
It is NOT recommended to install this package if you are
not installing one of the above programs.
</para>
</note>
&lfs120_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&python311-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &python311-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &python311-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &python311-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &python311-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Python 3.11 Dependencies</bridgehead>
<bridgehead renderas="sect4">Recommended</bridgehead>
<para role="recommended">
<xref linkend="sqlite"/> (required if building firefox or thunderbird)
</para>
<bridgehead renderas="sect4">Optional</bridgehead>
<para role="optional">
<xref linkend="bluez"/>,
<xref linkend="gdb"/> (required for some tests),
<xref linkend="valgrind"/>, and
<ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
</para>
<para condition="html" role="usernotes">Editor Notes:
<ulink url="&blfs-wiki;/Python3"/>
</para>
</sect2>
<sect2 role="installation">
<title>Installation of Python 3.11</title>
<para>
Install <application>Python 3.11</application> by running the following
commands:
</para>
<screen><userinput>CXX="/usr/bin/g++" \
./configure --prefix=/opt/python3.11 \
--disable-shared \
--with-system-expat &amp;&amp;
make</userinput></screen>
<para>
To test the result, issue <command>LC_ALL=en_US.UTF-8
make test</command>.
Some tests may need an Internet connection.
</para>
<para>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>make install</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para>
<command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
message during configuration.
</para>
<para>
<parameter>--prefix=/opt/python3.11</parameter>: This installs python 3.11
into /opt in order to avoid conflicts with the system version of python, and
allow for easy removal/isolation once programs update to python3.12.
</para>
<para>
<parameter>--disable-shared</parameter>: This switch disables building shared
libraries. Since all the packages that need python-3.11 have built in modules and
don't directly link to python, it is safe to turn off shared library support.
</para>
<para>
<parameter>--with-system-expat</parameter>: This switch enables linking
against the system version of <application>Expat</application>.
</para>
<!--
<para>
<parameter>- -with-ensurepip=yes</parameter> : This switch enables building
the <command>pip</command> and <command>setuptools</command> packaging
programs. <command>setuptools</command> is needed for building some
Python modules.
</para>
-->
<!--
This was removed from the book
<para>
<option>- -with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
if you want to build the <application>Python</application> DBM Module
against <application>Berkeley DB</application> instead of
<application>GDBM</application>.
</para>
-->
<para>
<parameter>--enable-optimizations</parameter>: This switch enables
stable, but expensive, optimizations.
</para>
</sect2>
<sect2 role="configuration">
<title>Configuring Python 3.11</title>
<para>
In order to maintain compatibility with programs that look for it,
optionally, create the following versioned symlink to run python3.11,
</para>
<screen role="root"><userinput>ln -svfn /opt/python3.11/bin/python3.11 /usr/bin/python3.11</userinput></screen>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>
python3.11
</seg>
<seg>
libpython3.11.a
</seg>
<seg>
/opt/python3.11/include/python3.11, and
/opt/python3.11/lib/python3.11,
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<!--
<varlistentry id="2to3">
<term><command>2to3</command></term>
<listitem>
<para>
is designed to assist in the transition between python2 and python3
by automatically converting code to be Python3 compatible.
</para>
<indexterm zone="python3 2to3">
<primary sortas="b-2to3">2to3</primary>
</indexterm>
</listitem>
</varlistentry>
Put here for easy use when removing Python2 -->
<!--
<varlistentry id="easy_install">
<term><command>easy_install</command></term>
<listitem>
<para>
is a frontend to pip3 to make it easier to configure python modules
through the PIP package manager
</para>
<indexterm zone="python3 easy_install">
<primary sortas="python3 easy_install">easy_install</primary>
</indexterm>
</listitem>
</varlistentry>
-->
<varlistentry id="python311-ver">
<term><command>python3.11</command></term>
<listitem>
<para>
is a version-specific name for the <command>python</command>
program
</para>
<indexterm zone="python311 python311-ver">
<primary sortas="b-python3.11">python3.11</primary>
</indexterm>
</listitem>
</varlistentry>
<!--
<varlistentry id="pyvenv">
<term><command>pyvenv</command></term>
<listitem>
<para>
creates virtual <application>Python</application> environments in
one or more target directories.
</para>
<indexterm zone="python3 pyvenv">
<primary
sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
</indexterm>
</listitem>
</varlistentry>
-->
</variablelist>
</sect2>
</sect1>

View File

@ -345,6 +345,9 @@
<!ENTITY python3-lib-suffix "cpython-&python3-major;&python3-minor;-&lt;arch&gt;-linux-gnu">
<!ENTITY python3-site "/usr/lib/python&python3-majorver;/site-packages">
<!-- Remove once mozilla programs can use python 3.12 -->
<!ENTITY python311-version "3.11.1">
<!ENTITY ruby-minor-version "3.2">
<!ENTITY ruby-patch-version "2">
<!ENTITY ruby-version "&ruby-minor-version;.&ruby-patch-version;">

View File

@ -145,7 +145,7 @@ tar: Exiting with failure status due to previous errors
<xref linkend="alsa-lib"/> if you edit the mozconfig;
now deprecated by mozilla), in either case please read the
Configuration Information,
<xref linkend="python3"/> (rebuilt after installing <xref linkend="sqlite"/>),
<xref linkend="python311"/> (built after installing <xref linkend="sqlite"/>),
<xref linkend="six"/>,
<xref linkend="startup-notification"/>, and
<xref linkend="unzip"/>
@ -191,6 +191,7 @@ tar: Exiting with failure status due to previous errors
<sect2 role="installation">
<title>Installation of Firefox</title>
<!--
<para>
The building system ships several internal copies of the Python 3
modules <application>setuptools</application> and
@ -231,6 +232,7 @@ sed -e '/^import/s/imp$/importlib.util/' \
spec.loader.exec_module(mod)/" -i python/mach/mach/main.py &amp;&amp;
sed '/import imp/d' -i netwerk/dns/prepare_tlds.py
</userinput></screen>
-->
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1859752
https://hg.mozilla.org/try/rev/d5f3b0c4f08a -->
@ -420,8 +422,8 @@ echo "613364a7-9418-4c86-bcee-57e32fd70c23" > mozilla-key</userinput></screen>
<screen><userinput>export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none &amp;&amp;
export MOZBUILD_STATE_PATH=${PWD}/mozbuild &amp;&amp;
./mach configure &amp;&amp;
./mach build</userinput></screen>
python3.11 ./mach configure &amp;&amp;
python3.11 ./mach build</userinput></screen>
<para>
The <filename>mozconfig</filename> above disables the tests because
@ -438,7 +440,7 @@ export MOZBUILD_STATE_PATH=${PWD}/mozbuild &amp;&amp;
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none ./mach install</userinput></screen>
<screen role="root"><userinput>MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none python3.11 ./mach install</userinput></screen>
<para>
Empty the environment variables which were set above: