Skip to content

Commit

Permalink
Porting to php8 (#74)
Browse files Browse the repository at this point in the history
* Initial work for php 8

* php7 -> php8
  • Loading branch information
Zaffy committed Sep 24, 2020
1 parent baec8a2 commit 7889bd1
Show file tree
Hide file tree
Showing 29 changed files with 416 additions and 162 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
# Debug files
*.dSYM/

# Tests-generated stuff
tests/*.diff
tests/*.php
tests/*.out
tests/*.sh
tests/*.log
tests/*.exp

*.fragments
Makefile*
autom4te*
Expand All @@ -55,6 +63,6 @@ mkinstalldirs
run-tests.php
fails.log
configure.ac
tests/*.php
*.code-workspace
.vscode/*
.idea/
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_IMAGE=php:7.4-rc
ARG PHP_IMAGE=php:8.0-rc
FROM $PHP_IMAGE

RUN apt-get update && apt-get install -y \
Expand All @@ -8,5 +8,7 @@ RUN apt-get update && apt-get install -y \

COPY docker/host.conf /etc/host.conf

# ENV LOCAL_DEV 1
# ADD . /usr/src/pecl-memcache
COPY docker/start.sh /
CMD ["/start.sh"]
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This is an official repository for pecl-memcache plugin since 2019.

This repository contains modified pecl-memcache plugin ported to PHP7,
This repository contains modified pecl-memcache plugin ported to PHP8,
which was originally developed for the need of hosting company in Slovakia (Websupport.sk).

The latest release is 4.0.5.1 (released: 2019-12-19) with support for PHP 7.0-7.4.
Expand Down
4 changes: 2 additions & 2 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if (PHP_MEMCACHE != "no") {
var dll = get_define('PHPDLL');
var old_conf_dir = configure_module_dirname;

if (dll.match(/^php7/) != null) {
configure_module_dirname = configure_module_dirname + "\\php7";
if (dll.match(/^php8/) != null) {
configure_module_dirname = configure_module_dirname + "\\php8";
} else if (dll.match(/^php5/) != null) {
ERROR("PHP 7.x required for pecl-php-memcache ver 4+. Use pecl-php-meachce ver 3.x for PHP 5.x.");
} else {
Expand Down
4 changes: 2 additions & 2 deletions config9.m4
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if test "$PHP_MEMCACHE" != "no"; then
fi

AC_MSG_CHECKING(PHP version)
if test -d $abs_srcdir/php7 ; then
if test -d $abs_srcdir/php8 ; then
dnl # only when for PECL, not for PHP
export OLD_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="$CPPFLAGS $INCLUDES"
Expand All @@ -73,7 +73,7 @@ if test "$PHP_MEMCACHE" != "no"; then
#error "PHP < 7"
#endif
], [
subdir=php7
subdir=php8
AC_MSG_RESULT([PHP 7.x])
],
AC_MSG_ERROR([PHP 7.x required for pecl-php-memcache ver 4+. Use pecl-php-memcache ver 3.x for PHP 5.x.])
Expand Down
16 changes: 8 additions & 8 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash

CFLAGS="-fstack-protector-strong -fpic -fpie -O2"
CPPFLAGS="$PHP_CFLAGS"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"

export CFLAGS="-fstack-protector-strong -O2"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=both"

# Build extension
set -eux
Expand All @@ -14,10 +13,11 @@ then
git clone https://github.com/websupport-sk/pecl-memcache.git
fi

cd pecl-memcache;
phpize
cd pecl-memcache;
[[ -n "${LOCAL_DEV}" ]] && phpize --clean
phpize
./configure
make -j$(nproc)
make -j"$(nproc)"

# Spawn memcached for tests
echo "Starting memcached... "
Expand All @@ -29,4 +29,4 @@ chown memcache:memcache /var/run/memcached

# Let's start tests
cd /usr/src/pecl-memcache
TEST_PHP_ARGS="--show-diff --keep-all -w fails.log" make test
NO_INTERACTION=1 TEST_PHP_ARGS="--show-diff --keep-all -w fails.log" make test
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<file name="host.conf" role="src" />
<file name="start.sh" role="src" />
</dir>
<dir name="php7">
<dir name="php8">
<file name="memcache.c" role="src" />
<file name="memcache_pool.c" role="src" />
<file name="memcache_queue.c" role="src" />
Expand Down
Loading

0 comments on commit 7889bd1

Please sign in to comment.