The biggest change is that most of `0001-hacks-for-WebAssembly-build.patch` is eliminated, and the remaining is split up into individual single-purpose patches with corresponding documentation.
Most of `0001-hacks-for-WebAssembly-build.patch` is in fact unnecessary. We can continue to produce `.a` files instead of `.bc` files, and all we have to do to make it build is to set `$(ARCH) = emar` and `$(RANLIB) = emranlib`. In fact, we don't have to set them to anything, since the point of emmake is to set these for us (except emmake uses `$(AR)` so we set `$(ARCH) = $(AR)`).
There are places where `ar` and `cc` etc. are used directly instead of the variables; we use `sed` to fix this in the parent `Makefile` instead of patching.
In addition, there are also the following changes:
- Change the build system to build CLAPACK-WA/INSTALL as well. We should always have built it, but we managed to get away with not doing so due to a bug in emscripten that is fixed in 1.38.43. See https://github.com/iodide-project/pyodide/pull/843#issuecomment-744428471
- Generate `F2CLIB/libf2c/arith.h` properly instead of setting it to an empty file.
- Remove a seemingly unnecessary patch (945f06c46e)
In python's Makefile generated by makesetup, SQLITEBUILD and BZIP2BUILD
are not defined, so we are left with empty -I and -L commands. These
manage to build by virtue of us inserting -I/path/to/sqlite and
-I/path/to/bzip2 to every single build command.
This commit does the same for zlib for consistency.
When sqlite was originally added, the issue
described was bypassed by patching the python files. An alternative
workaround is used here that doesn't require any patching.
1. Split long shell command into multiple commands
2. Make BINARYEN_VERSION a variable instead of hardcoding in Makefile
3. Set Makefile.envs and patches as dependencies
It was changed from 4 to 8 in emscripten 1.38.31. Before the patch,
compiling numpy gives some warnings about redefining SIZEOF_OFF_T, but
as far as I can tell, it did not cause any real issues.