Skip to content

Commit 2b9bdb7

Browse files
committed
PYODIDE_BUILD-variable, check for pyminify
1 parent e5b9a85 commit 2b9bdb7

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ debug :
233233

234234
nano: FORCE
235235
# smallest version for flare
236-
CURRENT_MODE="_nano" PYODIDE_PACKAGES="False" make
236+
PYODIDE_BUILD="_nano" PYODIDE_PACKAGES="False" make
237237

238238
pico: FORCE
239239
# smallest possible python version
240-
CURRENT_MODE="_pico" PYODIDE_PACKAGES="False" make
240+
PYODIDE_BUILD="_pico" PYODIDE_PACKAGES="False" make

Makefile.envs

-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export PYODIDE=1
3030
export PYODIDE_PACKAGE_ABI=1
3131
export EM_COMPILER_WRAPPER=ccache
3232

33-
# default == full python, nano == webframework subset, pico == only libs that are nessesary to load pyodide
34-
export PYTHON_MODE=$(CURRENT_MODE)
35-
3633
export OPTFLAGS=-Os
3734
export CFLAGS_BASE=\
3835
$(OPTFLAGS) \

cpython/Makefile

+7-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ LIBFFI_COMMIT=f671fe3521fb2f383d9b74bd64254b1d3760a31e
3232
all: $(INSTALL)/lib/$(LIB)
3333

3434

35-
$(INSTALL)/lib/$(LIB): $(BUILD)/$(LIB) remove_modules$(PYTHON_MODE).txt
35+
$(INSTALL)/lib/$(LIB): $(BUILD)/$(LIB) remove_modules$(PYODIDE_BUILD).txt
3636
( \
3737
cd $(BUILD); \
3838
sed -i -e 's/libinstall:.*/libinstall:/' Makefile; \
@@ -46,7 +46,9 @@ $(INSTALL)/lib/$(LIB): $(BUILD)/$(LIB) remove_modules$(PYTHON_MODE).txt
4646
mv `cat pybuilddir.txt`/$(SYSCONFIG_NAME).py $(INSTALL)/lib/python$(PYMAJOR).$(PYMINOR)/
4747
rmdir `cat pybuilddir.txt`
4848
rm pybuilddir.txt
49-
cd $(INSTALL)/lib/python$(PYMAJOR).$(PYMINOR)/ && rm -rf `cat $(ROOT)/remove_modules$(PYTHON_MODE).txt`
49+
cd $(INSTALL)/lib/python$(PYMAJOR).$(PYMINOR)/ && rm -rf `cat $(ROOT)/remove_modules$(PYODIDE_BUILD).txt`
50+
# try to run pyminify; If this fails, pyminify is not available. Check your Docker container version!
51+
pyminify --version >/dev/null 2>&1
5052
for py in `find $(INSTALL)/lib/python$(PYMAJOR).$(PYMINOR) -name "*.py"`; do echo "Minifying $${py}..."; pyminify --remove-literal-statements $${py} > $${py}.min; mv $${py}.min $${py}; done
5153

5254

@@ -139,7 +141,7 @@ $(BUILD)/Makefile: $(BUILD)/.patched $(ZLIBBUILD)/.configured $(INSTALL)/lib/lib
139141
LDFLAGS="-static" \
140142
OPT="-fwrapv -Os -Wall" \
141143
CFLAGS="${PYTHON_CFLAGS}" \
142-
CPPFLAGS=$(if $(PYTHON_MODE),"-I$(ZLIBBUILD)","-I$(SQLITEBUILD) -I$(BZIP2BUILD) -I$(ZLIBBUILD)") \
144+
CPPFLAGS=$(if $(PYODIDE_BUILD),"-I$(ZLIBBUILD)","-I$(SQLITEBUILD) -I$(BZIP2BUILD) -I$(ZLIBBUILD)") \
143145
--without-doc-strings \
144146
--without-pymalloc \
145147
--disable-shared \
@@ -152,8 +154,8 @@ $(BUILD)/Makefile: $(BUILD)/.patched $(ZLIBBUILD)/.configured $(INSTALL)/lib/lib
152154
)
153155

154156

155-
$(BUILD)/Modules/Setup.local : $(BUILD)/Makefile Setup$(PYTHON_MODE).local
156-
cp Setup$(PYTHON_MODE).local $(BUILD)/Modules/Setup.local
157+
$(BUILD)/Modules/Setup.local : $(BUILD)/Makefile Setup$(PYODIDE_BUILD).local
158+
cp Setup$(PYODIDE_BUILD).local $(BUILD)/Modules/Setup.local
157159

158160
$(BUILD)/$(LIB): $(BUILD)/Makefile $(BUILD)/pyconfig.h $(BUILD)/Modules/Setup.local $(INSTALL)/lib/libffi.a
159161
cat pyconfig.undefs.h >> $(BUILD)/pyconfig.h

0 commit comments

Comments
 (0)