Files
synology-open-vm-tools/cross/berkeleydb-5.3
Safihre 6a071f8c24 Python 2.7.14 - Cross compilation overhaul - Generic service
For documentation purposes I want to describe what I have learned after hours and hours of debugging this.

Compilation:
- The changes from 2.7.14 > 2.7.13 in the cross-building are substantial, previous patches don't work anymore.
- We now rely on supplying `--host`, `--target` and `--build` in the compile. Since `--host` and `--build` are already automatically added by the framework, we just need to add `--target`.
- There is no need any more for a separate `PGEN`.
- We should supply `PYTHON_FOR_BUILD` as native/python, but the basic detection in `configure.ac` isn't enough since it doesn't supply `_PYTHON_HOST_PLATFORM` to `setup.py` (needed to enable cross-compiling of Python internal modules).
- The main problem was that the `_sysconfigdata.py` data file was not generated correctly. It contains data of the `native` build and not the real cross-platform. This file is later used when all extension modules are build, it contains all the linker/compiler/directory/etc-flags needed. I spend way too much time trying to patch files while it will all work fine, as long as `_sysconfigdata.py` is generated correctly. When we let `configure` do its job, it will generate the correct `_sysconfigdata.py`.
- In the `install` step of Python it's a complicated situation where we need native/python to compile things but using the `_sysconfigdata.py` of the cross-compiled modules. Therefore we need to copy the library directories of native/python but use the cross-compiled `_sysconfigdata.py`, this needs to be patched in `configure.ac`.
- Python 2 and 3 only support berkleydb v5.3 and not v6.0. As discussed, the extra package `cross/berkleydb-5.3` was created for compatibility.
- On `x64` and `x86` systems the `setup.py` will detect that the build-platform (Ubuntu/Debian) supports multi-arch compiling, even though we are cross-compiling. This results in wrong `-I` command-line options to be added to `_ctypes` building. So we need a patch to disable this detection in `setup.py`.
- Using the container-based TravisCI there seems to be a version of `ncursesw` installed, which causes the `configure` to pick it up. However, this breaks with the cross-compile which has a newer version of `ncurses` and the `setup.py` only wants v5 of `ncursesw`. 
- Forcing of filesystem encoding to UTF8 using the patch is still a required patch for proper functioning of some packages.

Related notes:
- No need for `cross/cryptography`, it can be installed via `requirements.txt` since we already compile dependencies (`cross/cffi` and `cross/openssl`) through `cross/bcrypt`.
- Added `requests` to main Python package due to its wide usage, can later be removed from specific packages.
- Updated `cross/curl` and `cross/libsodium` for compatibility.
- Removed `cross/busybox` dependency and transformed to Generic Service setup.
- Fixed `cross/pyyaml` to detect `libyaml` correctly.
- Patched `configure.ac` to not fail when `ncursesw` is detected, for example for x86 toolchains.
2018-01-13 20:53:04 +01:00
..