Skip to content

Commit

Permalink
Merge cbcc66e into d190b67
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Aug 2, 2017
2 parents d190b67 + cbcc66e commit d6ba632
Show file tree
Hide file tree
Showing 24 changed files with 303 additions and 132 deletions.
153 changes: 153 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
version: '{branch}.{build}'
branches:
only:
- master
- appveyor
- w32
- windows

image: Visual Studio 2017

environment:
PHP_SDK_BINARY_TOOLS_VER: php-sdk-2.0.9
matrix:
- PHP_VER: 7.2
VC_VER: vc15
ARCH: x86
- PHP_VER: 7.2
VC_VER: vc15
ARCH: x64

install:
- cmd: cinst wget
- cmd: >-
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
build_script:
# json-c
- cmd: >-
cd C:\projects
git clone -b windows https://github.com/jbboehr/json-c.git
cd json-c
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\projects\output -DCMAKE_BUILD_TYPE=Release ..
nmake
nmake install
# libyaml
- cmd: >-
cd C:\projects
git clone https://github.com/yaml/libyaml
cd libyaml
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\projects\output -DCMAKE_BUILD_TYPE=Release ..
nmake
copy /Y *.lib \projects\output\lib\
copy /Y ..\include\yaml.h \projects\output\include\
# getopt.h
- cmd: >-
cd C:\projects
git clone https://github.com/jbboehr/Getopt-for-Visual-Studio.git
copy /Y Getopt-for-Visual-Studio\getopt.h output\include\
# dirent.h
- cmd: >-
cd C:\projects
git clone https://github.com/jbboehr/dirent.git
copy /Y dirent\include\dirent.h output\include
# libmustache
- cmd: >-
cd C:\projects\
git clone https://github.com/jbboehr/libmustache.git
cd C:\projects\libmustache
git submodule update --init
mkdir build
cd build
SET LIBYAML_PATH=\projects\output
SET LIBJSON_PATH=\projects\output
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\projects\output -DCMAKE_BUILD_TYPE=Release ..
nmake
nmake install
- cmd: >-
cd C:\projects\php-mustache
wget https://github.com/OSTC/php-sdk-binary-tools/archive/%PHP_SDK_BINARY_TOOLS_VER%.zip --no-check-certificate -q -O php-sdk-binary-tools-%PHP_SDK_BINARY_TOOLS_VER%.zip
7z x -y php-sdk-binary-tools-%PHP_SDK_BINARY_TOOLS_VER%.zip -oC:\projects
move C:\projects\php-sdk-binary-tools-%PHP_SDK_BINARY_TOOLS_VER% C:\projects\php-sdk
C:\projects\php-sdk\bin\phpsdk_setvars.bat
git clone https://github.com/php/php-src C:\projects\php-src -b PHP-%PHP_VER% --depth=1
mkdir C:\projects\php-src\ext\mustache
xcopy C:\projects\php-mustache C:\projects\php-src\ext\mustache /s /e /y /q
REM FIXME no PHP 7.2 deps downloads available yet - wget http://windows.php.net/downloads/php-sdk/deps-%PHP_VER%-%VC_VER%-%ARCH%.7z -q
wget http://windows.php.net/downloads/php-sdk/deps-master-%VC_VER%-%ARCH%.7z -q
REM FIXME no PHP 7.2 deps downloads available yet - 7z x -y deps-%PHP_VER%-%VC_VER%-%ARCH%.7z -oC:\projects\php-src
7z x -y deps-master-%VC_VER%-%ARCH%.7z -oC:\projects\php-src
cd C:\projects\php-src
buildconf.bat
configure.bat --disable-all --enable-cli --enable-cgi --enable-zts --enable-json --enable-mustache=shared --with-libmustache=\projects\output --with-prefix=C:\projects\php-mustache\bin --with-php-build=deps
nmake
nmake install
cd C:\projects\php-mustache\bin
echo [PHP] > php.ini
echo extension_dir = "ext" >> php.ini
echo extension=php_mustache.dll >> php.ini
set TEST_PHP_EXECUTABLE=%cd%\php.exe
php -v
php -m
test_script:
- cmd: php.exe /projects/php-src/run-tests.php /projects/php-src/ext/mustache -q --show-diff
artifacts:
- path: bin
name: master
type: zip
33 changes: 8 additions & 25 deletions config.w32
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@

ARG_ENABLE("mustache", "Mustache", "no");
ARG_WITH("libmustache", "libmustache location", "no");

if( PHP_MUSTACHE != "no" ) {
EXTENSION('mustache', "\
php_mustache.cpp \
mustache_ast.cpp \
mustache_code.cpp \
mustache_mustache.cpp \
mustache_exceptions.cpp \
mustache_data.cpp \
mustache_template.cpp \
mustache_lambda.cpp \
mustache_lambda_helper.cpp \
mustache_class_method_lambda.cpp \
mustache_zend_closure_lambda.cpp",
PHP_MUSTACHE_SHARED,
"-I" + configure_module_dirname + "/mustache/src");
ADD_SOURCES(configure_module_dirname + "/mustache/src", "\
mustache.cpp \
compiler.cpp \
data.cpp \
lambda.cpp \
node.cpp \
renderer.cpp \
tokenizer.cpp \
utils.cpp \
vm.cpp", "mustache");
AC_DEFINE('HAVE_MUSTACHE', 1);
if (CHECK_LIB("mustache_static.lib", "mustache", PHP_LIBMUSTACHE + "\\lib") &&
CHECK_HEADER_ADD_INCLUDE("mustache_config.h", "CFLAGS_MUSTACHE", PHP_LIBMUSTACHE + "\\include\\mustache" + ";" + PHP_PHP_BUILD + "\\include")) {
EXTENSION('mustache', "php_mustache.cpp mustache_ast.cpp mustache_code.cpp mustache_mustache.cpp mustache_exceptions.cpp mustache_data.cpp mustache_template.cpp mustache_lambda.cpp mustache_lambda_helper.cpp mustache_class_method_lambda.cpp mustache_zend_closure_lambda.cpp", PHP_MUSTACHE_SHARED, "/EHsc /I \"" + PHP_LIBMUSTACHE + "\\include\\mustache" + "\"" + " " + "/I \"" + PHP_LIBMUSTACHE + "\\include" + "\"");
AC_DEFINE('HAVE_MUSTACHE', 1);
} else {
WARNING("mustache not enabled; libraries and headers not found");
}
}
5 changes: 4 additions & 1 deletion mustache_ast.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

#include "mustache_private.hpp"
#include "php_mustache.h"
#include "php5to7.h"
#include "mustache_exceptions.hpp"
#include "mustache_ast.hpp"

/* {{{ ZE2 OO definitions */
zend_class_entry * MustacheAST_ce_ptr;
Expand Down
2 changes: 2 additions & 0 deletions mustache_ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#ifndef PHP_MUSTACHE_AST_HPP
#define PHP_MUSTACHE_AST_HPP

#include <mustache/mustache.hpp>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
3 changes: 3 additions & 0 deletions mustache_class_method_lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

#include "php_mustache.h"
#include "php5to7.h"
#include "mustache_private.hpp"
#include "mustache_class_method_lambda.hpp"

ClassMethodLambda::~ClassMethodLambda()
{
Expand Down
6 changes: 5 additions & 1 deletion mustache_code.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

#include "mustache_private.hpp"
#include <mustache/compiler.hpp>
#include "php_mustache.h"
#include "php5to7.h"
#include "mustache_exceptions.hpp"
#include "mustache_code.hpp"

/* {{{ ZE2 OO definitions */
zend_class_entry * MustacheCode_ce_ptr;
Expand Down
11 changes: 10 additions & 1 deletion mustache_data.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@

#include "mustache_private.hpp"
#include <mustache/mustache.hpp>
#include <mustache/lambda.hpp>
#include "php_mustache.h"
#include "php5to7.h"
#include <Zend/zend_closures.h>
#include "mustache_class_method_lambda.hpp"
#include "mustache_exceptions.hpp"
#include "mustache_lambda.hpp"
#include "mustache_zend_closure_lambda.hpp"
#include "mustache_data.hpp"

/* {{{ ZE2 OO definitions */
zend_class_entry * MustacheData_ce_ptr;
Expand Down
2 changes: 2 additions & 0 deletions mustache_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#ifndef PHP_MUSTACHE_DATA_HPP
#define PHP_MUSTACHE_DATA_HPP

#include <mustache/mustache.hpp>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
4 changes: 4 additions & 0 deletions mustache_exceptions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

#include "php_mustache.h"
#include <Zend/zend_exceptions.h>
#include "php5to7.h"
#include "mustache_private.hpp"
#include "mustache_exceptions.hpp"

/* {{{ ZE2 OO definitions */
zend_class_entry * MustacheException_ce_ptr;
Expand Down
5 changes: 4 additions & 1 deletion mustache_exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#ifndef PHP_MUSTACHE_EXCEPTIONS_HPP
#define PHP_MUSTACHE_EXCEPTIONS_HPP

#include <exception>
#include <stdexcept>

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -23,7 +26,7 @@ class PhpInvalidParameterException : public std::exception {

class InvalidParameterException : public std::runtime_error {
public:
InvalidParameterException(const std::string& desc) : std::runtime_error(desc) { }
explicit InvalidParameterException(const std::string& desc) : std::runtime_error(desc) { }
};

#endif /* PHP_MUSTACHE_EXCEPTIONS_HPP */
Expand Down
11 changes: 10 additions & 1 deletion mustache_lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@

#include "mustache_private.hpp"
#define NOMINMAX

#include <algorithm>

#include "php_mustache.h"
#include "php5to7.h"
#include "mustache_lambda_helper.hpp"
#include "mustache_lambda.hpp"

#undef min

#if PHP_MAJOR_VERSION >= 7
std::string Lambda::invoke()
Expand Down
8 changes: 1 addition & 7 deletions mustache_lambda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#ifndef PHP_MUSTACHE_LAMBDA_HPP
#define PHP_MUSTACHE_LAMBDA_HPP

#ifdef __cplusplus
extern "C" {
#endif
#include <mustache/lambda.hpp>

class Lambda : public mustache::Lambda {
protected:
Expand All @@ -19,9 +17,5 @@ class Lambda : public mustache::Lambda {
std::string invoke(std::string * text, mustache::Renderer * renderer);
};

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* PHP_MUSTACHE_LAMBDA_HPP */

5 changes: 4 additions & 1 deletion mustache_lambda_helper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

#include "mustache_private.hpp"
#include "php_mustache.h"
#include "php5to7.h"
#include "mustache_exceptions.hpp"
#include "mustache_lambda_helper.hpp"

/* {{{ ZE2 OO definitions */
zend_class_entry * MustacheLambdaHelper_ce_ptr;
Expand Down
9 changes: 6 additions & 3 deletions mustache_lambda_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#ifndef PHP_MUSTACHE_LAMBDA_HELPER_HPP
#define PHP_MUSTACHE_LAMBDA_HELPER_HPP

#include <mustache/mustache.hpp>
#include <mustache/renderer.hpp>

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -22,10 +25,10 @@ extern zend_class_entry * MustacheLambdaHelper_ce_ptr;

struct php_obj_MustacheLambdaHelper * php_mustache_lambda_helper_object_fetch_object(zval * zv TSRMLS_DC);

PHP_MINIT_FUNCTION(mustache_lambda_helper);
extern PHP_MINIT_FUNCTION(mustache_lambda_helper);

PHP_METHOD(MustacheLambdaHelper, __construct);
PHP_METHOD(MustacheLambdaHelper, render);
extern PHP_METHOD(MustacheLambdaHelper, __construct);
extern PHP_METHOD(MustacheLambdaHelper, render);

#ifdef __cplusplus
} // extern "C"
Expand Down
9 changes: 8 additions & 1 deletion mustache_mustache.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@

#include "mustache_private.hpp"
#include "php_mustache.h"
#include "php5to7.h"
#include "mustache_ast.hpp"
#include "mustache_code.hpp"
#include "mustache_data.hpp"
#include "mustache_exceptions.hpp"
#include "mustache_template.hpp"
#include "mustache_mustache.hpp"

/* {{{ ZE2 OO definitions */
zend_class_entry * Mustache_ce_ptr;
Expand Down
2 changes: 2 additions & 0 deletions mustache_mustache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#ifndef PHP_MUSTACHE_MUSTACHE_HPP
#define PHP_MUSTACHE_MUSTACHE_HPP

#include "mustache/mustache.hpp"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
Loading

0 comments on commit d6ba632

Please sign in to comment.