Created How to Python (markdown)

Kevin Lange 2016-12-11 23:10:29 +09:00
parent 06462006e0
commit 8891e91bf1

12
How-to-Python.md Normal file

@ -0,0 +1,12 @@
Python will eventually be one of the primary languages for writing userspace applications for ToaruOS, but building it is a little involved right now.
1. **Install Python 3.6 on your host.** Python 3.6 is (as of writing) a release candidate, so you won't be finding it in your package manager's repositories. Install it from source, preferably from the RC release tarball. Python needs a copy of the current version when cross compiling, though I don't know where it gets used.
2. **Have a working Toaru toolchain.** You need the toolchain to cross-compile Python, obviously. Remember if you're trying to build CDs, you want your toolchain to be installed to its own build environment and then sourced.
3. **Do a first-pass build of ToaruOS.** Python depends on `libtoaru-dlfcn.so` to resolve symbols for `ldopen`, and this library is built is part of the userspace build. The library itself only exists to ensure those symbols resolve - the actual definitions live inside the loader. Python will also want the shared libc and libm - building the whole userspace will satisfy this, but you can also just build `hdd/usr/lib/lib{c,m,taoru-dlfcn}.so` if you wish.
4. **Build Python!** Use `toolchain/install-python.sh`. This will clone the Toaru fork of Python 3.6, build it, and do some additional cleanup (including installing symlinks, removing static libraries, removing some broken/unused modules...)
If you are building in the context of a CD, you can run `make cdrom` for the initial build step. You'll want to run `toolchain/install-python.sh` within the context of your CD build directory to ensure that everything is installed correctly. To make sure you have the headers for Python, you'll also need to install it in your actual toolchain sysroot as well, or copy the headers from one to the other.
If everything goes well, you should have a working Python 3.6.
![screenshot of python](http://i.imgur.com/2LUS5Wh.png)