source: trunk/devel/run @ 1003

Last change on this file since 1003 was 1003, checked in by moo, 2 years ago

refactor: fix build for optimizer, use mod_* directories

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/bin/bash
2# this script is for developers only
3set -e
4
5. devel/run.cfg
6if [[ ! -z $1 ]]; then
7    type=$1
8fi
9
10case "$type" in
11prep*)
12    exec ./devel/prepare
13    ;;
14xtest)
15    exec /usr/bin/make -f devel/test.mak
16    ;;
17tags)
18    exec ./devel/prepare tags
19    ;;
20esac
21
22basename=$(basename $(pwd))
23if echo $basename | grep -- - >/dev/null; then :; else
24    svn propget svn:ignore . > .svnignore
25
26    dirs=${dirs:-php5-debug}
27    for dir in $dirs; do
28        mkdir -p ../${basename}-${dir}
29        cd ../${basename}-${dir} || exit
30        lndir ../${basename} > /dev/null
31
32        pwd
33        $0 "$@"
34    done
35    exit
36fi
37
38phpbasename=${basename#*-}
39xcachebasename=${basename%%-*}
40xcachesrcdir=../$xcachebasename
41
42if [[ ! -z $1 ]]; then
43    type=$1
44    shift
45
46    args=("$@")
47fi
48
49if [[ -z ${args[0]} ]]; then
50    args=(devel.php)
51fi
52
53case "$type" in
54reb*)
55    if [[ -r Makefile ]]; then
56        make xcachesvnclean
57    fi
58    ;;
59esac
60
61rm -f php-src
62find -L . -type l | xargs rm -f
63lndir "$xcachesrcdir" >/dev/null
64find . -iname .\*.swp | xargs rm -f
65ln -sf ~/src/php/$phpbasename php-src
66for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
67    if [[ -r $i ]]; then
68        ln -sf "$i" php-cgi
69    fi
70done
71ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
72
73case "$type" in
74reb*)
75    PHPDIRS=${PHPDIRS:-$HOME/test}
76    if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then
77        echo $PHPDIRS/$phpbasename/bin/phpize not found
78        exit
79    fi
80    export PATH=$PHPDIRS/$phpbasename/bin:$PATH
81    phpize --clean \
82    && phpize \
83    && CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure \
84        --enable-xcache-cacher \
85        --enable-xcache-optimizer \
86        --enable-xcache-encoder \
87        --enable-xcache-decoder \
88        --enable-xcache-disassembler \
89        --enable-xcache-test --enable-xcache-constant \
90    && make clean all
91    exit
92    ;;
93make)
94    MAKEARGS=("$@")
95    ;;
96esac
97
98LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
99ret=${PIPESTATUS[0]}
100if [[ $ret -ne 0 || $type = make ]]; then
101    exit $ret
102fi
103
104cmd=()
105tracer=()
106case "$basename" in
107*-apache1*)
108    cmd=($HOME/apache1/bin/httpd -X)
109    ;;
110*-apache*)
111    exit 1
112    ;;
113*)
114    cmd=(./php-cgi -q -c devel.ini)
115    "${cmd[@]}" -v
116    ;;
117esac
118
119case "${args[0]}" in
120fcgi)
121    args=(-b 1026)
122    shift
123    ;;
124esac
125
126case "$type" in
127ltr*)
128    export USE_ZEND_ALLOC=0
129    tracer=(ltrace -s1024 -e malloc,realloc,free,write)
130    ;;
131str*)
132    tracer=(strace -s1024 -T ./php-cgi)
133    ;;
134gdb)
135    #USE_ZEND_ALLOC=0
136    tracer=(gdb --args)
137    ;;
138val*)
139    export USE_ZEND_ALLOC=0
140    tracer=(valgrind --gen-suppressions=all)
141    ;;
142dc)
143    exec ./php-cli -c devel.ini ./mod_disassembler/bin/phpdc.phpr "${args[@]}" | tee decompiled.php
144    ;;
145dop)
146    exec ./php-cli -c devel.ini ./mod_disassembler/bin/phpdop.phpr "${args[@]}"
147    ;;
148retest)
149    exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
150    ;;
151test)
152    case "${args[0]}" in
153    *.phpt)
154        exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
155        ;;
156    */)
157        exec make xcachetest TESTS="${args[@]}"
158        ;;
159    *)
160        exec make xcachetest
161        ;;
162    esac
163    ;;
164esac
165
166export XCACHE_SKIP_FCGI_WARNING=1
167echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
168exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
Note: See TracBrowser for help on using the repository browser.