py/mkenv.mk: Use micropython-lib from submodule by default.

Also adds micropython-lib to 'make submodules' when using a frozen manifest
(for make and cmake).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared 2022-07-08 15:00:33 +10:00 committed by Damien George
parent 58bed5ec14
commit 579f330508
5 changed files with 20 additions and 3 deletions

View File

@ -74,6 +74,10 @@ after_test:
throw "$env:MSYSTEM mpy_cross build exited with code $LASTEXITCODE"
}
cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'ports/windows')
C:\msys64\usr\bin\bash.exe -l -c "make -B VARIANT=$($env:PyVariant) submodules"
if ($LASTEXITCODE -ne 0) {
throw "$env:MSYSTEM build exited with code $LASTEXITCODE"
}
C:\msys64\usr\bin\bash.exe -l -c "make -B -j4 V=1 MICROPY_MPYCROSS=../../mpy-cross/mpy-cross.exe VARIANT=$($env:PyVariant)"
if ($LASTEXITCODE -ne 0) {
throw "$env:MSYSTEM build exited with code $LASTEXITCODE"

View File

@ -170,7 +170,7 @@ using(var outFile = System.IO.File.CreateText(OutputFile)) {
<PreprocessorDefinitions>MICROPY_MODULE_FROZEN_MPY=1;MICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<Exec Command="$(PyPython) $(PyBaseDir)tools\makemanifest.py -v MPY_DIR=$(PyBaseDir) -v MPY_LIB_DIR=$(PyBaseDir)../micropython-lib -v PORT_DIR=$(PyWinDir) -o $(PyBuildDir)frozen_content.c -b $(PyBuildDir) $(FrozenManifest)"/>
<Exec Command="$(PyPython) $(PyBaseDir)tools\makemanifest.py -v MPY_DIR=$(PyBaseDir) -v MPY_LIB_DIR=$(PyBaseDir)/lib/micropython-lib -v PORT_DIR=$(PyWinDir) -o $(PyBuildDir)frozen_content.c -b $(PyBuildDir) $(FrozenManifest)"/>
<WriteLinesToFile File="$(TLogLocation)frozen.read.1.tlog" Lines="$(FrozenManifest)" Overwrite="True"/>
</Target>

View File

@ -57,7 +57,8 @@ MAKE_MANIFEST = $(PYTHON) $(TOP)/tools/makemanifest.py
MAKE_FROZEN = $(PYTHON) $(TOP)/tools/make-frozen.py
MPY_TOOL = $(PYTHON) $(TOP)/tools/mpy-tool.py
MPY_LIB_DIR = $(TOP)/../micropython-lib
MPY_LIB_SUBMODULE_DIR = $(TOP)/lib/micropython-lib
MPY_LIB_DIR = $(MPY_LIB_SUBMODULE_DIR)
ifeq ($(MICROPY_MPYCROSS),)
MICROPY_MPYCROSS = $(TOP)/mpy-cross/mpy-cross

View File

@ -180,7 +180,12 @@ if(MICROPY_FROZEN_MANIFEST)
# Note: target_compile_definitions already added earlier.
if(NOT MICROPY_LIB_DIR)
set(MICROPY_LIB_DIR ${MICROPY_DIR}/../micropython-lib)
string(CONCAT GIT_SUBMODULES "${GIT_SUBMODULES} " lib/micropython-lib)
set(MICROPY_LIB_DIR ${MICROPY_DIR}/lib/micropython-lib)
endif()
if(NOT (${ECHO_SUBMODULES}) AND NOT EXISTS ${MICROPY_LIB_DIR}/README.md)
message(FATAL_ERROR " micropython-lib not initialized.\n Run 'make BOARD=${MICROPY_BOARD} submodules'")
endif()
# If MICROPY_MPYCROSS is not explicitly defined in the environment (which

View File

@ -174,8 +174,15 @@ $(error Support for FROZEN_MPY_DIR was removed. Please use manifest.py instead,
endif
ifneq ($(FROZEN_MANIFEST),)
# If we're using the default submodule path for micropython-lib, then make
# sure it's included in "make submodules".
ifeq ($(MPY_LIB_DIR),$(MPY_LIB_SUBMODULE_DIR))
GIT_SUBMODULES += lib/micropython-lib
endif
# to build frozen_content.c from a manifest
$(BUILD)/frozen_content.c: FORCE $(BUILD)/genhdr/qstrdefs.generated.h $(BUILD)/genhdr/root_pointers.h | $(MICROPY_MPYCROSS_DEPENDENCY)
$(Q)test -e "$(MPY_LIB_DIR)/README.md" || (echo "Error: micropython-lib not initialized. Run 'make submodules'"; false)
$(Q)$(MAKE_MANIFEST) -o $@ -v "MPY_DIR=$(TOP)" -v "MPY_LIB_DIR=$(MPY_LIB_DIR)" -v "PORT_DIR=$(shell pwd)" -v "BOARD_DIR=$(BOARD_DIR)" -b "$(BUILD)" $(if $(MPY_CROSS_FLAGS),-f"$(MPY_CROSS_FLAGS)",) --mpy-tool-flags="$(MPY_TOOL_FLAGS)" $(FROZEN_MANIFEST)
endif