Skip to content

Commit aa1c97d

Browse files
committed
Improved Windows build
1 parent 8fe4402 commit aa1c97d

File tree

6 files changed

+89
-1
lines changed

6 files changed

+89
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unreleased]
88
### Added
99
- Added script to build development version
10+
- Added ability to compile extension for PHP 7 (Windows)
11+
- Added Windows manual
1012

1113
### Changed
1214
- Optimize build to produce smaller module

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Supported PHP versions:
1616

1717
## Get Started
1818

19+
### Windows
20+
21+
Windows users should follow [this guide](https://github.com/phalcon/php-zephir-parser/blob/master/WINDOWS.md).
22+
1923
### Linux
2024

2125
On a Unix-based platform you can easily compile and install the extension from sources.
@@ -60,6 +64,7 @@ sudo ./install
6064
Add the extension to your php.ini:
6165

6266
```ini
67+
[Zephir Parser]
6368
extension=zephir_parser.so
6469
```
6570

WINDOWS.md

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

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ install:
5454
- 'cd parser'
5555
- 'copy %PHP_SDK%\bin\re2c.exe .\re2c.exe'
5656
- '"%VS110COMNTOOLS%\VsDevCmd" %BUILD_PLATFORM%'
57-
- cmd /c install-win32.bat
57+
- cmd /c install-win32-php5.bat
5858

5959
- echo Building PHP [%PHP_VERSION%]
6060
- '%PHP_SDK%\bin\phpsdk_setvars'

parser/install-win32-php7.bat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cl lemon.c
2+
del parser.c parser.h scanner.c
3+
re2c -o scanner.c scanner.re
4+
lemon -s parser.php7.lemon
5+
type parser.php7.c > parser.c
6+
type base.c >> parser.c

0 commit comments

Comments
 (0)