mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-18 00:11:20 +08:00
interpreters/python: create Python's config files dynamically
The `Setup.local` and the `config.site` files are used by Python's build system to, respectively, enable or disable Python's modules and set/unset available functions in the target system. These files are now set according to NuttX's configs, enabling or disabling Python's features according to the configs set on NuttX.
This commit is contained in:
2
interpreters/python/.gitignore
vendored
2
interpreters/python/.gitignore
vendored
@@ -4,3 +4,5 @@
|
||||
/Python/
|
||||
/romfs_cpython_modules.h
|
||||
/romfs_cpython_modules.img
|
||||
/config.site
|
||||
/Setup.local
|
||||
|
@@ -32,6 +32,7 @@ UNPACK ?= unzip -q -o
|
||||
|
||||
MACHDEP=nuttx
|
||||
CONFIG_SITE=${CURDIR}/config.site
|
||||
SETUP_LOCAL=${CURDIR}/Setup.local
|
||||
CPYTHON_PATH=$(CURDIR)/$(CPYTHON_UNPACKNAME)
|
||||
|
||||
BUILDIR=$(CURDIR)/build
|
||||
@@ -92,6 +93,35 @@ $(HOSTPYTHON):
|
||||
)
|
||||
$(MAKE) -C $(HOSTBUILD) install
|
||||
|
||||
# The `config.site` file contains settings that override the configuration
|
||||
# settings provided by the `configure` script. Depending on the features
|
||||
# enabled on NuttX, this file may need to be adjusted.
|
||||
|
||||
$(CONFIG_SITE):
|
||||
$(Q) ( cp $(CONFIG_SITE).in $(CONFIG_SITE))
|
||||
ifeq ($(CONFIG_ARCH_HAVE_FORK),y)
|
||||
@echo "export ac_cv_func_fork=\"yes\"" >> $@
|
||||
else
|
||||
@echo "export ac_cv_func_fork=\"no\"" >> $@
|
||||
endif
|
||||
ifeq ($(CONFIG_SYSTEM_SYSTEM),y)
|
||||
@echo "export ac_cv_func_system=\"yes\"" >> $@
|
||||
else
|
||||
@echo "export ac_cv_func_system=\"no\"" >> $@
|
||||
endif
|
||||
|
||||
# The `Setup.local` file enables or disables Python modules.
|
||||
# Depending on the features enabled on NuttX, this file may need to be
|
||||
# adjusted. Please note that the base `Setup.local.in` file only contains
|
||||
# a section to disable Python modules. Inserting lines to it will disable
|
||||
# such modules.
|
||||
|
||||
$(SETUP_LOCAL):
|
||||
$(Q) ( cp $(SETUP_LOCAL).in $(SETUP_LOCAL))
|
||||
ifneq ($(CONFIG_ARCH_HAVE_FORK),y)
|
||||
@echo "_posixsubprocess" >> $@
|
||||
endif
|
||||
|
||||
# For the Python's `configure` script, please consider the following
|
||||
# when building for NuttX:
|
||||
#
|
||||
@@ -103,7 +133,7 @@ $(HOSTPYTHON):
|
||||
# Python/Modules/getpath.c (issue will be filed soon to track this
|
||||
# problem).
|
||||
|
||||
$(TARGETBUILD)/Makefile: $(HOSTPYTHON)
|
||||
$(TARGETBUILD)/Makefile: $(HOSTPYTHON) $(CONFIG_SITE) $(SETUP_LOCAL)
|
||||
$(Q) mkdir -p $(TARGETBUILD)/Modules
|
||||
$(Q) mkdir -p $(TARGETMODULES)/python$(CPYTHON_VERSION_MINOR)
|
||||
$(Q) ( cp Setup.local $(TARGETBUILD)/Modules/Setup.local )
|
||||
@@ -177,5 +207,7 @@ distclean::
|
||||
$(call DELFILE, $(CPYTHON_ZIP))
|
||||
$(call DELFILE, romfs_cpython_modules.img)
|
||||
$(call DELFILE, romfs_cpython_modules.h)
|
||||
$(call DELFILE, config.site)
|
||||
$(call DELFILE, Setup.local)
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
|
@@ -1,3 +1,4 @@
|
||||
export MODULE_BUILDTYPE="static"
|
||||
export ac_cv_file__dev_ptmx="no"
|
||||
export ac_cv_file__dev_ptc="no"
|
||||
export ac_cv_buggy_getaddrinfo="no"
|
||||
@@ -15,10 +16,9 @@ export ac_cv_func_clock_gettime="yes"
|
||||
export ac_cv_header_sys_syscall_h="no"
|
||||
export ac_cv_func_timegm="yes"
|
||||
export ac_cv_func_clock="yes"
|
||||
export ac_cv_func_fork="yes"
|
||||
export ac_cv_func_waitpid="yes"
|
||||
export ac_cv_func_pipe="yes"
|
||||
export ac_cv_enable_strict_prototypes_warning="no"
|
||||
export ac_cv_func_getnameinfo="yes"
|
||||
export ac_cv_func_poll="yes"
|
||||
export MODULE_BUILDTYPE="static"
|
||||
export ac_cv_func_gethostname="yes"
|
Reference in New Issue
Block a user