mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-24 13:54:19 +08:00
Merge branch 'python-php-openssl' into 'master'
Support PHP and Python with OpenSSL See merge request redox-os/cookbook!630
This commit is contained in:
commit
a522d00fca
@ -10,7 +10,7 @@ ARCH="${TARGET%%-*}"
|
||||
COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/Configure"
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
shared
|
||||
# threads # needs ucontext.h
|
||||
threads
|
||||
no-dgram
|
||||
"redox-${ARCH}"
|
||||
--prefix="/"
|
||||
|
||||
@ -6,7 +6,13 @@ patches = [
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "configure"
|
||||
depends = [
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"ncurses",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
cookbook_configure
|
||||
ln -s "libhistory.so.7" "${COOKBOOK_STAGE}"/usr/lib/libhistory.so
|
||||
ln -s "libreadline.so.7" "${COOKBOOK_STAGE}"/usr/lib/libreadline.so
|
||||
"""
|
||||
|
||||
9
recipes/wip/dev/lang/php-composer/recipe.toml
Normal file
9
recipes/wip/dev/lang/php-composer/recipe.toml
Normal file
@ -0,0 +1,9 @@
|
||||
#TODO must be run using `php $(which composer)`
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
mkdir -p "${COOKBOOK_STAGE}"/usr/bin
|
||||
wget -c https://getcomposer.org/download/2.8.12/composer.phar
|
||||
chmod a+x composer.phar
|
||||
cp composer.phar ${COOKBOOK_STAGE}/usr/bin/composer
|
||||
"""
|
||||
79
recipes/wip/dev/lang/php80/recipe.toml
Normal file
79
recipes/wip/dev/lang/php80/recipe.toml
Normal file
@ -0,0 +1,79 @@
|
||||
#TODO promote
|
||||
[source]
|
||||
tar = "https://www.php.net/distributions/php-8.0.30.tar.xz"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"curl",
|
||||
"gettext",
|
||||
"libffi",
|
||||
"libgmp",
|
||||
"libavif",
|
||||
"libicu",
|
||||
"libjpeg",
|
||||
"libedit",
|
||||
"libonig",
|
||||
"libpng",
|
||||
"libsodium",
|
||||
"libwebp",
|
||||
"libxml2",
|
||||
"libiconv",
|
||||
"libzip",
|
||||
"ncurses",
|
||||
"nghttp2",
|
||||
"openssl1",
|
||||
"pcre",
|
||||
"sqlite3",
|
||||
"xz",
|
||||
"zlib",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
export SUFFIX="80"
|
||||
|
||||
# extension stuff
|
||||
export CURL_LIBS="-lcurl -lnghttp2 -lssl -lcrypto"
|
||||
export CXXFLAGS="-std=c++17"
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--program-suffix=${SUFFIX}
|
||||
--sysconfdir=/etc
|
||||
--with-config-file-path=/etc/php/$SUFFIX
|
||||
--with-config-file-scan-dir=/etc/php/$SUFFIX/conf.d
|
||||
--with-iconv="${COOKBOOK_SYSROOT}/usr"
|
||||
--disable-opcache
|
||||
--enable-bcmath
|
||||
--enable-calendar
|
||||
# --enable-fpm # need times function
|
||||
--enable-gd
|
||||
--enable-intl
|
||||
--enable-mbstring
|
||||
--with-curl
|
||||
--with-gettext
|
||||
--with-gmp
|
||||
--with-jpeg
|
||||
--with-webp
|
||||
--with-avif
|
||||
--with-ffi
|
||||
--with-libedit
|
||||
--with-openssl
|
||||
--with-sodium
|
||||
--with-zip
|
||||
)
|
||||
|
||||
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" "$@"
|
||||
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}"
|
||||
"${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
|
||||
mkdir -p ${COOKBOOK_STAGE}/etc/php/$SUFFIX/conf.d
|
||||
cp ${COOKBOOK_SOURCE}/php.ini* ${COOKBOOK_STAGE}/etc/php/$SUFFIX/
|
||||
"""
|
||||
92
recipes/wip/dev/lang/php80/redox.patch
Normal file
92
recipes/wip/dev/lang/php80/redox.patch
Normal file
@ -0,0 +1,92 @@
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2023-08-04 00:13:08.000000000 +0700
|
||||
+++ source-new/configure 2025-09-20 05:04:59.993364619 +0700
|
||||
@@ -46043,7 +46043,7 @@
|
||||
fi
|
||||
|
||||
|
||||
- ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=truednl
|
||||
+ ax_cxx_compile_alternatives="17 0x" ax_cxx_compile_cxx11_required=truednl
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@@ -72692,7 +72692,7 @@
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
|
||||
- php_cv_crypt_r_style=none
|
||||
+ php_cv_crypt_r_style=struct_crypt_data_gnu_source
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
diff -ruwN source/ext/intl/config.m4 source-new/ext/intl/config.m4
|
||||
--- source/ext/intl/config.m4 2023-08-04 00:13:08.000000000 +0700
|
||||
+++ source-new/ext/intl/config.m4 2025-09-20 05:05:18.892414632 +0700
|
||||
@@ -83,7 +83,7 @@
|
||||
breakiterator/codepointiterator_methods.cpp"
|
||||
|
||||
PHP_REQUIRE_CXX()
|
||||
- PHP_CXX_COMPILE_STDCXX(11, mandatory, PHP_INTL_STDCXX)
|
||||
+ PHP_CXX_COMPILE_STDCXX(17, mandatory, PHP_INTL_STDCXX)
|
||||
PHP_INTL_CXX_FLAGS="$INTL_COMMON_FLAGS $PHP_INTL_STDCXX $ICU_CXXFLAGS"
|
||||
case $host_alias in
|
||||
*cygwin*) PHP_INTL_CXX_FLAGS="$PHP_INTL_CXX_FLAGS -D_POSIX_C_SOURCE=200809L"
|
||||
diff -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag
|
||||
--- source/ext/phar/Makefile.frag 2023-08-04 00:13:08.000000000 +0700
|
||||
+++ source-new/ext/phar/Makefile.frag 2025-09-19 23:19:19.020178026 +0700
|
||||
@@ -9,20 +9,7 @@
|
||||
pharcmd: $(builddir)/phar.php $(builddir)/phar.phar
|
||||
|
||||
PHP_PHARCMD_SETTINGS = -n -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0
|
||||
-PHP_PHARCMD_EXECUTABLE = ` \
|
||||
- if test -x "$(top_builddir)/$(SAPI_CLI_PATH)"; then \
|
||||
- $(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \
|
||||
- if test "x$(PHP_MODULES)" != "x"; then \
|
||||
- $(top_srcdir)/build/shtool echo -n -- " -d extension_dir=$(top_builddir)/modules"; \
|
||||
- for i in bz2 zlib phar; do \
|
||||
- if test -f "$(top_builddir)/modules/$$i.la"; then \
|
||||
- . $(top_builddir)/modules/$$i.la; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
|
||||
- fi; \
|
||||
- done; \
|
||||
- fi; \
|
||||
- else \
|
||||
- $(top_srcdir)/build/shtool echo -n -- "$(PHP_EXECUTABLE)"; \
|
||||
- fi;`
|
||||
+PHP_PHARCMD_EXECUTABLE = "true"
|
||||
PHP_PHARCMD_BANG = `$(top_srcdir)/build/shtool echo -n -- "$(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT)";`
|
||||
|
||||
$(builddir)/phar/phar.inc: $(srcdir)/phar/phar.inc
|
||||
@@ -42,9 +29,3 @@
|
||||
|
||||
install-pharcmd: pharcmd
|
||||
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
||||
- $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix).phar
|
||||
- -@rm -f $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix)
|
||||
- $(LN_S) -f $(program_prefix)phar$(program_suffix).phar $(INSTALL_ROOT)$(bindir)/$(program_prefix)phar$(program_suffix)
|
||||
- @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1
|
||||
- @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phar$(program_suffix).1
|
||||
- @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phar$(program_suffix).phar.1
|
||||
diff -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c
|
||||
--- source/ext/posix/posix.c 2023-08-04 00:13:08.000000000 +0700
|
||||
+++ source-new/ext/posix/posix.c 2025-09-19 22:21:28.998031846 +0700
|
||||
@@ -443,7 +443,7 @@
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
- if ((ticks = times(&t)) == -1) {
|
||||
+ {
|
||||
POSIX_G(last_error) = errno;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
diff -ruwN source/ext/standard/hrtime.c source-new/ext/standard/hrtime.c
|
||||
--- source/ext/standard/hrtime.c 2023-08-04 00:13:08.000000000 +0700
|
||||
+++ source-new/ext/standard/hrtime.c 2025-09-19 23:34:34.839471333 +0700
|
||||
@@ -70,6 +70,8 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
+#elif defined(__redox__)
|
||||
+ /* pass */
|
||||
#elif PHP_HRTIME_PLATFORM_POSIX
|
||||
|
||||
#if !_POSIX_MONOTONIC_CLOCK
|
||||
@ -8,14 +8,18 @@ patches = [
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"curl",
|
||||
"gettext",
|
||||
"libffi",
|
||||
"libgmp",
|
||||
"libavif",
|
||||
"libicu",
|
||||
"libjpeg",
|
||||
"libedit",
|
||||
"libonig",
|
||||
"libpng",
|
||||
"libsodium",
|
||||
"libwebp",
|
||||
"libxml2",
|
||||
"libiconv",
|
||||
@ -24,7 +28,6 @@ dependencies = [
|
||||
"nghttp2",
|
||||
"openssl1",
|
||||
"pcre",
|
||||
"readline",
|
||||
"sqlite3",
|
||||
"xz",
|
||||
"zlib",
|
||||
@ -37,24 +40,26 @@ export CURL_LIBS="-lcurl -lnghttp2 -lssl -lcrypto"
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--program-suffix=${SUFFIX}
|
||||
--sysconfdir=/etc
|
||||
--with-config-file-path=/etc
|
||||
--with-config-file-scan-dir=/etc/conf.d
|
||||
--with-config-file-path=/etc/php/$SUFFIX
|
||||
--with-config-file-scan-dir=/etc/php/$SUFFIX/conf.d
|
||||
--with-iconv="${COOKBOOK_SYSROOT}/usr"
|
||||
--disable-phar # doesn't work cross compiling
|
||||
--disable-opcache
|
||||
--enable-bcmath
|
||||
--enable-calendar
|
||||
# --enable-fpm # need times function
|
||||
--enable-gd
|
||||
--enable-intl
|
||||
--enable-mbstring
|
||||
--with-curl
|
||||
--with-gettext
|
||||
--with-gmp
|
||||
--with-jpeg
|
||||
--with-webp
|
||||
--with-avif
|
||||
--with-ffi
|
||||
--with-intl
|
||||
--with-mbstring
|
||||
--with-libedit
|
||||
--with-readline
|
||||
# --with-openssl # need 1.1.1
|
||||
--with-sodium
|
||||
--with-zip
|
||||
)
|
||||
|
||||
@ -67,4 +72,6 @@ COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
for bin in "php-cgi" "php-config" "php" "phpdbg" "phpize"; do
|
||||
ln -s "$bin$SUFFIX" ${COOKBOOK_STAGE}/usr/bin/$bin
|
||||
done
|
||||
mkdir -p ${COOKBOOK_STAGE}/etc/php/$SUFFIX/conf.d
|
||||
cp ${COOKBOOK_SOURCE}/php.ini* ${COOKBOOK_STAGE}/etc/php/$SUFFIX/
|
||||
"""
|
||||
|
||||
@ -8,10 +8,14 @@ patches = [
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"libffi",
|
||||
"libuuid",
|
||||
# "openssl1", requires 1.1.1
|
||||
# "ncurses",
|
||||
"ncurses",
|
||||
"ncursesw",
|
||||
# "readline", unable to link
|
||||
"readline",
|
||||
"sqlite3",
|
||||
"zlib",
|
||||
"xz"
|
||||
]
|
||||
@ -22,11 +26,11 @@ ARCH="${TARGET%%-*}"
|
||||
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--prefix=/usr
|
||||
--enable-shared
|
||||
--disable-ipv6
|
||||
--host=${GNU_TARGET}
|
||||
--build=$ARCH
|
||||
--with-build-python
|
||||
# --with-openssl="${COOKBOOK_SYSROOT}/usr"
|
||||
--with-ensurepip=install
|
||||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
||||
|
||||
@ -1,17 +1,21 @@
|
||||
#TODO Fix dynamic loading of C modules
|
||||
#TODO Fix openssl dependency
|
||||
#TODO Add additional dependencies (readline, ncurses, etc.)
|
||||
[source]
|
||||
tar = "https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz"
|
||||
patches = [
|
||||
# 'redox.patch'
|
||||
'redox.patch'
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
# "openssl1", needs threading / ucontext.h
|
||||
"bzip2",
|
||||
"libffi",
|
||||
"libuuid",
|
||||
"ncurses",
|
||||
"ncursesw",
|
||||
"openssl1",
|
||||
"readline",
|
||||
"sqlite3",
|
||||
"zlib",
|
||||
"xz"
|
||||
]
|
||||
@ -45,10 +49,10 @@ export PATH="${BUILDMACH_STAGE}/usr/local/bin:${PATH}"
|
||||
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--prefix=/usr
|
||||
--enable-shared
|
||||
--disable-ipv6
|
||||
--host=${GNU_TARGET}
|
||||
--build=$ARCH
|
||||
# --with-openssl="${COOKBOOK_SYSROOT}/usr"
|
||||
--with-ensurepip=install
|
||||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
diff --git a/config.sub b/config.sub
|
||||
index 52f04bc..4a352eb 100755
|
||||
--- a/config.sub
|
||||
+++ b/config.sub
|
||||
@@ -1376,7 +1376,7 @@ case $os in
|
||||
diff -ruwN source/config.sub source-new/config.sub
|
||||
--- source/config.sub 2014-08-12 15:19:20.000000000 +0700
|
||||
+++ source-new/config.sub 2025-09-19 21:11:57.907457211 +0700
|
||||
@@ -1376,7 +1376,7 @@
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
@ -11,10 +10,39 @@ index 52f04bc..4a352eb 100755
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
diff --git a/randutils.c b/randutils.c
|
||||
index 80893d3..a39168d 100644
|
||||
--- a/randutils.c
|
||||
+++ b/randutils.c
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2014-08-12 15:19:19.000000000 +0700
|
||||
+++ source-new/configure 2025-09-19 21:20:30.460699979 +0700
|
||||
@@ -5312,7 +5312,7 @@
|
||||
;;
|
||||
|
||||
# This must be glibc/ELF.
|
||||
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
+linux* | k*bsd*-gnu | kopensolaris*-gnu | redox*)
|
||||
lt_cv_deplibs_check_method=pass_all
|
||||
;;
|
||||
|
||||
@@ -8866,7 +8866,7 @@
|
||||
archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
|
||||
;;
|
||||
|
||||
- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | redox*)
|
||||
tmp_diet=no
|
||||
if test "$host_os" = linux-dietlibc; then
|
||||
case $cc_basename in
|
||||
@@ -10534,7 +10534,7 @@
|
||||
;;
|
||||
|
||||
# This must be glibc/ELF.
|
||||
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
+linux* | k*bsd*-gnu | kopensolaris*-gnu | redox*)
|
||||
version_type=linux # correct to gnu/linux during the next big refactor
|
||||
need_lib_prefix=no
|
||||
need_version=no
|
||||
diff -ruwN source/randutils.c source-new/randutils.c
|
||||
--- source/randutils.c 2014-08-12 15:07:18.000000000 +0700
|
||||
+++ source-new/randutils.c 2025-09-19 21:11:57.907659403 +0700
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user