Skip to content

Commit 95c02e2

Browse files
committed
Fixed travis build script
1 parent 951bf5d commit 95c02e2

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

tests/ci/install-travis

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if [ x"$RE2C_BIN" = x ]; then
4242
exit 1
4343
fi
4444

45-
cd ${CURRENT_DIR}/parser
45+
cd ${CURRENT_DIR}/../../parser
4646

4747
rm -f *.o *.lo
4848

@@ -70,19 +70,45 @@ if [ ! -f parser.php7.c ]; then
7070
fi
7171
echo
7272

73+
PHP_FULL_VERSION=`${PHP_CONFIG_BIN} --version`
74+
75+
if [ $? != 0 ]; then
76+
echo "php-config is not installed"
77+
exit 1
78+
fi
79+
80+
if [ "${PHP_FULL_VERSION:0:3}" == "5.3" ]; then
81+
echo "php 5.3 is no longer supported"
82+
exit 1
83+
fi
84+
85+
if [ "${PHP_FULL_VERSION:0:3}" == "5.4" ]; then
86+
echo "php 5.4 is no longer supported"
87+
exit 1
88+
fi
89+
90+
if [ "${PHP_FULL_VERSION:0:1}" == "5" ]; then
91+
PHP_VERSION="php5"
92+
else
93+
PHP_VERSION="php7"
94+
fi
95+
96+
echo -e "Generating parser..."
97+
./lemon -s parser.${PHP_VERSION}.lemon
98+
99+
if [ ! -f parser.${PHP_VERSION}.c ]; then
100+
echo "error: couldn't generate parser"
101+
exit 1
102+
fi
103+
73104
echo "#include <php.h>" > parser.c
74-
echo "#if PHP_VERSION_ID < 70000" >> parser.c
75-
cat parser.php5.c >> parser.c
76-
echo "#else" >> parser.c
77-
cat parser.php7.c >> parser.c
78-
echo "#endif" >> parser.c
105+
cat parser.${PHP_VERSION}.c >> parser.c
79106
cat base.c >> parser.c
80107

81108
sed s/"\#line"/"\/\/"/g scanner.c > xx && mv -f xx scanner.c
82109
sed s/"#line"/"\/\/"/g parser.c > xx && mv -f xx parser.c
83110

84-
# Move to specified architecture
85-
cd ${CURRENT_DIR}
111+
cd ${CURRENT_DIR}/../../
86112

87113
# Clean current compilation
88114
if [ -f Makefile ]; then
@@ -97,6 +123,6 @@ make -j"$(getconf _NPROCESSORS_ONLN)"
97123
make test
98124
make install
99125

100-
phpenv config-add ${CURRENT_DIR}/tests/ci/zephir_parser.ini
126+
phpenv config-add ${CURRENT_DIR}/zephir_parser.ini
101127

102128
echo -e "\nThanks for compiling Zephir Parser!\nBuild succeed: Please restart your web server to complete the installation"

0 commit comments

Comments
 (0)