Skip to content

[pull] master from CopernicaMarketingSoftware:master #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
*.txt
*.a.*
*.so.*
shared/
static/
build/
.vscode/
49 changes: 17 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,7 @@ endif
# you want to leave that flag out on production servers).
#

COMPILER_FLAGS = -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD
SHARED_COMPILER_FLAGS = -fpic
STATIC_COMPILER_FLAGS =
PHP_COMPILER_FLAGS = ${COMPILER_FLAGS} `${PHP_CONFIG} --includes`
COMPILER_FLAGS = -Wall -c -std=c++11 -fvisibility=hidden -DBUILDING_PHPCPP -Wno-write-strings -MD -fpic `${PHP_CONFIG} --includes`

#
# Linker flags
Expand Down Expand Up @@ -160,16 +157,14 @@ PHP_SOURCES = $(wildcard zend/*.cpp)
# library. We also use a Makefile function here that takes all source files.
#

COMMON_SHARED_OBJECTS = $(COMMON_SOURCES:%.cpp=shared/%.o)
PHP_SHARED_OBJECTS = $(PHP_SOURCES:%.cpp=shared/%.o)
COMMON_STATIC_OBJECTS = $(COMMON_SOURCES:%.cpp=static/%.o)
PHP_STATIC_OBJECTS = $(PHP_SOURCES:%.cpp=static/%.o)
COMMON_OBJECTS = $(COMMON_SOURCES:%.cpp=build/%.o)
PHP_OBJECTS = $(PHP_SOURCES:%.cpp=build/%.o)

#
# Dependencies
#

DEPENDENCIES = $(wildcard shared/common/*.d) $(wildcard shared/zend/*.d) $(wildcard static/common/*.d) $(wildcard static/zend/*.d)
DEPENDENCIES = $(wildcard build/common/*.d) $(wildcard build/zend/*.d)

#
# End of the variables section. Here starts the list of instructions and
Expand All @@ -190,36 +185,26 @@ phpcpp: ${PHP_SHARED_LIBRARY} ${PHP_STATIC_LIBRARY}
@echo
@echo "Build complete."

${PHP_SHARED_LIBRARY}: shared_directories ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}
${LINKER} ${PHP_LINKER_FLAGS} -Wl,${LINKER_SONAME_OPTION},libphpcpp.so.$(SONAME) -o $@ ${COMMON_SHARED_OBJECTS} ${PHP_SHARED_OBJECTS}
${PHP_SHARED_LIBRARY}: build_directories ${COMMON_OBJECTS} ${PHP_OBJECTS}
${LINKER} ${PHP_LINKER_FLAGS} -Wl,${LINKER_SONAME_OPTION},libphpcpp.so.$(SONAME) -o $@ ${COMMON_OBJECTS} ${PHP_OBJECTS}

${PHP_STATIC_LIBRARY}: static_directories ${COMMON_STATIC_OBJECTS} ${PHP_STATIC_OBJECTS}
${ARCHIVER} $@ ${COMMON_STATIC_OBJECTS} ${PHP_STATIC_OBJECTS}
${PHP_STATIC_LIBRARY}: build_directories ${COMMON_OBJECTS} ${PHP_OBJECTS}
${ARCHIVER} $@ ${COMMON_OBJECTS} ${PHP_OBJECTS}

shared_directories:
${MKDIR} shared/common
${MKDIR} shared/zend

static_directories:
${MKDIR} static/common
${MKDIR} static/zend
build_directories:
${MKDIR} build/common
${MKDIR} build/zend

clean:
${RM} shared ${PHP_SHARED_LIBRARY}
${RM} static ${PHP_STATIC_LIBRARY}
${RM} build ${PHP_SHARED_LIBRARY} ${PHP_STATIC_LIBRARY}
find -name *.o | xargs ${RM}
find -name *.d | xargs ${RM}

${COMMON_SHARED_OBJECTS}:
${COMPILER} ${PHP_COMPILER_FLAGS} ${SHARED_COMPILER_FLAGS} -o $@ ${@:shared/%.o=%.cpp}

${COMMON_STATIC_OBJECTS}:
${COMPILER} ${PHP_COMPILER_FLAGS} ${STATIC_COMPILER_FLAGS} -o $@ ${@:static/%.o=%.cpp}

${PHP_SHARED_OBJECTS}:
${COMPILER} ${PHP_COMPILER_FLAGS} ${SHARED_COMPILER_FLAGS} -o $@ ${@:shared/%.o=%.cpp}
${COMMON_OBJECTS}:
${COMPILER} ${COMPILER_FLAGS} -o $@ ${@:build/%.o=%.cpp}

${PHP_STATIC_OBJECTS}:
${COMPILER} ${PHP_COMPILER_FLAGS} ${STATIC_COMPILER_FLAGS} -o $@ ${@:static/%.o=%.cpp}
${PHP_OBJECTS}:
${COMPILER} ${COMPILER_FLAGS} -o $@ ${@:build/%.o=%.cpp}


# The if statements below must be seen as single line by make
Expand Down
2 changes: 1 addition & 1 deletion zend/parametersimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ParametersImpl : public Parameters
reserve(argc);

// array to store all the arguments in
zval arguments[argc];
zval* arguments = static_cast<zval*>(alloca(argc * sizeof(zval)));

// retrieve the arguments
zend_get_parameters_array_ex(argc, arguments);
Expand Down
6 changes: 3 additions & 3 deletions zend/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ Value Value::call(const char *name)
Value Value::exec(int argc, Value *argv) const
{
// array of zvals to execute
zval params[argc];
zval* params = static_cast<zval*>(alloca(argc * sizeof(zval)));

// convert all the values
for(int i = 0; i < argc; i++) { params[i] = *argv[i]._val; }
Expand All @@ -925,7 +925,7 @@ Value Value::exec(const char *name, int argc, Value *argv) const
Value method(name);

// array of zvals to execute
zval params[argc];
zval* params = static_cast<zval*>(alloca(argc * sizeof(zval)));

// convert all the values
for(int i = 0; i < argc; i++) { params[i] = *argv[i]._val; }
Expand All @@ -947,7 +947,7 @@ Value Value::exec(const char *name, int argc, Value *argv)
Value method(name);

// array of zvals to execute
zval params[argc];
zval* params = static_cast<zval*>(alloca(argc * sizeof(zval)));

// convert all the values
for(int i = 0; i < argc; i++) { params[i] = *argv[i]._val; }
Expand Down