Download standard libraries in a zipfile. ### Description

This is a re-work of #3166. After this PR, the standard libraries are not vendored with `pyodide.asm.data`. Instead, it is now downloaded separately in a zip file similar to how we download pyodide_py.tar.

~~The hard part of this PR is to bootstrap Python without Python source codes. This requires deep-freezing all modules that are required during the bootstrap.~~

~~As mentioned in #3539, `encodings` module is needed during the bootstrap stage, but it is a large module (> 1.0MB) containing a bunch of encodings in the world, so I tried to freeze a subset of the encodings module that is used in the bootstrap (thanks for the idea from Hood), so the size increase of pyodide.asm.wasm is only 70KB.~~

~~However, the problem of freezing only part of the module is that the current Python import system does not support it. Therefore, I added some hacks to make it work, which is explained in a comment in pyodide.ts.~~

### File size change after this PR:

Before

```
- pyodide.asm.data:
    Original size: 4555 KB
    Gzip compressed size (level 1): 3062 KB
    Gzip compressed size (level 6): 2911 KB
    Gzip compressed size (level 9): 2911 KB
    Brotli compressed size: 2522 KB
- pyodide.asm.js:
    Original size: 1186 KB
    Gzip compressed size (level 1): 246 KB
    Gzip compressed size (level 6): 208 KB
    Gzip compressed size (level 9): 208 KB
    Brotli compressed size: 169 KB
- pyodide.asm.wasm:
    Original size: 8715 KB
    Gzip compressed size (level 1): 3142 KB
    Gzip compressed size (level 6): 2791 KB
    Gzip compressed size (level 9): 2791 KB
    Brotli compressed size: 2096 KB
```

After

```
- pyodide.asm.data:
    Original size: 4 KB
    Gzip compressed size (level 1): 0 KB
    Gzip compressed size (level 6): 0 KB
    Gzip compressed size (level 9): 0 KB
    Brotli compressed size: 0 KB
- pyodide.asm.js:
    Original size: 1086 KB
    Gzip compressed size (level 1): 213 KB
    Gzip compressed size (level 6): 177 KB
    Gzip compressed size (level 9): 177 KB
    Brotli compressed size: 145 KB
- pyodide.asm.wasm:
    Original size: 8775 KB
    Gzip compressed size (level 1): 3162 KB
    Gzip compressed size (level 6): 2806 KB
    Gzip compressed size (level 9): 2806 KB
    Brotli compressed size: 2105 KB
- python_stdlib.zip:
    Original size: 2230 KB
    Gzip compressed size (level 1): 2196 KB
    Gzip compressed size (level 6): 2194 KB
    Gzip compressed size (level 9): 2194 KB
    Brotli compressed size: 2181 KB
```


### Remaining works:

- remove pyodide.asm.data: the only remaining parts inside pyodide.asm.data is our [webbrowser.py](https://github.com/pyodide/pyodide/blob/main/src/py/lib/webbrowser.py) stub, I think we can either remove it or move it into pyodide_py.
- maybe merge pyodide_py.tar into the standard libraries zipfile.
- add option to use pycompiled standard libraries.

### Checklists

- [x] Add a [CHANGELOG](https://github.com/pyodide/pyodide/blob/main/docs/project/changelog.md) entry
- [x] Add / update tests

From c5b15988defebfd88bb3812a81179a92219047ad Mon Sep 17 00:00:00 2001
From: ryanking13 <def6488@gmail.com>
Date: Tue, 19 Apr 2022 07:18:31 +0000
Subject: [PATCH] Enable image formats

---
 setup.py | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/setup.py b/setup.py
index 3468b260d..ba7cc64e0 100755
--- a/setup.py
+++ b/setup.py
@@ -630,7 +630,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("zlib"):
             _dbg("Looking for zlib")
-            if _find_include_file(self, "zlib.h"):
+            if "PYODIDE" in os.environ:
+                feature.zlib = "z"
+            elif _find_include_file(self, "zlib.h"):
                 if _find_library_file(self, "z"):
                     feature.zlib = "z"
                 elif sys.platform == "win32" and _find_library_file(self, "zlib"):
@@ -638,7 +640,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("jpeg"):
             _dbg("Looking for jpeg")
-            if _find_include_file(self, "jpeglib.h"):
+            if "PYODIDE" in os.environ:
+                feature.jpeg = "jpeg"
+            elif _find_include_file(self, "jpeglib.h"):
                 if _find_library_file(self, "jpeg"):
                     feature.jpeg = "jpeg"
                 elif sys.platform == "win32" and _find_library_file(self, "libjpeg"):
@@ -694,7 +698,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("tiff"):
             _dbg("Looking for tiff")
-            if _find_include_file(self, "tiff.h"):
+            if "PYODIDE" in os.environ:
+                feature.tiff = "tiff"
+            elif _find_include_file(self, "tiff.h"):
                 if _find_library_file(self, "tiff"):
                     feature.tiff = "tiff"
                 if sys.platform in ["win32", "darwin"] and _find_library_file(
@@ -704,7 +710,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("freetype"):
             _dbg("Looking for freetype")
-            if _find_library_file(self, "freetype"):
+            if "PYODIDE" in os.environ:
+                feature.freetype = "freetype"
+            elif _find_library_file(self, "freetype"):
                 # look for freetype2 include files
                 freetype_version = 0
                 for subdir in self.compiler.include_dirs:
@@ -769,7 +777,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("webp"):
             _dbg("Looking for webp")
-            if _find_include_file(self, "webp/encode.h") and _find_include_file(
+            if "PYODIDE" in os.environ:
+                feature.webp = "webp"
+            elif _find_include_file(self, "webp/encode.h") and _find_include_file(
                 self, "webp/decode.h"
             ):
                 # In Google's precompiled zip it is call "libwebp":
@@ -810,7 +820,8 @@ class pil_build_ext(build_ext):
         libs = self.add_imaging_libs.split()
         defs = []
         if feature.jpeg:
-            libs.append(feature.jpeg)
+            if "PYODIDE" not in os.environ:
+                libs.append(feature.jpeg)
             defs.append(("HAVE_LIBJPEG", None))
         if feature.jpeg2000:
             libs.append(feature.jpeg2000)
-- 
2.36.1


From c5b15988defebfd88bb3812a81179a92219047ad Mon Sep 17 00:00:00 2001
From: ryanking13 <def6488@gmail.com>
Date: Tue, 19 Apr 2022 07:18:31 +0000
Subject: [PATCH] Enable image formats

---
 setup.py | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/setup.py b/setup.py
index 3468b260d..ba7cc64e0 100755
--- a/setup.py
+++ b/setup.py
@@ -630,7 +630,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("zlib"):
             _dbg("Looking for zlib")
-            if _find_include_file(self, "zlib.h"):
+            if "PYODIDE" in os.environ:
+                feature.zlib = "z"
+            elif _find_include_file(self, "zlib.h"):
                 if _find_library_file(self, "z"):
                     feature.zlib = "z"
                 elif sys.platform == "win32" and _find_library_file(self, "zlib"):
@@ -638,7 +640,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("jpeg"):
             _dbg("Looking for jpeg")
-            if _find_include_file(self, "jpeglib.h"):
+            if "PYODIDE" in os.environ:
+                feature.jpeg = "jpeg"
+            elif _find_include_file(self, "jpeglib.h"):
                 if _find_library_file(self, "jpeg"):
                     feature.jpeg = "jpeg"
                 elif sys.platform == "win32" and _find_library_file(self, "libjpeg"):
@@ -694,7 +698,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("tiff"):
             _dbg("Looking for tiff")
-            if _find_include_file(self, "tiff.h"):
+            if "PYODIDE" in os.environ:
+                feature.tiff = "tiff"
+            elif _find_include_file(self, "tiff.h"):
                 if _find_library_file(self, "tiff"):
                     feature.tiff = "tiff"
                 if sys.platform in ["win32", "darwin"] and _find_library_file(
@@ -704,7 +710,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("freetype"):
             _dbg("Looking for freetype")
-            if _find_library_file(self, "freetype"):
+            if "PYODIDE" in os.environ:
+                feature.freetype = "freetype"
+            elif _find_library_file(self, "freetype"):
                 # look for freetype2 include files
                 freetype_version = 0
                 for subdir in self.compiler.include_dirs:
@@ -769,7 +777,9 @@ class pil_build_ext(build_ext):
 
         if feature.want("webp"):
             _dbg("Looking for webp")
-            if _find_include_file(self, "webp/encode.h") and _find_include_file(
+            if "PYODIDE" in os.environ:
+                feature.webp = "webp"
+            elif _find_include_file(self, "webp/encode.h") and _find_include_file(
                 self, "webp/decode.h"
             ):
                 # In Google's precompiled zip it is call "libwebp":
@@ -810,7 +820,8 @@ class pil_build_ext(build_ext):
         libs = self.add_imaging_libs.split()
         defs = []
         if feature.jpeg:
-            libs.append(feature.jpeg)
+            if "PYODIDE" not in os.environ:
+                libs.append(feature.jpeg)
             defs.append(("HAVE_LIBJPEG", None))
         if feature.jpeg2000:
             libs.append(feature.jpeg2000)
-- 
2.36.1

