Add libedit and php readline support

This commit is contained in:
Wildan M 2025-09-18 09:32:33 +07:00
parent 38edfa0a78
commit 0fbd836535
4 changed files with 140 additions and 20 deletions

View File

@ -1,4 +1,4 @@
#TODO fix readline and openssl
#TODO fix openssl
[source]
tar = "https://www.php.net/distributions/php-8.4.12.tar.xz"
patches = [
@ -13,30 +13,36 @@ dependencies = [
"libgmp",
"libavif",
"libjpeg",
# "libedit",
"libedit",
"libonig",
"libpng",
"libwebp",
"libxml2",
"libiconv",
"libzip",
# "ncurses",
"ncurses",
"nghttp2",
"openssl1",
"pcre",
# "readline",
"readline",
"sqlite3",
"xz",
"zlib",
]
script = """
DYNAMIC_INIT
# extension stuff
export SUFFIX="84"
export CURL_LIBS="-lcurl -lnghttp2 -lssl -lcrypto"
#export READLINE_DIR="${COOKBOOK_SYSROOT}/usr"
COOKBOOK_CONFIGURE_FLAGS+=(
--without-iconv
--disable-phar
--program-suffix=${SUFFIX}
--sysconfdir=/etc
--with-config-file-path=/etc
--with-config-file-scan-dir=/etc/conf.d
--with-iconv="${COOKBOOK_SYSROOT}/usr"
--disable-phar # doesn't work cross compiling
--disable-opcache
# --enable-fpm # need times function
--enable-gd
--with-curl
--with-gmp
@ -46,9 +52,9 @@ COOKBOOK_CONFIGURE_FLAGS+=(
--with-ffi
--with-intl
--with-mbstring
# --with-libedit
# --with-readline
# --with-openssl
--with-libedit
--with-readline
# --with-openssl # need 1.1.1
--with-zip
)
@ -57,4 +63,8 @@ COOKBOOK_CONFIGURE_FLAGS+=(
"${COOKBOOK_MAKE}" install \
INSTALL_ROOT="${COOKBOOK_STAGE}" \
datarootdir=/usr/share localstatedir=/var
for bin in "php-cgi" "php-config" "php" "phpdbg" "phpize"; do
ln -s "$bin$SUFFIX" ${COOKBOOK_STAGE}/usr/bin/$bin
done
"""

View File

@ -1,6 +1,6 @@
diff --color -ruwN source/configure source-new/configure
--- source/configure 2025-08-26 20:36:28.000000000 +0700
+++ source-new/configure 2025-09-16 07:44:46.452670941 +0700
+++ source-new/configure 2025-09-16 07:50:56.962975667 +0700
@@ -25863,7 +25863,7 @@
then :
ac_cv_lib_curl_curl_easy_perform=yes
@ -28,9 +28,21 @@ diff --color -ruwN source/configure source-new/configure
ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
if test "x$ac_cv_header_gmp_h" = xyes
then :
diff --color -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag
--- source/ext/phar/Makefile.frag 2025-08-26 20:36:28.000000000 +0700
+++ source-new/ext/phar/Makefile.frag 2025-09-18 07:37:43.264765180 +0700
@@ -30,7 +30,7 @@
-@test -f $(builddir)/phar/phar.inc || cp $(srcdir)/phar/phar.inc $(builddir)/phar/phar.inc
TEST_PHP_EXECUTABLE = $(shell $(PHP_EXECUTABLE) -v 2>&1)
-TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -c 'Exec format error')
+TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -E -c 'Exec format error|required file not found')
$(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
-@(echo "Generating phar.php"; \
diff --color -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c
--- source/ext/posix/posix.c 2025-08-26 20:36:28.000000000 +0700
+++ source-new/ext/posix/posix.c 2025-09-16 07:02:03.974662569 +0700
+++ source-new/ext/posix/posix.c 2025-09-16 07:50:56.989976200 +0700
@@ -375,7 +375,7 @@
ZEND_PARSE_PARAMETERS_NONE();

View File

@ -1,14 +1,13 @@
#TODO make dependencies work
#TODO promote
[source]
tar = "https://www.thrysoee.dk/editline/libedit-20221030-3.1.tar.gz"
tar = "https://www.thrysoee.dk/editline/libedit-20250104-3.1.tar.gz"
patches = [
"redox.patch"
]
[build]
template = "custom"
template = "configure"
dependencies = [
"ncurses",
"termcap",
"terminfo",
]
script = """
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include/ncurses"
cookbook_configure
"""

View File

@ -0,0 +1,99 @@
diff --color -ruwN source/configure source-new/configure
--- source/configure 2025-01-05 00:16:30.000000000 +0700
+++ source-new/configure 2025-09-18 06:50:23.667443238 +0700
@@ -6384,7 +6384,7 @@
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | redox*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -7715,7 +7715,7 @@
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*)
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu**|x86_64-redox*)
# Find out what ABI is being produced by ac_compile, and set linker
# options accordingly. Note that the listed cases only cover the
# situations where additional linker options are needed (such as when
@@ -7734,7 +7734,7 @@
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_i386_fbsd"
;;
- x86_64-*linux*|x86_64-gnu*)
+ x86_64-*linux*|x86_64-gnu*|x86_64-redox*)
case `$FILECMD conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
@@ -7763,7 +7763,7 @@
x86_64-*kfreebsd*-gnu)
LD="${LD-ld} -m elf_x86_64_fbsd"
;;
- x86_64-*linux*|x86_64-gnu*)
+ x86_64-*linux*|x86_64-gnu*|x86_64-*redox*)
LD="${LD-ld} -m elf_x86_64"
;;
powerpcle-*linux*)
@@ -12168,7 +12168,7 @@
;;
# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | redox*)
version_type=linux # correct to gnu/linux during the next big refactor
need_lib_prefix=no
need_version=no
diff --color -ruwN source/src/chartype.h source-new/src/chartype.h
--- source/src/chartype.h 2022-06-11 14:57:59.000000000 +0700
+++ source-new/src/chartype.h 2025-09-18 06:38:37.401509690 +0700
@@ -39,7 +39,8 @@
!(defined(__APPLE__) && defined(__MACH__)) && \
!defined(__OpenBSD__) && \
!defined(__FreeBSD__) && \
- !defined(__DragonFly__)
+ !defined(__DragonFly__) && \
+ !defined(__redox__)
#ifndef __STDC_ISO_10646__
/* In many places it is assumed that the first 127 code points are ASCII
* compatible, so ensure wchar_t indeed does ISO 10646 and not some other
diff --color -ruwN source/src/editline/readline.h source-new/src/editline/readline.h
--- source/src/editline/readline.h 2023-08-27 14:25:53.000000000 +0700
+++ source-new/src/editline/readline.h 2025-09-18 06:41:15.169232816 +0700
@@ -78,7 +78,7 @@
#ifndef CTRL
#include <sys/ioctl.h>
-#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
+#if !defined(__sun) && !defined(__hpux) && !defined(_AIX) && !defined(__redox__)
#include <sys/ttydefaults.h>
#endif
#ifndef CTRL
diff --color -ruwN source/src/sys.h source-new/src/sys.h
--- source/src/sys.h 2024-08-09 01:03:34.000000000 +0700
+++ source-new/src/sys.h 2025-09-18 06:40:02.388537017 +0700
@@ -116,10 +116,6 @@
typedef unsigned int u_int32_t;
#endif
-#ifndef HAVE_SIZE_MAX
-#define SIZE_MAX ((size_t)-1)
-#endif
-
#define REGEX /* Use POSIX.2 regular expression functions */
#undef REGEXP /* Use UNIX V8 regular expression functions */
diff --color -ruwN source/src/wcsdup.c source-new/src/wcsdup.c
--- source/src/wcsdup.c 2022-06-11 14:57:59.000000000 +0700
+++ source-new/src/wcsdup.c 2025-09-18 06:44:01.365917599 +0700
@@ -11,7 +11,7 @@
* code is also granted without any restrictions.
*/
-#ifndef HAVE_WCSDUP
+#if !defined(HAVE_WCSDUP) && !defined(__redox__)
#include "config.h"