8 How to Python
K Lange edited this page 2018-10-06 22:59:26 +09:00

Since 251bd8d, ToaruOS-NIH's C library has been capable of building Python using the following steps:

  1. Install Python 3.6 locally. Python requires that you have the same version as you trying to build when cross-compiling.

  2. Activate the ToaruOS toolchain so that i686-pc-toaru-gcc is in your path:

    source util/activate.sh

  3. Clone the nih branch of https://github.com/klange/cpython to a directory.

  4. Configure Python as follows:

    ./configure --disable-ipv6 --enable-shared --host=i686-pc-toaru --build=i686 --prefix=/usr/python ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_func_dlopen=yes ac_cv_func_wait3=no ac_cv_var_tzname=no ac_cv_func_unsetenv=no ac_cv_var_putenv=no ac_cv_header_sys_lock_h=no ac_cv_header_sys_param_h=no ac_cv_header_sys_resource_h=no ac_cv_header_libintl_h=no ac_cv_func_sigaction=no

  5. Run make to build Python.

  6. Install Python to the the ToaruOS filesystem base directory:

    make DESTDIR="$TOOLCHAIN/../base" commoninstall bininstall

  7. Return to your ToaruOS checkout and run the following to clean up unused parts of the Python installation and reduce its size:

    util/fix-python.sh