Commits

Ivan Vučica committed 235c3eb

Very basic and untested patch for building for PHP 5.3 on Mountain Lion on i386.

Unfortunately, that PHP is x86_64 only, so having to force i386 to use the old
objc runtime makes it impossible to use the extension with PHP. Unless PHP is
rebuilt as universal binary, the extension can't be used nor tested.

Solution would be to patch the bridge to use the modern runtime.

Comments (0)

Files changed (2)

 
 PHPCONFIG=php-config
-PHPCFLAGS=-DPHP_ATOM_INC -DCOMPILE_DL_OBJC -DPIC -I. `$(PHPCONFIG) --includes` -Ilibffi/include -g -Wall  -I/usr/include/libxml2
+PHPCFLAGS=-DPHP_ATOM_INC -DCOMPILE_DL_OBJC -DPIC -I. `$(PHPCONFIG) --includes` -Ilibffi/include -g -Wall  -I/usr/include/libxml2 -arch i386
 
 all: objc.so
 
 *.m: php_objc.h
 
 objc.so: $(PHPOBJC_OBJS) 
-	gcc -framework Foundation -framework AppKit -bundle -flat_namespace -undefined suppress -o objc.so $(PHPOBJC_OBJS) -Llibffi/.libs -lffi
+	gcc -framework Foundation -framework AppKit -bundle -flat_namespace -undefined suppress -o objc.so $(PHPOBJC_OBJS) -Llibffi/.libs -lffi -arch i386
 
 %.o: %.m
 	gcc $(PHPCFLAGS) -c $< -o $@
 
 shim: shim.c
-	gcc -o shim shim.c
+	gcc -o shim shim.c -arch i386
 
 install: objc.so
 	install -m 755 objc.so `$(PHPCONFIG) --extension-dir`
  * This source file is subject to version 3.01 of the PHP license.
  */
 #include "php_objc.h"
-		  
+
+//#if (PHP_MAJOR_VERSION > 5 && PHP_MINOR_VERSION >= 3) 
+#define ZVAL_ADDREF(x) Z_ADDREF_P(x)
+//#endif
+
 typedef void (*my_ffi_func)(ffi_cif*,void*,void**,void*);
 
 static zend_object_handlers php_objc_handlers;
 {
 	if (!getThis()) {
 		php_objc_method_call_inner(
-			((zend_internal_function*)EG(function_state_ptr)->function)
+			((zend_internal_function*)EG(/*function_state_ptr*/current_execute_data)->/**/function_state./**/function)
 			->function_name, 0,
 			INTERNAL_FUNCTION_PARAM_PASSTHRU);
 		return;
 	}
 	Z_OBJ_HANDLER_P(getThis(), call_method)(
-		((zend_internal_function*)EG(function_state_ptr)->function)
+		((zend_internal_function*)EG(/*function_state_ptr*/current_execute_data)->/**/function_state./**/function)
 			->function_name,
 			INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }