$ git submodule init
$ git submodule update
$ mkdir capstone/build
$ cd capstone/build
$ cmake ..
$ cmake --build . --config Release
$ cmake -G "Visual Studio 14 2015 Win64" ..
The php build using mc.exe command which resides on
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin
maybe install Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
Resource:
- http://blog.benoitblanchon.fr/build-php-extension-on-windows/
- https://wiki.php.net/internals/windows/stepbystepbuild
Step:
-
Install Visual Studio 2015.
-
Open VS2015 x86 Native Tools Command Prompt.
-
The PHP binary tools SDK is located in
C:\php-sdk -
Create build directory once:
$ cd c:\php-sdk\ $ bin\phpsdk_buildtree.bat phpdevCopy
C:\php-sdk\phpdev\vc9toC:\php-sdk\phpdev\vc14. -
The PHP source code is located in
C:\php-sdk\phpdev\vc14\x86\php-7.0.14-src -
Put libraries on which PHP depends in
C:\php-sdk\phpdev\vc14\x86\deps -
Clone this repo in
C:\php-exts\capstone -
Setup environment:
$ cd c:\php-sdk\ $ bin\phpsdk_setvars.bat -
Build config as phpize:
$ cd C:\php-sdk\phpdev\vc14\x86\php-7.0.14-src $ buildconf.bat --add-modules-dir=C:\php-exts -
Configure:
$ cd C:\php-sdk\phpdev\vc14\x86\php-7.0.14-src $ configure.bat --disable-all --enable-cli --enable-capstone -
Make:
$ cd C:\php-sdk\phpdev\vc14\x86\php-7.0.14-src $ nmake php_capstone.dll
The generated file will be in .\Release_TS and .\x64\Relase_TS for Win64.
$ echo extension_dir=%cd%\Release_TS >> Release_TS\php.ini
$ echo extension=php_capstone.dll >> Release_TS\php.ini
$ nmake test TESTS=C:\php-exts\php-capstone\tests
$ phpize --clean
$ phpize
$ ./configure
If you get error regarding __ZNSt8ios_base4InitD1Ev it is because the libtool
using gcc instead g++ compiler in which it doesn't link to libstdc++.
Change the command produced in Makefile from --mode=link $(CC) into --mode=link $(CXX)
on the rule ./capstone.la (bottom).
$ make
Make sure the modules/capstone.so linked with libstdc++ (C++ only):
$ otool -L modules/capstone.so
$ make test
$ make install
$ echo "extension=capstone.so" > /usr/local/etc/php/7.0/conf.d/ext-capstone.ini
$ brew services restart php70