Skip to content

Commit 95fe197

Browse files
authored
Merge pull request #8 from phalcon/development
1.0.2
2 parents 348f63a + 55636bf commit 95fe197

28 files changed

+791
-108
lines changed

.appveyor.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1.0.1-{build}
1+
version: 1.0.2-{build}
22

33
build: false
44
environment:
@@ -47,6 +47,9 @@ matrix:
4747
clone_depth: 1
4848
clone_folder: c:\projects\parser
4949

50+
only_commits:
51+
message: /\[win build\]/
52+
5053
branches:
5154
only:
5255
- master
@@ -55,6 +58,7 @@ init:
5558
- SET PATH=C:\Program Files (x86)\MSBuild\%PHP_VC%.0\Bin;C:\Program Files\OpenSSL;C:\php;C:\php-sdk\bin;C:\php-devpack;%PATH%
5659
- SET PATH=C:\Program Files (x86)\Microsoft Visual Studio %PHP_VC%.0\VC;C:\Program Files (x86)\Microsoft Visual Studio %PHP_VC%.0\VC\bin;%PATH%
5760
- SET ANSICON=121x90 (121x90)
61+
- ps: IF ($env:APPVEYOR_REPO_BRANCH -eq "development") {$env:APPVEYOR_CACHE_SKIP_SAVE = "true"}
5862

5963
os: Windows Server 2012 R2
6064
platform:
@@ -102,6 +106,11 @@ install:
102106
} Else {
103107
$env:PHP_DEPS_URL="http://windows.php.net/downloads/php-sdk/deps-${env:PHP_TARGET}-vc${env:PHP_VC}-${env:PLATFORM}.7z"
104108
}
109+
If ($env:PHP_TYPE -Match "nts-Win32") {
110+
$env:RELEASE_ZIPBALL="zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_TARGET}-nts_${env:APPVEYOR_BUILD_VERSION}"
111+
} Else {
112+
$env:RELEASE_ZIPBALL="zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_TARGET}_${env:APPVEYOR_BUILD_VERSION}"
113+
}
105114
# ==================================================
106115
- echo Initializing Build
107116
# ==================================================
@@ -170,21 +179,21 @@ after_build:
170179
- echo Collect artifacts and zip
171180
# ==================================================
172181
- cd %APPVEYOR_BUILD_FOLDER%\package
173-
- ps: 7z a zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_VERSION}_${env:APPVEYOR_BUILD_VERSION}.zip *.*
174-
- ps: mv *.zip ${env:APPVEYOR_BUILD_FOLDER}\
182+
- 7z a %RELEASE_ZIPBALL%.zip *.*
183+
- mv %RELEASE_ZIPBALL%.zip %APPVEYOR_BUILD_FOLDER%\
175184

176185
on_failure:
177186
- 'dir'
178187
- ps: >-
179-
if (Test-Path -Path ${env:PHP_SRC}\compile-errors.log) {
188+
If (Test-Path -Path ${env:PHP_SRC}\compile-errors.log) {
180189
type ${env:PHP_SRC}\compile-errors.log
181190
}
182191
183-
if (Test-Path -Path ${env:PHP_SRC}\compile.log) {
192+
If (Test-Path -Path ${env:PHP_SRC}\compile.log) {
184193
type ${env:PHP_SRC}\compile.log
185194
}
186195
187-
if (Test-Path -Path ${env:PHP_SRC}\configure.js) {
196+
If (Test-Path -Path ${env:PHP_SRC}\configure.js) {
188197
type ${env:PHP_SRC}\configure.js
189198
}
190199
@@ -202,4 +211,3 @@ notifications:
202211
203212
subject: "Build Zephir Parser [{{status}}]"
204213
on_build_status_changed: true
205-

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
```
1818
### Details
1919

20-
* Zephir Parser version: (`php --ri "Zephir Parser""`)
21-
* PHP Version: (`php -v`)
20+
* Zephir Parser version (`php --ri "Zephir Parser"`):
21+
* PHP Version (`php -v`):
2222
* Operating System:
2323
* Installation type: Compiling from source || installing via package manager
24-
* Compiller version (if any):
24+
* Compiler version (if any):
2525
* Zephir version (if any):
2626
* Other related info:

.gitignore

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313
acinclude.m4
1414
aclocal.m4
1515
autom4te.cache
16-
build
16+
/build
1717
config.guess
1818
config.h
1919
config.h.in
20+
config.h.in~
2021
config.log
2122
config.nice
2223
config.status
2324
config.sub
2425
configure
2526
configure.in
26-
include
27+
/include
2728
install-sh
2829
libtool
2930
ltmain.sh
@@ -33,7 +34,7 @@ Makefile.global
3334
Makefile.objects
3435
missing
3536
mkinstalldirs
36-
modules
37+
/modules
3738
run-tests.php
3839
tests/*/*.diff
3940
tests/*/*.out
@@ -45,16 +46,14 @@ tests/*/*.sh
4546
# Parser files
4647
parser/lemon
4748
parser/scanner.c
48-
4949
parser/parser.c
50-
5150
parser/parser.php5.c
5251
parser/parser.php5.h
5352
parser/parser.php5.out
54-
5553
parser/parser.php7.c
5654
parser/parser.php7.h
5755
parser/parser.php7.out
5856

5957
vendor
6058
composer.lock
59+
phpunit.xml

.travis.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,48 +18,50 @@ compiler:
1818

1919
env:
2020
global:
21-
- LD_LIBRARY_PATH="$TRAVIS_BUILD_DIR/build/lib":$LD_LIBRARY_PATH
22-
- LIBRARY_PATH="$TRAVIS_BUILD_DIR/build/lib":$LIBRARY_PATH
23-
- C_INCLUDE_PATH="$TRAVIS_BUILD_DIR/build/include"
21+
- CFLAGS="-g3 -O0 -Wall -fvisibility=hidden"
22+
- ZEND_DONT_UNLOAD_MODULES=1
23+
- USE_ZEND_ALLOC=0
2424
matrix:
25-
- CC="ccache gcc" CFLAGS="-g3 -O0 -fno-delete-null-pointer-checks -Wall -std=gnu90 -fvisibility=hidden"
26-
- CC="ccache clang" CFLAGS="-g3 -O0 -fcolor-diagnostics -Wall -std=gnu90"
25+
- CC="gcc"
26+
- CC="clang"
2727

2828
matrix:
2929
fast_finish: true
3030
allow_failures:
3131
- php: nightly
3232
include:
33-
- env: CC="ccache gcc" CFLAGS="-g3 -O0 -fno-delete-null-pointer-checks -Wall -std=gnu90 -fvisibility=hidden"
33+
- env: CC="gcc"
3434
php: nightly
3535
compiler: gcc
36-
- env: CC="ccache clang" CFLAGS="-g3 -O0 -fcolor-diagnostics -Wall -std=gnu90"
36+
- env: CC="clang"
3737
php: nightly
3838
compiler: clang
3939

4040
cache:
4141
apt: true
42-
ccache: true
4342
timeout: 691200
4443
directories:
4544
- vendor
46-
- $HOME/.ccache
4745
- $HOME/.composer/cache
4846

4947
install:
50-
- bash ./tests/ci/install-travis
51-
- composer --prefer-source install
48+
- phpenv config-rm xdebug.ini || true
49+
- bash ./unit-tests/ci/install-travis
50+
- composer install --quiet --no-interaction --no-ansi --no-progress --optimize-autoloader --dev --prefer-dist --no-suggest --ignore-platform-reqs
5251

5352
before_install:
5453
- if [[ ! -z "${GH_TOKEN}" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; echo "Configured Github token"; fi;
5554

5655
script:
5756
- php --ri "Zephir Parser"
58-
- valgrind --read-var-info=yes --error-exitcode=1 --fullpath-after= --track-origins=yes --leak-check=full ./vendor/bin/phpunit -c phpunit.xml.dist --debug tests/
57+
- valgrind --read-var-info=yes --error-exitcode=1 --fullpath-after= --track-origins=yes --leak-check=full --num-callers=20 --suppressions=unit-tests/ci/zephir_parser.3.7.0.sup $(phpenv which php) ./unit-tests/phpunit -c phpunit.xml.dist --debug unit-tests/
5958

6059
notifications:
6160
email:
62-
61+
recipients:
62+
63+
on_success: change
64+
on_failure: always
6365

6466
addons:
6567
apt:

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9-
## 1.0.1 - 2017-03-31
9+
## [1.0.2] - 2017-04-14
10+
### Added
11+
- Added an ability to use parentheses in for loops [#3](https://github.com/phalcon/php-zephir-parser/issues/3)
12+
13+
### Changed
14+
- Improved install script to use specific optimizations for gcc and add ability to install on Gentoo and macOS
15+
16+
### Fixed
17+
- Fixed parser memory leaks [#2](https://github.com/phalcon/php-zephir-parser/issues/2)
18+
19+
## [1.0.1] - 2017-03-31
1020
### Added
1121
- Added script to build development version (Linux)
1222
- Added ability to compile extension for PHP 7 (Windows)
@@ -22,6 +32,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2232
- Removing unused structures
2333
- Removing unused variables
2434

25-
## 1.0.0 - 2017-03-26
35+
## [1.0.0] - 2017-03-26
2636
### Added
2737
- Initial stable release

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.1
1+
1.0.2

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
},
55
"autoload-dev": {
66
"psr-4": {
7-
"Zephir\\Parser\\Tests\\": "tests/Extension/"
7+
"Zephir\\Parser\\Tests\\": "unit-tests/Extension/"
88
}
99
}
1010
}

install

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@
1414
# [email protected] so we can mail you a copy immediately.
1515

1616
# Available params:
17-
# --arch
1817
# --phpize
1918
# --php-config
2019
#
2120
# Example:
2221
# ./install --phpize /usr/bin/phpize5.6 --php-config /usr/bin/php-config5.6
2322

23+
set -e
24+
2425
CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
2526

2627
GCC_BIN=$(command -v gcc 2>/dev/null)
2728
RE2C_BIN=${RE2C_BIN:-$(command -v re2c 2>/dev/null)}
2829

2930
if [ x"$RE2C_BIN" = x ]; then
3031
echo -e "error: unable to locate the re2c"
31-
exit 2
32+
exit 1
3233
fi
3334

3435
if [ x"$GCC_BIN" = x ]; then
3536
echo -e "error: unable to locate the gcc"
3637
exit 1
3738
fi
3839

39-
# Check best compilation flags for compiller
40+
# Check best compilation flags for compiler
4041
export CC=gcc
4142
export CFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer"
42-
export CPPFLAGS="-DZEPHIR_PARSER_RELEASE"
4343

4444
# Set defaults
4545
PHPIZE_BIN=$(command -v phpize 2>/dev/null)
@@ -75,6 +75,11 @@ if [ "${PHP_FULL_VERSION:0:3}" == "5.3" ]; then
7575
exit 1
7676
fi
7777

78+
if [ "${PHP_FULL_VERSION:0:3}" == "5.4" ]; then
79+
echo "php 5.4 is no longer supported"
80+
exit 1
81+
fi
82+
7883
# Detect possible flags
7984
echo "int main() {}" > t.c
8085
gcc ${CFLAGS} t.c -o t 2> t.t
@@ -88,11 +93,13 @@ if [ $? != 0 ]; then
8893
fi
8994
fi
9095

96+
# Activate some gcc specific optimizations for gcc >= 4
9197
if [ $(gcc -dumpversion | cut -f1 -d.) -ge 4 ]; then
92-
gcc ${CFLAGS} -fvisibility=hidden t.c -o t 2> t.t
93-
export CFLAGS="$CFLAGS -fvisibility=hidden"
98+
gcc ${CFLAGS} -fvisibility=hidden t.c -o t 2> t.t && export CFLAGS="$CFLAGS -fvisibility=hidden"
9499
fi
95100

101+
gcc ${CFLAGS} -flto t.c -o t 2> t.t && { export CFLAGS="$CFLAGS -flto"; export LDFLAGS="$LDFLAGS $CFLAGS"; }
102+
96103
rm -f t.t t.c t
97104

98105
cd ${CURRENT_DIR}/parser
@@ -109,7 +116,8 @@ rm -f \
109116
parser.php5.out \
110117
parser.php7.c \
111118
parser.php7.h \
112-
parser.php7.out
119+
parser.php7.out \
120+
config.h.in~
113121

114122
${RE2C_BIN} -o scanner.c scanner.re
115123

@@ -147,22 +155,34 @@ fi
147155

148156
# Perform the compilation
149157
${PHPIZE_BIN}
150-
./configure --silent --with-php-config=${PHPCONFIG_BIN} --enable-zephir_parser
151-
make -s -j"$(getconf _NPROCESSORS_ONLN)"
152158

153-
echo
159+
# For some reason the libtool script being generated by autogen contains lines referring
160+
# to "$echo message" instead of "echo message".
161+
export echo=echo
154162

155-
make -s install
163+
# Detect Gentoo Linux
164+
if [ -f /etc/gentoo-release ]; then
165+
LIBTOOLIZE_BIN=$(command -v libtoolize 2>/dev/null)
166+
aclocal && ${LIBTOOLIZE_BIN} --force && autoheader && autoconf
167+
fi
168+
169+
# Detect macOS
170+
if [ "$(uname -s 2>/dev/null)" = "Darwin" ]; then
171+
LIBTOOLIZE_BIN=$(command -v glibtoolize 2>/dev/null)
172+
aclocal && ${LIBTOOLIZE_BIN} --force && autoheader && autoconf
173+
fi
156174

157-
echo
175+
./configure --silent --with-php-config=${PHPCONFIG_BIN} --enable-zephir_parser
176+
177+
make -s -j"$(getconf _NPROCESSORS_ONLN)"
178+
make -s install
158179

159180
# Clean current compilation
160181
if [ -f Makefile ]; then
161182
make -s clean
162183
${PHPIZE_BIN} --clean
163184
fi
164185

165-
166186
cd ${CURRENT_DIR}/parser
167187

168188
# Cleanup
@@ -177,7 +197,8 @@ rm -f \
177197
parser.php5.out \
178198
parser.php7.c \
179199
parser.php7.h \
180-
parser.php7.out
200+
parser.php7.out \
201+
config.h.in~
181202

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

0 commit comments

Comments
 (0)