Open swen100 opened 3 years ago
Hello Swen,
Thanks for all the work!
On your fork config.w32 is looking for src/php_cairo_api.h https://github.com/swen100/cairo/blob/php8/config.w32#L39 But it is not there anymore, so it will not compile on Windows.
eos_datastructures compiles fine on PHP 8, but fails on PHP 8.1. Reason: convert_to_explicit_type
was removed in PHP 8.1.
https://github.com/php/php-src/commit/422d1665a2a744421b5911cbe8541370509bc4f5
Also drop the unused convert_to_explicit_type macros.
Fixed by
diff --git a/src/php_eos_datastructures.h b/src/php_eos_datastructures.h
index 72ce6a4..6b86a50 100644
--- a/src/php_eos_datastructures.h
+++ b/src/php_eos_datastructures.h
@@ -30,6 +30,38 @@ extern zend_module_entry eos_datastructures_module_entry;
# define PHP_EOS_DATASTRUCTURES_API extern
#endif
+#ifndef convert_to_explicit_type
+#define convert_to_explicit_type(pzv, type) \
+ do { \
+ switch (type) { \
+ case IS_NULL: \
+ convert_to_null(pzv); \
+ break; \
+ case IS_LONG: \
+ convert_to_long(pzv); \
+ break; \
+ case IS_DOUBLE: \
+ convert_to_double(pzv); \
+ break; \
+ case _IS_BOOL: \
+ convert_to_boolean(pzv); \
+ break; \
+ case IS_ARRAY: \
+ convert_to_array(pzv); \
+ break; \
+ case IS_OBJECT: \
+ convert_to_object(pzv); \
+ break; \
+ case IS_STRING: \
+ convert_to_string(pzv); \
+ break; \
+ default: \
+ assert(0); \
+ break; \
+ } \
+ } while (0);
+#endif
+
#endif /* PHP_EOS_DATASTRUCTURES_EXT_H */
/*
Hello Swen,
Thanks for all the work!
On your fork config.w32 is looking for src/php_cairo_api.h https://github.com/swen100/cairo/blob/php8/config.w32#L39 But it is not there anymore, so it will not compile on Windows.
config.m4 has the same reference to a missing php_cairo_api.h https://github.com/swen100/cairo/blob/php8/config.m4#L39
@Jan-E OK, I included your fix and did some additional (small) modifications to remove depcrecation-messages because of PHP 8.1 I also corrected the linking to the xxx.h files.
Hello,
Nice code. Congratulation.
How do you have generate the code ?
PS : In https://github.com/swen100/cairo/blob/php8/src/surface.c#L1011 If libcairo.so version is smaller than 1.6 i got an compile error because CAIRO_SURFACE_TYPE_QUARTZ_IMAGE See documentation : https://www.cairographics.org/manual/cairo-cairo-surface-t.html#cairo-surface-type-t I find this way very elegant : https://github.com/swen100/cairo/blob/php8/src/surface.c#L936
These are some nice improvements! In the longer term, has anyone considered shifting toward a userland FFI implementation for library bindings like this (since FFI became available in PHP 7.4)? I would imagine it would make maintenance a lot easier going forward, though I haven't explored any of the possible negative impacts yet (e.g. performance).
Hi,
Has anyone tried to compile this on an alpine docker container? Currently I'm getting the following error:
Error relocating /usr/local/lib/php/extensions/no-debug-non-zts-20200930/cairo.so: jpeg_read_scanlines: symbol not found)
I've tried searching for the jpeg_read_scanlines function in the libjpeg library and it exists:
`nm -D /usr/lib/libjpeg.so | grep -I scan
0000000000022e24 T jpeg_crop_scanline@@LIBJPEG_8.0 0000000000022afc T jpeg_has_multiple_scans@@LIBJPEG_8.0 000000000002306c T jpeg_read_scanlines@@LIBJPEG_8.0 00000000000232e4 T jpeg_skip_scanlines@@LIBJPEG_8.0 000000000000fc3c T jpeg_write_scanlines@@LIBJPEG_8.0 U sscanf `
Any ideas how I can resolve this issue?
Hello everybody. Since PHP 8 was released last year, maybe some are looking for a port of the cairo-extension for PHP. Here it is! It took quite a bit of work, but now it's finished after all.
I've created a fork and a new branch. The code can be found here: https://github.com/swen100/cairo
What have I done:
I would be happy if someone in charge and with access to the project could make a php8-branch in the original project to be able to take over the code from my branch.
Btw, the extension needed for cairo (datastructures) was also adapted to work with PHP 8 and can be found here: https://github.com/swen100/structures
Many greetings, Swen