Files
archived-pecl-networking-ge…/const_gen.sh
jluedke 2a12523919 - Fixed build issue with 5.1.x
Merged eday changes
    - Added wait functions, uncommented other worker functions.
    - Added timeout functions.
    - Updated function list from C library and removed free methods 
      (should use unset).
    - Added stubs for new functions, fixed tests, fixed some of the 
      existing functions from changes.
2009-10-01 08:03:18 +00:00

51 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
#
# Gearman PHP Extension
#
# Copyright (C) 2008 James M. Luedke <contact@jamesluedke.com>,
# Eric Day <eday@oddments.org>
# All rights reserved.
#
# Use and distribution licensed under the PHP license. See
# the LICENSE file in this directory for full text.
if [ "$1" = "" ]
then
header=/usr/local/include/libgearman/constants.h
else
header=$1
fi
if [ ! -e $header ]
then
echo "$header does not exist"
exit 1;
fi
if [ -e php_gearman.c.new ]
then
echo "php_gearman.c.new already exists"
exit 1;
fi
awk 'BEGIN { p= 1; } \
/CONST_GEN_START/ { p= 0; print $0; } \
{ if (p == 1) { print $0; } }' php_gearman.c >> php_gearman.c.new
grep ' GEARMAN' $header | \
sed 's/.*\(GEARMAN[A-Z0-9_]*\).*/\1/' | \
sed 's/\(.*\)/ REGISTER_LONG_CONSTANT("\1",\
\1,\
CONST_CS | CONST_PERSISTENT);/' | \
sed 's/LONG\(.*GEARMAN_DEFAULT_TCP_HOST\)/STRING\1/' | \
sed 's/LONG\(.*GEARMAN_DEFAULT_UDS\)/STRING\1/' | \
sed 's/LONG\(.*GEARMAN_DEFAULT_USER\)/STRING\1/' >> php_gearman.c.new
awk 'BEGIN { p= 0; } \
/CONST_GEN_STOP/ { p= 1; } \
{ if (p == 1) { print $0; } }' php_gearman.c >> php_gearman.c.new
echo "New source file can be found in: php_gearman.c.new"
exit 0