build using system libxcrypt

(cherry picked from commit 7113f618aa)
(cherry picked from commit c87dfed745)
This commit is contained in:
Remi Collet 2021-10-18 09:50:31 +02:00
parent c0be14249f
commit 9cf61a5f3f
4 changed files with 82 additions and 3 deletions

4
.gitignore vendored
View File

@ -34,3 +34,7 @@ php-7.*.xz.asc
/php-8.0.11RC1.tar.xz.asc
/php-8.0.11.tar.xz
/php-8.0.11.tar.xz.asc
/php-8.0.12RC1.tar.xz
/php-8.0.12RC1.tar.xz.asc
/php-8.0.12.tar.xz
/php-8.0.12.tar.xz.asc

66
php-8.0.12-crypt.patch Normal file
View File

@ -0,0 +1,66 @@
From 9f98bc58c7bb7fdbb25614ca645bbd7a465fdfed Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 15 Oct 2021 15:45:50 +0200
Subject: [PATCH] remove closing bracket in bad place
---
build/php.m4 | 1 -
1 file changed, 1 deletion(-)
diff --git a/build/php.m4 b/build/php.m4
index 9746ba28f325..7fb9e3125d13 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -2219,7 +2219,6 @@ struct crypt_data buffer;
crypt_r("passwd", "hash", &buffer);
]])],[php_cv_crypt_r_style=struct_crypt_data_gnu_source],[])
fi
- ])
if test "$php_cv_crypt_r_style" = "none"; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
From fc4e31467c352032ee709ac55d3c67bc22abcd8d Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 15 Oct 2021 17:11:12 +0200
Subject: [PATCH] add --with-external-libcrypt build option display an error
message if some algo not available in external libcrypt
---
ext/standard/config.m4 | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
index 58b9c5e658a4..3ec18be4d7df 100644
--- a/ext/standard/config.m4
+++ b/ext/standard/config.m4
@@ -267,14 +267,25 @@ int main() {
])])
+PHP_ARG_WITH([external-libcrypt],
+ [for external libcrypt or libxcrypt],
+ [AS_HELP_STRING([--with-external-libcrypt],
+ [Use external libcrypt or libxcrypt])],
+ [no],
+ [no])
+
dnl
dnl If one of them is missing, use our own implementation, portable code is then possible
dnl
-dnl TODO This is currently always enabled
-if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "$ac_cv_crypt_md5" = "no" || test "$ac_cv_crypt_sha512" = "no" || test "$ac_cv_crypt_sha256" = "no" || test "$ac_cv_func_crypt_r" != "yes" || true; then
- AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r for blowfish, des, ext des and md5])
-
- PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c)
+dnl This is currently enabled by default
+if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "$ac_cv_crypt_md5" = "no" || test "$ac_cv_crypt_sha512" = "no" || test "$ac_cv_crypt_sha256" = "no" || test "$ac_cv_func_crypt_r" != "yes" || test "$PHP_EXTERNAL_LIBCRYPT" = "no"; then
+ if test "$PHP_EXTERNAL_LIBCRYPT" = "no"; then
+ AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r for blowfish, des, ext des and md5])
+
+ PHP_ADD_SOURCES(PHP_EXT_DIR(standard), crypt_freesec.c crypt_blowfish.c crypt_sha512.c crypt_sha256.c php_crypt_r.c)
+ else
+ AC_MSG_ERROR([Cannot use external libcrypt as some algo are missing])
+ fi
else
AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 0, [Whether PHP has to use its own crypt_r for blowfish, des and ext des])
fi

View File

@ -62,7 +62,7 @@
%bcond_with imap
%bcond_without lmdb
%global upver 8.0.11
%global upver 8.0.12
#global rcver RC1
Summary: PHP scripting language for creating dynamic web sites
@ -123,6 +123,8 @@ Patch48: php-8.0.10-snmp-sha.patch
# switch phar to use sha256 signature by default, from 8.1
# implement openssl_256 and openssl_512 for phar signatures, from 8.1
Patch49: php-8.0.10-phar-sha.patch
# use system libxcrypt
Patch51: php-8.0.12-crypt.patch
# Upstream fixes (100+)
@ -150,6 +152,7 @@ BuildRequires: pkgconfig(zlib) >= 1.2.0.4
BuildRequires: smtpdaemon
BuildRequires: pkgconfig(libedit)
BuildRequires: pkgconfig(libpcre2-8) >= 10.30
BuildRequires: pkgconfig(libxcrypt)
BuildRequires: bzip2
BuildRequires: perl-interpreter
BuildRequires: autoconf
@ -721,6 +724,7 @@ in pure PHP.
%patch47 -p1 -b .phpinfo
%patch48 -p1 -b .sha
%patch49 -p1 -b .pharsha
%patch51 -p1 -b .libxcrypt
# upstream patches
@ -878,6 +882,7 @@ ln -sf ../configure
--with-openssl \
--with-system-ciphers \
--with-external-pcre \
--with-external-libcrypt \
%ifarch s390 s390x sparc64 sparcv9 riscv64
--without-pcre-jit \
%endif
@ -1534,6 +1539,10 @@ systemctl try-restart php-fpm.service >/dev/null 2>&1 || :
%changelog
* Tue Oct 19 2021 Remi Collet <remi@remirepo.net> - 8.0.12-1
- Update to 8.0.12 - http://www.php.net/releases/8_0_12.php
- build using system libxcrypt
* Wed Sep 22 2021 Remi Collet <remi@remirepo.net> - 8.0.11-1
- Update to 8.0.11 - http://www.php.net/releases/8_0_11.php

View File

@ -1,2 +1,2 @@
SHA512 (php-8.0.11.tar.xz) = 2d346959b2691ea0d5334dc9cad225b7a65ec53d6a6493f3b95c4819a0c088bec36aa1bf4ab3c8044a631bcfefb689d85463ff2259d42000e65dac30badcc59d
SHA512 (php-8.0.11.tar.xz.asc) = a98a5ad2bd6d67b2902e05900dc39622b2e9b23deeb46de4dde5fe6f8a260fe0ce82e2cc1be5335fbb96f8b5e8638b04233e13ed79dd7cd8907105699b68a5a3
SHA512 (php-8.0.12.tar.xz) = 927b15c4443f3741a5325ec7bf387987b405cd5e64e40fd81f1945bf073adda30eeede8e1f98185f505cb61f969cf1abe05b8dad57a3c4e87971e8037bb16b23
SHA512 (php-8.0.12.tar.xz.asc) = 90c8a179651ad530c8cb162a3d7f08472dd82a8c1b667b2df6ad0fd7c1cc1b97f18f8e13cae62d1176b36d579a1bd0646957631612a3ca11658d37c0dc6ff70b