Add PyYAML and libyaml (#1181)

Co-authored-by: daoxian <daoxian@alibaba-inc.com>
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
This commit is contained in:
daoxian 2021-06-06 15:38:48 +08:00 committed by GitHub
parent 69d77194d8
commit b9848db7df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,14 @@
package:
name: libyaml
version: 0.2.1
source:
url: https://github.com/yaml/libyaml/archive/0.2.1.zip
build:
library: true
script: |
CFLAGS="-fPIC" emcmake cmake -DCMAKE_INSTALL_PREFIX=.. .
emmake make -j ${PYODIDE_JOBS:-3}
ln -s libyaml-0.2.1/libyaml_static.a ../libyaml.a
ln -s libyaml-0.2.1/include ..

28
packages/pyyaml/meta.yaml Normal file
View File

@ -0,0 +1,28 @@
package:
name: pyyaml
version: 5.3.1
source:
# path: downloads/pyyaml-5.3.1
url: https://github.com/yaml/pyyaml/archive/5.3.1.zip
patches:
- patches/Makefile.patch
- patches/setup.cfg.patch
build:
skip_host: True
cflags: |
-I../../../../cpython/installs/python-3.8.2/include/python3.8
-I../../../../emsdk/emsdk/fastcomp/emscripten/system/include/libc
-I../../../libyaml/build/include
ldflags: |
-L../../../libyaml/build/
requirements:
run:
- libyaml
test:
imports:
- yaml

View File

@ -0,0 +1,11 @@
--- downloads/pyyaml-5.3.1/Makefile 2020-03-18 21:09:19.000000000 +0000
+++ patches/Makefile 2020-11-20 06:33:24.117490628 +0000
@@ -1,7 +1,7 @@
.PHONY: default build buildext force forceext install installext test testext dist clean
-PYTHON=/usr/bin/python
+PYTHON=/bin/env python
TEST=
PARAMETERS=

View File

@ -0,0 +1,18 @@
--- downloads/pyyaml-5.3.1/setup.cfg 2021-01-24 16:20:43.372414420 +0000
+++ patches/setup.cfg 2021-01-24 16:20:49.767657201 +0000
@@ -13,7 +13,7 @@
#compiler=mingw32
# Additional preprocessor definitions might be required.
-#define=YAML_DECLARE_STATIC
+define=YAML_DECLARE_STATIC
# The following options are used to build PyYAML Windows installer
# for Python 2.7 on my PC:
@@ -22,4 +22,4 @@
#define=YAML_DECLARE_STATIC
[metadata]
-license_file = LICENSE
\ No newline at end of file
+license_file = LICENSE

View File

@ -0,0 +1,11 @@
--- downloads/pyyaml-5.3.1/setup.py 2020-03-18 21:09:19.000000000 +0000
+++ patches/setup.py 2020-11-24 06:47:26.652992652 +0000
@@ -287,6 +287,8 @@ if bdist_wheel:
if __name__ == '__main__':
+ from distutils import sysconfig
+ sysconfig._config_vars['EXT_SUFFIX'] = '.js'
setup(
name=NAME,