source: trunk/devel/run @ 998

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

refactor: fix build, easier devel

  • Property svn:executable set to *
File size: 2.8 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    if [[ ! -z $1 ]]; then
47        args=("$@")
48    elif [[ -z $args ]]; then
49        args=(devel.php)
50    fi
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 --enable-xcache-disassembler --enable-xcache-test --enable-xcache-constant \
84    && make clean all
85    exit
86    ;;
87make)
88    MAKEARGS=("$@")
89    ;;
90esac
91
92LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
93ret=${PIPESTATUS[0]}
94if [[ $ret -ne 0 || $type = make ]]; then
95    exit $ret
96fi
97
98cmd=()
99tracer=()
100case "$basename" in
101*-apache1*)
102    cmd=($HOME/apache1/bin/httpd -X)
103    ;;
104*-apache*)
105    exit 1
106    ;;
107*)
108    cmd=(./php-cgi -q -c devel.ini)
109    "${cmd[@]}" -v
110    ;;
111esac
112
113case "${args[0]}" in
114fcgi)
115    args=(-b 1026)
116    shift
117    ;;
118esac
119
120case "$type" in
121ltr*)
122    export USE_ZEND_ALLOC=0
123    tracer=(ltrace -s1024 -e malloc,realloc,free,write)
124    ;;
125str*)
126    tracer=(strace -s1024 -T ./php-cgi)
127    ;;
128gdb)
129    #USE_ZEND_ALLOC=0
130    tracer=(gdb --args)
131    ;;
132val*)
133    export USE_ZEND_ALLOC=0
134    tracer=(valgrind --gen-suppressions=all)
135    ;;
136dc)
137    exec ./php-cli -c devel.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
138    ;;
139dop)
140    exec ./php-cli -c devel.ini ./bin/phpdop.phpr "${args[@]}"
141    ;;
142retest)
143    exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
144    ;;
145test)
146    case "${args[0]}" in
147    *.phpt)
148        exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
149        ;;
150    */)
151        exec make xcachetest TESTS="${args[@]}"
152        ;;
153    *)
154        exec make xcachetest
155        ;;
156    esac
157    ;;
158esac
159
160export XCACHE_SKIP_FCGI_WARNING=1
161echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
162exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"
Note: See TracBrowser for help on using the repository browser.