Skip to content

Commit

Permalink
Merge pull request #20 from zelgerj/master
Browse files Browse the repository at this point in the history
fixed #19, cleanup and minor build refactoring
  • Loading branch information
zelgerj committed Jun 9, 2014
2 parents dd04722 + b20f070 commit 9b39c14
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 25 deletions.
17 changes: 10 additions & 7 deletions build.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@
# ---- General Settings ---------------------------------------------------------
php.ext.name = appserver

release.version = 0.1.9
release.version = 0.1.10
release.stability = beta
api.version = 0.1.9
api.version = 0.1.10
api.stability = beta

php.version = 5.5.10
php.version = 5.6.0beta4

# for stable releases
php.downloadurl = http://de1.php.net/get/php-${php.version}.tar.gz/from/this/mirror
# for beta releases
php.downloadurl = http://downloads.php.net/tyrael/php-${php.version}.tar.gz

php.configure = --prefix=/opt/appserver \
--enable-debug \
--enable-sockets \
--enable-fpm \
--enable-maintainer-zts \
--enable-pthreads=static \
--enable-redis=static \
--enable-apcu=static \
--enable-appserver=static \
--enable-xdebug=shared \
--enable-pcntl \
Expand All @@ -39,11 +43,10 @@ php.configure = --prefix=/opt/appserver \
--with-openssl \
--with-zlib \
zmq.version = dev-master
pthreads.version = 2.0.4
memcached.version = 2.1.0
redis.version = 2.2.3
apcu.version = 4.0.2
xdebug.version = 2.2.3

deploy.dir = ${c-build.dir}/php-${php.version}/ext
deploy.dir = ${c-build.dir}/php/ext
17 changes: 6 additions & 11 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<!-- Get PHP source package by given version number -->
<!-- ==================================================================== -->
<target name="get-php-src" depends="check-php-src-present" unless="${php-src.present}" description="Get PHP source package by given version number">
<get src="http://de1.php.net/get/php-${php.version}.tar.gz/from/this/mirror" dest="/tmp/php-${php.version}.tar.gz"/>
<get src="${php.downloadurl}" dest="/tmp/php-${php.version}.tar.gz"/>
</target>

<!-- ==================================================================== -->
Expand Down Expand Up @@ -161,6 +161,8 @@
<!-- Prepares the PHP sources for the runtime -->
<!-- ==================================================================== -->
<target name="prepare-source" depends="prepare" description="Prepares the PHP sources for the runtime.">
<delete dir="${c-build.dir}/php-{php.version}" includeemptydirs="true" quiet="false" verbose="false" failonerror="false"/>

<!-- prepare PHP sources -->
<antcall target="get-php-src"/>
<untar src="/tmp/php-${php.version}.tar.gz" dest="${c-build.dir}" compression="gzip"/>
Expand All @@ -171,7 +173,7 @@
</chmod>

<!-- recreate symlink -->
<delete file="${c-build.dir}/php" followsymlinks="false" removenotfollowedsymlinks="true" />
<symlink link="${c-build.dir}/php" action="delete"/>
<symlink link="${c-build.dir}/php" resource="${c-build.dir}/php-${php.version}"/>

<antcall target="get-pthreads-src"/>
Expand All @@ -180,17 +182,11 @@
<fileset dir="/tmp/pthreads-${pthreads.version}"/>
</move>

<!-- pthreads head
<!-- activate to fetch pthreads head instead of given version in properties file
<exec executable="git" dir="${c-build.dir}/php/ext">
<arg line="clone https://github.com/krakjoe/pthreads.git"/>
</exec>
-->

<!-- zmq head
<exec executable="git" dir="${c-build.dir}/php/ext">
<arg line="clone https://github.com/mkoppanen/php-zmq.git zmq"/>
</exec>
-->

<antcall target="get-memcached-src"/>
<untar src="/tmp/memcached-${memcached.version}.tgz" dest="/tmp" compression="gzip"/>
Expand Down Expand Up @@ -245,8 +241,7 @@
<!-- Inits the build source for PHP -->
<!-- ==================================================================== -->
<target name="init-build" description="Init the php build environment.">
<delete dir="${c-build.dir}" includeemptydirs="true" quiet="false" verbose="false" failonerror="true"/>
<antcall target="prepare-source"/>
<antcall target="prepare-source"/>
<antcall target="deploy"/>
<antcall target="configure"/>
<antcall target="make"/>
Expand Down
39 changes: 39 additions & 0 deletions launch/anotherTest.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="/opt/appserver/var/www/anotherStackableStorageTest.php"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/php/sapi/cli/php"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="php-ext-appserver"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.macosx.base.1221491367"/>
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/anotherTest"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
<stringAttribute key="provider" value="org.eclipse.linuxtools.profiling.provider.valgrind.cachegrind"/>
</launchConfiguration>
5 changes: 3 additions & 2 deletions launch/appserver.launch
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-d date.timezone=Europe/Berlin -d zend_extension=${project_loc}/build/php/modules/xdebug.so /opt/appserver/server.php"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-d date.timezone=Europe/Berlin -d appserver.remove_functions=getenv,putenv /opt/appserver/server.php"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/php/sapi/cli/php"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="php-ext-appserver"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.macosx.base.1221491367"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="/opt/appserver"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/php-ext-appserver"/>
</listAttribute>
Expand Down
16 changes: 16 additions & 0 deletions src/appserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,27 @@ PHP_FUNCTION(appserver_set_raw_post_data)
return;
}

/* removed raw_post_data in php-5.6.x */
#if ZEND_MODULE_API_NO >= 20131226
/* create stream if not exists yes */
if (!SG(request_info).request_body) {
SG(request_info).request_body = php_stream_temp_create(TEMP_STREAM_DEFAULT, SAPI_POST_BLOCK_SIZE);
}
/* write given post data to stream */
php_stream_write(SG(request_info).request_body, postData, postData_len);
/* rewind it for further processing */
php_stream_rewind(SG(request_info).request_body);
/* make old var $HTTP_RAW_POST_DATA available */
SET_VAR_STRINGL("HTTP_RAW_POST_DATA", estrndup(postData, postData_len), postData_len);

#else
/* set to $HTTP_RAW_POST_DATA var */
SET_VAR_STRINGL("HTTP_RAW_POST_DATA", estrndup(postData, postData_len), postData_len);
/* set to php://input */
SG(request_info).raw_post_data = estrndup(postData, postData_len);
SG(request_info).raw_post_data_length = postData_len;
#endif

}

/* {{{ proto boolean appserver_redefine(string $constant [, mixed $value])
Expand Down
6 changes: 3 additions & 3 deletions src/tests/appserver_005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Johann Zelger <jz [at] techdivision [dot] com>
--FILE--
<?php

header('Content-type: text/html');
header('Content-type: text/html;charset=UTF-8');
header('X-POWERED-BY: appserver.io');
var_dump(appserver_get_headers(false));
var_dump(appserver_get_headers(false));
Expand All @@ -14,13 +14,13 @@ var_dump(appserver_get_headers(false));
--EXPECT--
array(2) {
[0]=>
string(23) "Content-type: text/html"
string(37) "Content-type: text/html;charset=UTF-8"
[1]=>
string(26) "X-POWERED-BY: appserver.io"
}
array(2) {
[0]=>
string(23) "Content-type: text/html"
string(37) "Content-type: text/html;charset=UTF-8"
[1]=>
string(26) "X-POWERED-BY: appserver.io"
}
4 changes: 2 additions & 2 deletions src/tests/appserver_006.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Johann Zelger <jz [at] techdivision [dot] com>
--FILE--
<?php

header('Content-type: text/html');
header('Content-type: text/html;charset=UTF-8');
header('X-POWERED-BY: appserver.io');
var_dump(appserver_get_headers(true));
var_dump(appserver_get_headers());
Expand All @@ -14,7 +14,7 @@ var_dump(appserver_get_headers());
--EXPECT--
array(2) {
[0]=>
string(23) "Content-type: text/html"
string(37) "Content-type: text/html;charset=UTF-8"
[1]=>
string(26) "X-POWERED-BY: appserver.io"
}
Expand Down

0 comments on commit 9b39c14

Please sign in to comment.