Skip to content

Commit fc3ba05

Browse files
committed
Improved build on Appveyor
1 parent 9b8e8b7 commit fc3ba05

13 files changed

+302
-196
lines changed

.appveyor.yml

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
version: 1.0.1-{build}
2+
3+
build: false
4+
environment:
5+
matrix:
6+
- PHP_TARGET: 5.5
7+
PHP_VC: 11
8+
PHP_MAJOR: 5
9+
PHP_TYPE: "Win32"
10+
- PHP_TARGET: 5.5
11+
PHP_VC: 11
12+
PHP_MAJOR: 5
13+
PHP_TYPE: "nts-Win32"
14+
- PHP_TARGET: 5.6
15+
PHP_VC: 11
16+
PHP_MAJOR: 5
17+
PHP_TYPE: "Win32"
18+
- PHP_TARGET: 5.6
19+
PHP_VC: 11
20+
PHP_MAJOR: 5
21+
PHP_TYPE: "nts-Win32"
22+
- PHP_TARGET: 7.0
23+
PHP_VC: 14
24+
PHP_MAJOR: 7
25+
PHP_TYPE: "Win32"
26+
- PHP_TARGET: 7.0
27+
PHP_VC: 14
28+
PHP_MAJOR: 7
29+
PHP_TYPE: "nts-Win32"
30+
- PHP_TARGET: 7.1
31+
PHP_VC: 14
32+
PHP_MAJOR: 7
33+
PHP_TYPE: "Win32"
34+
- PHP_TARGET: 7.1
35+
PHP_VC: 14
36+
PHP_MAJOR: 7
37+
PHP_TYPE: "nts-Win32"
38+
NO_INTERACTION: 1
39+
PHP_SDK: c:\php-sdk
40+
PHP_DEVPACK: c:\php-devpack
41+
42+
matrix:
43+
fast_finish: true
44+
allow_failures:
45+
- platform: x64
46+
47+
clone_depth: 1
48+
clone_folder: c:\projects\parser
49+
50+
branches:
51+
only:
52+
- master
53+
- development
54+
init:
55+
- 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%
56+
- 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%
57+
- SET ANSICON=121x90 (121x90)
58+
59+
os: Windows Server 2012 R2
60+
platform:
61+
- x86
62+
- x64
63+
64+
install:
65+
# ==================================================
66+
- echo Setting PHP version...
67+
# ==================================================
68+
- ps: Start-FileDownload 'http://windows.php.net/downloads/releases/sha1sum.txt'
69+
- ps: $env:PHP_VERSION=type sha1sum.txt | where { $_ -match "php-(${env:PHP_TARGET}\.\d+)-src" } | foreach { $matches[1] }
70+
- ps: $env:PHP_PLATFORM="${env:PHP_SDK}\phpdev\vc${env:PHP_VC}\${env:PLATFORM}"
71+
- ps: $env:PHP_SRC="${env:PHP_PLATFORM}\php-${env:PHP_VERSION}-src"
72+
- ps: >-
73+
If ($env:PLATFORM -eq 'x86') {
74+
If ($env:PHP_TYPE -Match "nts-Win32") {
75+
$env:RELEASE_FOLDER="Release"
76+
$env:PHP_CONFIGURE_FLAGS="--disable-all --enable-cli --enable-zephir_parser=shared --disable-zts"
77+
} Else {
78+
$env:RELEASE_FOLDER="Release_TS"
79+
$env:PHP_CONFIGURE_FLAGS="--disable-all --enable-cli --enable-zephir_parser=shared"
80+
}
81+
} else {
82+
If ($env:PHP_TYPE -Match "nts-Win32") {
83+
$env:RELEASE_FOLDER="x64\Release"
84+
$env:PHP_CONFIGURE_FLAGS="--disable-all --enable-cli --enable-zephir_parser=shared --disable-zts"
85+
} Else {
86+
$env:RELEASE_FOLDER="x64\Release_TS"
87+
$env:PHP_CONFIGURE_FLAGS="--disable-all --enable-cli --enable-zephir_parser=shared"
88+
}
89+
}
90+
If ($env:PHP_VC -eq '11') {
91+
$env:VSCOMNTOOLS=$env:VS110COMNTOOLS
92+
} elseif ($env:PHP_VC -eq '14') {
93+
$env:VSCOMNTOOLS=$env:VS140COMNTOOLS
94+
}
95+
If ($env:PLATFORM -eq 'x64') {
96+
$env:ARCH='x86_amd64'
97+
} Else {
98+
$env:ARCH='x86'
99+
}
100+
If ($env:PHP_TARGET -eq '5.5') {
101+
$env:PHP_DEPS_URL="http://windows.php.net/downloads/php-sdk/archives/deps-${env:PHP_TARGET}-vc${env:PHP_VC}-${env:PLATFORM}.7z"
102+
} Else {
103+
$env:PHP_DEPS_URL="http://windows.php.net/downloads/php-sdk/deps-${env:PHP_TARGET}-vc${env:PHP_VC}-${env:PLATFORM}.7z"
104+
}
105+
# ==================================================
106+
- echo Initializing Build
107+
# ==================================================
108+
- mkdir %PHP_SDK% && cd %PHP_SDK%
109+
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip', 'C:\php-sdk.zip')
110+
- 7z.exe x C:\php-sdk.zip | FIND /V "ing "
111+
- phpsdk_buildtree phpdev
112+
- ps: Rename-Item ${env:PHP_SDK}\phpdev\vc9 ${env:PHP_SDK}\phpdev\vc${env:PHP_VC}
113+
- mkdir %PHP_SRC%
114+
# ==================================================
115+
- echo Install PHP Dev pack
116+
# ==================================================
117+
- cd C:\
118+
- ps: (new-object net.webclient).DownloadFile('http://windows.php.net/downloads/releases/php-devel-pack-' + ${env:PHP_VERSION} + '-Win32-VC' + ${env:PHP_VC} + '-' + ${env:PLATFORM} + '.zip', 'C:\php-dev.zip')
119+
- 7z.exe x php-dev.zip | FIND /V "ing "
120+
- ps: Rename-Item "php-${env:PHP_VERSION}-devel-VC${env:PHP_VC}-${env:PLATFORM}" C:\php-devpack
121+
# ==================================================
122+
- echo Downloading and preparing PHP source code
123+
# ==================================================
124+
- git clone -b PHP-%PHP_TARGET% --depth 1 https://github.com/php/php-src %PHP_SRC%
125+
- cd %PHP_PLATFORM%
126+
- ps: (new-object net.webclient).DownloadFile(${env:PHP_DEPS_URL}, 'C:\php-sdk-deps.7z')
127+
- 7z.exe x C:\php-sdk-deps.7z | FIND /V "ing "
128+
- cd %PHP_SDK%
129+
- phpsdk_setvars
130+
- '"%VSCOMNTOOLS%\VsDevCmd" %PLATFORM%'
131+
- vcvarsall %ARCH%
132+
# ==================================================
133+
- echo Preparing extension to build
134+
# ==================================================
135+
- mkdir %PHP_SRC%\ext\zephir_parser
136+
- xcopy /s /q c:\projects\parser\*.* %PHP_SRC%\ext\zephir_parser
137+
- cd %PHP_SRC%\ext\zephir_parser
138+
- cmd /c build-win32-php%PHP_MAJOR%.bat
139+
# ==================================================
140+
- echo Build PHP with enabled Zephir Parser
141+
# ==================================================
142+
- cd %PHP_SRC%
143+
- buildconf
144+
- configure %PHP_CONFIGURE_FLAGS%
145+
- nmake 2> compile-errors.log 1> compile.log
146+
- echo extension=%PHP_SRC%\%RELEASE_FOLDER%\php_zephir_parser.dll >> C:\Windows\php.ini
147+
- SET PATH=%PHP_SRC%\%RELEASE_FOLDER%;%PATH%
148+
- php -v
149+
- php --ri "Zephir Parser"
150+
151+
build_script:
152+
# ==================================================
153+
- echo Creating package to zip
154+
# ==================================================
155+
- mkdir %APPVEYOR_BUILD_FOLDER%\package
156+
- cd %APPVEYOR_BUILD_FOLDER%\package
157+
- cp %PHP_SRC%\%RELEASE_FOLDER%\php_zephir_parser.dll .\
158+
- cp %APPVEYOR_BUILD_FOLDER%\LICENSE .\
159+
- cp %APPVEYOR_BUILD_FOLDER%\CREDITS .\
160+
- cp %APPVEYOR_BUILD_FOLDER%\CHANGELOG.md .\
161+
162+
after_build:
163+
# ==================================================
164+
- echo Collect artifacts and zip
165+
# ==================================================
166+
- cd %APPVEYOR_BUILD_FOLDER%\package
167+
- ps: 7z a zephir_parser_${env:PLATFORM}_vc${env:PHP_VC}_php${env:PHP_VERSION}_${env:APPVEYOR_BUILD_VERSION}.zip *.*
168+
- ps: mv *.zip ${env:APPVEYOR_BUILD_FOLDER}\
169+
170+
on_failure:
171+
- 'dir'
172+
- ps: >-
173+
if (Test-Path -Path ${env:PHP_SRC}\compile-errors.log) {
174+
type ${env:PHP_SRC}\compile-errors.log
175+
}
176+
177+
if (Test-Path -Path ${env:PHP_SRC}\compile.log) {
178+
type ${env:PHP_SRC}\compile.log
179+
}
180+
181+
if (Test-Path -Path ${env:PHP_SRC}\configure.js) {
182+
type ${env:PHP_SRC}\configure.js
183+
}
184+
185+
on_success:
186+
- 'dir'
187+
188+
artifacts:
189+
- path: '.\*.zip'
190+
type: zip
191+
name: ZephirParser
192+
193+
notifications:
194+
- provider: Email
195+
to:
196+
197+
subject: "Build Zephir Parser [{{status}}]"
198+
on_build_status_changed: true
199+

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.c linguist-language=C
2+
*.h linguist-language=C
3+
*.w32 linguist-language=JavaScript

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ dist: trusty
44
sudo: false
55

66
php:
7-
- 5.4
87
- 5.5
98
- 5.6
109
- 7.0

CHANGELOG.md

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

77
## [Unreleased]
88
### Added
9-
- Added script to build development version
9+
- Added script to build development version (Linux)
1010
- Added ability to compile extension for PHP 7 (Windows)
11-
- Added Windows manual
11+
- Added Windows manual (Windows)
1212

1313
### Changed
1414
- Optimize build to produce smaller module
15-
- Improved Win32 build by providing separated `bat` file
15+
- Improved Win32 build by providing separated `bat` file (Windows)
16+
- Improved build and tests on Appveyor (Windows)
1617

1718
### Fixed
1819
- Fixed compiler warnings on build lemon

README.WIN32-BUILD-SYSTEM

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[Zephir Parser]
2+
---------------
3+
4+
[Installation Guide]
5+
--------------------
6+
7+
This guide explains how to install Zephir Parser using a Windows operating system.
8+
Some parts are optional, when you have a specific PHP version.
9+
Parts which are only necessary for a specific PHP version, are marked as such.
10+
11+
[Software Requirements (PHP 5.5 or later)]
12+
------------------------------------------
13+
14+
* Install Visual Studio 2012 Express: http://www.microsoft.com/en-US/download/details.aspx?id=34673
15+
You should start it and activate it.
16+
17+
[Software Requirements (below PHP 5.5)]
18+
---------------------------------------
19+
20+
* Install Windows SDK 6.1: http://www.microsoft.com/en-us/download/details.aspx?id=24826
21+
WARNING: This usually takes very long to install and is very big
22+
23+
* Install Visual Studio 2008 Express (after SDK 6.1!): http://go.microsoft.com/fwlink/?LinkId=104679
24+
Install C++ Express Edition, (You should start and activate it)
25+
26+
[Software Requirements General]
27+
-------------------------------
28+
29+
* Install PHP (NTS): http://windows.php.net/download/
30+
* Download and extract it
31+
* Make sure it is in the PATH, as for example below:
32+
setx path "%path%;c:\path-to-php\"
33+
34+
* Install PHP SDK: http://windows.php.net/downloads/php-sdk/
35+
(Currently `php-sdk-binary-tools-20110915.zip` is the newest):
36+
setx php_sdk "c:\path-to-php-sdk"
37+
38+
* Download PHP Developer Pack(NTS!): http://windows.php.net/downloads/releases/
39+
(Or build it yourself with `--enable-debug --disable-zts` and `nmake build-devel`,
40+
or just `nmake snap` by using the PHP-SDK). Run:
41+
setx php_devpack "c:\path-to-extracted-devpack"
42+
43+
44+
[Installation of Zephir Parser]
45+
-------------------------------
46+
47+
* Clone/Download the repostiory
48+
* Copy `re2c.exe` to the `parser` folder (from PHP-SDK for example)
49+
* Next, build `lemon`:
50+
* PHP 5
51+
cmd /c build-win32-php5.bat
52+
* PHP 7
53+
cmd /c build-win32-php7.bat
54+
55+
* Then compile Zephir Parser:
56+
%PHP_DEVPACK%\phpize
57+
configure --enable-zephir_parser
58+
nmake 2> compile-errors.log 1> compile.log
59+
60+
* Edit your `php.ini` file and add this line:
61+
[Zephir Parser]
62+
extension=c:\path-to-zephir-parser\ext\Release_TS\php_test.dll
63+
64+
* Finally, **restart your web server**
65+
66+
67+
NOTE: To ensure that your Zephir Parser installation was successful, debug with:
68+
<?php phpinfo(); ?>
69+
70+
and search for a section mentioning the Zephir Parser extension.
71+
72+
[Additional Links]
73+
------------------
74+
75+
Building PHP under Windows: https://wiki.php.net/internals/windows/stepbystepbuild

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@
55

66
The Zephir Parser delivered as a C extension for the PHP language.
77

8-
Supported PHP versions:
9-
10-
- **5.4**
11-
- **5.5**
12-
- **5.6**
13-
- **7.0**
14-
- **7.1**
15-
- **7.2**
8+
Supported PHP versions: **5.5**, **5.6**, **7.0**, **7.1**, **7.2**
169

1710
## Get Started
1811

1912
### Windows
2013

21-
Windows users should follow [this guide](https://github.com/phalcon/php-zephir-parser/blob/master/WINDOWS.md).
14+
To install Zephir Parser on Windows:
15+
16+
1. Download [Zephir Parser for Windows](https://github.com/phalcon/php-zephir-parser/releases/latest)
17+
2. Extract the DLL file and copy it to your PHP extensions directory
18+
3. Edit your php.ini file and add this line:
19+
```ini
20+
[Zephir Parser]
21+
extension=zephir_parser.dll
22+
```
23+
4. Finally, restart your web server
24+
25+
You can [compile it yourself](https://github.com/phalcon/php-zephir-parser/blob/master/README.WIN32-BUILD-SYSTEM).
2226

2327
### Linux
2428

0 commit comments

Comments
 (0)