Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests, restore Alpine tests, fix PHP 8.1+ deprecation warning #39

Merged
merged 9 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/ci-ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ set -o errexit
case "${ID:-}" in
alpine)
apk update
apk add $PHPIZE_DEPS lapack-dev libexecinfo-dev openblas-dev
case "$VERSION_ID" in
3.11.* | 3.12.* | 3.13.* | 3.14.* | 3.15.* | 3.16.* | 3.17.*)
apk update && apk add $PHPIZE_DEPS lapack lapack-dev openblas-dev
if [ ! -e /usr/lib/liblapacke.so ]; then
# Fix for Alpine 3.15, 3.16 and 3.17
ln -s /usr/lib/liblapacke.so.3 /usr/lib/liblapacke.so
fi
;;
*)
apk add $PHPIZE_DEPS liblapack lapack-dev openblas-dev
;;
esac
;;
debian)
apt-get update
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ci-ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ jobs:
matrix:
image:
- php:7.4-cli
- php:7.4-cli-alpine
- php:8.0-cli
- php:8.0-cli-alpine
- php:8.1-cli
- php:8.1-cli-alpine
- php:8.2-cli
- php:8.2-cli-alpine

name: Image ${{ matrix.image }}
runs-on: ubuntu-latest
Expand All @@ -33,7 +37,7 @@ jobs:
run: docker pull ${{ matrix.image }}

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Compile
run: docker run --rm -v "$GITHUB_WORKSPACE:/app" ${{ matrix.image }} /app/.github/workflows/ci-ext.sh
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*.dSYM
*.deps
*.tgz
*.dep

zephir.phar
autom4te.cache/
Expand Down
39 changes: 21 additions & 18 deletions build-ext
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,45 @@ const CONFIG_M4_PATH = './ext/config.m4';
const EXECINFO_MATCH = "PHP_SUBST(TENSOR_SHARED_LIBADD)\n";
const EXECINFO_PATCH = <<<'EOT'

AC_CHECK_FUNC(backtrace_symbols, have_backtrace_symbols=yes, have_backtrace_symbols=no)
if test $have_backtrace_symbols = no; then
LDFLAGS="${LDFLAGS:-} -lexecinfo"
AC_CANONICAL_BUILD
if test "$build_os" = linux-musl; then
CPPFLAGS="${CPPFLAGS:-} -DALPINE_LINUX"
else
AC_CHECK_FUNC(backtrace_symbols, have_backtrace_symbols=yes, have_backtrace_symbols=no)
if test $have_backtrace_symbols = no; then
LDFLAGS="${LDFLAGS:-} -lexecinfo"
fi
fi

EOT
;

chdir(__DIR__);

echo 'Reading config.m4 file';

echo 'Reading config.m4 file... ';
$configM4Contents = file_get_contents(CONFIG_M4_PATH);

if (!$configM4Contents) {
fwrite(STDERR, "Failed to read the config.m4 file!\n");

exit(1);
}
echo "done.\n";

echo 'Applying libexec patch';

echo 'Applying libexec patch... ';
if (strpos($configM4Contents, EXECINFO_MATCH) === false) {
fwrite(STDERR, "Patch entrypoint not found!\n");
fwrite(STDERR, "patch entrypoint not found!\n");

exit(1);
} elseif (strpos($configM4Contents, trim(EXECINFO_PATCH)) !== false) {
echo "Already applied.\n";
echo "already applied.\n";
} else {
$configM4Contents = str_replace(EXECINFO_MATCH, EXECINFO_MATCH . EXECINFO_PATCH, $configM4Contents);
}

echo 'Saving config.m4 file';

if (!file_put_contents(CONFIG_M4_PATH, $configM4Contents)) {
fwrite(STDERR, "Failed to write the config.m4 file\n");

exit(1);
echo "done.\n";
echo 'Saving config.m4 file... ';
if (!file_put_contents(CONFIG_M4_PATH, $configM4Contents)) {
fwrite(STDERR, "Failed to write the config.m4 file\n");

exit(1);
}
echo "done.\n";
}
11 changes: 8 additions & 3 deletions ext/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ if test "$PHP_TENSOR" = "yes"; then
done
PHP_SUBST(TENSOR_SHARED_LIBADD)

AC_CHECK_FUNC(backtrace_symbols, have_backtrace_symbols=yes, have_backtrace_symbols=no)
if test $have_backtrace_symbols = no; then
LDFLAGS="${LDFLAGS:-} -lexecinfo"
AC_CANONICAL_BUILD
if test "$build_os" = linux-musl; then
CPPFLAGS="${CPPFLAGS:-} -DALPINE_LINUX"
else
AC_CHECK_FUNC(backtrace_symbols, have_backtrace_symbols=yes, have_backtrace_symbols=no)
if test $have_backtrace_symbols = no; then
LDFLAGS="${LDFLAGS:-} -lexecinfo"
fi
fi

old_CPPFLAGS=$CPPFLAGS
Expand Down
96 changes: 0 additions & 96 deletions ext/include/arithmetic.dep

This file was deleted.

96 changes: 0 additions & 96 deletions ext/include/comparison.dep

This file was deleted.

Loading
Loading