@@ -1,15 +1,11 @@
menuconfig BR2_PACKAGE_UWSGI
bool "uwsgi"
depends on !BR2_STATIC_LIBS # dlfcn.h
- depends on BR2_USE_MMU # python
- depends on BR2_USE_WCHAR # python
- depends on BR2_TOOLCHAIN_HAS_THREADS # python
# While it's possible to build uwsgi without PCRE, it would require not to
# build Python or PHP or several of the embedded plugins.
# The official documentation also recommends building PCRE support.
# https://uwsgi-docs.readthedocs.io/en/latest/SNI.html?highlight=sni-regexp
select BR2_PACKAGE_PCRE
- select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON
help
The uWSGI server.
The uWSGI project aims at developing a full stack for
@@ -24,7 +20,36 @@ menuconfig BR2_PACKAGE_UWSGI
if BR2_PACKAGE_UWSGI
-comment "plugins"
+choice
+ prompt "Main application type"
+ default BR2_PACKAGE_UWSGI_APPLICATION_PHP
+ help
+ Select the application type
+
+config BR2_PACKAGE_UWSGI_APPLICATION_PHP
+ bool "PHP"
+ depends on !BR2_BINFMT_FLAT # PHP
+ select BR2_PACKAGE_PHP # runtime
+ select BR2_PACKAGE_PHP_BUILD_SHARED_LIBRARY # linking
+ help
+ Select this if your primary application is PHP based.
+
+config BR2_PACKAGE_UWSGI_APPLICATION_PYTHON
+ bool "Python"
+ depends on BR2_USE_MMU # python
+ depends on BR2_USE_WCHAR # python
+ depends on BR2_TOOLCHAIN_HAS_THREADS # python
+ select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON
+ help
+ Select this if your primary application is Python based.
+
+comment "uwsgi-python needs a toolchain w/ wchar, threads"
+ depends on BR2_USE_MMU
+ depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
+
+endchoice
+
+comment "plugins with external dependencies"
config BR2_PACKAGE_UWSGI_PLUGINS_CAPABILITIES
bool "POSIX capability support"
@@ -60,6 +85,10 @@ config BR2_PACKAGE_UWSGI_PLUGINS_YAML
endif
-comment "uwsgi needs a toolchain w/ dynamic library, wchar, threads"
- depends on BR2_USE_MMU
- depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
+config BR2_PACKAGE_UWSGI_MAIN_APPLICATION
+ string
+ default "php" if BR2_PACKAGE_UWSGI_APPLICATION_PHP
+ default "python" if BR2_PACKAGE_UWSGI_APPLICATION_PYTHON
+
+comment "uwsgi needs a toolchain w/ dynamic library"
+ depends on BR2_STATIC_LIBS
@@ -5,5 +5,5 @@ pcre = true
ssl = false
xml = false
yaml = false
-main_plugin = python
+main_plugin = #MAIN_PLUGIN#
plugin_dir = /usr/lib/uwsgi
@@ -16,14 +16,7 @@ UWSGI_ENV += \
UWSGI_INCLUDES="$(STAGING_DIR)/usr/include" \
PLUGIN_BASE_DIR="$(TARGET_DIR)" \
PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \
- UWSGI_PROFILE=$(@D)/buildroot.ini \
- PYTHON_LIBDIR="$(STAGING_DIR)/usr/lib"
-
-ifeq ($(BR2_PACKAGE_PYTHON),y)
-UWSGI_DEPENDENCIES += host-python host-python-setuptools python
-else
-UWSGI_DEPENDENCIES += host-python3 host-python3-setuptools python3
-endif
+ UWSGI_PROFILE=$(@D)/buildroot.ini
ifeq ($(BR2_PACKAGE_LIBZLIB),y)
UWSGI_DEPENDENCIES += libzlib
@@ -33,6 +26,22 @@ ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y)
UWSGI_DEPENDENCIES += util-linux
endif
+ifeq ($(BR2_PACKAGE_UWSGI_APPLICATION_PHP),y)
+UWSGI_DEPENDENCIES += php
+UWSGI_ENV += \
+ UWSGICONFIG_PHPDIR="$(STAGING_DIR)/usr" \
+ UWSGICONFIG_PHPLIBDIR="$(STAGING_DIR)/usr/lib"
+endif
+
+ifeq ($(BR2_PACKAGE_UWSGI_APPLICATION_PYTHON),y)
+UWSGI_ENV += PYTHON_LIBDIR="$(STAGING_DIR)/usr/lib"
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+UWSGI_DEPENDENCIES += host-python host-python-setuptools python
+else
+UWSGI_DEPENDENCIES += host-python3 host-python3-setuptools python3
+endif
+endif
+
# Plugins
ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_CAPABILITIES),y)
UWSGI_DEPENDENCIES += libcap
@@ -82,6 +91,7 @@ define UWSGI_SETUP_PROFILE
$(eval value=$(shell echo $f | cut -d: -f 2)) \
$(SED) "s%$(option).*%$(option) = $(value)%g" $(@D)/buildroot.ini
)
+ $(SED) "s%#MAIN_PLUGIN#%$(BR2_PACKAGE_UWSGI_MAIN_APPLICATION)%g" $(@D)/buildroot.ini
endef
UWSGI_POST_PATCH_HOOKS = UWSGI_SETUP_PROFILE