flathub / org.freedesktop.Sdk.Extension.php73

0 stars 1 forks source link

22.08 build broken #111

Open hfiguiere opened 1 year ago

hfiguiere commented 1 year ago

The 22.08 build failed. Something about openSSL.

hfiguiere commented 1 year ago

Only PHP >= 8.1 supports OpenSSL >= 3.0.

One solution would be to build the version of openssl that came with 21.08

Lctrs commented 1 year ago

Yeah I've been working on this locally but without luck. It worked for php 7.4 though but I still can't compile php 7.3.

Lctrs commented 1 year ago

For reference, here is my current patch for php 7.3 :

diff --git a/org.freedesktop.Sdk.Extension.php73.json b/org.freedesktop.Sdk.Extension.php73.json
index 2ea81b4..40031a5 100644
--- a/org.freedesktop.Sdk.Extension.php73.json
+++ b/org.freedesktop.Sdk.Extension.php73.json
@@ -37,7 +37,7 @@
         "prefix": "/usr/lib/sdk/php73",
         "prepend-path": "/usr/lib/sdk/php73/bin",
         "prepend-ld-library-path": "/usr/lib/sdk/php73/lib",
-        "append-pkg-config-path": "/usr/lib/sdk/php73/lib/pkgconfig",
+        "prepend-pkg-config-path": "/usr/lib/sdk/php73/lib/pkgconfig",
         "env": {
             "PHP_INI_DIR": "/usr/lib/sdk/php73/etc/php"
         }
@@ -133,6 +133,36 @@
             ]
         },
         {
+            "name": "openssl",
+            "config-opts": [
+                "enable-ec_nistp_64_gcc_128",
+                "--prefix=/usr/lib/sdk/php73",
+                "--openssldir=/usr/lib/sdk/php73/etc/pki/tls",
+                "shared",
+                "threads"
+            ],
+            "cleanup": [
+                "/bin",
+                "/share/doc"
+            ],
+            "sources": [
+                {
+                    "type": "archive",
+                    "url": "https://www.openssl.org/source/openssl-1.1.1q.tar.gz",
+                    "sha256": "d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca"
+                },
+                {
+                    "type": "shell",
+                    "commands": [
+                        "cp config configure"
+                    ]
+                }
+            ],
+            "post-install": [
+                "install -Dm644 LICENSE ${FLATPAK_DEST}/share/licenses/openssl/LICENSE"
+            ]
+        },
+        {
             "name": "php",
             "buildsystem": "autotools",
             "build-options": {
@@ -184,7 +214,7 @@
                 "--with-libzip",
                 "--with-mhash",
                 "--with-mysqli",
-                "--with-openssl",
+                "--with-openssl=/usr/lib/sdk/php73",
                 "--with-password-argon2=/usr/lib/sdk/php73",
                 "--with-pdo-mysql",
                 "--with-pdo-pgsql=/usr/lib/sdk/php73",
@@ -212,6 +242,10 @@
                     "path": "patches/php/freetype.patch"
                 },
                 {
+                    "type": "patch",
+                    "path": "patches/php/support-icu-70.1.patch"
+                },
+                {
                     "type": "shell",
                     "commands": [
                         "./buildconf --force"
diff --git a/patches/php/support-icu-70.1.patch b/patches/php/support-icu-70.1.patch
new file mode 100644
index 0000000..20c1a48
--- /dev/null
+++ b/patches/php/support-icu-70.1.patch
@@ -0,0 +1,71 @@
+From cd1447a6962496fca60a2f5e5d9cf4448575cc24 Mon Sep 17 00:00:00 2001
+From: Ben Ramsey <ramsey@php.net>
+Date: Tue, 19 Oct 2021 23:59:11 -0500
+Subject: [PATCH 1/4] Change UBool to bool for equality operators in ICU >=
+ 70.1
+
+Refer to:
+- https://github.com/unicode-org/icu/commit/633438f8da99fee815e2c61626ea779a84567a3d
+- https://github.com/unicode-org/icu/commit/f6325d49ba57ec26f320b2865ce09ca47db458d9
+---
+ ext/intl/breakiterator/codepointiterator_internal.cpp | 4 ++++
+ ext/intl/breakiterator/codepointiterator_internal.h   | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/ext/intl/breakiterator/codepointiterator_internal.cpp b/ext/intl/breakiterator/codepointiterator_internal.cpp
+index 71ba056994d0..3982a599af38 100644
+--- a/ext/intl/breakiterator/codepointiterator_internal.cpp
++++ b/ext/intl/breakiterator/codepointiterator_internal.cpp
+@@ -73,7 +73,11 @@ CodePointBreakIterator::~CodePointBreakIterator()
+   clearCurrentCharIter();
+ }
+ 
++#if U_ICU_VERSION_MAJOR_NUM >= 70
++bool CodePointBreakIterator::operator==(const BreakIterator& that) const
++#else
+ UBool CodePointBreakIterator::operator==(const BreakIterator& that) const
++#endif
+ {
+   if (typeid(*this) != typeid(that)) {
+       return false;
+diff --git a/ext/intl/breakiterator/codepointiterator_internal.h b/ext/intl/breakiterator/codepointiterator_internal.h
+index 43ec79d0b776..93b903a20bb8 100644
+--- a/ext/intl/breakiterator/codepointiterator_internal.h
++++ b/ext/intl/breakiterator/codepointiterator_internal.h
+@@ -37,7 +37,11 @@ namespace PHP {
+ 
+       virtual ~CodePointBreakIterator();
+ 
++#if U_ICU_VERSION_MAJOR_NUM >= 70
++      virtual bool operator==(const BreakIterator& that) const;
++#else
+       virtual UBool operator==(const BreakIterator& that) const;
++#endif
+ 
+       virtual CodePointBreakIterator* clone(void) const;
+ 
+
+From 8cc00121d884491064ace635370730b693d7ce57 Mon Sep 17 00:00:00 2001
+From: Ben Ramsey <ramsey@php.net>
+Date: Wed, 20 Oct 2021 00:02:55 -0500
+Subject: [PATCH 2/4] Accommodate changes to canonicalized forms in ICU >= 70.1
+
+Refer to:
+https://github.com/unicode-org/icu/commit/01e1adc9e412c9c3177dc3e30d056c25d8687853
+---
+ ext/intl/locale/locale_methods.c              |   2 +-
+ 3 files changed, 370 insertions(+), 3 deletions(-)
+
+diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
+index 1782dd6ecb43..159b3ea0a192 100644
+--- a/ext/intl/locale/locale_methods.c
++++ b/ext/intl/locale/locale_methods.c
+@@ -1238,7 +1238,7 @@ PHP_FUNCTION(locale_filter_matches)
+       if( token && (token==cur_lang_tag) ){
+           /* check if the char. after match is SEPARATOR */
+           chrcheck = token + (strlen(cur_loc_range));
+-          if( isIDSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
++          if( isIDSeparator(*chrcheck) || isKeywordSeparator(*chrcheck) || isEndOfTag(*chrcheck) ){
+               efree( cur_lang_tag );
+               efree( cur_loc_range );
+               if( can_lang_tag){