From d67648a6b86eb2c8ec8b22532612f11c299f9713 Mon Sep 17 00:00:00 2001 From: Dexter Chua Date: Thu, 3 Dec 2020 21:27:40 +0800 Subject: [PATCH] BLD Update package build script's default ldflags (#817) --- .circleci/config.yml | 6 +++--- Makefile.envs | 15 --------------- docs/changelog.md | 2 ++ packages/Makefile | 2 +- pyodide_build/common.py | 25 +++++++++++++------------ 5 files changed, 19 insertions(+), 31 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b52942fe..0d3dd5bb3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,7 +30,7 @@ jobs: - restore_cache: keys: - - v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20200709- + - v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20201203- - run: name: dependencies @@ -52,7 +52,7 @@ jobs: paths: - ./emsdk/emsdk - ~/.ccache - key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20200709-{{ .BuildNum }} + key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20201203-{{ .BuildNum }} - persist_to_workspace: root: . @@ -71,7 +71,7 @@ jobs: # this cache is generated by the main build job, we never store it here - restore_cache: keys: - - v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20200709- + - v1-emsdk-{{ checksum "emsdk/Makefile" }}-v20201203- - run: name: dependencies diff --git a/Makefile.envs b/Makefile.envs index 5826a7abe..39be55d5f 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -17,18 +17,3 @@ export PYTHONINCLUDE=$(PYODIDE_ROOT)/cpython/installs/python-$(PYVERSION)/includ # This env variable is used to detect pyodide at build time, # do not rename it. export PYODIDE_PACKAGE_ABI=1 - -export SIDE_LDFLAGS=\ - -O2 \ - -s "BINARYEN_METHOD='native-wasm'" \ - -Werror \ - -s EMULATED_FUNCTION_POINTERS=1 \ - -s EMULATE_FUNCTION_POINTER_CASTS=1 \ - -s SIDE_MODULE=1 \ - -s WASM=1 \ - -s "BINARYEN_TRAP_MODE='clamp'" \ - --memory-init-file 0 \ - -s LINKABLE=1 \ - -s EXPORT_ALL=1 \ - -s ERROR_ON_MISSING_LIBRARIES=0 \ - -s ASSERTIONS=1 diff --git a/docs/changelog.md b/docs/changelog.md index a7eaec6db..39eb25f62 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -20,6 +20,8 @@ [#480](https://github.com/iodide-project/pyodide/pull/480) - New packages: freesasa, lxml, python-sat, traits, astropy - Updated packages: numpy 1.15.4, pandas 1.0.5 among others. +- Updated default `--ldflags` argument to `pyodide_build` scripts to equal what + pyodide actually uses. ## Version 0.15.0 diff --git a/packages/Makefile b/packages/Makefile index 7f3498d8c..e2cc102df 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -3,7 +3,7 @@ include ../Makefile.envs all: deps ../bin/pyodide buildall . ../build \ - --package_abi=$(PYODIDE_PACKAGE_ABI) --ldflags="$(SIDE_LDFLAGS)" --host=$(HOSTPYTHONROOT) --target=$(TARGETPYTHONROOT) --only $(PYODIDE_PACKAGES) + --package_abi=$(PYODIDE_PACKAGE_ABI) --host=$(HOSTPYTHONROOT) --target=$(TARGETPYTHONROOT) --only $(PYODIDE_PACKAGES) update-all: for pkg in $$(find . -maxdepth 1 -type d -exec basename {} \; | tail -n +2); do \ diff --git a/pyodide_build/common.py b/pyodide_build/common.py index c3bc5d886..68b105e23 100644 --- a/pyodide_build/common.py +++ b/pyodide_build/common.py @@ -6,24 +6,25 @@ ROOTDIR = Path(__file__).parents[1].resolve() / "tools" HOSTPYTHON = ROOTDIR / ".." / "cpython" / "build" / "3.8.2" / "host" TARGETPYTHON = ROOTDIR / ".." / "cpython" / "installs" / "python-3.8.2" DEFAULTCFLAGS = "" +# fmt: off DEFAULTLDFLAGS = " ".join( [ "-O2", - "-s", - "BINARYEN_METHOD='native-wasm'", + "-s", "BINARYEN_METHOD='native-wasm'", "-Werror", - "-s", - "EMULATED_FUNCTION_POINTERS=1", - "-s", - "EMULATE_FUNCTION_POINTER_CASTS=1", - "-s", - "SIDE_MODULE=1", - "-s", - "WASM=1", - "--memory-init-file", - "0", + "-s", "EMULATED_FUNCTION_POINTERS=1", + "-s", "EMULATE_FUNCTION_POINTER_CASTS=1", + "-s", "SIDE_MODULE=1", + "-s", "WASM=1", + "-s", "BINARYEN_TRAP_MODE='clamp'", + "--memory-init-file", "0", + "-s", "LINKABLE=1", + "-s", "EXPORT_ALL=1", + "-s", "ERROR_ON_MISSING_LIBRARIES=0", + "-s", "ASSERTIONS=1", ] ) +# fmt: on def parse_package(package):