mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-17 17:47:12 +00:00
Initial skeleton of extension (#2)
* Added .gitignore * Added initial attempt at autoconf config * Skeleton C source
This commit is contained in:
+194
@@ -0,0 +1,194 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=autotools,cmake,phpstorm
|
||||
|
||||
### Autotools ###
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
/ar-lib
|
||||
/mdate-sh
|
||||
/py-compile
|
||||
/test-driver
|
||||
/ylwrap
|
||||
.deps/
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/config.guess
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.scan
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
|
||||
# https://www.gnu.org/software/libtool/
|
||||
|
||||
/ltmain.sh
|
||||
|
||||
# http://www.gnu.org/software/texinfo
|
||||
|
||||
/texinfo.tex
|
||||
|
||||
# http://www.gnu.org/software/m4/
|
||||
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
|
||||
# Generated Makefile
|
||||
# (meta build system like autotools,
|
||||
# can automatically generate from config.status script
|
||||
# (which is called by configure script))
|
||||
Makefile
|
||||
|
||||
### Autotools Patch ###
|
||||
|
||||
### CMake ###
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
### CMake Patch ###
|
||||
# External projects
|
||||
*-prefix/
|
||||
|
||||
### PhpStorm ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### PhpStorm Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||
.idea/**/sonarlint/
|
||||
|
||||
# SonarQube Plugin
|
||||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||
.idea/**/sonarIssues.xml
|
||||
|
||||
# Markdown Navigator plugin
|
||||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||
.idea/**/markdown-navigator.xml
|
||||
.idea/**/markdown-navigator-enh.xml
|
||||
.idea/**/markdown-navigator/
|
||||
|
||||
# Cache file creation bug
|
||||
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||
.idea/$CACHE_FILE$
|
||||
|
||||
# CodeStream plugin
|
||||
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||
.idea/codestream.xml
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/autotools,cmake,phpstorm
|
||||
|
||||
.deps
|
||||
.libs/
|
||||
build/
|
||||
configure.in
|
||||
mkinstalldirs
|
||||
run-tests.php
|
||||
Makefile.global
|
||||
acinclude.m4
|
||||
libtool
|
||||
modules/
|
||||
*.lo
|
||||
config.h
|
||||
config.nice
|
||||
*.la
|
||||
Makefile*
|
||||
@@ -0,0 +1,30 @@
|
||||
dnl
|
||||
dnl * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
dnl * SPDX-License-Identifier: Apache-2.0.
|
||||
dnl
|
||||
|
||||
PHP_ARG_WITH(awscrt)
|
||||
|
||||
if test "$PHP_AWSCRT" != "no"; then
|
||||
AC_MSG_CHECKING([for libcrypto])
|
||||
for search_path in "$AWS_LIBCRYTO_INSTALL" "$PHP_AWSCRT/build/deps/openssl" /opt/openssl /usr/local /usr; do
|
||||
if test -f "$search_path/include/openssl/crypto.h"; then
|
||||
LIBCRYPTO_PATH=$search_path
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$LIBCRYPTO_PATH"; then
|
||||
AC_MSG_ERROR([not found])
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([found at $LIBCRYPTO_PATH])
|
||||
|
||||
PHP_ADD_INCLUDE($LIBCRYPTO_PATH/include)
|
||||
dnl PHP_ADD_LIBPATH($LIBCRYPTO_PATH/lib)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(:libcrypto.a, $LIBCRYPTO_PATH/lib, AWSCRT_SHARED_LIBADD)
|
||||
|
||||
AWSCRT_SOURCES=src/*.c
|
||||
|
||||
PHP_NEW_EXTENSION(awscrt, $AWSCRT_SOURCES, $ext_shared)
|
||||
PHP_SUBST(AWSCRT_SHARED_LIBADD)
|
||||
fi
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
/**
|
||||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0.
|
||||
*/
|
||||
|
||||
#include "php_aws_crt.h"
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(awscrt);
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("awscrt.log_level", "", PHP_INI_ALL, OnUpdateLongGEZero, log_level, zend_awscrt_globals, awscrt_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
static PHP_MINIT_FUNCTION(awscrt)
|
||||
{
|
||||
REGISTER_INI_ENTRIES();
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static PHP_MSHUTDOWN_FUNCTION(awscrt)
|
||||
{
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static PHP_GINIT_FUNCTION(awscrt)
|
||||
{
|
||||
#if defined(COMPILE_DL_ASTKIT) && defined(ZTS)
|
||||
ZEND_TSRMLS_CACHE_UPDATE();
|
||||
#endif
|
||||
awscrt_globals->log_level = 0;
|
||||
}
|
||||
|
||||
zend_module_entry awscrt_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"awscrt",
|
||||
NULL, /* functions */
|
||||
PHP_MINIT(awscrt),
|
||||
PHP_MSHUTDOWN(awscrt),
|
||||
NULL, /* RINIT */
|
||||
NULL, /* RSHUTDOWN */
|
||||
NULL, /* MINFO */
|
||||
NO_VERSION_YET,
|
||||
PHP_MODULE_GLOBALS(awscrt),
|
||||
PHP_GINIT(awscrt),
|
||||
NULL, /* GSHUTDOWN */
|
||||
NULL, /* RPOSTSHUTDOWN */
|
||||
STANDARD_MODULE_PROPERTIES_EX};
|
||||
|
||||
#ifdef COMPILE_DL_AWSCRT
|
||||
ZEND_GET_MODULE(awscrt)
|
||||
#endif
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef PHP_AWS_CRT_H
|
||||
#define PHP_AWS_CRT_H
|
||||
|
||||
/**
|
||||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(awscrt)
|
||||
long log_level;
|
||||
ZEND_END_MODULE_GLOBALS(awscrt)
|
||||
|
||||
ZEND_EXTERN_MODULE_GLOBALS(awscrt)
|
||||
|
||||
#define AWSCRT_GLOBAL(v) ZEND_MODULE_GLOBALS_ACCESSOR(awscrt, v)
|
||||
|
||||
#endif /* PHP_AWS_CRT_H */
|
||||
Reference in New Issue
Block a user