[Buildroot] [git commit] package/php-pam: new package

From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: 2021-12-17 21:48:00
Subsystem: the rest · Maintainer: Linus Torvalds

commit: https://git.buildroot.net/buildroot/commit/?id=403b62943b9b1c648a5e86281438e8d38e27929a
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The php-pam package provides a PHP PAM (Pluggable Authentication
Modules) integration.

https://pecl.php.net/package/PAM

Based on initial work from Nicolas Carrier [off-list ref]

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  4 ++++
 package/Config.in                             |  2 ++
 package/php-pam/Config.in                     | 16 ++++++++++++++
 package/php-pam/php-pam.hash                  |  3 +++
 package/php-pam/php-pam.mk                    | 26 ++++++++++++++++++++++
 support/testing/tests/package/test_php_pam.py | 32 +++++++++++++++++++++++++++
 6 files changed, 83 insertions(+)
diff --git a/DEVELOPERS b/DEVELOPERS
index ea4fc89ebf..de960d25b0 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1163,10 +1163,12 @@ F:	package/lua-augeas/
 F:	package/modsecurity2/
 F:	package/php-apcu/
 F:	package/php-lua/
+F:	package/php-pam/
 F:	support/testing/tests/package/test_dtbocfg.py
 F:	support/testing/tests/package/test_lua_augeas.py
 F:	support/testing/tests/package/test_php_apcu.py
 F:	support/testing/tests/package/test_php_lua.py
+F:	support/testing/tests/package/test_php_pam.py
 
 N:	Herv�� Codina <herve.codina@bootlin.com>
 F:	package/php-pecl-dbus/
@@ -2027,6 +2029,7 @@ F:	package/lua-augeas/
 F:	package/modsecurity2/
 F:	package/php-apcu/
 F:	package/php-lua/
+F:	package/php-pam/
 F:	package/php-pecl-dbus/
 F:	package/php-xdebug/
 F:	package/python-augeas/
@@ -2043,6 +2046,7 @@ F:	support/testing/tests/package/test_bmap_tools.py
 F:	support/testing/tests/package/test_php_apcu.py
 F:	support/testing/tests/package/test_php_pecl_dbus.py
 F:	support/testing/tests/package/test_php_lua.py
+F:	support/testing/tests/package/test_php_pam.py
 F:	support/testing/tests/package/test_python_augeas.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_git.py
diff --git a/package/Config.in b/package/Config.in
index 136500ca40..c61ef472e3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -870,7 +870,9 @@ menu "External php extensions"
 	source "package/php-geoip/Config.in"
 	source "package/php-gnupg/Config.in"
 	source "package/php-imagick/Config.in"
+	source "package/php-lua/Config.in"
 	source "package/php-memcached/Config.in"
+	source "package/php-pam/Config.in"
 	source "package/php-pecl-dbus/Config.in"
 	source "package/php-ssh2/Config.in"
 	source "package/php-xdebug/Config.in"
diff --git a/package/php-pam/Config.in b/package/php-pam/Config.in
new file mode 100644
index 0000000000..70f62a3180
--- /dev/null
+++ b/package/php-pam/Config.in
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_PHP_PAM
+	bool "php-pam"
+	depends on BR2_ENABLE_LOCALE # linux-pam
+	depends on BR2_USE_WCHAR # linux-pam
+	depends on BR2_USE_MMU # linux-pam
+	depends on !BR2_STATIC_LIBS # linux-pam
+	select BR2_PACKAGE_LINUX_PAM
+	help
+	  PHP PAM (Pluggable Authentication Modules) integration
+
+	  https://pecl.php.net/package/PAM
+
+comment "php-pam needs a toolchain w/ wchar, locale, dynamic library"
+	depends on BR2_USE_MMU
+	depends on !BR2_ENABLE_LOCALE || !BR2_USE_WCHAR \
+		|| BR2_STATIC_LIBS
diff --git a/package/php-pam/php-pam.hash b/package/php-pam/php-pam.hash
new file mode 100644
index 0000000000..c3eb49fbe7
--- /dev/null
+++ b/package/php-pam/php-pam.hash
@@ -0,0 +1,3 @@
+# Locally calculated:
+sha256  fda3b5f719d51cb278351eedd3d7a96db75661324d81fdcf8072a4309121bc92  pam-2.2.3.tgz
+sha256  0967ad6cf4b7fe81d38709d7aaef3fecb3bd685be7eebb37b864aa34c991baa7  LICENSE
diff --git a/package/php-pam/php-pam.mk b/package/php-pam/php-pam.mk
new file mode 100644
index 0000000000..8e20095d86
--- /dev/null
+++ b/package/php-pam/php-pam.mk
@@ -0,0 +1,26 @@
+################################################################################
+#
+# php-pam
+#
+################################################################################
+
+PHP_PAM_VERSION = 2.2.3
+PHP_PAM_SITE = http://pecl.php.net/get
+PHP_PAM_SOURCE = pam-$(PHP_PAM_VERSION).tgz
+PHP_PAM_LICENSE = PHP-3.01
+PHP_PAM_LICENSE_FILES = LICENSE
+PHP_PAM_DEPENDENCIES = php linux-pam host-autoconf host-pkgconf
+
+PHP_PAM_CONF_OPTS = \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php-config \
+	--with-pam=$(STAGING_DIR)/usr
+
+define PHP_PAM_PHPIZE
+	(cd $(@D); \
+		PHP_AUTOCONF=$(HOST_DIR)/usr/bin/autoconf \
+		PHP_AUTOHEADER=$(HOST_DIR)/usr/bin/autoheader \
+		$(STAGING_DIR)/usr/bin/phpize)
+endef
+PHP_PAM_PRE_CONFIGURE_HOOKS += PHP_PAM_PHPIZE
+
+$(eval $(autotools-package))
diff --git a/support/testing/tests/package/test_php_pam.py b/support/testing/tests/package/test_php_pam.py
new file mode 100644
index 0000000000..c4c1412e10
--- /dev/null
+++ b/support/testing/tests/package/test_php_pam.py
@@ -0,0 +1,32 @@
+import os
+
+import infra.basetest
+
+
+class TestPhpPam(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_PHP=y
+        BR2_PACKAGE_PHP_SAPI_CLI=y
+        BR2_PACKAGE_PHP_PAM=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        img = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", img])
+        self.emulator.login()
+
+        self.assertRunOk("mkdir /etc/php.d")
+        self.assertRunOk("echo 'extension=pam.so'> /etc/php.d/pam.ini")
+
+        output, exit_code = self.emulator.run("php --ri pam | sed '/^$/d'")
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], "pam")
+        self.assertEqual(output[1], "PAM support => enabled")
+        # Do not check the version value in order to avoid test failure when
+        # bumping package version
+        self.assertEqual(output[2][0:21], "Extension version => ")

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help