XCache is a fast, stable PHP opcode cacher that has been proven and is now running on production servers under high load. https://xcache.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

138 lines
2.5 KiB

  1. #!/bin/bash
  2. # this script is for developers only
  3. . run.cfg
  4. basename=$(basename $(pwd))
  5. if echo $basename | grep -- - >/dev/null; then :; else
  6. dirs=${dirs:-php5-debug}
  7. for dir in $dirs; do
  8. cd ../${basename}-${dir} || exit
  9. rm -f php-src
  10. find -L . -type l | xargs rm -f
  11. lndir ../$basename >/dev/null
  12. find . -iname .\*.swp | xargs rm -f
  13. ln -sf ~/src/php/$dir php-src
  14. for i in ~/src/php/$dir/sapi/cgi/php{,-cgi}; do
  15. [[ -r $i ]] && ln -sf "$i" php-cgi
  16. done
  17. ln -sf ~/src/php/$dir/sapi/cli/php php-cli
  18. pwd
  19. $0 "$@"
  20. done
  21. exit
  22. fi
  23. phpbasename=${basename#*-}
  24. xcachebasename=${basename%%-*}
  25. if [[ ! -z $1 ]]; then
  26. type=$1
  27. shift
  28. if [[ ! -z $1 ]]; then
  29. args=("$@")
  30. elif [[ -z $args ]]; then
  31. args=(test.php)
  32. fi
  33. fi
  34. case $type in
  35. prepare)
  36. exec ./devel/prepare.devel
  37. ;;
  38. tags)
  39. exec ./devel/prepare.devel tags
  40. ;;
  41. rebuild)
  42. PHPDIRS=${PHPDIRS:-$HOME/test}
  43. if [[ ! -x $PHPDIRS/$phpbasename/bin/phpize ]]; then
  44. echo $PHPDIRS/$phpbasename/bin/phpize not found
  45. exit
  46. fi
  47. export PATH=$PHPDIRS/$phpbasename/bin:$PATH
  48. phpize --clean \
  49. && phpize \
  50. && CFLAGS="-Wall -Wno-unused -W -Wshadow -std=gnu99" ./configure --enable-xcache-disassembler --enable-xcache-test --enable-xcache-constant \
  51. && make
  52. exit
  53. ;;
  54. make)
  55. MAKEARGS=("$@")
  56. ;;
  57. esac
  58. LANG=C /usr/bin/make $MAKEOPTS "${MAKEARGS[@]}" 2>&1 | hi error implicit warn FAIL
  59. ret=${PIPESTATUS[0]}
  60. if [[ $ret -ne 0 || $type = make ]]; then
  61. exit $ret
  62. fi
  63. cmd=()
  64. tracer=()
  65. case "$basename" in
  66. *-apache1*)
  67. cmd=($HOME/apache1/bin/httpd -X)
  68. ;;
  69. *-apache*)
  70. exit 1
  71. ;;
  72. *)
  73. cmd=(./php-cgi -q -c php.ini)
  74. "${cmd[@]}" -v
  75. ;;
  76. esac
  77. case "${args[0]}" in
  78. fcgi)
  79. args=(-b 1026)
  80. shift
  81. ;;
  82. esac
  83. case "$type" in
  84. ltr*)
  85. export USE_ZEND_ALLOC=0
  86. tracer=(ltrace -s1024 -e malloc,realloc,free,write)
  87. ;;
  88. str*)
  89. tracer=(strace -s1024 -T ./php-cgi)
  90. ;;
  91. gdb)
  92. #USE_ZEND_ALLOC=0
  93. tracer=(gdb --args)
  94. ;;
  95. val*)
  96. export USE_ZEND_ALLOC=0
  97. tracer=(valgrind --gen-suppressions=all)
  98. ;;
  99. dc)
  100. exec ./php-cli -c php.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
  101. ;;
  102. dop)
  103. exec ./php-cli -c php.ini ./bin/phpdop.phpr "${args[@]}"
  104. ;;
  105. retest)
  106. exec make xcachetest "$@" TESTS="`grep '^/.*\.phpt$' php_test_results_*.txt | uniq | xargs`"
  107. ;;
  108. test)
  109. case "${args[0]}" in
  110. *.phpt)
  111. exec make xcachetest TEST_ARGS=-v TESTS="${args[*]}"
  112. ;;
  113. */)
  114. exec make xcachetest TESTS="${args[@]}"
  115. ;;
  116. *)
  117. exec make xcachetest
  118. ;;
  119. esac
  120. ;;
  121. esac
  122. export XCACHE_SKIP_FCGI_WARNING=1
  123. echo "${tracer[@]}" "${cmd[@]}" "${args[@]}"
  124. exec "${tracer[@]}" "${cmd[@]}" "${args[@]}"