From patchwork Wed Aug 7 23:17:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1143746 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uUakCwnV"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 463nVL126gz9sN6 for ; Thu, 8 Aug 2019 09:18:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 45DD48773F; Wed, 7 Aug 2019 23:17:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JScMT5AINr7d; Wed, 7 Aug 2019 23:17:54 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 4804287701; Wed, 7 Aug 2019 23:17:54 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 7CFCF1BF588 for ; Wed, 7 Aug 2019 23:17:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7A553869AB for ; Wed, 7 Aug 2019 23:17:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ss9kUL_--6v2 for ; Wed, 7 Aug 2019 23:17:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id A26E28687B for ; Wed, 7 Aug 2019 23:17:51 +0000 (UTC) Received: by mail-ot1-f66.google.com with SMTP id n5so111230243otk.1 for ; Wed, 07 Aug 2019 16:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4ERD90gjrDwp3xhvXyJpCMqtPjiSEclDA8lenxscGpg=; b=uUakCwnV0/G2fWV5Q0RWyg1JJqRNgCENIC8H57gfRnmFbj4vT4UeQ6ZSdIh1j/6ieW u1j/UapmGw+GmO04aojLnhKz8CZHgV2bf8bzrPbsGNvwZpXrYWrT8DlUyW+4Gpxbs+h9 /X32yneng6qJLqpYfFUz4/uGQMVi8lDHQIWtfKDOYkoujoLScBjHuaT96b6qD4OcDNnZ beK/iNL2rqeT5Pkj4blPXgbops0dTmyqG6EoFa9Vl2LwcrKY90GhSGIDxm7fNq3X/Bta Nb91LJVtST7j8WI8FQKDIG2aYYS9pfqcs+QXtcElnEaVBt4XdeS5viXkqNz66B1JnALh zVhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4ERD90gjrDwp3xhvXyJpCMqtPjiSEclDA8lenxscGpg=; b=H7lmXaLiAFProzY0bS1XKirjm2qswL1b0CyIqwn+rqeKOSfhVM86fCrTtYYW1n8uzb eBO8ZaRgw1fN5WKAvoqzod0lckYFzxTww2yAijL+7njho8LheFsC+h6DpaQaMJnmXys9 Imwo6aMm09q7cKmFVE3rBN5lbpDcwPKPnShS0yJcDZUsZzM/xjGX1Fo0v1bnm29t+ppz /uSqLw0c/c560zVtw62nO9iF81Sno9CWR7s0dDuDEe+HwMjfoZ3UdJuVNT/dpyz4qgq9 09o3d+hQHfm7kHE60btldtpoZYLrRZ9e+LFQsY30n486u6MXH7sY3fSuuxyT/WuId5vf PBZg== X-Gm-Message-State: APjAAAVcab5k3FEgcRjhIEZYxLX6w4+FFgVBdkNcXgnEP52ntcv80Bg8 7HGRqKY1M8lxnn2FA+o7HR5gV6ol X-Google-Smtp-Source: APXvYqxj16/IRmkaukkWgXBgHSQG95NxjcLwerHuVX+sT2PwWzGsmlHt+kLDVKCHF1jMnof3/51ULg== X-Received: by 2002:a6b:641a:: with SMTP id t26mr11961196iog.3.1565219870275; Wed, 07 Aug 2019 16:17:50 -0700 (PDT) Received: from localhost.localdomain (68-188-149-81.dhcp.aldl.mi.charter.com. [68.188.149.81]) by smtp.gmail.com with ESMTPSA id c13sm219047iok.84.2019.08.07.16.17.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 16:17:49 -0700 (PDT) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Wed, 7 Aug 2019 19:17:42 -0400 Message-Id: <20190807231744.57150-2-aduskett@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190807231744.57150-1-aduskett@gmail.com> References: <20190807231744.57150-1-aduskett@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/3] uwsgi: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Adam Duskett The uWSGI project aims at developing a full stack for building hosting services. Application servers (for various programming languages and protocols), proxies, process managers and monitors are all implemented using a common API and a standard configuration style. Thanks to its pluggable architecture, it can be extended to support more platforms and languages. There are five patches currently required to properly cross-compile uWSGI, all but one of which are pending upstream: 1) add-plugin_base_dir-variable.patch - uWSGI appends the full path of the plugin directory to the binary when compiling, which results in plugins failing to load on the target filing system. 2) add-a-xml2_config-environment-variable-for-cross-co.patch - uWSGI calls out to xml2-config with no way to define a path for xml2-config, thus resulting in the hosts xml2-config cflags and library paths used, add the XML2_CONFIG environment variable which overwrites the default xml2-config path. 3) add-a-pcre_config-environment-variable-for-cross-co.patch - This patch is the same as the above, except the variable name is PCRE_CONFIG. 4) adjust-python-library-header-paths-for-cross-compila.patch - uWSGI calls sysconfig.get_config_var('LIBDIR') which return the host header and library paths. To fix this, prefix the LIBDIR path with _python_sysroot taken from the sysconfigdata module. 5) fix-building-with-uClibc.patch - There are two issues building uwsgi with uClibc: 1) core/uwsgi.c includes when __GLIBC__ is defined, but does not check if __UCLIBC__ is also defined. 2) plugins/router_basicauth/router_basicauth.c checks if __GLIBC__ is defined for and to enable a workaround for a bug in Glibc-2.2.5, both of which do not apply to uClibc. Adding a check for __UCLIBC__ for both of these conditions fixes the issue. Even though PCRE is not technically required, the official documentation recommends always building with PCRE support, and many of the embedded plugins require PCRE to be present. As such, PCRE is set as a dependency. https://uwsgi-docs.readthedocs.io/en/latest/SNI.html?highlight=sni-regexp The "Main application type" prompt in the Config.in is to set the main_plugin variable in the buildroot.ini file. There is a "buildroot.ini.in" file which is used to overwrite the default settings in buildconf/base.ini. The following settings that explicitly set: - json: Allow a config file to be in JSON format - pcre: Explicitly set to True - ssl: Allow SSL connections - xml: Allow a config file to be in XML format. - yaml: Allow a config file to be in YAML format. - main_plugin: Set to Python. - plugin_dir: The plugin directory for the target. The .ini file does not have a standard value for each option; because of this, each option is a key/value pair with a colon set as a delimiter. A for loop set's each setting appropriately by splitting the key/value into two variables and running SED against the .ini file. Tested with every option enabled: br-arm-full [1/6]: OK br-arm-cortex-a9-glibc [2/6]: OK br-arm-cortex-m4-full [3/6]: SKIPPED br-x86-64-musl [4/6]: OK br-arm-full-static [5/6]: SKIPPED sourcery-arm [6/6]: OK Signed-off-by: Adam Duskett --- DEVELOPERS | 1 + package/Config.in | 1 + .../0001-add-plugin_base_dir-variable.patch | 47 ++++++++++ ...ig-environment-variable-for-cross-co.patch | 60 +++++++++++++ ...ig-environment-variable-for-cross-co.patch | 58 ++++++++++++ ...brary-header-paths-for-cross-compila.patch | 34 +++++++ .../uwsgi/0005-fix-building-with-uClibc.patch | 61 +++++++++++++ package/uwsgi/Config.in | 65 ++++++++++++++ package/uwsgi/buildroot.ini.in | 9 ++ package/uwsgi/uwsgi.hash | 3 + package/uwsgi/uwsgi.mk | 88 +++++++++++++++++++ 11 files changed, 427 insertions(+) create mode 100644 package/uwsgi/0001-add-plugin_base_dir-variable.patch create mode 100644 package/uwsgi/0002-add-a-xml2_config-environment-variable-for-cross-co.patch create mode 100644 package/uwsgi/0003-add-a-pcre_config-environment-variable-for-cross-co.patch create mode 100644 package/uwsgi/0004-adjust-python-library-header-paths-for-cross-compila.patch create mode 100644 package/uwsgi/0005-fix-building-with-uClibc.patch create mode 100644 package/uwsgi/Config.in create mode 100644 package/uwsgi/buildroot.ini.in create mode 100644 package/uwsgi/uwsgi.hash create mode 100644 package/uwsgi/uwsgi.mk diff --git a/DEVELOPERS b/DEVELOPERS index e8ba6cd985..77be6ccdc0 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -70,6 +70,7 @@ F: package/semodule-utils/ F: package/setools/ F: package/sngrep/ F: package/systemd/ +F: package/uwsgi/ N: Adam Heinrich F: package/jack1/ diff --git a/package/Config.in b/package/Config.in index 5f2191a554..46dbf1d027 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2094,6 +2094,7 @@ endif source "package/vpnc/Config.in" source "package/vsftpd/Config.in" source "package/vtun/Config.in" + source "package/uwsgi/Config.in" source "package/wavemon/Config.in" source "package/wget/Config.in" source "package/whois/Config.in" diff --git a/package/uwsgi/0001-add-plugin_base_dir-variable.patch b/package/uwsgi/0001-add-plugin_base_dir-variable.patch new file mode 100644 index 0000000000..ace1df09a4 --- /dev/null +++ b/package/uwsgi/0001-add-plugin_base_dir-variable.patch @@ -0,0 +1,47 @@ +From 2b15d1c4d48a431a92d76486818a84d9653e549b Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Mon, 29 Jan 2018 11:40:52 -0500 +Subject: [PATCH] add plugin_base_dir variable + +Currently, when cross-compiling, if the plugin_dir points to the target +directory, uwsgi will embed the full path during compiling. +This whole path results in uwsgi trying to load a full target path instead of +/usr/lib/uwsgi when running on the target. + +Creating a new PLUGIN_BASE_DIR variable and prefixing plugin_dir allows the +plugin to be installed to the appropriate directory but still have uwsgi load +the plugins from the correct folder when ran from on the cross-compiled target. + +Current status: Pending +https://github.com/unbit/uwsgi/pull/2052 + +Signed-off-by: Adam Duskett +--- + uwsgiconfig.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/uwsgiconfig.py b/uwsgiconfig.py +index 0c33491..5b356ec 100644 +--- a/uwsgiconfig.py ++++ b/uwsgiconfig.py +@@ -27,7 +27,7 @@ try: + except: + import configparser as ConfigParser + +- ++PLUGIN_BASE_DIR = os.environ.get('PLUGIN_BASE_DIR', '') + PY3 = sys.version_info[0] == 3 + + if uwsgi_os == 'Darwin': +@@ -1435,7 +1435,7 @@ def build_plugin(path, uc, cflags, ldflags, libs, name = None): + pass + + if uc: +- plugin_dest = uc.get('plugin_build_dir', uc.get('plugin_dir')) + '/' + name + '_plugin' ++ plugin_dest = PLUGIN_BASE_DIR + uc.get('plugin_build_dir', uc.get('plugin_dir')) + '/' + name + '_plugin' + else: + plugin_dest = name + '_plugin' + +-- +2.14.3 + diff --git a/package/uwsgi/0002-add-a-xml2_config-environment-variable-for-cross-co.patch b/package/uwsgi/0002-add-a-xml2_config-environment-variable-for-cross-co.patch new file mode 100644 index 0000000000..014494e5cb --- /dev/null +++ b/package/uwsgi/0002-add-a-xml2_config-environment-variable-for-cross-co.patch @@ -0,0 +1,60 @@ +From b98241acc633396dc7f4ab9e4153af552ac6d4a0 Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Sat, 3 Aug 2019 14:59:18 -0400 +Subject: [PATCH] add a XML2_CONFIG environment variable for cross-compiling + +Currently, xml2-config is called out with no way to define an xml2-config path, +which causes uwsgi to use the host xml2-config which will cause the xml2 +library and CFlag directories to point to the host instead of +the cross-environment. + +Add a check for the XML2_CONFIG environment variable, and if it exists, use the +resulting path instead. + +Current-status: pending +https://github.com/unbit/uwsgi/pull/2050 + +Signed-off-by: Adam Duskett +--- + uwsgiconfig.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/uwsgiconfig.py b/uwsgiconfig.py +index 22c9dd3..26403f1 100644 +--- a/uwsgiconfig.py ++++ b/uwsgiconfig.py +@@ -1303,12 +1303,13 @@ class uConf(object): + self.gcc_list.append('core/legion') + report['ssl'] = True + ++ xml2config = os.environ.get('XML2_CONFIG','xml2-config') + if self.get('xml'): + if self.get('xml') == 'auto': +- xmlconf = spcall('xml2-config --libs') ++ xmlconf = spcall(xml2config + ' --libs') + if xmlconf and uwsgi_os != 'Darwin': + self.libs.append(xmlconf) +- xmlconf = spcall("xml2-config --cflags") ++ xmlconf = spcall(xml2config + " --cflags") + self.cflags.append(xmlconf) + self.cflags.append("-DUWSGI_XML -DUWSGI_XML_LIBXML2") + self.gcc_list.append('core/xmlconf') +@@ -1319,13 +1320,13 @@ class uConf(object): + self.gcc_list.append('core/xmlconf') + report['xml'] = 'expat' + elif self.get('xml') == 'libxml2': +- xmlconf = spcall('xml2-config --libs') ++ xmlconf = spcall(xml2config + ' --libs') + if xmlconf is None: + print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML") + sys.exit(1) + else: + self.libs.append(xmlconf) +- xmlconf = spcall("xml2-config --cflags") ++ xmlconf = spcall(xml2config + " --cflags") + if xmlconf is None: + print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML") + sys.exit(1) +-- +2.21.0 + diff --git a/package/uwsgi/0003-add-a-pcre_config-environment-variable-for-cross-co.patch b/package/uwsgi/0003-add-a-pcre_config-environment-variable-for-cross-co.patch new file mode 100644 index 0000000000..88fca366b4 --- /dev/null +++ b/package/uwsgi/0003-add-a-pcre_config-environment-variable-for-cross-co.patch @@ -0,0 +1,58 @@ +From 170cbd7226c1a0774da3c19733c2f473befc8eed Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Sat, 3 Aug 2019 15:32:41 -0400 +Subject: [PATCH] Add a PCRE_CONFIG environment variable for cross-compiling + +Currently, pcre-config is called out with no way to define a pcre-config path, +which causes uwsgi to use the host pcre-config, which will cause the pcre +library and cflag directories to point to the host. + +Add a check for the PCRE_CONFIG environment variable, and if it exists, +use the resulting path instead. + +upstream-status: pending +https://github.com/unbit/uwsgi/pull/2051 + +Signed-off-by: Adam Duskett +--- + uwsgiconfig.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/uwsgiconfig.py b/uwsgiconfig.py +index 26403f1..b800cdb 100644 +--- a/uwsgiconfig.py ++++ b/uwsgiconfig.py +@@ -1072,25 +1072,26 @@ class uConf(object): + has_pcre = False + + # re-enable after pcre fix ++ pcreconfig = os.environ.get('PCRE_CONFIG','pcre-config') + if self.get('pcre'): + if self.get('pcre') == 'auto': +- pcreconf = spcall('pcre-config --libs') ++ pcreconf = spcall(pcreconfig + ' --libs') + if pcreconf: + self.libs.append(pcreconf) +- pcreconf = spcall("pcre-config --cflags") ++ pcreconf = spcall(pcreconfig + ' --cflags') + self.cflags.append(pcreconf) + self.gcc_list.append('core/regexp') + self.cflags.append("-DUWSGI_PCRE") + has_pcre = True + + else: +- pcreconf = spcall('pcre-config --libs') ++ pcreconf = spcall(pcreconfig + ' --libs') + if pcreconf is None: + print("*** libpcre headers unavailable. uWSGI build is interrupted. You have to install pcre development package or disable pcre") + sys.exit(1) + else: + self.libs.append(pcreconf) +- pcreconf = spcall("pcre-config --cflags") ++ pcreconf = spcall(pcreconfig + ' --cflags') + self.cflags.append(pcreconf) + self.gcc_list.append('core/regexp') + self.cflags.append("-DUWSGI_PCRE") +-- +2.21.0 + diff --git a/package/uwsgi/0004-adjust-python-library-header-paths-for-cross-compila.patch b/package/uwsgi/0004-adjust-python-library-header-paths-for-cross-compila.patch new file mode 100644 index 0000000000..9eb39b1212 --- /dev/null +++ b/package/uwsgi/0004-adjust-python-library-header-paths-for-cross-compila.patch @@ -0,0 +1,34 @@ +From 8bf43f727d34619773d826357f49e172876f8a30 Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Sat, 3 Aug 2019 17:12:09 -0400 +Subject: [PATCH] Adjust python library/header paths for cross-compilation + +uWSGI calls sysconfig.get_config_var('LIBDIR') which return the host header and +library paths. + +To fix this, prefix the LIBDIR path with _python_sysroot taken +from the sysconfigdata module. + +upstream status: Not submitted, Buildroot specific. + +Signed-off-by: Adam Duskett +--- + plugins/python/uwsgiplugin.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/plugins/python/uwsgiplugin.py b/plugins/python/uwsgiplugin.py +index 843876f..a74de7d 100644 +--- a/plugins/python/uwsgiplugin.py ++++ b/plugins/python/uwsgiplugin.py +@@ -52,6 +52,8 @@ if not 'UWSGI_PYTHON_NOLIB' in os.environ: + else: + try: + libdir = sysconfig.get_config_var('LIBDIR') ++ if "_python_sysroot" in os.environ: ++ libdir = os.environ.get("_python_sysroot") + libdir + except: + libdir = "%s/lib" % sysconfig.PREFIX + +-- +2.21.0 + diff --git a/package/uwsgi/0005-fix-building-with-uClibc.patch b/package/uwsgi/0005-fix-building-with-uClibc.patch new file mode 100644 index 0000000000..c8854cd7c9 --- /dev/null +++ b/package/uwsgi/0005-fix-building-with-uClibc.patch @@ -0,0 +1,61 @@ +From 98c616be6bb745cc5178de3b1a3a84d1f86d6e34 Mon Sep 17 00:00:00 2001 +From: Adam Duskett +Date: Wed, 7 Aug 2019 15:10:46 -0400 +Subject: [PATCH] fix building with uClibc + +There are two issues building uwsgi with uClibc: +1) core/uwsgi.c includes when __GLIBC__ is defined, but does not +check if __UCLIBC__ is also defined. + +2) plugins/router_basicauth/router_basicauth.c checks if __GLIBC__ is defined +for and to enable a workaround for a bug in glibc-2.2.5, both of which +do not apply to uClibc. +Add a check for __UCLIBC__ for both of these conditions. + +Upstream status: pending +https://github.com/unbit/uwsgi/pull/2054 + +Signed-off-by: Adam Duskett +--- + core/uwsgi.c | 2 +- + plugins/router_basicauth/router_basicauth.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/core/uwsgi.c b/core/uwsgi.c +index ef9e310..523bf45 100644 +--- a/core/uwsgi.c ++++ b/core/uwsgi.c +@@ -1820,7 +1820,7 @@ void uwsgi_plugins_atexit(void) { + + void uwsgi_backtrace(int depth) { + +-#if defined(__GLIBC__) || (defined(__APPLE__) && !defined(NO_EXECINFO)) || defined(UWSGI_HAS_EXECINFO) ++#if (!defined(__UCLIBC__) && defined __GLIBC__) || (defined(__APPLE__) && !defined(NO_EXECINFO)) || defined(UWSGI_HAS_EXECINFO) + + #include + +diff --git a/plugins/router_basicauth/router_basicauth.c b/plugins/router_basicauth/router_basicauth.c +index 429bade..0b7161e 100644 +--- a/plugins/router_basicauth/router_basicauth.c ++++ b/plugins/router_basicauth/router_basicauth.c +@@ -3,7 +3,7 @@ + #ifdef UWSGI_ROUTING + + // TODO: Add more crypt_r supported platfroms here +-#if defined(__linux__) && defined(__GLIBC__) ++#if defined(__linux__) && defined(__GLIBC__) && !defined(__UCLIBC__) + #include + #elif defined(__CYGWIN__) + #include +@@ -67,7 +67,7 @@ static uint16_t htpasswd_check(char *filename, char *auth) { + + if (clen > 13) cpwd[13] = 0; + +-#if defined(__linux__) && defined(__GLIBC__) ++#if defined(__linux__) && defined(__GLIBC__) && !defined(__UCLIBC__) + struct crypt_data cd; + memset(&cd, 0, sizeof(struct crypt_data)); + /* work around glibc-2.2.5 bug, +-- +2.21.0 + diff --git a/package/uwsgi/Config.in b/package/uwsgi/Config.in new file mode 100644 index 0000000000..8b1082d06e --- /dev/null +++ b/package/uwsgi/Config.in @@ -0,0 +1,65 @@ +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 + building hosting services. Application servers + (for various programming languages and protocols), proxies, + process managers and monitors are all implemented using a + common API and a standard configuration style. Thanks to + its pluggable architecture, it can be extended to support + more platforms and languages. + + https://uwsgi-docs.readthedocs.io/en/latest/ + +if BR2_PACKAGE_UWSGI + +comment "plugins" + +config BR2_PACKAGE_UWSGI_PLUGINS_CAPABILITIES + bool "POSIX capability support" + select BR2_PACKAGE_LIBCAP + help + POSIX capabilities allow fine-grained permissions for + processes. In addition to the standard UNIX permission scheme, + they define a new set of privileges for system resources. + +config BR2_PACKAGE_UWSGI_PLUGINS_JSON + bool "JSON" + select BR2_PACKAGE_JANSSON if !BR2_PACKAGE_YAJL + help + Load the config from a json file. + +config BR2_PACKAGE_UWSGI_PLUGINS_SSL + bool "SSL" + select BR2_PACKAGE_OPENSSL + help + SSL Support + +config BR2_PACKAGE_UWSGI_PLUGINS_XML + bool "XML" + select BR2_PACKAGE_LIBXML2 if !BR2_PACKAGE_EXPAT + help + Load the config from a XML file. + +config BR2_PACKAGE_UWSGI_PLUGINS_YAML + bool "YAML" + select BR2_PACKAGE_LIBYAML + help + Load the config from a YAML file. + +endif + +comment "uwsgi-python 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 diff --git a/package/uwsgi/buildroot.ini.in b/package/uwsgi/buildroot.ini.in new file mode 100644 index 0000000000..75ad8afa32 --- /dev/null +++ b/package/uwsgi/buildroot.ini.in @@ -0,0 +1,9 @@ +[uwsgi] +inherit = base +json = false +pcre = true +ssl = false +xml = false +yaml = false +main_plugin = python +plugin_dir = /usr/lib/uwsgi diff --git a/package/uwsgi/uwsgi.hash b/package/uwsgi/uwsgi.hash new file mode 100644 index 0000000000..bbdfe3b9ea --- /dev/null +++ b/package/uwsgi/uwsgi.hash @@ -0,0 +1,3 @@ +# Locally computed +sha256 4972ac538800fb2d421027f49b4a1869b66048839507ccf0aa2fda792d99f583 uwsgi-2.0.18.tar.gz +sha256 ca495399f5da3ce2724649b47eb118f7549344ba58c0cf350d94c3390e435897 LICENSE diff --git a/package/uwsgi/uwsgi.mk b/package/uwsgi/uwsgi.mk new file mode 100644 index 0000000000..9e44666b97 --- /dev/null +++ b/package/uwsgi/uwsgi.mk @@ -0,0 +1,88 @@ +################################################################################ +# +# uwsgi +# +################################################################################ + +UWSGI_VERSION = 2.0.18 +UWSGI_SITE = $(call github,unbit,uwsgi,$(UWSGI_VERSION)) +UWSGI_LICENSE = GPL-2.0+ +UWSGI_LICENSE_FILES = LICENSE +UWSGI_SETUP_TYPE = setuptools +UWSGI_DEPENDENCIES += pcre + +UWSGI_ENV += \ + UWSGI_REMOVE_INCLUDES="/usr/include,/usr/local/include" \ + UWSGI_INCLUDES="$(STAGING_DIR)/usr/include" \ + PLUGIN_BASE_DIR="$(TARGET_DIR)" \ + PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \ + UWSGI_PROFILE=$(@D)/buildroot.ini + +ifeq ($(BR2_PACKAGE_PYTHON),y) +UWSGI_DEPENDENCIES += python +else +UWSGI_DEPENDENCIES += python3 +endif + +ifeq ($(BR2_PACKAGE_LIBZLIB),y) +UWSGI_DEPENDENCIES += libzlib +endif + +ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y) +UWSGI_DEPENDENCIES += util-linux +endif + +# Plugins +ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_CAPABILITIES),y) +UWSGI_DEPENDENCIES += libcap +endif + +# The uwsgi config.ini file does not use the same values for every option. +# Use a key/value with a colon as a delimiter to set the appropriate setting. +ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_JSON),y) +ifeq ($(BR2_PACKAGE_JANSSON),y) +UWSGI_DEPENDENCIES += jansson +UWSGI_INI_OPTS += "json:jansson" +else +UWSGI_DEPENDENCIES += yajl +UWSGI_INI_OPTS += "json:yajl" +endif +endif + +ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_SSL),y) +UWSGI_DEPENDENCIES += openssl +UWSGI_INI_OPTS += "ssl:true" +endif + +ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_XML),y) +ifeq ($(BR2_PACKAGE_LIBXML2),y) +UWSGI_DEPENDENCIES += libxml2 +UWSGI_INI_OPTS += "xml:libxml2" +UWSGI_ENV += XML2_CONFIG="$(STAGING_DIR)/usr/bin/xml2-config" +else +UWSGI_DEPENDENCIES += expat +UWSGI_INI_OPTS += "xml:expat" +endif +endif + +ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_YAML),y) +UWSGI_DEPENDENCIES += libyaml +UWSGI_INI_OPTS += "yaml:libyaml" +endif + +define UWSGI_SETUP_PROFILE + mkdir -p $(TARGET_DIR)/usr/lib/uwsgi + + $(INSTALL) -D -m 755 $(UWSGI_PKGDIR)/buildroot.ini.in \ + $(@D)/buildroot.ini + + $(foreach f,$(UWSGI_INI_OPTS), \ + $(eval option=$(shell echo $f | cut -d: -f 1)) \ + $(eval value=$(shell echo $f | cut -d: -f 2)) \ + $(SED) "s%$(option).*%$(option) = $(value)%g" $(@D)/buildroot.ini + ) +endef +UWSGI_POST_PATCH_HOOKS = UWSGI_SETUP_PROFILE + +$(eval $(python-package)) -- 2.21.0 From patchwork Wed Aug 7 23:17:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1143748 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RTDjSAkq"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 463nVP3vJMz9sBF for ; Thu, 8 Aug 2019 09:18:04 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7567B228BA; Wed, 7 Aug 2019 23:17:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BlUzVkeCOZbF; Wed, 7 Aug 2019 23:17:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 2F02720427; Wed, 7 Aug 2019 23:17:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 8F0891BF588 for ; Wed, 7 Aug 2019 23:17:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8CA1420427 for ; Wed, 7 Aug 2019 23:17:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yiVMqpwsI+KM for ; Wed, 7 Aug 2019 23:17:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by silver.osuosl.org (Postfix) with ESMTPS id BDB4A2035E for ; Wed, 7 Aug 2019 23:17:52 +0000 (UTC) Received: by mail-ot1-f48.google.com with SMTP id s20so45627377otp.4 for ; Wed, 07 Aug 2019 16:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=I34WSw3PJg1rwObP3mkJ5Jo+cHtNiT6HwZbq/klXLms=; b=RTDjSAkqnDHMzPP/r1UgyaTt6D57PJiZUa1UvTeDfRZEO3nyuM0TyNFQILe024fw1G 5cpy+G5AIdee9oOCJDwbWsstv/KeBpAHY4DOgmdv1eSgJv1RXO+4+Srz6Xz3/rPjQ7AB 50I2G6GNSIONm52tSTAYdhwO7p0J/9+WP+F4HbmQwy5FXjiSMUFD+Ce4vW3O5Nh8AAgS txaYN26OWLMpHPUnlBfx4//souPTr93rrgu+aVF9ds/GT+zdORtmnFcHzba3t447EDSW aVS/tRA2Tr4HS6SC0NKnp+B9d/Or4tgsQUbQbYBem9+dDD7++K97rpc2j5mBR8qe/aWS 5miw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I34WSw3PJg1rwObP3mkJ5Jo+cHtNiT6HwZbq/klXLms=; b=ts2msvrliioqz74lQG1rt4R0sErvPv8VJeI2wxDvqfOv+31g1LWnpffdSUTgrg9sPY ggStsKrpvpmMuNwzQ1UNNjJ1uOGdJPimSQ3m6rP7XCCbtzfCPKIqCUa8QAMoyAjNttJq T3EeqB6P8KqdpDiXzGbZzk97/9VqcaOnbjw1rMUOV+dIyqKZnl+iCMysa9SQlrhdNiWO vnGtsHYpNroLbqyxVLxJ+gwmjX2L6hIea14DjVVyWxazOy0+CottRODvY2KnMMpMp8Eo bN7ODsZxs1Q4LSO9cOeMwXgGpDvf6QWef++Ig2rlBgvhurGnHQ8hzCpJR73qj7ld+pJN xOeg== X-Gm-Message-State: APjAAAXoIi6QGYLYonpVhe/P1lUmWetMvDPGr23pPLPOt4qvBUCd2Ua6 9cpgO7PT5dSjY7kVYhg76rZBXiTg X-Google-Smtp-Source: APXvYqzPLXzxBc3Ohki7b10vMtN4TzEZPvsdgvK1XNe96N4ZI7JoMDkI2iKJ4cdhLzbcdkXEKxG+dw== X-Received: by 2002:a6b:bec7:: with SMTP id o190mr11147638iof.158.1565219871610; Wed, 07 Aug 2019 16:17:51 -0700 (PDT) Received: from localhost.localdomain (68-188-149-81.dhcp.aldl.mi.charter.com. [68.188.149.81]) by smtp.gmail.com with ESMTPSA id c13sm219047iok.84.2019.08.07.16.17.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 16:17:51 -0700 (PDT) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Wed, 7 Aug 2019 19:17:43 -0400 Message-Id: <20190807231744.57150-3-aduskett@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190807231744.57150-1-aduskett@gmail.com> References: <20190807231744.57150-1-aduskett@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/3] package/php: add option to force building the shared library X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Adam Duskett The uWSGI plugin requires libphp7.so to build. This option forces PHP to build the libphp7.so file. Signed-off-by: Adam Duskett --- package/php/Config.in | 9 +++++++++ package/php/php.mk | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/package/php/Config.in b/package/php/Config.in index 2469573541..f2ccf8a5c4 100644 --- a/package/php/Config.in +++ b/package/php/Config.in @@ -19,6 +19,15 @@ config BR2_PACKAGE_PHP if BR2_PACKAGE_PHP +config BR2_PACKAGE_PHP_BUILD_SHARED_LIBRARY + bool "Build the shared library" + depends on !BR2_STATIC_LIBS + help + Build the libphp7.so file. + +comment "Building the shared library needs a toolchain w/ dynamic library" + depends on BR2_STATIC_LIBS + config BR2_PACKAGE_PHP_SAPI_APACHE bool "Apache interface" depends on BR2_PACKAGE_APACHE diff --git a/package/php/php.mk b/package/php/php.mk index 0502158377..f03be79ae8 100644 --- a/package/php/php.mk +++ b/package/php/php.mk @@ -121,6 +121,10 @@ PHP_CONF_OPTS += \ $(if $(BR2_PACKAGE_PHP_EXT_MBSTRING),--enable-mbstring) \ $(if $(BR2_PACKAGE_PHP_EXT_PHAR),--enable-phar) +ifeq ($(BR2_PACKAGE_PHP_BUILD_SHARED_LIBRARY),y) +PHP_CONF_OPTS += --enable-embed=shared +endif + ifeq ($(BR2_PACKAGE_PHP_EXT_MCRYPT),y) PHP_CONF_OPTS += --with-mcrypt=$(STAGING_DIR)/usr PHP_DEPENDENCIES += libmcrypt From patchwork Wed Aug 7 23:17:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1143749 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ACPnek14"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 463nVY6pQLz9sN6 for ; Thu, 8 Aug 2019 09:18:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 312322291C; Wed, 7 Aug 2019 23:18:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U2GLKLRfVapS; Wed, 7 Aug 2019 23:18:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 16843228B0; Wed, 7 Aug 2019 23:17:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 1DC3A1BF588 for ; Wed, 7 Aug 2019 23:17:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 14D5F2076F for ; Wed, 7 Aug 2019 23:17:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uOlO0sPPoLzW for ; Wed, 7 Aug 2019 23:17:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by silver.osuosl.org (Postfix) with ESMTPS id CAD0920412 for ; Wed, 7 Aug 2019 23:17:53 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id x21so17854117otq.12 for ; Wed, 07 Aug 2019 16:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DeTZ9AWlpQt0cADOum4WQSn5uwTvODX1nH+eR20L+VE=; b=ACPnek14sWcAdQ45jC2vT5J3//3Bog6h4xFk8JKdt/vcA/qeq8F6ag8xvCEApbHO93 tdwotGoaav7yCQd2JZbdQj+RBt/uP7dbreeB2hKJ0G16DL2fNjsNPz0xSRGpIkOwK7Dn t7ogRX1tDyhKr/WKRVlU2LWVoaBRGXt5XOV3iHQn3su/AaYHZcI+JbZkgqfPpgkRLd5j r7JHW7OURhiwyNZLCCD+gyJPUEzQXcROglcUo9d75QynCjBJyAUl1MzEMXzf920hCx9c bH6ilVXpERPox1bSGi3snqWB+Qtq4+yzgnSxJS8EaCls+67XtheCNBdCVDH1wAFEyPkm mbtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DeTZ9AWlpQt0cADOum4WQSn5uwTvODX1nH+eR20L+VE=; b=nqrUkw+8wg5BaRK14qubAu0AhCwLbXq/t257E925Mlyv4kfTgQiR48Paqk1vGblZJa C/CcUGtm0PySWlS5E/vZrB9jS7P0Jl8CS8oic7wyW3KW6MSTfTVvN/JEjyVbv2eXtZvp oy3ARb0BIntVo2JShbnd9bk5bkf8FoEhijpYr3/vllThucRVtpUTj8kJLbxglom57I5E Uh+lB3pLoGaKBIBuL/ViypoSluW7V7CQGf+V7fP10wwhVSdIBxNCYHp3nK+16E6V8Dr4 lbUeW4/FWUJGoz++mSupl+DlJsvS4C/C62PoC+3oUBZncpOM+OfOs/1boH/kRS98EFw7 1Zcg== X-Gm-Message-State: APjAAAWkqN9YNEVymUVnj2WymeXeHeX6MQIPJMea2AonSuqhGt1wiyd0 U1uubh1vztk33Jj+Ax1rxmLWDiKn X-Google-Smtp-Source: APXvYqx7q1A91c0b61gDRU2skhC8V6qErO3xbqv56YlkSvv/z9WVGq2luvuhHQxqbglWKAbRyuwhqA== X-Received: by 2002:a02:c059:: with SMTP id u25mr3630410jam.109.1565219872781; Wed, 07 Aug 2019 16:17:52 -0700 (PDT) Received: from localhost.localdomain (68-188-149-81.dhcp.aldl.mi.charter.com. [68.188.149.81]) by smtp.gmail.com with ESMTPSA id c13sm219047iok.84.2019.08.07.16.17.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 16:17:51 -0700 (PDT) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Wed, 7 Aug 2019 19:17:44 -0400 Message-Id: <20190807231744.57150-4-aduskett@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190807231744.57150-1-aduskett@gmail.com> References: <20190807231744.57150-1-aduskett@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/3] package/uwsgi: add support for application types X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Adam Duskett Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Adam Duskett uWSGI supports many different application types; two everyday use cases are Python and PHP. uWSGI requires Python to configure, build, and install, but it is not necessary to run. Setting the package type to generic saves upwards of 29M of space with a Glibc target filing system (52M vs. 23M.) If however, the primary application type is Python, then the package is better suited to be a python-package because there is no longer any space saved, Python is now on the target and staging directories, and Buildroot can provide all of the necessary variables to compile the Python plugin. The "Main application type" prompt in the Config.in sets the main_plugin variable in the buildroot.ini file. Signed-off-by: Adam Duskett --- package/uwsgi/Config.in | 45 +++++++++++++++++++++++++------ package/uwsgi/buildroot.ini.in | 2 +- package/uwsgi/uwsgi.mk | 48 ++++++++++++++++++++++++++++------ 3 files changed, 78 insertions(+), 17 deletions(-) diff --git a/package/uwsgi/Config.in b/package/uwsgi/Config.in index 8b1082d06e..a1341f289e 100644 --- a/package/uwsgi/Config.in +++ b/package/uwsgi/Config.in @@ -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-python 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 diff --git a/package/uwsgi/buildroot.ini.in b/package/uwsgi/buildroot.ini.in index 75ad8afa32..e9074a3644 100644 --- a/package/uwsgi/buildroot.ini.in +++ b/package/uwsgi/buildroot.ini.in @@ -5,5 +5,5 @@ pcre = true ssl = false xml = false yaml = false -main_plugin = python +main_plugin = #MAIN_PLUGIN# plugin_dir = /usr/lib/uwsgi diff --git a/package/uwsgi/uwsgi.mk b/package/uwsgi/uwsgi.mk index 4441c94b16..95eec5284d 100644 --- a/package/uwsgi/uwsgi.mk +++ b/package/uwsgi/uwsgi.mk @@ -8,22 +8,16 @@ UWSGI_VERSION = 2.0.18 UWSGI_SITE = $(call github,unbit,uwsgi,$(UWSGI_VERSION)) UWSGI_LICENSE = GPL-2.0+ UWSGI_LICENSE_FILES = LICENSE -UWSGI_SETUP_TYPE = setuptools -UWSGI_DEPENDENCIES += pcre +UWSGI_DEPENDENCIES += host-python3 host-python3-setuptools pcre UWSGI_ENV += \ + CC="$(TARGET_CC)" \ UWSGI_REMOVE_INCLUDES="/usr/include,/usr/local/include" \ UWSGI_INCLUDES="$(STAGING_DIR)/usr/include" \ PLUGIN_BASE_DIR="$(TARGET_DIR)" \ PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \ UWSGI_PROFILE=$(@D)/buildroot.ini -ifeq ($(BR2_PACKAGE_PYTHON),y) -UWSGI_DEPENDENCIES += python -else -UWSGI_DEPENDENCIES += python3 -endif - ifeq ($(BR2_PACKAGE_LIBZLIB),y) UWSGI_DEPENDENCIES += libzlib endif @@ -32,6 +26,24 @@ 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 + +# Set uWSGI to a python-package if the main application is also Python. +ifeq ($(BR2_PACKAGE_UWSGI_APPLICATION_PYTHON),y) +UWSGI_SETUP_TYPE = setuptools +UWSGI_ENV += PYTHON_LIBDIR="$(STAGING_DIR)/usr/lib" +ifeq ($(BR2_PACKAGE_PYTHON),y) +UWSGI_DEPENDENCIES += python +else +UWSGI_DEPENDENCIES += python3 +endif +endif + # Plugins ifeq ($(BR2_PACKAGE_UWSGI_PLUGINS_CAPABILITIES),y) UWSGI_DEPENDENCIES += libcap @@ -81,7 +93,29 @@ 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 +# Python is required to configure, build, and install uWsgi, but is C, as such, +# Python is not a requirement. If the main application type is not Python, then +# Python must be called out manually. However, if the main application is +# Python, uWSGI can be setup as a python-package type. +ifneq ($(BR2_PACKAGE_UWSGI_APPLICATION_PYTHON),y) +define UWSGI_BUILD_CMDS + cd $(@D); \ + $(TARGET_MAKE_ENV) $(UWSGI_ENV) $(HOST_DIR)/bin/python3 \ + ./setup.py build +endef + +define UWSGI_INSTALL_TARGET_CMDS + cd $(@D); \ + $(TARGET_MAKE_ENV) $(UWSGI_ENV) $(HOST_DIR)/bin/python3 \ + ./setup.py install $(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS) +endef + +$(eval $(generic-package)) +else $(eval $(python-package)) +endif