Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Apr 2015 20:34:10 +0000 (UTC)
From:      Mikhail Teterin <mi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r383677 - in head/graphics/pecl-imlib2: . files
Message-ID:  <201504092034.t39KYAPg015095@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mi
Date: Thu Apr  9 20:34:09 2015
New Revision: 383677
URL: https://svnweb.freebsd.org/changeset/ports/383677

Log:
  Unbreak by fixing the code to work newer PHP. I'm not sure, if this
  extension is all that useful considering the ImageMagick- and
  GD-based alternatives, but if it has to go, it will not be for
  reasons of being "php-5.3 only".
  
  While here change hard-coded default of /usr/share to ${LOCALBASE}/share,
  define LICENSE and otherwise pet portlint.
  
  Approved by:	being condemned

Added:
  head/graphics/pecl-imlib2/files/patch-php_imlib   (contents, props changed)
Modified:
  head/graphics/pecl-imlib2/Makefile
  head/graphics/pecl-imlib2/files/patch-imlib2.c

Modified: head/graphics/pecl-imlib2/Makefile
==============================================================================
--- head/graphics/pecl-imlib2/Makefile	Thu Apr  9 20:26:16 2015	(r383676)
+++ head/graphics/pecl-imlib2/Makefile	Thu Apr  9 20:34:09 2015	(r383677)
@@ -3,31 +3,29 @@
 
 PORTNAME=	imlib2
 PORTVERSION=	0.1.00
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	graphics
 MASTER_SITES=	http://pecl.php.net/get/
 PKGNAMEPREFIX=	pecl-
-EXTRACT_SUFX=	.tgz
 DIST_SUBDIR=	PECL
 
 MAINTAINER=	leeym@FreeBSD.org
 COMMENT=	PECL extension if imlib2
 
-DEPRECATED=	requires php53, security EOL reached 14 Aug 2014
-EXPIRATION_DATE=	2015-04-15
+LICENSE=	PHP202
 
 LIB_DEPENDS=	libImlib2.so:${PORTSDIR}/graphics/imlib2
 
+USES=		tar:tgz
 USE_PHP=	yes
 USE_PHPEXT=	yes
-IGNORE_WITH_PHP=5 55 56
 
 # libImlib2 may or may not depend on X, however,
 # imlib2 extension doesn't need X related functions in libImlib2
-CFLAGS+=	-DX_DISPLAY_MISSING
+CFLAGS+=	-DX_DISPLAY_MISSING -Wno-deprecated
 
 post-patch:
 	@${REINPLACE_CMD} -e 's/-ldl//' ${WRKSRC}/config.m4
-	@${REINPLACE_CMD} -e '/Xlib.h/d' ${WRKSRC}/php_imlib2.h
+	@${REINPLACE_CMD} -e 's,/usr/share,${LOCALBASE}/share,' ${WRKSRC}/imlib2.c
 
 .include <bsd.port.mk>

Modified: head/graphics/pecl-imlib2/files/patch-imlib2.c
==============================================================================
--- head/graphics/pecl-imlib2/files/patch-imlib2.c	Thu Apr  9 20:26:16 2015	(r383676)
+++ head/graphics/pecl-imlib2/files/patch-imlib2.c	Thu Apr  9 20:34:09 2015	(r383677)
@@ -1,6 +1,14 @@
---- ./imlib2.c.orig	2004-01-01 18:57:55.000000000 -0500
-+++ ./imlib2.c	2010-04-16 20:02:16.000000000 -0400
-@@ -47,6 +47,10 @@
+--- imlib2.c	2004-01-01 18:57:55.000000000 -0500
++++ imlib2.c	2015-04-09 12:48:55.000000000 -0400
+@@ -26,6 +26,7 @@
+ 
+ #include "php.h"
+ #include "php_ini.h"
++#include "ext/standard/head.h"
+ #include "ext/standard/info.h"
+ #include "php_imlib2.h"
+ #include <Imlib2.h>
+@@ -47,8 +48,12 @@
  static int le_imlib2_img;
  static int le_imlib2_poly;
  
@@ -9,9 +17,41 @@
 +	ZEND_ARG_PASS_INFO(1)
 +	ZEND_END_ARG_INFO();
  
- function_entry imlib2_functions[] = {
+-function_entry imlib2_functions[] = {
++zend_function_entry imlib2_functions[] = {
  	PHP_FE(imlib2_image_modify_gamma,NULL)
-@@ -643,8 +647,8 @@
+ 	PHP_FE(imlib2_image_modify_contrast,NULL)
+ 	PHP_FE(imlib2_image_modify_brightness,NULL)
+@@ -271,8 +276,8 @@
+    *four = Z_LVAL_PP(zfour);
+ }
+ 
+-static int _php_handle_cliprect_array(zval **dbox, char *func_name,
+-                                      int *x, int *y, int *w, int *h)
++static int _php_handle_cliprect_array(zval **dbox, const char *func_name,
++                                      int *x, int *y, int *w, int *h TSRMLS_DC)
+ {
+    zval **element, ***box_coords;
+    int i,arrcount;
+@@ -382,7 +387,7 @@
+ }
+ 
+ 
+-static void _php_imlib2_draw_something(INTERNAL_FUNCTION_PARAMETERS, void (*func)(), char *func_name)
++static void _php_imlib2_draw_something(INTERNAL_FUNCTION_PARAMETERS, void (*func)(), const char *func_name)
+ {
+    zval **img, **d1, **d2, **d3, **d4, **dr, **dg, **db, **da, **dbox;
+    int x,y,w,h,r,g,b,a,cx,cy,cw,ch,argc;
+@@ -407,7 +412,7 @@
+ 
+    if (argc > 9)
+    {
+-      if (!_php_handle_cliprect_array(dbox, func_name, &cx,&cy,&cw,&ch))
++      if (!_php_handle_cliprect_array(dbox, func_name, &cx,&cy,&cw,&ch TSRMLS_CC))
+          RETURN_FALSE;
+       imlib_context_set_cliprect(cx,cy,cw,ch);
+    }
+@@ -643,8 +648,8 @@
  	zval **img, **gamma;
  	Imlib_Image im;
  	Imlib_Color_Modifier cm;
@@ -21,7 +61,16 @@
  
  	if (ZEND_NUM_ARGS() != 2 | zend_get_parameters_ex(2, &img, &gamma) == FAILURE) {
  		WRONG_PARAM_COUNT;
-@@ -675,8 +679,8 @@
+@@ -654,7 +659,7 @@
+ 
+ 	ng = Z_DVAL_PP(gamma);
+ 
+-	if(cm = imlib_create_color_modifier()){
++	if ((cm = imlib_create_color_modifier())) {
+ 		imlib_context_set_color_modifier(cm);
+ 		imlib_context_set_image(im);
+ 		imlib_modify_color_modifier_gamma(ng);
+@@ -675,8 +680,8 @@
  	zval **img, **contrast;
  	Imlib_Image im;
  	Imlib_Color_Modifier cm;
@@ -31,7 +80,16 @@
  
  	if (ZEND_NUM_ARGS() != 2 | zend_get_parameters_ex(2, &img, &contrast) == FAILURE) {
  		WRONG_PARAM_COUNT;
-@@ -707,8 +711,8 @@
+@@ -686,7 +691,7 @@
+ 
+ 	nc = Z_DVAL_PP(contrast);
+ 
+-	if(cm = imlib_create_color_modifier()){
++	if ((cm = imlib_create_color_modifier())) {
+ 		imlib_context_set_color_modifier(cm);
+ 		imlib_context_set_image(im);
+ 		imlib_modify_color_modifier_contrast(nc);
+@@ -707,8 +712,8 @@
  	zval **img, **bv;
  	Imlib_Image im;
  	Imlib_Color_Modifier cm;
@@ -41,7 +99,16 @@
  
  	if (ZEND_NUM_ARGS() != 2 | zend_get_parameters_ex(2, &img, &bv) == FAILURE) {
  		WRONG_PARAM_COUNT;
-@@ -760,9 +764,9 @@
+@@ -718,7 +723,7 @@
+ 
+ 	nbv = Z_DVAL_PP(bv);
+ 
+-	if(cm = imlib_create_color_modifier()){
++	if ((cm = imlib_create_color_modifier())) {
+ 		imlib_context_set_color_modifier(cm);
+ 		imlib_context_set_image(im);
+ 		imlib_modify_color_modifier_brightness(nbv);
+@@ -760,9 +765,9 @@
  {
  	zval **img, **angle;
  	double rot_angle, rads, pi;
@@ -52,3 +119,66 @@
  
  	if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2, &img, &angle) == FAILURE) {
  		WRONG_PARAM_COUNT;
+@@ -806,7 +811,7 @@
+    tmpfile = estrdup("/tmp/phpimlib.XXXXXX");
+ 
+    if ((fd = mkstemp(tmpfile)) < 0) {
+-      php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name());
++      php_error(E_WARNING, "%s: unable to open temporary file", get_active_function_name(TSRMLS_C));
+       efree(tmpfile);
+       RETURN_FALSE;
+    }
+@@ -814,7 +819,7 @@
+    /* TODO: notify in case of errors? */
+    retval = fchmod(fd, S_IRUSR|S_IWUSR);
+    if (retval != 0) {
+-      php_error(E_WARNING, "%s: could not change permissions on temporary file", get_active_function_name());
++      php_error(E_WARNING, "%s: could not change permissions on temporary file", get_active_function_name(TSRMLS_C));
+       close(fd);
+       efree(tmpfile);
+       RETURN_FALSE;
+@@ -851,7 +856,7 @@
+    /* fseek or something, then read the file and dump it out. */
+    lseek(fd, 0, SEEK_SET);
+ 
+-   output = php_header();
++   output = php_header(TSRMLS_C);
+    if (output) {
+       char buf[4096];
+ 
+@@ -861,7 +866,7 @@
+       ap_bsetflag(php3_rqst->connection->client, B_EBCDIC2ASCII, 0);
+ #endif
+       while ((retval = read(fd, buf, sizeof(buf))) > 0) {
+-         php_write(buf, retval);
++         php_write(buf, retval TSRMLS_CC);
+       }
+    }
+ 
+@@ -1254,7 +1259,7 @@
+ 
+    if (argc > 7)
+    {
+-      if (!_php_handle_cliprect_array(dbox, "imlib_image_draw_polygon", &cx, &cy, &cw, &ch))
++      if (!_php_handle_cliprect_array(dbox, "imlib_image_draw_polygon", &cx, &cy, &cw, &ch TSRMLS_CC))
+          RETURN_FALSE;
+       imlib_context_set_cliprect(cx,cy,cw,ch);
+    }
+@@ -1303,7 +1308,7 @@
+ 
+    if (argc > 7)
+    {
+-      if (!_php_handle_cliprect_array(fbox, "imlib_image_fill_color_range_rectangle", &cx,&cy,&cw,&ch))
++      if (!_php_handle_cliprect_array(fbox, "imlib_image_fill_color_range_rectangle", &cx,&cy,&cw,&ch TSRMLS_CC))
+          RETURN_FALSE;
+       imlib_context_set_cliprect(cx,cy,cw,ch);
+    }
+@@ -1350,7 +1355,7 @@
+ 
+    if (argc > 6)
+    {
+-      if (!_php_handle_cliprect_array(dbox, "imlib_image_fill_polygon", &cx, &cy, &cw, &ch))
++      if (!_php_handle_cliprect_array(dbox, "imlib_image_fill_polygon", &cx, &cy, &cw, &ch TSRMLS_CC))
+          RETURN_FALSE;
+       imlib_context_set_cliprect(cx,cy,cw,ch);
+    }

Added: head/graphics/pecl-imlib2/files/patch-php_imlib
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/pecl-imlib2/files/patch-php_imlib	Thu Apr  9 20:34:09 2015	(r383677)
@@ -0,0 +1,22 @@
+--- php_imlib2.h	2004-01-01 18:01:13.000000000 -0500
++++ php_imlib2.h	2015-04-09 13:10:05.000000000 -0400
+@@ -2,5 +2,4 @@
+ #define PHP_IMLIB2_H
+ 
+-#include "X11/Xlib.h"
+ #include <Imlib2.h>
+ 
+@@ -86,5 +85,5 @@
+ 	int font_cache_max_size;
+ 	int font_cache_status;
+-	char *font_path;
++	const char *font_path;
+ ZEND_END_MODULE_GLOBALS(imlib2)
+ 
+@@ -104,5 +103,5 @@
+ #ifdef ZTS
+ #define IMLIB2_G(v) TSRMG(imlib2_globals_id, zend_imlib2_globals *, v)
+-#define IMLIB2_LS_FETCH() imlib2_globals *imlib2_globals = ts_resource(gd_imlib_id)
++#define IMLIB2_LS_FETCH() zend_imlib2_globals *imlib2_globals = ts_resource(imlib2_globals_id)
+ #else
+ #define IMLIB2_G(v) (imlib2_globals.v)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504092034.t39KYAPg015095>