From df5b91a8ba98894281fdac081eb959b8e44e6902 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 19 Apr 2023 19:25:32 +0200 Subject: [PATCH 01/50] draft of modern build --- modernbuild/docker-compose.yml | 18 + modernbuild/image/Dockerfile | 104 ++ modernbuild/image/Dockerfile_musl | 87 ++ modernbuild/project/CMakeLists.txt | 99 ++ modernbuild/project/CMakePresets.json | 159 +++ modernbuild/project/cmake/conan.cmake | 1038 +++++++++++++++++ .../project/cmake/elastic_conan_export.cmake | 32 + .../cmake/elastic_conan_installer.cmake | 106 ++ .../cmake/elastic_get_git_version.cmake | 43 + .../elastic_set_default_build_options.cmake | 86 ++ modernbuild/project/cmake/test_venv.py | 14 + modernbuild/project/conan/conan_profile.in | 17 + modernbuild/project/conan/settings.yml | 154 +++ .../project/dependencies/php72/conandata.yml | 29 + .../project/dependencies/php72/conanfile.py | 56 + .../project/dependencies/php73/conandata.yml | 29 + .../project/dependencies/php73/conanfile.py | 56 + .../project/dependencies/php74/conandata.yml | 29 + .../project/dependencies/php74/conanfile.py | 56 + .../project/dependencies/php80/conandata.yml | 29 + .../project/dependencies/php80/conanfile.py | 56 + .../project/dependencies/php81/conandata.yml | 29 + .../project/dependencies/php81/conanfile.py | 56 + .../project/dependencies/php82/conandata.yml | 29 + .../project/dependencies/php82/conanfile.py | 56 + src/ext/CMakeLists.txt | 68 ++ src/ext/elastic_apm.c | 17 +- src/ext/sample_prof.c | 450 +++---- src/ext/unit_tests/CMakeLists.txt | 41 +- 29 files changed, 2789 insertions(+), 254 deletions(-) create mode 100644 modernbuild/docker-compose.yml create mode 100644 modernbuild/image/Dockerfile create mode 100644 modernbuild/image/Dockerfile_musl create mode 100644 modernbuild/project/CMakeLists.txt create mode 100644 modernbuild/project/CMakePresets.json create mode 100644 modernbuild/project/cmake/conan.cmake create mode 100644 modernbuild/project/cmake/elastic_conan_export.cmake create mode 100644 modernbuild/project/cmake/elastic_conan_installer.cmake create mode 100644 modernbuild/project/cmake/elastic_get_git_version.cmake create mode 100644 modernbuild/project/cmake/elastic_set_default_build_options.cmake create mode 100644 modernbuild/project/cmake/test_venv.py create mode 100644 modernbuild/project/conan/conan_profile.in create mode 100644 modernbuild/project/conan/settings.yml create mode 100644 modernbuild/project/dependencies/php72/conandata.yml create mode 100644 modernbuild/project/dependencies/php72/conanfile.py create mode 100644 modernbuild/project/dependencies/php73/conandata.yml create mode 100644 modernbuild/project/dependencies/php73/conanfile.py create mode 100644 modernbuild/project/dependencies/php74/conandata.yml create mode 100644 modernbuild/project/dependencies/php74/conanfile.py create mode 100644 modernbuild/project/dependencies/php80/conandata.yml create mode 100644 modernbuild/project/dependencies/php80/conanfile.py create mode 100644 modernbuild/project/dependencies/php81/conandata.yml create mode 100644 modernbuild/project/dependencies/php81/conanfile.py create mode 100644 modernbuild/project/dependencies/php82/conandata.yml create mode 100644 modernbuild/project/dependencies/php82/conanfile.py create mode 100644 src/ext/CMakeLists.txt diff --git a/modernbuild/docker-compose.yml b/modernbuild/docker-compose.yml new file mode 100644 index 000000000..7f5f66491 --- /dev/null +++ b/modernbuild/docker-compose.yml @@ -0,0 +1,18 @@ +version: "2.1" +services: + build_apm_php: + build: + context: . + dockerfile: image/Dockerfile + volumes: + - ../:/source +# command: sleep 100000 + command: sh -c "cd project && cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release " + + build_apm_php_musl: + build: + context: . + dockerfile: image/Dockerfile_musl + volumes: + - ../:/source + command: sleep 100000 diff --git a/modernbuild/image/Dockerfile b/modernbuild/image/Dockerfile new file mode 100644 index 000000000..e82cc9ca6 --- /dev/null +++ b/modernbuild/image/Dockerfile @@ -0,0 +1,104 @@ +FROM centos:7 as devtools + +ARG GCC_VERSION=12.2.0 +ARG BINUTILS_VERSION=2.40 +ARG CMAKE_VERSION=3.26.3 +ARG PYTHON_VERSION=3.9.16 +ARG USER_NAME=build + +#binutils: bison - gprofng, texinfo - makeinfo + +RUN yum -y update && yum -y install centos-release-scl +RUN yum -y install sudo curl wget git make autoconf bzip2 \ + texinfo bison \ + python3 python3-pip python3-venv \ + devtoolset-7-binutils devtoolset-7-gcc devtoolset-7-gcc-c++ zlib-devel + +RUN adduser -p password ${USER_NAME} \ + && passwd -d ${USER_NAME} \ + && echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER ${USER_NAME} + +RUN mkdir -p /home/${USER_NAME}/prerequisities +WORKDIR /home/${USER_NAME}/prerequisities + +RUN curl -LO https://gcc.gnu.org/pub/gcc/releases/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz \ + && tar -xf gcc-${GCC_VERSION}.tar.xz \ + && rm gcc-${GCC_VERSION}.tar.xz + +RUN source scl_source enable devtoolset-7 \ + && cd gcc-${GCC_VERSION} \ + && ./contrib/download_prerequisites \ + && SHARED_CONFIGURE_OPTIONS="--enable-languages=c,c++ --enable-shared --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --disable-werror --enable-checking=release --with-pic --disable-symvers --enable-obsolete" \ + && SHARED_CONFIGURE_OPTIONS="$SHARED_CONFIGURE_OPTIONS --disable-libstdcxx-visibility" \ + && CONFIGURE_OPTIONS="$SHARED_CONFIGURE_OPTIONS --with-tune=generic --enable-libstdcxx-debug-flags=-gdwarf-2" \ + && CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-multilib" \ + && echo $CONFIGURE_OPTIONS \ + && ./configure --prefix=/opt/gcc-${GCC_VERSION} $CONFIGURE_OPTIONS \ + && make -j$(nproc) \ + && sudo make install \ + && cd - \ + && rm -rf gcc-${GCC_VERSION} + +RUN curl -LO https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz \ + && tar -xf binutils-${BINUTILS_VERSION}.tar.xz \ + && rm binutils-${BINUTILS_VERSION}.tar.xz + +RUN source scl_source enable devtoolset-7 \ + && cd binutils-${BINUTILS_VERSION} \ + && ./configure --prefix=/opt/binutils-${BINUTILS_VERSION} CFLAGS=-Wno-unused-value --enable-gold \ + && make -j$(nproc) \ + && sudo make install \ + && cd - \ + && rm -rf binutils-${BINUTILS_VERSION} + +RUN curl -OL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \ + && chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh \ + && sudo mkdir -p /opt/cmake-${CMAKE_VERSION} \ + && sudo ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/opt/cmake-${CMAKE_VERSION} \ + && rm cmake-${CMAKE_VERSION}-linux-x86_64.sh + +RUN curl -LO https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz \ + && tar -xf Python-${PYTHON_VERSION}.tgz \ + && rm Python-${PYTHON_VERSION}.tgz + +RUN sudo yum -y install libffi-devel openssl-devel sqlite-devel readline-devel xz-devel bzip2-devel + +RUN source scl_source enable devtoolset-7 \ + && cd Python-${PYTHON_VERSION} \ + && ./configure --help \ + && ./configure --enable-optimizations --prefix=/opt/python-${PYTHON_VERSION} \ + && make \ + && sudo make install + + +RUN sudo yum -y remove devtoolset-7* centos-release-scl \ + && sudo yum -y clean all + + +FROM centos:7 + +ARG GCC_VERSION=12.2.0 +ARG BINUTILS_VERSION=2.40 +ARG CMAKE_VERSION=3.26.3 +ARG PYTHON_VERSION=3.9.16 +ARG USER_NAME=build + +COPY --from=devtools /opt /opt + +RUN yum -y update && yum -y install sudo curl wget git make autoconf bzip2 \ + perl-Thread-Queue \ + file \ + glibc-devel + +RUN adduser -p password ${USER_NAME} \ + && passwd -d ${USER_NAME} \ + && echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER ${USER_NAME} + +WORKDIR /source/modernbuild + +ENV PATH="/opt/binutils-${BINUTILS_VERSION}/bin:/opt/cmake-${CMAKE_VERSION}/bin:/opt/python-${PYTHON_VERSION}/bin:${PATH}" +ENV CMAKE_INSTALL_PREFIX=/opt/cmake-${CMAKE_VERSION} diff --git a/modernbuild/image/Dockerfile_musl b/modernbuild/image/Dockerfile_musl new file mode 100644 index 000000000..bba65b978 --- /dev/null +++ b/modernbuild/image/Dockerfile_musl @@ -0,0 +1,87 @@ +FROM alpine:3.10 as devtools_alpine + +ARG GCC_VERSION=12.2.0 +ARG BINUTILS_VERSION=2.40 +ARG CMAKE_VERSION=3.26.3 +ARG USER_NAME=build + +#binutils: bison - gprofng, texinfo - makeinfo + +RUN apk update \ + && apk add sudo curl wget git make autoconf bzip2 \ + texinfo bison \ + binutils gcc g++ zlib-dev gettext-dev linux-headers + +RUN adduser --disabled-password --gecos '' ${USER_NAME} \ + && echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER ${USER_NAME} + +RUN mkdir -p /home/${USER_NAME}/prerequisities +WORKDIR /home/${USER_NAME}/prerequisities + +RUN curl -LO https://gcc.gnu.org/pub/gcc/releases/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.xz \ + && tar -xf gcc-${GCC_VERSION}.tar.xz \ + && rm gcc-${GCC_VERSION}.tar.xz + + +RUN cd gcc-${GCC_VERSION} \ + && ./contrib/download_prerequisites \ + && SHARED_CONFIGURE_OPTIONS="--enable-languages=c,c++ --enable-shared --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --disable-werror --enable-checking=release --with-pic --disable-symvers --enable-obsolete" \ + && SHARED_CONFIGURE_OPTIONS="$SHARED_CONFIGURE_OPTIONS --disable-libstdcxx-visibility" \ + && CONFIGURE_OPTIONS="$SHARED_CONFIGURE_OPTIONS --with-tune=generic --enable-libstdcxx-debug-flags=-gdwarf-2" \ + && CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS --build=x86_64-linux-musl --host=x86_64-linux-musl --target=x86_64-linux-musl --disable-multilib --disable-libsanitizer" \ + && echo $CONFIGURE_OPTIONS \ + && ./configure --prefix=/opt/gcc-${GCC_VERSION} $CONFIGURE_OPTIONS \ + && make -j$(nproc) \ + && sudo make install \ + && cd - \ + && rm -rf gcc-${GCC_VERSION} + +RUN curl -LO https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.xz \ + && tar -xf binutils-${BINUTILS_VERSION}.tar.xz \ + && rm binutils-${BINUTILS_VERSION}.tar.xz + +RUN cd binutils-${BINUTILS_VERSION} \ + && ./configure --help \ + && ./configure --prefix=/opt/binutils-${BINUTILS_VERSION} --enable-gold --build=x86_64-linux-musl --host=x86_64-linux-musl --target=x86_64-linux-musl --enable-shared --disable-multilib --with-system-zlib --enable-install-libiberty --disable-gprofng --enable-ld=default --enable-64-bit-bfd --enable-relro --enable-deterministic-archives --enable-default-execstack=no --enable-default-hash-style=gnu --with-pic --disable-werror --disable-nls --with-mmap \ + + && make -j$(nproc) \ + && sudo make install \ + && cd - \ + && rm -rf binutils-${BINUTILS_VERSION} + +RUN curl -LO https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \ + && tar -xf cmake-${CMAKE_VERSION}.tar.gz \ + && rm cmake-${CMAKE_VERSION}.tar.gz + +RUN sudo apk add curl-dev + +RUN cd cmake-${CMAKE_VERSION} \ + && ./bootstrap --prefix=/opt/cmake-${CMAKE_VERSION} --parallel="${nproc:-2}"\ + && make -j$(nproc)\ + && sudo make install + +FROM alpine:3.16 + +COPY --from=devtools_alpine /opt /opt + +ARG GCC_VERSION=12.2.0 +ARG BINUTILS_VERSION=2.40 +ARG CMAKE_VERSION=3.26.3 +ARG USER_NAME=build + +RUN apk add --no-cache sudo curl wget git make autoconf bzip2 \ + libstdc++ libintl icu musl-dev curl-dev linux-headers \ + python3 py3-pip py3-virtualenv bash + +RUN adduser --disabled-password --gecos '' ${USER_NAME} \ + && echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers + +USER ${USER_NAME} + +WORKDIR /source/modernbuild + +ENV PATH="/opt/binutils-${BINUTILS_VERSION}/bin:/opt/cmake-${CMAKE_VERSION}/bin:${PATH}" +ENV CMAKE_INSTALL_PREFIX=/opt/cmake-${CMAKE_VERSION} + diff --git a/modernbuild/project/CMakeLists.txt b/modernbuild/project/CMakeLists.txt new file mode 100644 index 000000000..a70b5e60e --- /dev/null +++ b/modernbuild/project/CMakeLists.txt @@ -0,0 +1,99 @@ +cmake_minimum_required(VERSION 3.26.0) + +# set path for our local includes +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") + +include(elastic_get_git_version) +elastic_get_git_version(_ELASTIC_PROJECT_VERSION _ELASTIC_SIMPLE_VERSION _ELASTIC_PROJECT_REVISION) + +message(STATUS "Project version: ${_ELASTIC_PROJECT_VERSION} (${_ELASTIC_SIMPLE_VERSION}) / ${_ELASTIC_PROJECT_REVISION}") + +project("apm-agent-php" +#TODO need to handle versioning somehow and generate C++ and PHP version automatically + VERSION "${_ELASTIC_PROJECT_VERSION}" + LANGUAGES C CXX +) + + +set(RELEASE_BUILD false) +set(DEBUG_BUILD false) +if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(RELEASE_BUILD true) +elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(DEBUG_BUILD true) +else() + message(FATAL_ERROR "Build type not supported: ${CMAKE_BUILD_TYPE}") +endif() + +# Detect Alpine/MUSLC build +if(EXISTS /etc/alpine-release) + set(MUSL_BUILD true) +endif() + +if ((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")) + message(FATAL_ERROR "System or architecure not supported") +endif() + +include(elastic_set_default_build_options) + +message(STATUS "Detected ${CMAKE_CXX_COMPILER_ID} compiler version: ${CMAKE_CXX_COMPILER_VERSION}") + +include(elastic_conan_installer) + +# Install project dependencies + +set(_supported_php_versions 72 73 74 80 81 82) + +function(get_php_api_from_release php_version ret_val) + block(SCOPE_FOR VARIABLES) + set(_php_release_72 20170718) + set(_php_release_73 20180731) + set(_php_release_74 20190902) + set(_php_release_80 20200930) + set(_php_release_81 20210902) + set(_php_release_82 20220829) + + set(${ret_val} ${_php_release_${php_version}}) + return(PROPAGATE ${ret_val}) + endblock() +endfunction() + + +message(STATUS "Creating dependencies from local directories") +foreach(_php_version ${_supported_php_versions}) + elastic_conan_create( + PATH ${CMAKE_SOURCE_DIR}/dependencies/php${_php_version} + REFERENCE php-headers-${_php_version}/1.0@elastic/local + PROFILE ${_CONAN_PROFILE} + ) +endforeach() + +# TODO implement multiarray with mapping of library->version + +set(dependencies + "libcurl/8.0.1" + "cmocka/1.1.5" + "libunwind/1.6.2" +) + +foreach(_php_version ${_supported_php_versions}) + list(APPEND dependencies "php-headers-${_php_version}/1.0@elastic/local") +endforeach() + +conan_cmake_run(REQUIRES ${dependencies} + OPTIONS Pkg/*:shared=False + boost:header_only=True + boost:error_code_header_only=True + libcurl:shared=False + libcurl:with_libssh2=False + libcurl:with_ssl=False + cmocka:shared=False + BUILD missing + PROFILE ${_CONAN_PROFILE} + PROFILE_BUILD ${_CONAN_PROFILE} + DEBUG_PROFILE ${_CONAN_PROFILE} + RELEASE_PROFILE ${_CONAN_PROFILE} + BASIC_SETUP CMAKE_TARGETS UPDATE NO_OUTPUT_DIRS + ) + +add_subdirectory(agent) diff --git a/modernbuild/project/CMakePresets.json b/modernbuild/project/CMakePresets.json new file mode 100644 index 000000000..bd824af46 --- /dev/null +++ b/modernbuild/project/CMakePresets.json @@ -0,0 +1,159 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 23, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default", + "hidden": true, + "displayName": "Default Config", + "description": "Default build using Makefiles", + "generator": "Unix Makefiles", + "binaryDir": "${sourceDir}/_build/${presetName}", + "environment": { + "MY_ENVIRONMENT_VARIABLE": "Test", + "PATH": "$env{HOME}/ninja/bin:$penv{PATH}" + } + }, + { + "name": "binutils", + "hidden": true, + "environment": { + "PATH": "/opt/binutils-2.40/bin:$penv{PATH}" + } + }, + { + "name": "gcc", + "hidden": true, + "environment": { + "COMPILER_HOME_PATH": "/opt/gcc-12.2.0" + }, + "cacheVariables": { + "CMAKE_C_COMPILER": { + "type": "STRING", + "value": "$env{COMPILER_HOME_PATH}/bin/gcc" + }, + "CMAKE_CXX_COMPILER": { + "type": "STRING", + "value": "$env{COMPILER_HOME_PATH}/bin/g++" + } + } + }, + { + "name": "debug", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": { + "type": "STRING", + "value": "Debug" + } + } + }, + { + "name": "release", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": { + "type": "STRING", + "value": "Release" + } + } + }, + { + "name": "os-type-unix", + "hidden": true, + "inherits": [ + "default", + "gcc" + ], + "generator": "Unix Makefiles" + }, + { + "name": "linux-x86-64-release", + "inherits": [ + "os-type-unix", + "release", + "binutils" + ] + }, + { + "name": "linux-x86-64-debug", + "inherits": [ + "os-type-unix", + "debug", + "binutils" + ] + }, + { + "name": "linuxmusl-x86-64-release", + "inherits": [ + "os-type-unix", + "release", + "binutils" + ] + }, + { + "name": "linuxmusl-x86-64-debug", + "inherits": [ + "os-type-unix", + "debug", + "binutils" + ] + } + ], + "buildPresets": [ + { + "name": "default", + "configurePreset": "default" + }, + { + "name": "release", + "hidden": true, + "configuration": "Release" + }, + { + "name": "debug", + "hidden": true, + "configuration": "Debug" + }, + { + "name": "linux-x86-64-debug", + "configurePreset": "linux-x86-64-debug", + "inherits": [ + "debug" + ] + }, + { + "name": "linux-x86-64-release", + "configurePreset": "linux-x86-64-release", + "inherits": [ + "release" + ] + }, + { + "name": "linuxmusl-x86-64-debug", + "configurePreset": "linuxmusl-x86-64-debug", + "inherits": [ + "debug" + ] + }, + { + "name": "linuxmusl-x86-64-release", + "configurePreset": "linuxmusl-x86-64-release", + "inherits": [ + "release" + ] + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "default", + "output": {"outputOnFailure": true}, + "execution": {"noTestsAction": "error", "stopOnFailure": true} + } + ] + } diff --git a/modernbuild/project/cmake/conan.cmake b/modernbuild/project/cmake/conan.cmake new file mode 100644 index 000000000..1ba78638b --- /dev/null +++ b/modernbuild/project/cmake/conan.cmake @@ -0,0 +1,1038 @@ +# The MIT License (MIT) + +# Copyright (c) 2018 JFrog + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + + +# This file comes from: https://github.com/conan-io/cmake-conan. Please refer +# to this repository for issues and documentation. + +# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called. +# It will take CMake current settings (os, compiler, compiler version, architecture) +# and translate them to conan settings for installing and retrieving dependencies. + +# It is intended to facilitate developers building projects that have conan dependencies, +# but it is only necessary on the end-user side. It is not necessary to create conan +# packages, in fact it shouldn't be use for that. Check the project documentation. + +# version: 0.18.1 + +# modified to distinguish ABI of glibc and musl - force downloaded packages to build locally + +include(CMakeParseArguments) + +function(_get_msvc_ide_version result) + set(${result} "" PARENT_SCOPE) + if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500) + set(${result} 8 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600) + set(${result} 9 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700) + set(${result} 10 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800) + set(${result} 11 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900) + set(${result} 12 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910) + set(${result} 14 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920) + set(${result} 15 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930) + set(${result} 16 PARENT_SCOPE) + elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940) + set(${result} 17 PARENT_SCOPE) + else() + message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]") + endif() +endfunction() + +macro(_conan_detect_build_type) + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_BUILD_TYPE) + set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE}) + elseif(CMAKE_BUILD_TYPE) + set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + else() + message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") + endif() + + string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER) + if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG") + set(_CONAN_SETTING_BUILD_TYPE "Debug") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE") + set(_CONAN_SETTING_BUILD_TYPE "Release") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO") + set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo") + elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL") + set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel") + endif() +endmacro() + +macro(_conan_check_system_name) + #handle -s os setting + if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic") + #use default conan os setting if CMAKE_SYSTEM_NAME is not defined + set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + set(CONAN_SYSTEM_NAME Macos) + endif() + if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX") + set(CONAN_SYSTEM_NAME Neutrino) + endif() + set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino) + list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index) + if (${_index} GREATER -1) + #check if the cmake system is a conan supported one + set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME}) + else() + message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}") + endif() + endif() +endmacro() + +macro(_conan_check_language) + get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES) + if (";${_languages};" MATCHES ";CXX;") + set(LANGUAGE CXX) + set(USING_CXX 1) + elseif (";${_languages};" MATCHES ";C;") + set(LANGUAGE C) + set(USING_CXX 0) + else () + message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.") + endif() +endmacro() + +macro(_conan_detect_compiler) + + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_ARCH) + set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH}) + endif() + + if(USING_CXX) + set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD}) + endif() + + if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) + # using GCC + # TODO: Handle other params + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(COMPILER_VERSION ${MAJOR}.${MINOR}) + if(${MAJOR} GREATER 4) + set(COMPILER_VERSION ${MAJOR}) + endif() + set(_CONAN_SETTING_COMPILER gcc) + set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel) + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(COMPILER_VERSION ${MAJOR}.${MINOR}) + set(_CONAN_SETTING_COMPILER intel) + set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang) + # using AppleClang + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(_CONAN_SETTING_COMPILER apple-clang) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC") + + string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION}) + list(GET VERSION_LIST 0 MAJOR) + list(GET VERSION_LIST 1 MINOR) + set(_CONAN_SETTING_COMPILER clang) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR}) + if(APPLE) + cmake_policy(GET CMP0025 APPLE_CLANG_POLICY) + if(NOT APPLE_CLANG_POLICY STREQUAL NEW) + message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it") + set(_CONAN_SETTING_COMPILER apple-clang) + endif() + endif() + if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7) + set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}) + endif() + if (USING_CXX) + conan_cmake_detect_unix_libcxx(_LIBCXX) + set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX}) + endif () + elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC + OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang + AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC" + AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")) + + set(_VISUAL "Visual Studio") + _get_msvc_ide_version(_VISUAL_VERSION) + if("${_VISUAL_VERSION}" STREQUAL "") + message(FATAL_ERROR "Conan: Visual Studio not recognized") + else() + set(_CONAN_SETTING_COMPILER ${_VISUAL}) + set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION}) + endif() + + if(NOT _CONAN_SETTING_ARCH) + if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64") + set(_CONAN_SETTING_ARCH x86_64) + elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM") + message(STATUS "Conan: Using default ARM architecture from MSVC") + set(_CONAN_SETTING_ARCH armv6) + elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86") + set(_CONAN_SETTING_ARCH x86) + else () + message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]") + endif() + endif() + + conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV}) + message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}") + set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime}) + + if (CMAKE_GENERATOR_TOOLSET) + set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) + elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja")) + set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET}) + endif() + else() + message(FATAL_ERROR "Conan: compiler setup not recognized") + endif() + +endmacro() + +function(conan_cmake_settings result) + #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER}) + #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID}) + #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION}) + #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS}) + #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE}) + #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE}) + #message(STATUS "GENERATOR " ${CMAKE_GENERATOR}) + #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64}) + + message(STATUS "Conan: Automatic detection of conan settings from cmake") + + conan_parse_arguments(${ARGV}) + + _conan_detect_build_type(${ARGV}) + + _conan_check_system_name() + + _conan_check_language() + + _conan_detect_compiler(${ARGV}) + + # If profile is defined it is used + if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE}) + elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE}) + elseif(ARGUMENTS_PROFILE) + set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE}) + endif() + + foreach(ARG ${_APPLIED_PROFILES}) + set(_SETTINGS ${_SETTINGS} -pr=${ARG}) + endforeach() + foreach(ARG ${ARGUMENTS_PROFILE_BUILD}) + conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET) + set(_SETTINGS ${_SETTINGS} -pr:b=${ARG}) + endforeach() + + if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL") + set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version + compiler.runtime compiler.libcxx compiler.toolset) + endif() + + # remove any manually specified settings from the autodetected settings + foreach(ARG ${ARGUMENTS_SETTINGS}) + string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}") + message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.") + list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}") + endforeach() + + # Automatic from CMake + foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) + string(TOUPPER ${ARG} _arg_name) + string(REPLACE "." "_" _arg_name ${_arg_name}) + if(_CONAN_SETTING_${_arg_name}) + set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}}) + endif() + endforeach() + + + # Hack to distinguish glibc and musl: https://github.com/conan-io/conan/issues/3972#issuecomment-464703892 + if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU) + if (EXISTS "/etc/alpine-release" AND _CONAN_SETTING_OS STREQUAL "Linux") + set(_SETTINGS ${_SETTINGS} -s compiler.libc=musl -s os.distro=Alpine) + else() + set(_SETTINGS ${_SETTINGS} -s compiler.libc=glibc -s os.distro=Centos7) + endif() + endif() + + foreach(ARG ${ARGUMENTS_SETTINGS}) + set(_SETTINGS ${_SETTINGS} -s ${ARG}) + endforeach() + + message(STATUS "Conan: Settings= ${_SETTINGS}") + + set(${result} ${_SETTINGS} PARENT_SCOPE) +endfunction() + + +function(conan_cmake_detect_unix_libcxx result) + # Take into account any -stdlib in compile options + get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS) + string(GENEX_STRIP "${compile_options}" compile_options) + + # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions + get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS) + string(GENEX_STRIP "${defines}" defines) + + foreach(define ${defines}) + if(define MATCHES "_GLIBCXX_USE_CXX11_ABI") + if(define MATCHES "^-D") + set(compile_options ${compile_options} "${define}") + else() + set(compile_options ${compile_options} "-D${define}") + endif() + endif() + endforeach() + + # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable + set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER}) + if(CMAKE_CXX_COMPILER_ARG1) + # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz" + # without this, ccache, winegcc, or other wrappers might lose all their arguments + separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1}) + list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1}) + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET) + # without --target= we may be calling the wrong underlying GCC + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}") + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}") + endif() + + if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT) + # without --sysroot= we may find the wrong #include + if(CMAKE_SYSROOT_COMPILE) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}") + elseif(CMAKE_SYSROOT) + list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}") + endif() + endif() + + separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) + + if(CMAKE_OSX_SYSROOT) + set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}") + endif() + + execute_process( + COMMAND ${CMAKE_COMMAND} -E echo "#include " + COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM - + OUTPUT_VARIABLE string_defines + ) + + if(string_defines MATCHES "#define __GLIBCXX__") + # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake + if(DEFINED _GLIBCXX_USE_CXX11_ABI) + if(_GLIBCXX_USE_CXX11_ABI) + set(${result} libstdc++11 PARENT_SCOPE) + return() + else() + set(${result} libstdc++ PARENT_SCOPE) + return() + endif() + endif() + + if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n") + set(${result} libstdc++11 PARENT_SCOPE) + else() + # Either the compiler is missing the define because it is old, and so + # it can't use the new abi, or the compiler was configured to use the + # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS) + set(${result} libstdc++ PARENT_SCOPE) + endif() + else() + set(${result} libc++ PARENT_SCOPE) + endif() +endfunction() + +function(conan_cmake_detect_vs_runtime result) + + conan_parse_arguments(${ARGV}) + if(ARGUMENTS_BUILD_TYPE) + set(build_type "${ARGUMENTS_BUILD_TYPE}") + elseif(CMAKE_BUILD_TYPE) + set(build_type "${CMAKE_BUILD_TYPE}") + else() + message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)") + endif() + + if(build_type) + string(TOUPPER "${build_type}" build_type) + endif() + set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS) + foreach(variable ${variables}) + if(NOT "${${variable}}" STREQUAL "") + string(REPLACE " " ";" flags "${${variable}}") + foreach (flag ${flags}) + if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd") + string(SUBSTRING "${flag}" 1 -1 runtime) + set(${result} "${runtime}" PARENT_SCOPE) + return() + endif() + endforeach() + endif() + endforeach() + if("${build_type}" STREQUAL "DEBUG") + set(${result} "MDd" PARENT_SCOPE) + else() + set(${result} "MD" PARENT_SCOPE) + endif() +endfunction() + +function(_collect_settings result) + set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version + compiler.runtime compiler.libcxx compiler.toolset + compiler.cppstd) + foreach(ARG ${ARGUMENTS_PROFILE_AUTO}) + string(TOUPPER ${ARG} _arg_name) + string(REPLACE "." "_" _arg_name ${_arg_name}) + if(_CONAN_SETTING_${_arg_name}) + set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}}) + endif() + endforeach() + set(${result} ${detected_setings} PARENT_SCOPE) +endfunction() + +function(conan_cmake_autodetect detected_settings) + _conan_detect_build_type(${ARGV}) + _conan_check_system_name() + _conan_check_language() + _conan_detect_compiler(${ARGV}) + _collect_settings(collected_settings) + set(${detected_settings} ${collected_settings} PARENT_SCOPE) +endfunction() + +macro(conan_parse_arguments) + set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD) + set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER OUTPUT_FOLDER CONAN_COMMAND) + set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE + PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO + INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES) + cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) +endmacro() + +function(old_conan_cmake_install) + # Calls "conan install" + # Argument BUILD is equivalant to --build={missing, PkgName,...} or + # --build when argument is 'BUILD all' (which builds all packages from source) + # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source + # cmake does not identify conan as command, even if it is +x and it is in the path + conan_parse_arguments(${ARGV}) + + if(CONAN_CMAKE_MULTI) + set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi) + else() + set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake) + endif() + + set(CONAN_BUILD_POLICY "") + foreach(ARG ${ARGUMENTS_BUILD}) + if(${ARG} STREQUAL "all") + set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build) + break() + else() + set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG}) + endif() + endforeach() + if(ARGUMENTS_CONAN_COMMAND) + set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + set(CONAN_OPTIONS "") + if(ARGUMENTS_CONANFILE) + if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE}) + set(CONANFILE ${ARGUMENTS_CONANFILE}) + else() + set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE}) + endif() + else() + set(CONANFILE ".") + endif() + foreach(ARG ${ARGUMENTS_OPTIONS}) + set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG}) + endforeach() + if(ARGUMENTS_UPDATE) + set(CONAN_INSTALL_UPDATE --update) + endif() + if(ARGUMENTS_NO_IMPORTS) + set(CONAN_INSTALL_NO_IMPORTS --no-imports) + endif() + set(CONAN_INSTALL_FOLDER "") + if(ARGUMENTS_INSTALL_FOLDER) + set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER}) + endif() + set(CONAN_OUTPUT_FOLDER "") + if(ARGUMENTS_OUTPUT_FOLDER) + set(CONAN_OUTPUT_FOLDER -of=${ARGUMENTS_OUTPUT_FOLDER}) + endif() + foreach(ARG ${ARGUMENTS_GENERATORS}) + set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG}) + endforeach() + foreach(ARG ${ARGUMENTS_ENV}) + set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG}) + endforeach() + set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS}) + + string (REPLACE ";" " " _conan_args "${conan_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}") + + if(ARGUMENTS_OUTPUT_QUIET) + execute_process(COMMAND ${CONAN_CMD} ${conan_args} + RESULT_VARIABLE return_code + OUTPUT_VARIABLE conan_output + ERROR_VARIABLE conan_output + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + else() + execute_process(COMMAND ${CONAN_CMD} ${conan_args} + RESULT_VARIABLE return_code + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + +endfunction() + +function(conan_cmake_install) + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET) + set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER OUTPUT_FOLDER) + set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE + PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) + cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN}) + foreach(arg ${installOptions}) + if(ARGS_${arg}) + set(${arg} ${${arg}} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${installOneValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "REMOTE") + set(flag "--remote") + elseif("${arg}" STREQUAL "LOCKFILE") + set(flag "--lockfile") + elseif("${arg}" STREQUAL "LOCKFILE_OUT") + set(flag "--lockfile-out") + elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID") + set(flag "--lockfile-node-id") + elseif("${arg}" STREQUAL "INSTALL_FOLDER") + set(flag "--install-folder") + elseif("${arg}" STREQUAL "OUTPUT_FOLDER") + set(flag "--output-folder") + endif() + set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${installMultiValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "GENERATOR") + set(flag "--generator") + elseif("${arg}" STREQUAL "BUILD") + set(flag "--build") + elseif("${arg}" STREQUAL "ENV") + set(flag "--env") + elseif("${arg}" STREQUAL "ENV_HOST") + set(flag "--env:host") + elseif("${arg}" STREQUAL "ENV_BUILD") + set(flag "--env:build") + elseif("${arg}" STREQUAL "OPTIONS") + set(flag "--options") + elseif("${arg}" STREQUAL "OPTIONS_HOST") + set(flag "--options:host") + elseif("${arg}" STREQUAL "OPTIONS_BUILD") + set(flag "--options:build") + elseif("${arg}" STREQUAL "PROFILE") + set(flag "--profile") + elseif("${arg}" STREQUAL "PROFILE_HOST") + set(flag "--profile:host") + elseif("${arg}" STREQUAL "PROFILE_BUILD") + set(flag "--profile:build") + elseif("${arg}" STREQUAL "SETTINGS") + set(flag "--settings") + elseif("${arg}" STREQUAL "SETTINGS_HOST") + set(flag "--settings:host") + elseif("${arg}" STREQUAL "SETTINGS_BUILD") + set(flag "--settings:build") + endif() + list(LENGTH ARGS_${arg} numargs) + foreach(item ${ARGS_${arg}}) + if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") + set(${arg} "--build") + break() + endif() + set(${arg} ${${arg}} ${flag} ${item}) + endforeach() + endif() + endforeach() + if(DEFINED UPDATE) + set(UPDATE --update) + endif() + if(DEFINED NO_IMPORTS) + set(NO_IMPORTS --no-imports) + endif() + set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} ${OUTPUT_FOLDER} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) + + string(REPLACE ";" " " _install_args "${install_args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}") + + if(ARGS_OUTPUT_QUIET) + set(OUTPUT_OPT OUTPUT_QUIET) + endif() + if(ARGS_ERROR_QUIET) + set(ERROR_OPT ERROR_QUIET) + endif() + + execute_process(COMMAND ${CONAN_CMD} ${install_args} + RESULT_VARIABLE return_code + ${OUTPUT_OPT} + ${ERROR_OPT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(NOT "${return_code}" STREQUAL "0") + if (ARGS_ERROR_QUIET) + message(WARNING "Conan install failed='${return_code}'") + else() + message(FATAL_ERROR "Conan install failed='${return_code}'") + endif() + endif() + +endfunction() + +function(conan_cmake_lock_create) + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + set(lockCreateOptions UPDATE BASE OUTPUT_QUIET ERROR_QUIET) + set(lockCreateOneValueArgs PATH REFERENCE REMOTE LOCKFILE LOCKFILE_OUT) + set(lockCreateMultiValueArgs BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE + PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD) + cmake_parse_arguments(ARGS "${lockCreateOptions}" "${lockCreateOneValueArgs}" "${lockCreateMultiValueArgs}" ${ARGN}) + foreach(arg ${lockCreateOptions}) + if(ARGS_${arg}) + set(${arg} ${${arg}} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${lockCreateOneValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "REMOTE") + set(flag "--remote") + elseif("${arg}" STREQUAL "LOCKFILE") + set(flag "--lockfile") + elseif("${arg}" STREQUAL "LOCKFILE_OUT") + set(flag "--lockfile-out") + endif() + set(${arg} ${${arg}} ${flag} ${ARGS_${arg}}) + endif() + endforeach() + foreach(arg ${lockCreateMultiValueArgs}) + if(DEFINED ARGS_${arg}) + if("${arg}" STREQUAL "BUILD") + set(flag "--build") + elseif("${arg}" STREQUAL "ENV") + set(flag "--env") + elseif("${arg}" STREQUAL "ENV_HOST") + set(flag "--env:host") + elseif("${arg}" STREQUAL "ENV_BUILD") + set(flag "--env:build") + elseif("${arg}" STREQUAL "OPTIONS") + set(flag "--options") + elseif("${arg}" STREQUAL "OPTIONS_HOST") + set(flag "--options:host") + elseif("${arg}" STREQUAL "OPTIONS_BUILD") + set(flag "--options:build") + elseif("${arg}" STREQUAL "PROFILE") + set(flag "--profile") + elseif("${arg}" STREQUAL "PROFILE_HOST") + set(flag "--profile:host") + elseif("${arg}" STREQUAL "PROFILE_BUILD") + set(flag "--profile:build") + elseif("${arg}" STREQUAL "SETTINGS") + set(flag "--settings") + elseif("${arg}" STREQUAL "SETTINGS_HOST") + set(flag "--settings:host") + elseif("${arg}" STREQUAL "SETTINGS_BUILD") + set(flag "--settings:build") + endif() + list(LENGTH ARGS_${arg} numargs) + foreach(item ${ARGS_${arg}}) + if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD") + set(${arg} "--build") + break() + endif() + set(${arg} ${${arg}} ${flag} ${item}) + endforeach() + endif() + endforeach() + if(DEFINED UPDATE) + set(UPDATE --update) + endif() + if(DEFINED BASE) + set(BASE --base) + endif() + set(lock_create_Args lock create ${PATH} ${REFERENCE} ${UPDATE} ${BASE} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER} + ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD} + ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD}) + + string(REPLACE ";" " " _lock_create_Args "${lock_create_Args}") + message(STATUS "Conan executing: ${CONAN_CMD} ${_lock_create_Args}") + + if(ARGS_OUTPUT_QUIET) + set(OUTPUT_OPT OUTPUT_QUIET) + endif() + if(ARGS_ERROR_QUIET) + set(ERROR_OPT ERROR_QUIET) + endif() + + execute_process(COMMAND ${CONAN_CMD} ${lock_create_Args} + RESULT_VARIABLE return_code + ${OUTPUT_OPT} + ${ERROR_OPT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + if(NOT "${return_code}" STREQUAL "0") + if (ARGS_ERROR_QUIET) + message(WARNING "Conan lock create failed='${return_code}'") + else() + message(FATAL_ERROR "Conan lock create failed='${return_code}'") + endif() + endif() +endfunction() + +function(conan_cmake_setup_conanfile) + conan_parse_arguments(${ARGV}) + if(ARGUMENTS_CONANFILE) + get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME) + # configure_file will make sure cmake re-runs when conanfile is updated + configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk) + else() + conan_cmake_generate_conanfile(ON ${ARGV}) + endif() +endfunction() + +function(conan_cmake_configure) + conan_cmake_generate_conanfile(OFF ${ARGV}) +endfunction() + +# Generate, writing in disk a conanfile.txt with the requires, options, and imports +# specified as arguments +# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR) +function(conan_cmake_generate_conanfile DEFAULT_GENERATOR) + + conan_parse_arguments(${ARGV}) + + set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt") + file(WRITE ${_FN} "") + + if(DEFINED ARGUMENTS_REQUIRES) + file(APPEND ${_FN} "[requires]\n") + foreach(REQUIRE ${ARGUMENTS_REQUIRES}) + file(APPEND ${_FN} ${REQUIRE} "\n") + endforeach() + endif() + + if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS) + file(APPEND ${_FN} "[generators]\n") + if (DEFAULT_GENERATOR) + file(APPEND ${_FN} "cmake\n") + endif() + if (DEFINED ARGUMENTS_GENERATORS) + foreach(GENERATOR ${ARGUMENTS_GENERATORS}) + file(APPEND ${_FN} ${GENERATOR} "\n") + endforeach() + endif() + endif() + + if(DEFINED ARGUMENTS_BUILD_REQUIRES) + file(APPEND ${_FN} "[build_requires]\n") + foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES}) + file(APPEND ${_FN} ${BUILD_REQUIRE} "\n") + endforeach() + endif() + + if(DEFINED ARGUMENTS_IMPORTS) + file(APPEND ${_FN} "[imports]\n") + foreach(IMPORTS ${ARGUMENTS_IMPORTS}) + file(APPEND ${_FN} ${IMPORTS} "\n") + endforeach() + endif() + + if(DEFINED ARGUMENTS_OPTIONS) + file(APPEND ${_FN} "[options]\n") + foreach(OPTION ${ARGUMENTS_OPTIONS}) + file(APPEND ${_FN} ${OPTION} "\n") + endforeach() + endif() + +endfunction() + + +macro(conan_load_buildinfo) + if(CONAN_CMAKE_MULTI) + set(_CONANBUILDINFO conanbuildinfo_multi.cmake) + else() + set(_CONANBUILDINFO conanbuildinfo.cmake) + endif() + if(ARGUMENTS_INSTALL_FOLDER) + set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER}) + else() + set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR}) + endif() + # Checks for the existence of conanbuildinfo.cmake, and loads it + # important that it is macro, so variables defined at parent scope + if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}") + message(STATUS "Conan: Loading ${_CONANBUILDINFO}") + include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}) + else() + message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}") + endif() +endmacro() + + +macro(conan_cmake_run) + conan_parse_arguments(${ARGV}) + + if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES) + message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators") + elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE) + message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.") + endif() + + if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED + AND NOT ARGUMENTS_BUILD_TYPE) + set(CONAN_CMAKE_MULTI ON) + if (NOT ARGUMENTS_CONFIGURATION_TYPES) + set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug") + endif() + message(STATUS "Conan: Using cmake-multi generator") + else() + set(CONAN_CMAKE_MULTI OFF) + endif() + + if(NOT CONAN_EXPORTED) + conan_cmake_setup_conanfile(${ARGV}) + if(CONAN_CMAKE_MULTI) + foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES}) + set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE}) + conan_cmake_settings(settings ${ARGV}) + old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) + endforeach() + set(CMAKE_BUILD_TYPE) + else() + conan_cmake_settings(settings ${ARGV}) + old_conan_cmake_install(SETTINGS ${settings} ${ARGV}) + endif() + endif() + + if (NOT ARGUMENTS_NO_LOAD) + conan_load_buildinfo() + endif() + + if(ARGUMENTS_BASIC_SETUP) + foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD) + if(ARGUMENTS_${_option}) + if(${_option} STREQUAL "CMAKE_TARGETS") + list(APPEND _setup_options "TARGETS") + else() + list(APPEND _setup_options ${_option}) + endif() + endif() + endforeach() + conan_basic_setup(${_setup_options}) + endif() +endmacro() + +macro(conan_check) + # Checks conan availability in PATH + # Arguments REQUIRED, DETECT_QUIET and VERSION are optional + # Example usage: + # conan_check(VERSION 1.0.0 REQUIRED) + set(options REQUIRED DETECT_QUIET) + set(oneValueArgs VERSION) + cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN}) + if(NOT CONAN_DETECT_QUIET) + message(STATUS "Conan: checking conan executable") + endif() + + find_program(CONAN_CMD conan) + if(NOT CONAN_CMD AND CONAN_REQUIRED) + message(FATAL_ERROR "Conan executable not found! Please install conan.") + endif() + if(NOT CONAN_DETECT_QUIET) + message(STATUS "Conan: Found program ${CONAN_CMD}") + endif() + execute_process(COMMAND ${CONAN_CMD} --version + RESULT_VARIABLE return_code + OUTPUT_VARIABLE CONAN_VERSION_OUTPUT + ERROR_VARIABLE CONAN_VERSION_OUTPUT) + + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan --version failed='${return_code}'") + endif() + + if(NOT CONAN_DETECT_QUIET) + string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT) + message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}") + endif() + + if(DEFINED CONAN_VERSION) + string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO + "${CONAN_VERSION_OUTPUT}") + if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION}) + message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \ + required: ${CONAN_VERSION}. Consider updating via 'pip \ + install conan==${CONAN_VERSION}'.") + endif() + endif() +endmacro() + +function(conan_add_remote) + # Adds a remote + # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional + # Example usage: + # conan_add_remote(NAME bincrafters INDEX 1 + # URL https://api.bintray.com/conan/bincrafters/public-conan + # VERIFY_SSL True) + set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL) + cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN}) + + if(DEFINED CONAN_INDEX) + set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}") + endif() + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED DETECT_QUIET) + endif() + set(CONAN_VERIFY_SSL_ARG "True") + if(DEFINED CONAN_VERIFY_SSL) + set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL}) + endif() + message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})") + execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG} + RESULT_VARIABLE return_code) + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan remote failed='${return_code}'") + endif() +endfunction() + +macro(conan_config_install) + # install a full configuration from a local or remote zip file + # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional + # Example usage: + # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git + # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false) + set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL) + set(multiValueArgs ARGS) + cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(DEFINED CONAN_COMMAND) + set(CONAN_CMD ${CONAN_COMMAND}) + else() + conan_check(REQUIRED) + endif() + + if(DEFINED CONAN_VERIFY_SSL) + set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}") + endif() + + if(DEFINED CONAN_TYPE) + set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}") + endif() + + if(DEFINED CONAN_ARGS) + set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"") + endif() + + if(DEFINED CONAN_SOURCE) + set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}") + endif() + + if(DEFINED CONAN_TARGET) + set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}") + endif() + + set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG} + ${CONAN_TYPE_ARG} + ${CONAN_ARGS_ARGS} + ${CONAN_SOURCE_ARGS} + ${CONAN_TARGET_ARGS}) + + message(STATUS "Conan: Installing config from ${CONAN_ITEM}") + execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS} + RESULT_VARIABLE return_code) + if(NOT "${return_code}" STREQUAL "0") + message(FATAL_ERROR "Conan config failed='${return_code}'") + endif() +endmacro() diff --git a/modernbuild/project/cmake/elastic_conan_export.cmake b/modernbuild/project/cmake/elastic_conan_export.cmake new file mode 100644 index 000000000..ad07f2d33 --- /dev/null +++ b/modernbuild/project/cmake/elastic_conan_export.cmake @@ -0,0 +1,32 @@ + +include(CMakeParseArguments) + +function(elastic_conan_export) + set(oneValueArgs PATH REFERENCE PROFILE) + cmake_parse_arguments(_elastic_conan_export "" "${oneValueArgs}" "" ${ARGN} ) + + message(STATUS "conan export path: ${_elastic_conan_export_PATH} ref: ${_elastic_conan_export_REFERENCE} profile: ${_elastic_conan_export_PROFILE}" ) + + execute_process(COMMAND ${CONAN_CMD} export ${_elastic_conan_export_PATH} ${_elastic_conan_export_REFERENCE} ) +endfunction() + +function(elastic_conan_create) + set(oneValueArgs PATH REFERENCE PROFILE) + cmake_parse_arguments(_elastic_conan_create "" "${oneValueArgs}" "" ${ARGN} ) + + execute_process(COMMAND ${CONAN_CMD} search --raw ${_elastic_conan_create_REFERENCE} + RESULT_VARIABLE return_code + OUTPUT_QUIET + ERROR_QUIET + ) + + if ("${return_code}" STREQUAL 0) + message(STATUS "Package ${_elastic_conan_create_REFERENCE} already installed") + return() + endif() + + message(STATUS "${CONAN_CMD} create --build=missing -pr ${_elastic_conan_create_PROFILE} ${_elastic_conan_create_PATH} ${_elastic_conan_create_REFERENCE}" ) + execute_process(COMMAND ${CONAN_CMD} create --build=missing -pr ${_elastic_conan_create_PROFILE} ${_elastic_conan_create_PATH} ${_elastic_conan_create_REFERENCE} + COMMAND_ERROR_IS_FATAL ANY + ) +endfunction() diff --git a/modernbuild/project/cmake/elastic_conan_installer.cmake b/modernbuild/project/cmake/elastic_conan_installer.cmake new file mode 100644 index 000000000..8471d70f7 --- /dev/null +++ b/modernbuild/project/cmake/elastic_conan_installer.cmake @@ -0,0 +1,106 @@ +include(CMakeParseArguments) + + + +set(python "python3") +set(python_pip "pip3") + +# Detect Alpine/MUSLC build +if(EXISTS /etc/alpine-release) + set(MUSL_BUILD true) +endif() + +message(STATUS "Enabling python virtual environment") + +set(VENV_PATH ${CMAKE_BINARY_DIR}/python_venv) + +if(NOT EXISTS ${VENV_PATH}) + execute_process( + COMMAND ${python} -m venv ${VENV_PATH} + COMMAND_ERROR_IS_FATAL ANY + ) + file(COPY cmake/test_venv.py DESTINATION ${CMAKE_BINARY_DIR}/) + set(_VENV_CREATED TRUE) +endif() + +set(ENV{VIRTUAL_ENV} ${VENV_PATH}) +set(ENV{PATH} $ENV{VIRTUAL_ENV}/bin:$ENV{PATH}) +set(python "${VENV_PATH}/bin/python3") +set(python_pip "${VENV_PATH}/bin/pip3") + +message(STATUS PATH="$ENV{PATH}") + + +# Testing if venv is detected propely by python +execute_process( + COMMAND ${python} ${CMAKE_BINARY_DIR}/test_venv.py + COMMAND_ERROR_IS_FATAL ANY + ) + +set(_PRV_CONAN_PROFILE_OS ${CMAKE_SYSTEM_NAME}) + +if (MUSL_BUILD) + #this is workaround to force build from souce on musl - this will prevent from installing libc binaries + set(_PRV_CONAN_PROFILE_OS_DISTRO "os.distro=Alpine") + set(_PRV_COMPILER_LIBC_IMPLEMENTATION "compiler.libc=musl") +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(_PRV_CONAN_PROFILE_OS_DISTRO "os.distro=Centos7") + set(_PRV_COMPILER_LIBC_IMPLEMENTATION "compiler.libc=glibc") +endif() + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + message(STATUS "Linux ${_PRV_CONAN_PROFILE_OS_DISTRO}, ${_PRV_COMPILER_LIBC_IMPLEMENTATION}") +endif() + +# setting up paths used to configure compiler profile +set(_PRV_CONAN_PROFILE_CC ${CMAKE_C_COMPILER}) +set(_PRV_CONAN_PROFILE_CXX ${CMAKE_CXX_COMPILER}) + +# some recipes doesn't use profile compiler, it is a workaround +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + list(APPEND CMAKE_PROGRAM_PATH "$ENV{COMPILER_HOME_PATH}/bin/") + set(ENV{PATH} $ENV{COMPILER_HOME_PATH}/bin:$ENV{PATH}) +endif() + +# Prepare conan profile +set(_PRV_COMPILER_NAME gcc) +string(REPLACE "." ";" _PRV_COMPILER_VERSION_TOKENIZED ${CMAKE_CXX_COMPILER_VERSION}) +list(GET _PRV_COMPILER_VERSION_TOKENIZED 0 _PRV_COMPILER_VERSION_MAJOR) +list(GET _PRV_COMPILER_VERSION_TOKENIZED 1 _PRV_COMPILER_VERSION_MINOR) +set(_PRV_COMPILER_VERSION_SHORT "${_PRV_COMPILER_VERSION_MAJOR}.${_PRV_COMPILER_VERSION_MINOR}") +set(_CONAN_PROFILE "${CMAKE_BINARY_DIR}/conan_compiler") + +configure_file("${CMAKE_SOURCE_DIR}/conan/conan_profile.in" "${_CONAN_PROFILE}" @ONLY) + + +if(_VENV_CREATED) + # Installing conan and required dependencies + execute_process( + COMMAND ${python_pip} install -U pip + COMMAND_ERROR_IS_FATAL ANY + ) + + execute_process( + COMMAND ${python_pip} install -U wheel + COMMAND_ERROR_IS_FATAL ANY + ) + + execute_process( + COMMAND ${python_pip} install -U conan<2.0 + COMMAND_ERROR_IS_FATAL ANY + ) + +endif() + +message(STATUS "Installing conan configuration from ${CMAKE_SOURCE_DIR}/conan/settings.yml") +execute_process( + COMMAND conan config install ${CMAKE_SOURCE_DIR}/conan/settings.yml + COMMAND_ERROR_IS_FATAL ANY +) + +message(STATUS "Conan installation done") + +include(conan) +conan_check() + +include(elastic_conan_export) diff --git a/modernbuild/project/cmake/elastic_get_git_version.cmake b/modernbuild/project/cmake/elastic_get_git_version.cmake new file mode 100644 index 000000000..241b76f1b --- /dev/null +++ b/modernbuild/project/cmake/elastic_get_git_version.cmake @@ -0,0 +1,43 @@ + +find_package(Git) + +function(elastic_get_git_version PROJECT_VERSION SIMPLE_VERSION GIT_REVISION_HASH) + #PROJECT_VERSION MAJOR.MINOR.PATCH + #SIMPLE_VERSION MAJOR.MINOR.PATCH-dirty + + block(SCOPE_FOR VARIABLES) + execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --match "v*" --dirty --abbrev=0 + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_VERSION + RESULT_VARIABLE GIT_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(${GIT_RESULT}) + message(FATAL_ERROR "Could not get version from git. Git error code: ${GIT_RESULT}. Output: ${GIT_VERSION}") + endif() + + # strip leading v + string(SUBSTRING ${GIT_VERSION} 1 -1 TMP_SIMPLE_VERSION) + + # remove -dirty if exists + string(REPLACE "-dirty" "" TMP_PROJECT_VERSION ${TMP_SIMPLE_VERSION}) + + execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_REVISION + RESULT_VARIABLE GIT_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + if(${GIT_RESULT}) + message(FATAL_ERROR "Could not get revision from git. Git error code: ${GIT_RESULT}. Output: ${GIT_REVISION}") + endif() + set(${GIT_REVISION_HASH} ${GIT_REVISION}) + + set(${PROJECT_VERSION} ${TMP_PROJECT_VERSION}) + set(${SIMPLE_VERSION} ${TMP_SIMPLE_VERSION}) + + return(PROPAGATE ${PROJECT_VERSION} ${SIMPLE_VERSION} ${GIT_REVISION_HASH}) + endblock() +endfunction() diff --git a/modernbuild/project/cmake/elastic_set_default_build_options.cmake b/modernbuild/project/cmake/elastic_set_default_build_options.cmake new file mode 100644 index 000000000..54175cff8 --- /dev/null +++ b/modernbuild/project/cmake/elastic_set_default_build_options.cmake @@ -0,0 +1,86 @@ + + +# Constrol switches +set(_ELASTIC_FAIL_ON_ERROR false) +set(_ELASTIC_WARN_ON_UNINITIALIZED true) + + +# determine build type and set +set(MUSL_BUILD false) + +set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES ON) # https://cmake.org/cmake/help/latest/prop_gbl/GLOBAL_DEPENDS_NO_CYCLES.html + +# Set the defauts for all targets +set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) # https://github.com/ComputationalRadiationPhysics/picongpu/issues/2109 +set(CMAKE_DISABLE_SOURCE_CHANGES ON) +set(CMAKE_CXX_EXTENSIONS OFF) # https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html#prop_tgt:CXX_EXTENSIONS +set(CMAKE_CXX_STANDARD_REQUIRED ON) # https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD_REQUIRED.html#prop_tgt:CXX_STANDARD_REQUIRED +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_INCLUDE_CURRENT_DIR ON) # https://cmake.org/cmake/help/latest/variable/CMAKE_INCLUDE_CURRENT_DIR.html + +set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) # include runtime search path for shared libs + +# set up visibility policy for dynamic linking +set(CMAKE_C_VISIBILITY_PRESET hidden) # https://cmake.org/cmake/help/latest/policy/CMP0063.html#policy:CMP0063 +set(CMAKE_CXX_VISIBILITY_PRESET hidden) + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) # https://cmake.org/cmake/help/latest/variable/CMAKE_POSITION_INDEPENDENT_CODE.html#variable:CMAKE_POSITION_INDEPENDENT_CODE + +# Enabling pthreads - https://cmake.org/cmake/help/v3.2/module/FindThreads.html +set(CMAKE_THREAD_PREFER_PTHREAD ON) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + + +# Keep output small as possible and manually control what we want to link with binaries +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "") + +# Workaround to enable globally staticaly linked libgcc and libstdc++ - don't need to be enabled foreach target +# linking with libdl and libpthreads +# Bsymbolic - use our own symbols instead of PHP one - prevent curl issues (https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/bsymbolic-functions.html) +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++ -pthread -ldl -Wl,-Bsymbolic -Wl,--exclude-libs,ALL") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++ -pthread") + +add_compile_options("-pipe") # don't use temporary files but pipe data to linker + +# Set up optimizations +if(RELEASE_BUILD) + add_compile_options("-O2" + "-g" + ) + add_definitions("-DNDEBUG") + add_definitions("-D_FORTIFY_SOURCE=2") +elseif(DEBUG_BUILD) + add_compile_options("-O0" + "-g3") +endif() + +add_compile_options("-pthread" + "-fexceptions" # Enable exception handling in C to interoperate properly with exception handlers written in C++ (https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html) + "-fstack-protector-strong" + ) + + +# handling warnings +add_compile_options( + "-Wall" + "-Wextra" + "-Wno-unused-parameter" # annoying when using PHP delivered macros +) + +if(NOT _ELASTIC_WARN_ON_UNINITIALIZED) + add_compile_options("-Wno-maybe-uninitialized") +endif() + +if(_ELASTIC_FAIL_ON_ERROR) + add_compile_options("-Werror") +endif() + +# C++ only switches +add_compile_options("$<$:-Wno-register>") +add_compile_options("$<$:-Wnon-virtual-dtor>") +add_compile_options("$<$:-fdiagnostics-show-template-tree>") # print template mismatch as tree - much more user friendly + +# C only switches +add_compile_options("$<$:-Wstrict-prototypes>") diff --git a/modernbuild/project/cmake/test_venv.py b/modernbuild/project/cmake/test_venv.py new file mode 100644 index 000000000..756e92c74 --- /dev/null +++ b/modernbuild/project/cmake/test_venv.py @@ -0,0 +1,14 @@ +import logging +import os +import sys + +#Detecting venv + +if sys.prefix == sys.base_prefix: + logging.error("venv not detected") + exit(1) +else: + logging.info("Virtual environment detected: " + sys.prefix) + + +exit(0) \ No newline at end of file diff --git a/modernbuild/project/conan/conan_profile.in b/modernbuild/project/conan/conan_profile.in new file mode 100644 index 000000000..f56637490 --- /dev/null +++ b/modernbuild/project/conan/conan_profile.in @@ -0,0 +1,17 @@ + +[settings] +os=@_PRV_CONAN_PROFILE_OS@ +@_PRV_CONAN_PROFILE_OS_DISTRO@ +arch=x86_64 +arch_build=x86_64 +build_type=Release +compiler=@_PRV_COMPILER_NAME@ +compiler.version=@_PRV_COMPILER_VERSION_SHORT@ +compiler.libcxx=libstdc++11 +@_PRV_COMPILER_LIBC_IMPLEMENTATION@ + + +[env] +CC=@_PRV_CONAN_PROFILE_CC@ +CXX=@_PRV_CONAN_PROFILE_CXX@ +LDFLAGS="-static-libgcc -static-libstdc++" diff --git a/modernbuild/project/conan/settings.yml b/modernbuild/project/conan/settings.yml new file mode 100644 index 000000000..39ca052aa --- /dev/null +++ b/modernbuild/project/conan/settings.yml @@ -0,0 +1,154 @@ + +# Only for cross building, 'os_build/arch_build' is the system that runs Conan +os_build: [Windows, WindowsStore, Linux, Macos, FreeBSD, SunOS, AIX, VxWorks] +arch_build: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7] + +# Only for building cross compilation tools, 'os_target/arch_target' is the system for +# which the tools generate code +os_target: [Windows, Linux, Macos, Android, iOS, watchOS, tvOS, FreeBSD, SunOS, AIX, Arduino, Neutrino] +arch_target: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7] + +# Rest of the settings are "host" settings: +# - For native building/cross building: Where the library/program will run. +# - For building cross compilation tools: Where the cross compiler will run. +os: + Windows: + subsystem: [None, cygwin, msys, msys2, wsl] + WindowsStore: + version: ["8.1", "10.0"] + WindowsCE: + platform: ANY + version: ["5.0", "6.0", "7.0", "8.0"] + Linux: + distro: ["Alpine", "Centos7"] + iOS: + version: &ios_version + ["7.0", "7.1", "8.0", "8.1", "8.2", "8.3", "9.0", "9.1", "9.2", "9.3", "10.0", "10.1", "10.2", "10.3", + "11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", + "13.0", "13.1", "13.2", "13.3", "13.4", "13.5", "13.6", "13.7", + "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", "14.8", + "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1"] + sdk: [None, "iphoneos", "iphonesimulator"] + sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4", + "13.0", "13.1", "13.2", "13.4", "13.5", "13.6", "13.7", + "14.0", "14.1", "14.2", "14.3", "14.4", "14.5", "15.0", "15.2", "15.4", "15.5", "16.0", "16.1"] + watchOS: + version: ["4.0", "4.1", "4.2", "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", + "7.0", "7.1", "7.2", "7.3", "7.4", "7.5", "7.6", "8.0", "8.1", "8.3", "8.4", "8.5", "8.6", "8.7", "9.0", "9.1"] + sdk: [None, "watchos", "watchsimulator"] + sdk_version: [None, "4.3", "5.0", "5.1", "5.2", "5.3", "6.0", "6.1", "6.2", + "7.0", "7.1", "7.2", "7.4", "8.0", "8.0.1", "8.3", "8.5", "9.0", "9.1"] + tvOS: + version: ["11.0", "11.1", "11.2", "11.3", "11.4", "12.0", "12.1", "12.2", "12.3", "12.4", + "13.0", "13.2", "13.3", "13.4", "14.0", "14.2", "14.3", "14.4", "14.5", "14.6", "14.7", + "15.0", "15.1", "15.2", "15.3", "15.4", "15.5", "15.6", "16.0", "16.1"] + sdk: [None, "appletvos", "appletvsimulator"] + sdk_version: [None, "11.3", "11.4", "12.0", "12.1", "12.2", "12.4", + "13.0", "13.1", "13.2", "13.4", "14.0", "14.2", "14.3", "14.5", "15.0", "15.2", "15.4", "16.0", "16.1"] + Macos: + version: [None, "10.6", "10.7", "10.8", "10.9", "10.10", "10.11", "10.12", "10.13", "10.14", "10.15", "11.0", "12.0", "13.0"] + sdk: [None, "macosx"] + sdk_version: [None, "10.13", "10.14", "10.15", "11.0", "11.1", "11.3", "12.0", "12.1", "12.3", "13.0"] + subsystem: + None: + catalyst: + ios_version: *ios_version + Android: + api_level: ANY + FreeBSD: + SunOS: + AIX: + Arduino: + board: ANY + Emscripten: + Neutrino: + version: ["6.4", "6.5", "6.6", "7.0", "7.1"] + baremetal: + VxWorks: + version: ["7"] +arch: [x86, x86_64, ppc32be, ppc32, ppc64le, ppc64, armv4, armv4i, armv5el, armv5hf, armv6, armv7, armv7hf, armv7s, armv7k, armv8, armv8_32, armv8.3, sparc, sparcv9, mips, mips64, avr, s390, s390x, asm.js, wasm, sh4le, e2k-v2, e2k-v3, e2k-v4, e2k-v5, e2k-v6, e2k-v7, xtensalx6, xtensalx106, xtensalx7] +compiler: + sun-cc: + version: ["5.10", "5.11", "5.12", "5.13", "5.14", "5.15"] + threads: [None, posix] + libcxx: [libCstd, libstdcxx, libstlport, libstdc++] + gcc: &gcc + version: ["4.1", "4.4", "4.5", "4.6", "4.7", "4.8", "4.9", + "5", "5.1", "5.2", "5.3", "5.4", "5.5", + "6", "6.1", "6.2", "6.3", "6.4", "6.5", + "7", "7.1", "7.2", "7.3", "7.4", "7.5", + "8", "8.1", "8.2", "8.3", "8.4", "8.5", + "9", "9.1", "9.2", "9.3", "9.4", "9.5", + "10", "10.1", "10.2", "10.3", "10.4", + "11", "11.1", "11.2", "11.3", + "12", "12.1", "12.2"] + libcxx: [libstdc++, libstdc++11] + threads: [None, posix, win32] # Windows MinGW + exception: [None, dwarf2, sjlj, seh] # Windows MinGW + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + libc: [glibc, musl] + Visual Studio: &visual_studio + runtime: [MD, MT, MTd, MDd] + version: ["8", "9", "10", "11", "12", "14", "15", "16", "17"] + toolset: [None, v90, v100, v110, v110_xp, v120, v120_xp, + v140, v140_xp, v140_clang_c2, LLVM-vs2012, LLVM-vs2012_xp, + LLVM-vs2013, LLVM-vs2013_xp, LLVM-vs2014, LLVM-vs2014_xp, + LLVM-vs2017, LLVM-vs2017_xp, v141, v141_xp, v141_clang_c2, v142, + llvm, ClangCL, v143] + cppstd: [None, 14, 17, 20, 23] + msvc: + version: [170, 180, 190, 191, 192, 193] + update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + runtime: [static, dynamic] + runtime_type: [Debug, Release] + cppstd: [98, 14, 17, 20, 23] + toolset: [None, v110_xp, v120_xp, v140_xp, v141_xp] + clang: + version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", + "5.0", "6.0", "7.0", "7.1", + "8", "9", "10", "11", "12", "13", "14", "15", "16"] + libcxx: [None, libstdc++, libstdc++11, libc++, c++_shared, c++_static] + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + runtime: [None, MD, MT, MTd, MDd, static, dynamic] + runtime_type: [None, Debug, Release] + runtime_version: [None, v140, v141, v142, v143] + apple-clang: &apple_clang + version: ["5.0", "5.1", "6.0", "6.1", "7.0", "7.3", "8.0", "8.1", "9.0", "9.1", "10.0", "11.0", "12.0", "13", "13.0", "13.1", "14", "14.0"] + libcxx: [libstdc++, libc++] + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + intel: + version: ["11", "12", "13", "14", "15", "16", "17", "18", "19", "19.1"] + update: [None, ANY] + base: + gcc: + <<: *gcc + threads: [None] + exception: [None] + Visual Studio: + <<: *visual_studio + apple-clang: + <<: *apple_clang + intel-cc: + version: ["2021.1", "2021.2", "2021.3"] + update: [None, ANY] + mode: ["icx", "classic", "dpcpp"] + libcxx: [None, libstdc++, libstdc++11, libc++] + cppstd: [None, 98, gnu98, 03, gnu03, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] + runtime: [None, static, dynamic] + runtime_type: [None, Debug, Release] + qcc: + version: ["4.4", "5.4", "8.3"] + libcxx: [cxx, gpp, cpp, cpp-ne, accp, acpp-ne, ecpp, ecpp-ne] + cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17] + mcst-lcc: + version: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25"] + base: + gcc: + <<: *gcc + threads: [None] + exceptions: [None] + +build_type: [None, Debug, Release, RelWithDebInfo, MinSizeRel] + + +cppstd: [None, 98, gnu98, 11, gnu11, 14, gnu14, 17, gnu17, 20, gnu20, 23, gnu23] # Deprecated, use compiler.cppstd diff --git a/modernbuild/project/dependencies/php72/conandata.yml b/modernbuild/project/dependencies/php72/conandata.yml new file mode 100644 index 000000000..2491593ed --- /dev/null +++ b/modernbuild/project/dependencies/php72/conandata.yml @@ -0,0 +1,29 @@ +name: "php-headers-72" +version: "1.0" +php_source_version: 7.2.34 + +sources: + 7.2.34: + linux: + - url: "https://www.php.net/distributions/php-7.2.34.tar.gz" + contentsRoot: "php-7.2.34" + 7.3.33: + linux: + - url: "https://www.php.net/distributions/php-7.3.33.tar.gz" + contentsRoot: "php-7.3.33" + 7.4.33: + linux: + - url: "https://www.php.net/distributions/php-7.4.33.tar.gz" + contentsRoot: "php-7.4.33" + 8.0.28: + linux: + - url: "https://www.php.net/distributions/php-8.0.28.tar.gz" + contentsRoot: "php-8.0.28" + 8.1.18: + linux: + - url: "https://www.php.net/distributions/php-8.1.18.tar.gz" + contentsRoot: "php-8.1.18" + 8.2.5: + linux: + - url: "https://www.php.net/distributions/php-8.2.5.tar.gz" + contentsRoot: "php-8.2.5" diff --git a/modernbuild/project/dependencies/php72/conanfile.py b/modernbuild/project/dependencies/php72/conanfile.py new file mode 100644 index 000000000..2f1ec5fcc --- /dev/null +++ b/modernbuild/project/dependencies/php72/conanfile.py @@ -0,0 +1,56 @@ +import os +import shutil + +from conans import tools, ConanFile, AutoToolsBuildEnvironment + +class PhpHeadersForPHP81Conan(ConanFile): + description = "PHP headers package required to build Elastic APM agent without additional PHP dependencies" + license = "The PHP License, version 3.01" + homepage = "https://php.net/" + url = "https://php.net/" + author = "pawel.filipczak@elastic.co" + + settings = "os", "compiler", "build_type", "arch" + platform = "linux" + + def init(self): + self.name = self.conan_data["name"] + self.version = self.conan_data["version"] # version of the package + self.php_version = self.conan_data["php_source_version"] # version of the PHP to build + self.source_temp_dir = "php-src" + + def requirements(self): + self.requires("libxml2/2.9.9") + self.requires("sqlite3/3.29.0") + + def source(self): + for source in self.conan_data["sources"][self.php_version][self.platform]: + + if "contentsRoot" in source: + # small hack - it can't contain custom fields, so we're removing it from source (got an unexpected keyword argument) + contentRoot = source["contentsRoot"] + del source["contentsRoot"] + tools.get(**source) + os.rename(contentRoot, self.source_temp_dir) + else: + self.output.error("Could not find 'contentsRoot' in conandata.yml") + raise Exception("Could not find 'contentsRoot' in conandata.yml") + + def build(self): + with tools.chdir(os.path.join(self.source_folder, self.source_temp_dir)): + buildEnv = AutoToolsBuildEnvironment(self) + envVariables = buildEnv.vars + envVariables['ac_cv_php_xml2_config_path'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, "bin/xml2-config") + envVariables['LIBXML_LIBS'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].libdirs[0]) + envVariables['LIBXML_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].includedirs[0])) + envVariables['SQLITE_LIBS'] = os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].libdirs[0]) + envVariables['SQLITE_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].includedirs[0])) + self.run("./buildconf --force") + buildEnv.configure(args=[""], vars=envVariables, build=False, host=False) + + def package(self): + source = os.path.join(self.source_folder, self.source_temp_dir) + self.copy("*.h", src=source, dst='include', keep_path=True) + + def package_id(self): + del self.info.settings.compiler.version diff --git a/modernbuild/project/dependencies/php73/conandata.yml b/modernbuild/project/dependencies/php73/conandata.yml new file mode 100644 index 000000000..29d9ff604 --- /dev/null +++ b/modernbuild/project/dependencies/php73/conandata.yml @@ -0,0 +1,29 @@ +name: "php-headers-73" +version: "1.0" +php_source_version: 7.3.33 + +sources: + 7.2.34: + linux: + - url: "https://www.php.net/distributions/php-7.2.34.tar.gz" + contentsRoot: "php-7.2.34" + 7.3.33: + linux: + - url: "https://www.php.net/distributions/php-7.3.33.tar.gz" + contentsRoot: "php-7.3.33" + 7.4.33: + linux: + - url: "https://www.php.net/distributions/php-7.4.33.tar.gz" + contentsRoot: "php-7.4.33" + 8.0.28: + linux: + - url: "https://www.php.net/distributions/php-8.0.28.tar.gz" + contentsRoot: "php-8.0.28" + 8.1.18: + linux: + - url: "https://www.php.net/distributions/php-8.1.18.tar.gz" + contentsRoot: "php-8.1.18" + 8.2.5: + linux: + - url: "https://www.php.net/distributions/php-8.2.5.tar.gz" + contentsRoot: "php-8.2.5" diff --git a/modernbuild/project/dependencies/php73/conanfile.py b/modernbuild/project/dependencies/php73/conanfile.py new file mode 100644 index 000000000..2f1ec5fcc --- /dev/null +++ b/modernbuild/project/dependencies/php73/conanfile.py @@ -0,0 +1,56 @@ +import os +import shutil + +from conans import tools, ConanFile, AutoToolsBuildEnvironment + +class PhpHeadersForPHP81Conan(ConanFile): + description = "PHP headers package required to build Elastic APM agent without additional PHP dependencies" + license = "The PHP License, version 3.01" + homepage = "https://php.net/" + url = "https://php.net/" + author = "pawel.filipczak@elastic.co" + + settings = "os", "compiler", "build_type", "arch" + platform = "linux" + + def init(self): + self.name = self.conan_data["name"] + self.version = self.conan_data["version"] # version of the package + self.php_version = self.conan_data["php_source_version"] # version of the PHP to build + self.source_temp_dir = "php-src" + + def requirements(self): + self.requires("libxml2/2.9.9") + self.requires("sqlite3/3.29.0") + + def source(self): + for source in self.conan_data["sources"][self.php_version][self.platform]: + + if "contentsRoot" in source: + # small hack - it can't contain custom fields, so we're removing it from source (got an unexpected keyword argument) + contentRoot = source["contentsRoot"] + del source["contentsRoot"] + tools.get(**source) + os.rename(contentRoot, self.source_temp_dir) + else: + self.output.error("Could not find 'contentsRoot' in conandata.yml") + raise Exception("Could not find 'contentsRoot' in conandata.yml") + + def build(self): + with tools.chdir(os.path.join(self.source_folder, self.source_temp_dir)): + buildEnv = AutoToolsBuildEnvironment(self) + envVariables = buildEnv.vars + envVariables['ac_cv_php_xml2_config_path'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, "bin/xml2-config") + envVariables['LIBXML_LIBS'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].libdirs[0]) + envVariables['LIBXML_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].includedirs[0])) + envVariables['SQLITE_LIBS'] = os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].libdirs[0]) + envVariables['SQLITE_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].includedirs[0])) + self.run("./buildconf --force") + buildEnv.configure(args=[""], vars=envVariables, build=False, host=False) + + def package(self): + source = os.path.join(self.source_folder, self.source_temp_dir) + self.copy("*.h", src=source, dst='include', keep_path=True) + + def package_id(self): + del self.info.settings.compiler.version diff --git a/modernbuild/project/dependencies/php74/conandata.yml b/modernbuild/project/dependencies/php74/conandata.yml new file mode 100644 index 000000000..5f6d12cda --- /dev/null +++ b/modernbuild/project/dependencies/php74/conandata.yml @@ -0,0 +1,29 @@ +name: "php-headers-74" +version: "1.0" +php_source_version: 7.4.33 + +sources: + 7.2.34: + linux: + - url: "https://www.php.net/distributions/php-7.2.34.tar.gz" + contentsRoot: "php-7.2.34" + 7.3.33: + linux: + - url: "https://www.php.net/distributions/php-7.3.33.tar.gz" + contentsRoot: "php-7.3.33" + 7.4.33: + linux: + - url: "https://www.php.net/distributions/php-7.4.33.tar.gz" + contentsRoot: "php-7.4.33" + 8.0.28: + linux: + - url: "https://www.php.net/distributions/php-8.0.28.tar.gz" + contentsRoot: "php-8.0.28" + 8.1.18: + linux: + - url: "https://www.php.net/distributions/php-8.1.18.tar.gz" + contentsRoot: "php-8.1.18" + 8.2.5: + linux: + - url: "https://www.php.net/distributions/php-8.2.5.tar.gz" + contentsRoot: "php-8.2.5" diff --git a/modernbuild/project/dependencies/php74/conanfile.py b/modernbuild/project/dependencies/php74/conanfile.py new file mode 100644 index 000000000..2f1ec5fcc --- /dev/null +++ b/modernbuild/project/dependencies/php74/conanfile.py @@ -0,0 +1,56 @@ +import os +import shutil + +from conans import tools, ConanFile, AutoToolsBuildEnvironment + +class PhpHeadersForPHP81Conan(ConanFile): + description = "PHP headers package required to build Elastic APM agent without additional PHP dependencies" + license = "The PHP License, version 3.01" + homepage = "https://php.net/" + url = "https://php.net/" + author = "pawel.filipczak@elastic.co" + + settings = "os", "compiler", "build_type", "arch" + platform = "linux" + + def init(self): + self.name = self.conan_data["name"] + self.version = self.conan_data["version"] # version of the package + self.php_version = self.conan_data["php_source_version"] # version of the PHP to build + self.source_temp_dir = "php-src" + + def requirements(self): + self.requires("libxml2/2.9.9") + self.requires("sqlite3/3.29.0") + + def source(self): + for source in self.conan_data["sources"][self.php_version][self.platform]: + + if "contentsRoot" in source: + # small hack - it can't contain custom fields, so we're removing it from source (got an unexpected keyword argument) + contentRoot = source["contentsRoot"] + del source["contentsRoot"] + tools.get(**source) + os.rename(contentRoot, self.source_temp_dir) + else: + self.output.error("Could not find 'contentsRoot' in conandata.yml") + raise Exception("Could not find 'contentsRoot' in conandata.yml") + + def build(self): + with tools.chdir(os.path.join(self.source_folder, self.source_temp_dir)): + buildEnv = AutoToolsBuildEnvironment(self) + envVariables = buildEnv.vars + envVariables['ac_cv_php_xml2_config_path'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, "bin/xml2-config") + envVariables['LIBXML_LIBS'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].libdirs[0]) + envVariables['LIBXML_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].includedirs[0])) + envVariables['SQLITE_LIBS'] = os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].libdirs[0]) + envVariables['SQLITE_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].includedirs[0])) + self.run("./buildconf --force") + buildEnv.configure(args=[""], vars=envVariables, build=False, host=False) + + def package(self): + source = os.path.join(self.source_folder, self.source_temp_dir) + self.copy("*.h", src=source, dst='include', keep_path=True) + + def package_id(self): + del self.info.settings.compiler.version diff --git a/modernbuild/project/dependencies/php80/conandata.yml b/modernbuild/project/dependencies/php80/conandata.yml new file mode 100644 index 000000000..6523273c4 --- /dev/null +++ b/modernbuild/project/dependencies/php80/conandata.yml @@ -0,0 +1,29 @@ +name: "php-headers-80" +version: "1.0" +php_source_version: 8.0.28 + +sources: + 7.2.34: + linux: + - url: "https://www.php.net/distributions/php-7.2.34.tar.gz" + contentsRoot: "php-7.2.34" + 7.3.33: + linux: + - url: "https://www.php.net/distributions/php-7.3.33.tar.gz" + contentsRoot: "php-7.3.33" + 7.4.33: + linux: + - url: "https://www.php.net/distributions/php-7.4.33.tar.gz" + contentsRoot: "php-7.4.33" + 8.0.28: + linux: + - url: "https://www.php.net/distributions/php-8.0.28.tar.gz" + contentsRoot: "php-8.0.28" + 8.1.18: + linux: + - url: "https://www.php.net/distributions/php-8.1.18.tar.gz" + contentsRoot: "php-8.1.18" + 8.2.5: + linux: + - url: "https://www.php.net/distributions/php-8.2.5.tar.gz" + contentsRoot: "php-8.2.5" diff --git a/modernbuild/project/dependencies/php80/conanfile.py b/modernbuild/project/dependencies/php80/conanfile.py new file mode 100644 index 000000000..2f1ec5fcc --- /dev/null +++ b/modernbuild/project/dependencies/php80/conanfile.py @@ -0,0 +1,56 @@ +import os +import shutil + +from conans import tools, ConanFile, AutoToolsBuildEnvironment + +class PhpHeadersForPHP81Conan(ConanFile): + description = "PHP headers package required to build Elastic APM agent without additional PHP dependencies" + license = "The PHP License, version 3.01" + homepage = "https://php.net/" + url = "https://php.net/" + author = "pawel.filipczak@elastic.co" + + settings = "os", "compiler", "build_type", "arch" + platform = "linux" + + def init(self): + self.name = self.conan_data["name"] + self.version = self.conan_data["version"] # version of the package + self.php_version = self.conan_data["php_source_version"] # version of the PHP to build + self.source_temp_dir = "php-src" + + def requirements(self): + self.requires("libxml2/2.9.9") + self.requires("sqlite3/3.29.0") + + def source(self): + for source in self.conan_data["sources"][self.php_version][self.platform]: + + if "contentsRoot" in source: + # small hack - it can't contain custom fields, so we're removing it from source (got an unexpected keyword argument) + contentRoot = source["contentsRoot"] + del source["contentsRoot"] + tools.get(**source) + os.rename(contentRoot, self.source_temp_dir) + else: + self.output.error("Could not find 'contentsRoot' in conandata.yml") + raise Exception("Could not find 'contentsRoot' in conandata.yml") + + def build(self): + with tools.chdir(os.path.join(self.source_folder, self.source_temp_dir)): + buildEnv = AutoToolsBuildEnvironment(self) + envVariables = buildEnv.vars + envVariables['ac_cv_php_xml2_config_path'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, "bin/xml2-config") + envVariables['LIBXML_LIBS'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].libdirs[0]) + envVariables['LIBXML_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].includedirs[0])) + envVariables['SQLITE_LIBS'] = os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].libdirs[0]) + envVariables['SQLITE_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].includedirs[0])) + self.run("./buildconf --force") + buildEnv.configure(args=[""], vars=envVariables, build=False, host=False) + + def package(self): + source = os.path.join(self.source_folder, self.source_temp_dir) + self.copy("*.h", src=source, dst='include', keep_path=True) + + def package_id(self): + del self.info.settings.compiler.version diff --git a/modernbuild/project/dependencies/php81/conandata.yml b/modernbuild/project/dependencies/php81/conandata.yml new file mode 100644 index 000000000..5a870624a --- /dev/null +++ b/modernbuild/project/dependencies/php81/conandata.yml @@ -0,0 +1,29 @@ +name: "php-headers-81" +version: "1.0" +php_source_version: 8.1.18 + +sources: + 7.2.34: + linux: + - url: "https://www.php.net/distributions/php-7.2.34.tar.gz" + contentsRoot: "php-7.2.34" + 7.3.33: + linux: + - url: "https://www.php.net/distributions/php-7.3.33.tar.gz" + contentsRoot: "php-7.3.33" + 7.4.33: + linux: + - url: "https://www.php.net/distributions/php-7.4.33.tar.gz" + contentsRoot: "php-7.4.33" + 8.0.28: + linux: + - url: "https://www.php.net/distributions/php-8.0.28.tar.gz" + contentsRoot: "php-8.0.28" + 8.1.18: + linux: + - url: "https://www.php.net/distributions/php-8.1.18.tar.gz" + contentsRoot: "php-8.1.18" + 8.2.5: + linux: + - url: "https://www.php.net/distributions/php-8.2.5.tar.gz" + contentsRoot: "php-8.2.5" diff --git a/modernbuild/project/dependencies/php81/conanfile.py b/modernbuild/project/dependencies/php81/conanfile.py new file mode 100644 index 000000000..2f1ec5fcc --- /dev/null +++ b/modernbuild/project/dependencies/php81/conanfile.py @@ -0,0 +1,56 @@ +import os +import shutil + +from conans import tools, ConanFile, AutoToolsBuildEnvironment + +class PhpHeadersForPHP81Conan(ConanFile): + description = "PHP headers package required to build Elastic APM agent without additional PHP dependencies" + license = "The PHP License, version 3.01" + homepage = "https://php.net/" + url = "https://php.net/" + author = "pawel.filipczak@elastic.co" + + settings = "os", "compiler", "build_type", "arch" + platform = "linux" + + def init(self): + self.name = self.conan_data["name"] + self.version = self.conan_data["version"] # version of the package + self.php_version = self.conan_data["php_source_version"] # version of the PHP to build + self.source_temp_dir = "php-src" + + def requirements(self): + self.requires("libxml2/2.9.9") + self.requires("sqlite3/3.29.0") + + def source(self): + for source in self.conan_data["sources"][self.php_version][self.platform]: + + if "contentsRoot" in source: + # small hack - it can't contain custom fields, so we're removing it from source (got an unexpected keyword argument) + contentRoot = source["contentsRoot"] + del source["contentsRoot"] + tools.get(**source) + os.rename(contentRoot, self.source_temp_dir) + else: + self.output.error("Could not find 'contentsRoot' in conandata.yml") + raise Exception("Could not find 'contentsRoot' in conandata.yml") + + def build(self): + with tools.chdir(os.path.join(self.source_folder, self.source_temp_dir)): + buildEnv = AutoToolsBuildEnvironment(self) + envVariables = buildEnv.vars + envVariables['ac_cv_php_xml2_config_path'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, "bin/xml2-config") + envVariables['LIBXML_LIBS'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].libdirs[0]) + envVariables['LIBXML_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].includedirs[0])) + envVariables['SQLITE_LIBS'] = os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].libdirs[0]) + envVariables['SQLITE_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].includedirs[0])) + self.run("./buildconf --force") + buildEnv.configure(args=[""], vars=envVariables, build=False, host=False) + + def package(self): + source = os.path.join(self.source_folder, self.source_temp_dir) + self.copy("*.h", src=source, dst='include', keep_path=True) + + def package_id(self): + del self.info.settings.compiler.version diff --git a/modernbuild/project/dependencies/php82/conandata.yml b/modernbuild/project/dependencies/php82/conandata.yml new file mode 100644 index 000000000..918b135dc --- /dev/null +++ b/modernbuild/project/dependencies/php82/conandata.yml @@ -0,0 +1,29 @@ +name: "php-headers-82" +version: "1.0" +php_source_version: 8.2.5 + +sources: + 7.2.34: + linux: + - url: "https://www.php.net/distributions/php-7.2.34.tar.gz" + contentsRoot: "php-7.2.34" + 7.3.33: + linux: + - url: "https://www.php.net/distributions/php-7.3.33.tar.gz" + contentsRoot: "php-7.3.33" + 7.4.33: + linux: + - url: "https://www.php.net/distributions/php-7.4.33.tar.gz" + contentsRoot: "php-7.4.33" + 8.0.28: + linux: + - url: "https://www.php.net/distributions/php-8.0.28.tar.gz" + contentsRoot: "php-8.0.28" + 8.1.18: + linux: + - url: "https://www.php.net/distributions/php-8.1.18.tar.gz" + contentsRoot: "php-8.1.18" + 8.2.5: + linux: + - url: "https://www.php.net/distributions/php-8.2.5.tar.gz" + contentsRoot: "php-8.2.5" diff --git a/modernbuild/project/dependencies/php82/conanfile.py b/modernbuild/project/dependencies/php82/conanfile.py new file mode 100644 index 000000000..2f1ec5fcc --- /dev/null +++ b/modernbuild/project/dependencies/php82/conanfile.py @@ -0,0 +1,56 @@ +import os +import shutil + +from conans import tools, ConanFile, AutoToolsBuildEnvironment + +class PhpHeadersForPHP81Conan(ConanFile): + description = "PHP headers package required to build Elastic APM agent without additional PHP dependencies" + license = "The PHP License, version 3.01" + homepage = "https://php.net/" + url = "https://php.net/" + author = "pawel.filipczak@elastic.co" + + settings = "os", "compiler", "build_type", "arch" + platform = "linux" + + def init(self): + self.name = self.conan_data["name"] + self.version = self.conan_data["version"] # version of the package + self.php_version = self.conan_data["php_source_version"] # version of the PHP to build + self.source_temp_dir = "php-src" + + def requirements(self): + self.requires("libxml2/2.9.9") + self.requires("sqlite3/3.29.0") + + def source(self): + for source in self.conan_data["sources"][self.php_version][self.platform]: + + if "contentsRoot" in source: + # small hack - it can't contain custom fields, so we're removing it from source (got an unexpected keyword argument) + contentRoot = source["contentsRoot"] + del source["contentsRoot"] + tools.get(**source) + os.rename(contentRoot, self.source_temp_dir) + else: + self.output.error("Could not find 'contentsRoot' in conandata.yml") + raise Exception("Could not find 'contentsRoot' in conandata.yml") + + def build(self): + with tools.chdir(os.path.join(self.source_folder, self.source_temp_dir)): + buildEnv = AutoToolsBuildEnvironment(self) + envVariables = buildEnv.vars + envVariables['ac_cv_php_xml2_config_path'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, "bin/xml2-config") + envVariables['LIBXML_LIBS'] = os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].libdirs[0]) + envVariables['LIBXML_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["libxml2"].rootpath, self.deps_cpp_info["libxml2"].includedirs[0])) + envVariables['SQLITE_LIBS'] = os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].libdirs[0]) + envVariables['SQLITE_CFLAGS'] = "-I{}".format(os.path.join(self.deps_cpp_info["sqlite3"].rootpath, self.deps_cpp_info["sqlite3"].includedirs[0])) + self.run("./buildconf --force") + buildEnv.configure(args=[""], vars=envVariables, build=False, host=False) + + def package(self): + source = os.path.join(self.source_folder, self.source_temp_dir) + self.copy("*.h", src=source, dst='include', keep_path=True) + + def package_id(self): + del self.info.settings.compiler.version diff --git a/src/ext/CMakeLists.txt b/src/ext/CMakeLists.txt new file mode 100644 index 000000000..682eab557 --- /dev/null +++ b/src/ext/CMakeLists.txt @@ -0,0 +1,68 @@ + +#scan for source files +AUX_SOURCE_DIRECTORY(. SrcFiles) + +function(copy_debug_symbols target) + block(SCOPE_FOR VARIABLES) + get_target_property(_TargetType ${target} TYPE) + + add_custom_command(TARGET ${target} + POST_BUILD + COMMAND + ${CMAKE_OBJCOPY} "--only-keep-debug" "$" "$/$" + + COMMAND + ${CMAKE_OBJCOPY} + "--add-gnu-debuglink=$/$" + "--strip-debug" "--strip-unneeded" + "$" + COMMENT "Striped debug symbols from ${target}" + ) + + endblock() +endfunction() + + +foreach(_php_version ${_supported_php_versions}) + set (_Target elasticapm_${_php_version}) + + add_library (${_Target} + SHARED ${SrcFiles} + ) + + target_compile_definitions(${_Target} + PRIVATE + "PHP_ATOM_INC" + "PHP_ABI=${CMAKE_C_COMPILER_ABI}") + + target_include_directories(${_Target} PUBLIC "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}" + "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}/ext" + "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}/main" + "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}/TSRM" + "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}/Zend" + "${CONAN_INCLUDE_DIRS_LIBCURL}" + ) + + target_link_libraries(${_Target} PRIVATE CONAN_PKG::libcurl) + + get_php_api_from_release(${_php_version} _ZEND_API_version) + + set_target_properties(${_Target} + PROPERTIES OUTPUT_NAME elastic_apm_${_ZEND_API_version} + PREFIX "" + ) + + set_target_properties(${_Target} + PROPERTIES OUTPUT_NAME elastic_apm_${_ZEND_API_version} + PREFIX "" + DEBUG_SYMBOL_FILE "elastic_apm_${_ZEND_API_version}.debug" + ) + + if (RELEASE_BUILD) + copy_debug_symbols(${_Target}) + endif() + +endforeach() + + +add_subdirectory(unit_tests) \ No newline at end of file diff --git a/src/ext/elastic_apm.c b/src/ext/elastic_apm.c index 7ce8f4d32..2590f1856 100644 --- a/src/ext/elastic_apm.c +++ b/src/ext/elastic_apm.c @@ -655,9 +655,14 @@ zend_module_entry elastic_apm_module_entry = { }; /* }}} */ -#ifdef COMPILE_DL_ELASTIC_APM -# ifdef ZTS -ZEND_TSRMLS_CACHE_DEFINE() -# endif -ZEND_GET_MODULE(elastic_apm) -#endif + +// #ifdef COMPILE_DL_ELASTIC_APM +// # ifdef ZTS +// ZEND_TSRMLS_CACHE_DEFINE() +// # endif +// extern "C" ZEND_GET_MODULE(elastic_apm) +// #endif + +extern __attribute__((visibility("default"))) void *get_module(void) { + return &elastic_apm_module_entry; +} diff --git a/src/ext/sample_prof.c b/src/ext/sample_prof.c index 20ea2c3ca..1e9985109 100644 --- a/src/ext/sample_prof.c +++ b/src/ext/sample_prof.c @@ -1,227 +1,227 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" -#include "php_sample_prof.h" -#include "zend_exceptions.h" -#include "sample_prof_arginfo.h" +// #ifdef HAVE_CONFIG_H +// #include "config.h" +// #endif + +// #include "php.h" +// #include "php_ini.h" +// #include "ext/standard/info.h" +// #include "php_sample_prof.h" +// #include "zend_exceptions.h" +// #include "sample_prof_arginfo.h" -#include - -#define SAMPLE_PROF_DEFAULT_INTERVAL 1 +// #include + +// #define SAMPLE_PROF_DEFAULT_INTERVAL 1 -/* On 64-bit this will give a 16 * 1MB allocation */ -#define SAMPLE_PROF_DEFAULT_ALLOC (1 << 20) - -ZEND_DECLARE_MODULE_GLOBALS(sample_prof) - -static inline zend_bool sample_prof_end() { - if (!SAMPLE_PROF_G->enabled) { - return 0; - } - - pthread_cancel(SAMPLE_PROF_G->thread_id); - - SAMPLE_PROF_G->enabled = 0; - return 1; -} - -static void *sample_prof_handler(void *data) { - zend_sample_prof_globals *g = SAMPLE_PROF_G; - -#ifdef ZTS - volatile zend_executor_globals *eg = TSRMG_BULK(executor_globals_id, zend_executor_globals *); -#else - volatile zend_executor_globals *eg = &executor_globals; -#endif - - retry_now: - while (1) { - volatile zend_execute_data *ex = eg->current_execute_data, *start_ex = ex; - zend_function *func; - const zend_op *opline; - - while (1) { - zend_execute_data *prev; - - /* We're not executing code right now, try again later */ - if (!ex) { - goto retry_later; - } - - func = ex->func; - opline = ex->opline; - prev = ex->prev_execute_data; - - /* current_execute_data changed in the meantime, reload it */ - if (eg->current_execute_data != start_ex) { - goto retry_now; - } - - if (func && ZEND_USER_CODE(func->type)) { - break; - } - - ex = prev; - } - - if (!opline) { - goto retry_later; - } - - g->entries[g->entries_num].filename = func->op_array.filename; - g->entries[g->entries_num].lineno = opline->lineno; - - if (++g->entries_num == g->entries_allocated) { - /* Doing a realloc within a signal handler is unsafe, end profiling */ - g->enabled = 0; - break; - } - - retry_later: - usleep(g->interval_usec); - } - pthread_exit(NULL); -} - -static void sample_prof_start(long interval_usec, size_t num_entries_alloc) { - zend_sample_prof_globals *g = SAMPLE_PROF_G; - - /* Initialize data structures for entries */ - if (g->entries) { - efree(g->entries); - } - - g->interval_usec = interval_usec; - g->entries_allocated = num_entries_alloc; - g->entries_num = 0; - g->entries = safe_emalloc(g->entries_allocated, sizeof(sample_prof_entry), 0); - - /* Register signal handler */ - if (pthread_create(&g->thread_id, NULL, sample_prof_handler, NULL)) { - zend_throw_exception(NULL, "Could not register signal handler", 0); - return; - } - - g->enabled = 1; -} - -PHP_FUNCTION(sample_prof_start) { - zend_long interval_usec = 0; - zend_long num_entries_alloc = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &interval_usec, &num_entries_alloc) == FAILURE) { - return; - } - - if (interval_usec < 0) { - zend_throw_exception(NULL, "Number of microseconds can't be negative", 0); - return; - } else if (interval_usec == 0) { - interval_usec = SAMPLE_PROF_DEFAULT_INTERVAL; - } - - if (num_entries_alloc < 0) { - zend_throw_exception(NULL, "Number of profiling can't be negative", 0); - return; - } else if (num_entries_alloc == 0) { - num_entries_alloc = SAMPLE_PROF_DEFAULT_ALLOC; - } - - sample_prof_start(interval_usec, num_entries_alloc); -} - -PHP_FUNCTION(sample_prof_end) { - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - RETURN_BOOL(sample_prof_end()); -} - -PHP_FUNCTION(sample_prof_get_data) { - zend_sample_prof_globals *g = SAMPLE_PROF_G; - size_t entry_num; - - if (zend_parse_parameters_none() == FAILURE) { - return; - } - - array_init(return_value); - - for (entry_num = 0; entry_num < g->entries_num; ++entry_num) { - sample_prof_entry *entry = &g->entries[entry_num]; - zend_string *filename = entry->filename; - uint32_t lineno = entry->lineno; - zval *lines, *num; - - lines = zend_hash_find(Z_ARR_P(return_value), filename); - if (lines == NULL) { - zval lines_zv; - array_init(&lines_zv); - lines = zend_hash_update(Z_ARR_P(return_value), filename, &lines_zv); - } - - num = zend_hash_index_find(Z_ARR_P(lines), lineno); - if (num == NULL) { - zval num_zv; - ZVAL_LONG(&num_zv, 0); - num = zend_hash_index_update(Z_ARR_P(lines), lineno, &num_zv); - } - - increment_function(num); - } -} - -PHP_RINIT_FUNCTION(sample_prof) - { - SAMPLE_PROF_G->enabled = 0; - SAMPLE_PROF_G->entries = NULL; - SAMPLE_PROF_G->entries_num = 0; - - return SUCCESS; - } - -PHP_RSHUTDOWN_FUNCTION(sample_prof) - { - sample_prof_end(); - if (SAMPLE_PROF_G->entries) { - efree(SAMPLE_PROF_G->entries); - } - - return SUCCESS; - } - -PHP_MINFO_FUNCTION(sample_prof) - { - php_info_print_table_start(); - php_info_print_table_header(2, "sample_prof support", "enabled"); - php_info_print_table_end(); - } - -const zend_function_entry sample_prof_functions[] = { - PHP_FE(sample_prof_start, arginfo_sample_prof_start) - PHP_FE(sample_prof_end, arginfo_sample_prof_end) - PHP_FE(sample_prof_get_data, arginfo_sample_prof_get_data) - PHP_FE_END -}; - -zend_module_entry sample_prof_module_entry = { - STANDARD_MODULE_HEADER, - "sample_prof", - sample_prof_functions, - NULL, - NULL, - PHP_RINIT(sample_prof), - PHP_RSHUTDOWN(sample_prof), - PHP_MINFO(sample_prof), - PHP_SAMPLE_PROF_VERSION, - PHP_MODULE_GLOBALS(sample_prof), - NULL, - NULL, - NULL, - STANDARD_MODULE_PROPERTIES_EX -}; +// /* On 64-bit this will give a 16 * 1MB allocation */ +// #define SAMPLE_PROF_DEFAULT_ALLOC (1 << 20) + +// ZEND_DECLARE_MODULE_GLOBALS(sample_prof) + +// static inline zend_bool sample_prof_end() { +// if (!SAMPLE_PROF_G->enabled) { +// return 0; +// } + +// pthread_cancel(SAMPLE_PROF_G->thread_id); + +// SAMPLE_PROF_G->enabled = 0; +// return 1; +// } + +// static void *sample_prof_handler(void *data) { +// zend_sample_prof_globals *g = SAMPLE_PROF_G; + +// #ifdef ZTS +// volatile zend_executor_globals *eg = TSRMG_BULK(executor_globals_id, zend_executor_globals *); +// #else +// volatile zend_executor_globals *eg = &executor_globals; +// #endif + +// retry_now: +// while (1) { +// volatile zend_execute_data *ex = eg->current_execute_data, *start_ex = ex; +// zend_function *func; +// const zend_op *opline; + +// while (1) { +// zend_execute_data *prev; + +// /* We're not executing code right now, try again later */ +// if (!ex) { +// goto retry_later; +// } + +// func = ex->func; +// opline = ex->opline; +// prev = ex->prev_execute_data; + +// /* current_execute_data changed in the meantime, reload it */ +// if (eg->current_execute_data != start_ex) { +// goto retry_now; +// } + +// if (func && ZEND_USER_CODE(func->type)) { +// break; +// } + +// ex = prev; +// } + +// if (!opline) { +// goto retry_later; +// } + +// g->entries[g->entries_num].filename = func->op_array.filename; +// g->entries[g->entries_num].lineno = opline->lineno; + +// if (++g->entries_num == g->entries_allocated) { +// /* Doing a realloc within a signal handler is unsafe, end profiling */ +// g->enabled = 0; +// break; +// } + +// retry_later: +// usleep(g->interval_usec); +// } +// pthread_exit(NULL); +// } + +// static void sample_prof_start(long interval_usec, size_t num_entries_alloc) { +// zend_sample_prof_globals *g = SAMPLE_PROF_G; + +// /* Initialize data structures for entries */ +// if (g->entries) { +// efree(g->entries); +// } + +// g->interval_usec = interval_usec; +// g->entries_allocated = num_entries_alloc; +// g->entries_num = 0; +// g->entries = safe_emalloc(g->entries_allocated, sizeof(sample_prof_entry), 0); + +// /* Register signal handler */ +// if (pthread_create(&g->thread_id, NULL, sample_prof_handler, NULL)) { +// zend_throw_exception(NULL, "Could not register signal handler", 0); +// return; +// } + +// g->enabled = 1; +// } + +// PHP_FUNCTION(sample_prof_start) { +// zend_long interval_usec = 0; +// zend_long num_entries_alloc = 0; + +// if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ll", &interval_usec, &num_entries_alloc) == FAILURE) { +// return; +// } + +// if (interval_usec < 0) { +// zend_throw_exception(NULL, "Number of microseconds can't be negative", 0); +// return; +// } else if (interval_usec == 0) { +// interval_usec = SAMPLE_PROF_DEFAULT_INTERVAL; +// } + +// if (num_entries_alloc < 0) { +// zend_throw_exception(NULL, "Number of profiling can't be negative", 0); +// return; +// } else if (num_entries_alloc == 0) { +// num_entries_alloc = SAMPLE_PROF_DEFAULT_ALLOC; +// } + +// sample_prof_start(interval_usec, num_entries_alloc); +// } + +// PHP_FUNCTION(sample_prof_end) { +// if (zend_parse_parameters_none() == FAILURE) { +// return; +// } + +// RETURN_BOOL(sample_prof_end()); +// } + +// PHP_FUNCTION(sample_prof_get_data) { +// zend_sample_prof_globals *g = SAMPLE_PROF_G; +// size_t entry_num; + +// if (zend_parse_parameters_none() == FAILURE) { +// return; +// } + +// array_init(return_value); + +// for (entry_num = 0; entry_num < g->entries_num; ++entry_num) { +// sample_prof_entry *entry = &g->entries[entry_num]; +// zend_string *filename = entry->filename; +// uint32_t lineno = entry->lineno; +// zval *lines, *num; + +// lines = zend_hash_find(Z_ARR_P(return_value), filename); +// if (lines == NULL) { +// zval lines_zv; +// array_init(&lines_zv); +// lines = zend_hash_update(Z_ARR_P(return_value), filename, &lines_zv); +// } + +// num = zend_hash_index_find(Z_ARR_P(lines), lineno); +// if (num == NULL) { +// zval num_zv; +// ZVAL_LONG(&num_zv, 0); +// num = zend_hash_index_update(Z_ARR_P(lines), lineno, &num_zv); +// } + +// increment_function(num); +// } +// } + +// PHP_RINIT_FUNCTION(sample_prof) +// { +// SAMPLE_PROF_G->enabled = 0; +// SAMPLE_PROF_G->entries = NULL; +// SAMPLE_PROF_G->entries_num = 0; + +// return SUCCESS; +// } + +// PHP_RSHUTDOWN_FUNCTION(sample_prof) +// { +// sample_prof_end(); +// if (SAMPLE_PROF_G->entries) { +// efree(SAMPLE_PROF_G->entries); +// } + +// return SUCCESS; +// } + +// PHP_MINFO_FUNCTION(sample_prof) +// { +// php_info_print_table_start(); +// php_info_print_table_header(2, "sample_prof support", "enabled"); +// php_info_print_table_end(); +// } + +// const zend_function_entry sample_prof_functions[] = { +// PHP_FE(sample_prof_start, arginfo_sample_prof_start) +// PHP_FE(sample_prof_end, arginfo_sample_prof_end) +// PHP_FE(sample_prof_get_data, arginfo_sample_prof_get_data) +// PHP_FE_END +// }; + +// zend_module_entry sample_prof_module_entry = { +// STANDARD_MODULE_HEADER, +// "sample_prof", +// sample_prof_functions, +// NULL, +// NULL, +// PHP_RINIT(sample_prof), +// PHP_RSHUTDOWN(sample_prof), +// PHP_MINFO(sample_prof), +// PHP_SAMPLE_PROF_VERSION, +// PHP_MODULE_GLOBALS(sample_prof), +// NULL, +// NULL, +// NULL, +// STANDARD_MODULE_PROPERTIES_EX +// }; diff --git a/src/ext/unit_tests/CMakeLists.txt b/src/ext/unit_tests/CMakeLists.txt index 071f5a605..f8ee4dc89 100644 --- a/src/ext/unit_tests/CMakeLists.txt +++ b/src/ext/unit_tests/CMakeLists.txt @@ -20,6 +20,16 @@ CMAKE_MINIMUM_REQUIRED( VERSION 3.15 ) PROJECT( unit_tests C ) +# disable warnings - fix tests and remove +add_compile_options("-Wno-comment") +add_compile_options("-Wno-enum-compare") +add_compile_options("-Wno-unused-local-typedefs") +add_compile_options("-Wno-unused-function") +add_compile_options("-Wno-sign-compare") +add_compile_options("-Wno-type-limits") +add_compile_options("-Wno-unused-variable") + + SET( CMAKE_C_STANDARD 99 ) SET( CMAKE_COMPILE_WARNING_AS_ERROR ON ) @@ -79,22 +89,9 @@ IF ( WIN32 ) ADD_COMPILE_DEFINITIONS( _CRT_SECURE_NO_WARNINGS ) ENDIF() -IF ( DEFINED ENV{cmocka_installed_dir} ) - SET( cmocka_installed_dir $ENV{cmocka_installed_dir} ) - SET( cmocka_include_dir ${cmocka_installed_dir}/include ) - SET( cmocka_lib_dir ${cmocka_installed_dir}/lib ) - SET( cmocka_static_lib ${cmocka_lib_dir}/cmocka.lib ) -ELSE() - #FIND_PACKAGE( cmocka REQUIRED ) - FIND_LIBRARY( cmocka_static_lib cmocka ) - IF ( NOT cmocka_static_lib ) - MESSAGE( FATAL_ERROR "cmocka library not found" ) - ENDIF() -ENDIF() - INCLUDE_DIRECTORIES( . ) INCLUDE_DIRECTORIES( ${src_ext_dir} ) -INCLUDE_DIRECTORIES( ${cmocka_include_dir} ) +INCLUDE_DIRECTORIES( ${CMOCKA_INCLUDE_DIR} ) FILE( GLOB unit_tests_source_files *.c *.h ) LIST( APPEND source_files ${unit_tests_source_files} ) @@ -120,17 +117,15 @@ ENDIF() ADD_EXECUTABLE( unit_tests ${source_files} ) -SET( link_with_libraries ${cmocka_static_lib} ) IF ( NOT WIN32 ) - # Link to library required by math.h and pthread.h - SET( link_with_libraries ${link_with_libraries} m pthread ) -ENDIF() - -FIND_LIBRARY( unwind_lib unwind ) -IF ( unwind_lib ) - SET( link_with_libraries ${link_with_libraries} unwind ) + # Link to library required by math.h + SET( link_with_libraries ${link_with_libraries} m ) ENDIF() -TARGET_LINK_LIBRARIES( unit_tests ${link_with_libraries} ) +target_link_libraries( unit_tests PRIVATE CONAN_PKG::cmocka + PRIVATE CONAN_PKG::libunwind + Threads::Threads + m + ) ADD_TEST( NAME Unit_tests COMMAND unit_tests ) From 23a55aecc125bb1137500ab76e3f93bda21bdf93 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 17 May 2023 14:22:42 +0200 Subject: [PATCH 02/50] reinvented folder structure --- .../project => agent/native}/CMakeLists.txt | 6 +++--- .../project => agent/native}/CMakePresets.json | 0 .../native/building}/cmake/conan.cmake | 0 .../building}/cmake/elastic_conan_export.cmake | 0 .../cmake/elastic_conan_installer.cmake | 8 ++++---- .../cmake/elastic_get_git_version.cmake | 0 .../elastic_set_default_build_options.cmake | 0 .../native/building}/cmake/test_venv.py | 0 .../native/building}/conan/conan_profile.in | 0 .../native/building}/conan/settings.yml | 0 .../building}/dependencies/php72/conandata.yml | 0 .../building}/dependencies/php72/conanfile.py | 0 .../building}/dependencies/php73/conandata.yml | 0 .../building}/dependencies/php73/conanfile.py | 0 .../building}/dependencies/php74/conandata.yml | 0 .../building}/dependencies/php74/conanfile.py | 0 .../building}/dependencies/php80/conandata.yml | 0 .../building}/dependencies/php80/conanfile.py | 0 .../building}/dependencies/php81/conandata.yml | 0 .../building}/dependencies/php81/conanfile.py | 0 .../building}/dependencies/php82/conandata.yml | 0 .../building}/dependencies/php82/conanfile.py | 0 .../building/dockerized/docker-compose.yml | 17 +++++++++++++++++ .../dockerized/images/Dockerfile_glibc | 2 +- .../dockerized/images}/Dockerfile_musl | 4 ++-- {src => agent/native}/ext/.gitignore | 0 .../native}/ext/AST_instrumentation.c | 0 .../native}/ext/AST_instrumentation.h | 0 {src => agent/native}/ext/CMakeLists.txt | 0 {src => agent/native}/ext/ConfigManager.c | 0 {src => agent/native}/ext/ConfigManager.h | 0 .../native}/ext/IntrusiveDoublyLinkedList.h | 0 {src => agent/native}/ext/MemoryTracker.c | 0 {src => agent/native}/ext/MemoryTracker.h | 0 {src => agent/native}/ext/ResultCode.c | 0 {src => agent/native}/ext/ResultCode.h | 0 {src => agent/native}/ext/StringView.h | 0 {src => agent/native}/ext/SystemMetrics.c | 0 {src => agent/native}/ext/SystemMetrics.h | 0 {src => agent/native}/ext/TextOutputStream.c | 0 {src => agent/native}/ext/TextOutputStream.h | 0 {src => agent/native}/ext/Tracer.c | 0 {src => agent/native}/ext/Tracer.h | 0 {src => agent/native}/ext/backend_comm.c | 0 {src => agent/native}/ext/backend_comm.h | 0 {src => agent/native}/ext/basic_macros.h | 0 {src => agent/native}/ext/basic_types.h | 0 {src => agent/native}/ext/basic_util.h | 0 {src => agent/native}/ext/config.m4 | 0 {src => agent/native}/ext/config.w32 | 0 {src => agent/native}/ext/constants.h | 0 {src => agent/native}/ext/elastic_apm.c | 0 {src => agent/native}/ext/elastic_apm.ini | 0 {src => agent/native}/ext/elastic_apm_API.c | 0 {src => agent/native}/ext/elastic_apm_API.h | 0 {src => agent/native}/ext/elastic_apm_alloc.h | 0 {src => agent/native}/ext/elastic_apm_assert.c | 0 {src => agent/native}/ext/elastic_apm_assert.h | 0 {src => agent/native}/ext/elastic_apm_clock.h | 0 .../native}/ext/elastic_apm_is_debug_build.h | 0 .../native}/ext/elastic_apm_version.h | 0 {src => agent/native}/ext/internal_checks.c | 0 {src => agent/native}/ext/internal_checks.h | 0 {src => agent/native}/ext/lifecycle.c | 0 {src => agent/native}/ext/lifecycle.h | 0 {src => agent/native}/ext/log.c | 0 {src => agent/native}/ext/log.h | 0 .../ext/numbered_intercepting_callbacks.h | 0 {src => agent/native}/ext/php_elastic_apm.h | 0 {src => agent/native}/ext/php_error.c | 0 {src => agent/native}/ext/php_error.h | 0 {src => agent/native}/ext/platform.c | 0 {src => agent/native}/ext/platform.h | 0 {src => agent/native}/ext/platform_threads.h | 0 .../native}/ext/platform_threads_linux.c | 0 {src => agent/native}/ext/sample_prof.c | 0 {src => agent/native}/ext/supportability.c | 0 {src => agent/native}/ext/supportability.h | 0 .../native}/ext/supportability_zend.h | 0 ...onfig_boolean_0_using_env_var_is_false.phpt | 0 .../config_boolean_0_using_ini_is_false.phpt | 0 ...config_boolean_1_using_env_var_is_true.phpt | 0 .../config_boolean_1_using_ini_is_true.phpt | 0 ...g_boolean_FaLSe_using_env_var_is_false.phpt | 0 ...onfig_boolean_FaLSe_using_ini_is_false.phpt | 0 ...nfig_boolean_No_using_env_var_is_false.phpt | 0 .../config_boolean_No_using_ini_is_false.phpt | 0 ...fig_boolean_OFF_using_env_var_is_false.phpt | 0 .../config_boolean_OFF_using_ini_is_false.phpt | 0 ...fig_boolean_TRue_using_env_var_is_true.phpt | 0 .../config_boolean_TRue_using_ini_is_true.phpt | 0 ...onfig_boolean_oN_using_env_var_is_true.phpt | 0 .../config_boolean_oN_using_ini_is_true.phpt | 0 ...nfig_boolean_yEs_using_env_var_is_true.phpt | 0 .../config_boolean_yEs_using_ini_is_true.phpt | 0 .../native}/ext/tests/config_defaults.phpt | 0 .../ext/tests/config_dynamic_options.phpt | 0 ..._setting_cannot_be_changed_after_start.phpt | 0 ...ni_has_higher_precedence_than_env_vars.phpt | 0 ...valid_ini_fallback_default_not_env_var.phpt | 0 ...tting_to_invalid_values_using_env_vars.phpt | 0 ...ig_setting_to_invalid_values_using_ini.phpt | 0 ...setting_to_non-defaults_using_env_vars.phpt | 0 ...nfig_setting_to_non-defaults_using_ini.phpt | 0 ...nfig_type_LogLevel_is_case_insensitive.phpt | 0 ..._LogLevel_unambiguous_prefix_is_enough.phpt | 0 .../ext/tests/opcache_preload_detection.inc | 0 .../ext/tests/opcache_preload_detection.phpt | 0 .../opcache_preload_detection_double.phpt | 0 .../native}/ext/tests_util/tests_util.php | 0 {src => agent/native}/ext/time_util.c | 0 {src => agent/native}/ext/time_util.h | 0 {src => agent/native}/ext/tracer_PHP_part.c | 0 {src => agent/native}/ext/tracer_PHP_part.h | 0 .../native}/ext/unit_tests/CMakeLists.txt | 0 .../native}/ext/unit_tests/DynamicArray.c | 0 .../native}/ext/unit_tests/DynamicArray.h | 0 .../ext/unit_tests/DynamicArray_tests.c | 0 .../IntrusiveDoublyLinkedList_tests.c | 0 .../native}/ext/unit_tests/Logger_tests.c | 0 .../ext/unit_tests/MemoryTracker_tests.c | 0 .../native}/ext/unit_tests/ResultCode_tests.c | 0 .../native}/ext/unit_tests/StringToStringMap.c | 0 .../native}/ext/unit_tests/StringToStringMap.h | 0 .../ext/unit_tests/StringToStringMap_tests.c | 0 .../ext/unit_tests/TextOutputStream_tests.c | 0 .../ext/unit_tests/TextOutputStream_tests.h | 0 .../ext/unit_tests/basic_macros_tests.c | 0 .../native}/ext/unit_tests/basic_types_tests.c | 0 .../unit_tests/cmocka_wrapped_for_unit_tests.h | 0 .../native}/ext/unit_tests/config_tests.c | 0 .../ext/unit_tests/default_test_fixture.c | 0 .../ext/unit_tests/default_test_fixture.h | 0 .../gen_numbered_intercepting_callbacks_src.h | 0 .../unit_tests/iterateOverCStackTrace_tests.c | 0 {src => agent/native}/ext/unit_tests/main.c | 0 .../native}/ext/unit_tests/mock_alloc.c | 0 .../native}/ext/unit_tests/mock_assert.c | 0 .../native}/ext/unit_tests/mock_assert.h | 0 .../native}/ext/unit_tests/mock_clock.c | 0 .../native}/ext/unit_tests/mock_clock.h | 0 .../native}/ext/unit_tests/mock_env_vars.c | 0 .../native}/ext/unit_tests/mock_env_vars.h | 0 .../ext/unit_tests/mock_global_tracer.c | 0 .../ext/unit_tests/mock_log_custom_sink.c | 0 .../ext/unit_tests/mock_log_custom_sink.h | 0 .../native}/ext/unit_tests/mock_php.h | 0 .../native}/ext/unit_tests/mock_php_ini.c | 0 .../native}/ext/unit_tests/mock_php_ini.h | 0 .../native}/ext/unit_tests/mock_stdlib.h | 0 .../native}/ext/unit_tests/mock_syslog.h | 0 .../unit_tests/parse_value_with_units_tests.c | 0 .../native}/ext/unit_tests/platform_tests.c | 0 .../native}/ext/unit_tests/time_util_tests.c | 0 .../native}/ext/unit_tests/unit_test_util.c | 0 .../native}/ext/unit_tests/unit_test_util.h | 0 .../native}/ext/unit_tests/util_tests.c | 0 {src => agent/native}/ext/util.c | 0 {src => agent/native}/ext/util.h | 0 {src => agent/native}/ext/util_for_PHP.c | 0 {src => agent/native}/ext/util_for_PHP.h | 0 .../php}/ElasticApm/CustomErrorData.php | 0 .../php}/ElasticApm/DistributedTracingData.php | 0 {src => agent/php}/ElasticApm/ElasticApm.php | 0 .../ExecutionSegmentContextInterface.php | 0 .../ElasticApm/ExecutionSegmentInterface.php | 0 .../AutoInstrument/AutoInstrumentationBase.php | 0 .../AutoInstrumentationInterface.php | 0 .../Impl/AutoInstrument/Autoloader.php | 0 .../AutoInstrument/BootstrapStageLogger.php | 0 .../Impl/AutoInstrument/BuiltinPlugin.php | 0 .../AutoInstrument/CurlAutoInstrumentation.php | 0 .../Impl/AutoInstrument/CurlHandleTracker.php | 0 .../Impl/AutoInstrument/CurlHandleWrapped.php | 0 .../AutoInstrument/CurlHandleWrappedTrait.php | 0 .../AutoInstrument/InstrumentationNames.php | 0 .../AutoInstrument/InterceptionManager.php | 0 .../MySQLiAutoInstrumentation.php | 0 .../AutoInstrument/PDOAutoInstrumentation.php | 0 .../Impl/AutoInstrument/PhpErrorData.php | 0 .../Impl/AutoInstrument/PhpPartFacade.php | 0 .../Impl/AutoInstrument/PluginBase.php | 0 .../Impl/AutoInstrument/PluginInterface.php | 0 .../Impl/AutoInstrument/Registration.php | 0 .../AutoInstrument/RegistrationContext.php | 0 .../RegistrationContextInterface.php | 0 .../TransactionForExtensionRequest.php | 0 .../Util/AutoInstrumentationUtil.php | 0 .../Util/DbAutoInstrumentationUtil.php | 0 .../Util/DbConnectionStringParser.php | 0 .../AutoInstrument/Util/MapPerWeakObject.php | 0 .../MapPerWeakObjectImplDynamicProperties.php | 0 .../Util/MapPerWeakObjectImplWeakMap.php | 0 .../Impl/AutoInstrument/bootstrap_php_part.php | 0 .../Impl/BackendComm/EventSender.php | 0 .../BackendComm/SerializationException.php | 0 .../Impl/BackendComm/SerializationUtil.php | 0 .../Impl/BreakdownMetrics/LeafData.php | 0 .../Impl/BreakdownMetrics/PerSpanTypeData.php | 0 .../Impl/BreakdownMetrics/PerTransaction.php | 0 .../Impl/BreakdownMetrics/SelfTimeTracker.php | 0 {src => agent/php}/ElasticApm/Impl/Clock.php | 0 .../php}/ElasticApm/Impl/ClockInterface.php | 0 .../Impl/Config/AllOptionsMetadata.php | 0 .../Impl/Config/BoolOptionMetadata.php | 0 .../Impl/Config/BoolOptionParser.php | 0 .../Impl/Config/CompositeRawSnapshot.php | 0 .../Impl/Config/CompositeRawSnapshotSource.php | 0 .../Impl/Config/DevInternalSubOptionNames.php | 0 .../Impl/Config/DurationOptionMetadata.php | 0 .../Impl/Config/DurationOptionParser.php | 0 .../ElasticApm/Impl/Config/DurationUnits.php | 0 .../Impl/Config/EnumOptionParser.php | 0 .../Impl/Config/EnvVarsRawSnapshotSource.php | 0 .../Impl/Config/FloatOptionMetadata.php | 0 .../Impl/Config/FloatOptionParser.php | 0 .../Impl/Config/IniRawSnapshotSource.php | 0 .../Impl/Config/IntOptionMetadata.php | 0 .../ElasticApm/Impl/Config/IntOptionParser.php | 0 .../Impl/Config/LogLevelOptionMetadata.php | 0 .../Impl/Config/LogLevelOptionParser.php | 0 .../Impl/Config/NullableIntOptionMetadata.php | 0 .../Config/NullableLogLevelOptionMetadata.php | 0 .../Impl/Config/NullableOptionMetadata.php | 0 .../Config/NullableStringOptionMetadata.php | 0 .../NullableWildcardListOptionMetadata.php | 0 .../Impl/Config/NumericOptionParser.php | 0 .../Impl/Config/OptionDefaultValues.php | 0 .../ElasticApm/Impl/Config/OptionMetadata.php | 0 .../ElasticApm/Impl/Config/OptionNames.php | 0 .../ElasticApm/Impl/Config/OptionParser.php | 0 .../Config/OptionWithDefaultValueMetadata.php | 0 .../ElasticApm/Impl/Config/ParseException.php | 0 .../php}/ElasticApm/Impl/Config/Parser.php | 0 .../Impl/Config/RawSnapshotFromArray.php | 0 .../Impl/Config/RawSnapshotInterface.php | 0 .../Impl/Config/RawSnapshotSourceInterface.php | 0 .../php}/ElasticApm/Impl/Config/Snapshot.php | 0 .../Impl/Config/SnapshotDevInternal.php | 0 .../ElasticApm/Impl/Config/SnapshotTrait.php | 0 .../Impl/Config/StringOptionMetadata.php | 0 .../Impl/Config/StringOptionParser.php | 0 .../Impl/Config/WildcardListOptionMetadata.php | 0 .../Impl/Config/WildcardListOptionParser.php | 0 .../php}/ElasticApm/Impl/Constants.php | 0 .../ElasticApm/Impl/ContextPartWrapper.php | 0 .../Impl/DistributedTracingDataInternal.php | 0 {src => agent/php}/ElasticApm/Impl/Error.php | 0 .../ElasticApm/Impl/ErrorExceptionData.php | 0 .../ElasticApm/Impl/ErrorTransactionData.php | 0 .../ElasticApm/Impl/EventSinkInterface.php | 0 .../php}/ElasticApm/Impl/ExecutionSegment.php | 0 .../Impl/ExecutionSegmentContext.php | 0 .../ElasticApm/Impl/GlobalTracerHolder.php | 0 .../ElasticApm/Impl/HttpDistributedTracing.php | 0 .../php}/ElasticApm/Impl/InferredSpanFrame.php | 0 .../ElasticApm/Impl/InferredSpansBuilder.php | 0 .../ElasticApm/Impl/InferredSpansManager.php | 0 .../Impl/Log/AdhocLoggableObject.php | 0 .../php}/ElasticApm/Impl/Log/Backend.php | 0 .../ElasticApm/Impl/Log/EnabledLoggerProxy.php | 0 .../Impl/Log/EnabledLoggerProxyNoLine.php | 0 .../php}/ElasticApm/Impl/Log/Level.php | 0 .../php}/ElasticApm/Impl/Log/LogCategory.php | 0 .../php}/ElasticApm/Impl/Log/LogConsts.php | 0 .../php}/ElasticApm/Impl/Log/LogStream.php | 0 .../ElasticApm/Impl/Log/LogStreamInterface.php | 0 .../php}/ElasticApm/Impl/Log/LoggableArray.php | 0 .../ElasticApm/Impl/Log/LoggableInterface.php | 0 .../ElasticApm/Impl/Log/LoggableStackTrace.php | 0 .../Impl/Log/LoggableToEncodedJson.php | 0 .../Impl/Log/LoggableToJsonEncodable.php | 0 .../ElasticApm/Impl/Log/LoggableToString.php | 0 .../php}/ElasticApm/Impl/Log/LoggableTrait.php | 0 .../php}/ElasticApm/Impl/Log/Logger.php | 0 .../php}/ElasticApm/Impl/Log/LoggerData.php | 0 .../php}/ElasticApm/Impl/Log/LoggerFactory.php | 0 .../ElasticApm/Impl/Log/LoggingSubsystem.php | 0 .../Impl/Log/LoggingSubsystemException.php | 0 .../php}/ElasticApm/Impl/Log/NoopLogSink.php | 0 .../ElasticApm/Impl/Log/NoopLoggerFactory.php | 0 .../Impl/Log/PropertyLogPriority.php | 0 .../php}/ElasticApm/Impl/Log/SinkBase.php | 0 .../php}/ElasticApm/Impl/Log/SinkInterface.php | 0 .../php}/ElasticApm/Impl/Log/SinkToCExt.php | 0 .../php}/ElasticApm/Impl/Metadata.php | 0 .../ElasticApm/Impl/MetadataDiscoverer.php | 0 .../php}/ElasticApm/Impl/MetricSet.php | 0 .../php}/ElasticApm/Impl/NameVersionData.php | 0 .../Impl/NoopDistributedTracingData.php | 0 .../php}/ElasticApm/Impl/NoopEventSink.php | 0 .../ElasticApm/Impl/NoopExecutionSegment.php | 0 .../Impl/NoopExecutionSegmentContext.php | 0 .../php}/ElasticApm/Impl/NoopSpan.php | 0 .../php}/ElasticApm/Impl/NoopSpanContext.php | 0 .../php}/ElasticApm/Impl/NoopSpanContextDb.php | 0 .../Impl/NoopSpanContextDestination.php | 0 .../ElasticApm/Impl/NoopSpanContextHttp.php | 0 .../ElasticApm/Impl/NoopSpanContextService.php | 0 .../Impl/NoopSpanContextServiceTarget.php | 0 .../php}/ElasticApm/Impl/NoopTracer.php | 0 .../php}/ElasticApm/Impl/NoopTransaction.php | 0 .../ElasticApm/Impl/NoopTransactionBuilder.php | 0 .../ElasticApm/Impl/NoopTransactionContext.php | 0 .../Impl/NoopTransactionContextRequest.php | 0 .../Impl/NoopTransactionContextRequestUrl.php | 0 .../Impl/NoopTransactionContextUser.php | 0 .../Impl/OptionalSerializableDataInterface.php | 0 .../php}/ElasticApm/Impl/ProcessData.php | 0 .../Impl/SerializableDataInterface.php | 0 .../php}/ElasticApm/Impl/ServiceAgentData.php | 0 .../php}/ElasticApm/Impl/ServiceData.php | 0 {src => agent/php}/ElasticApm/Impl/Span.php | 0 .../php}/ElasticApm/Impl/SpanContext.php | 0 .../php}/ElasticApm/Impl/SpanContextDb.php | 0 .../ElasticApm/Impl/SpanContextDestination.php | 0 .../Impl/SpanContextDestinationServiceData.php | 0 .../php}/ElasticApm/Impl/SpanContextHttp.php | 0 .../ElasticApm/Impl/SpanContextService.php | 0 .../Impl/SpanContextServiceTarget.php | 0 .../ElasticApm/Impl/SpanToSendInterface.php | 0 .../php}/ElasticApm/Impl/SrcRootDir.php | 0 .../php}/ElasticApm/Impl/StackTraceFrame.php | 0 .../php}/ElasticApm/Impl/SystemData.php | 0 {src => agent/php}/ElasticApm/Impl/Tracer.php | 0 .../php}/ElasticApm/Impl/TracerBuilder.php | 0 .../ElasticApm/Impl/TracerDependencies.php | 0 .../php}/ElasticApm/Impl/TracerInterface.php | 0 .../php}/ElasticApm/Impl/Transaction.php | 0 .../ElasticApm/Impl/TransactionBuilder.php | 0 .../ElasticApm/Impl/TransactionContext.php | 0 .../Impl/TransactionContextRequest.php | 0 .../Impl/TransactionContextRequestUrl.php | 0 .../ElasticApm/Impl/TransactionContextUser.php | 0 .../php}/ElasticApm/Impl/Util/ArrayUtil.php | 0 .../php}/ElasticApm/Impl/Util/Assert.php | 0 .../ElasticApm/Impl/Util/AssertException.php | 0 .../php}/ElasticApm/Impl/Util/AssertLevel.php | 0 .../php}/ElasticApm/Impl/Util/BoolUtil.php | 0 .../php}/ElasticApm/Impl/Util/CallerInfo.php | 0 .../ElasticApm/Impl/Util/ClassNameUtil.php | 0 .../Impl/Util/ClassicFormatStackTraceFrame.php | 0 .../php}/ElasticApm/Impl/Util/DbgUtil.php | 0 .../Impl/Util/ElasticApmExtensionUtil.php | 0 .../Impl/Util/EnabledAssertProxy.php | 0 .../ElasticApm/Impl/Util/ExceptionUtil.php | 0 .../Impl/Util/HiddenConstructorTrait.php | 0 .../php}/ElasticApm/Impl/Util/IdGenerator.php | 0 .../ElasticApm/Impl/Util/IdValidationUtil.php | 0 .../Impl/Util/InternalFailureException.php | 0 .../ElasticApm/Impl/Util/JsonException.php | 0 .../php}/ElasticApm/Impl/Util/JsonUtil.php | 0 .../ElasticApm/Impl/Util/NoopObjectTrait.php | 0 .../php}/ElasticApm/Impl/Util/NumericUtil.php | 0 .../php}/ElasticApm/Impl/Util/ObserverSet.php | 0 .../php}/ElasticApm/Impl/Util/PhpErrorUtil.php | 0 .../Impl/Util/PhpFormatStackTraceFrame.php | 0 .../php}/ElasticApm/Impl/Util/RandomUtil.php | 0 .../php}/ElasticApm/Impl/Util/RangeUtil.php | 0 .../Impl/Util/SingletonInstanceTrait.php | 0 .../Impl/Util/StackTraceFrameBase.php | 0 .../ElasticApm/Impl/Util/StackTraceUtil.php | 0 .../ElasticApm/Impl/Util/StaticClassTrait.php | 0 .../php}/ElasticApm/Impl/Util/TextUtil.php | 0 .../php}/ElasticApm/Impl/Util/TimeUtil.php | 0 .../php}/ElasticApm/Impl/Util/UrlParts.php | 0 .../php}/ElasticApm/Impl/Util/UrlUtil.php | 0 .../Impl/Util/WildcardListMatcher.php | 0 .../ElasticApm/Impl/Util/WildcardMatcher.php | 0 .../php}/ElasticApm/SpanContextDbInterface.php | 0 .../SpanContextDestinationInterface.php | 0 .../ElasticApm/SpanContextHttpInterface.php | 0 .../php}/ElasticApm/SpanContextInterface.php | 0 .../ElasticApm/SpanContextServiceInterface.php | 0 .../SpanContextServiceTargetInterface.php | 0 .../php}/ElasticApm/SpanInterface.php | 0 .../ElasticApm/TransactionBuilderInterface.php | 0 .../ElasticApm/TransactionContextInterface.php | 0 .../TransactionContextRequestInterface.php | 0 .../TransactionContextRequestUrlInterface.php | 0 .../TransactionContextUserInterface.php | 0 .../php}/ElasticApm/TransactionInterface.php | 0 {src => agent/php}/bootstrap_php_part.php | 0 modernbuild/docker-compose.yml | 18 ------------------ 384 files changed, 27 insertions(+), 28 deletions(-) rename {modernbuild/project => agent/native}/CMakeLists.txt (96%) rename {modernbuild/project => agent/native}/CMakePresets.json (100%) rename {modernbuild/project => agent/native/building}/cmake/conan.cmake (100%) rename {modernbuild/project => agent/native/building}/cmake/elastic_conan_export.cmake (100%) rename {modernbuild/project => agent/native/building}/cmake/elastic_conan_installer.cmake (90%) rename {modernbuild/project => agent/native/building}/cmake/elastic_get_git_version.cmake (100%) rename {modernbuild/project => agent/native/building}/cmake/elastic_set_default_build_options.cmake (100%) rename {modernbuild/project => agent/native/building}/cmake/test_venv.py (100%) rename {modernbuild/project => agent/native/building}/conan/conan_profile.in (100%) rename {modernbuild/project => agent/native/building}/conan/settings.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php72/conandata.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php72/conanfile.py (100%) rename {modernbuild/project => agent/native/building}/dependencies/php73/conandata.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php73/conanfile.py (100%) rename {modernbuild/project => agent/native/building}/dependencies/php74/conandata.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php74/conanfile.py (100%) rename {modernbuild/project => agent/native/building}/dependencies/php80/conandata.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php80/conanfile.py (100%) rename {modernbuild/project => agent/native/building}/dependencies/php81/conandata.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php81/conanfile.py (100%) rename {modernbuild/project => agent/native/building}/dependencies/php82/conandata.yml (100%) rename {modernbuild/project => agent/native/building}/dependencies/php82/conanfile.py (100%) create mode 100644 agent/native/building/dockerized/docker-compose.yml rename modernbuild/image/Dockerfile => agent/native/building/dockerized/images/Dockerfile_glibc (99%) rename {modernbuild/image => agent/native/building/dockerized/images}/Dockerfile_musl (98%) rename {src => agent/native}/ext/.gitignore (100%) rename {src => agent/native}/ext/AST_instrumentation.c (100%) rename {src => agent/native}/ext/AST_instrumentation.h (100%) rename {src => agent/native}/ext/CMakeLists.txt (100%) rename {src => agent/native}/ext/ConfigManager.c (100%) rename {src => agent/native}/ext/ConfigManager.h (100%) rename {src => agent/native}/ext/IntrusiveDoublyLinkedList.h (100%) rename {src => agent/native}/ext/MemoryTracker.c (100%) rename {src => agent/native}/ext/MemoryTracker.h (100%) rename {src => agent/native}/ext/ResultCode.c (100%) rename {src => agent/native}/ext/ResultCode.h (100%) rename {src => agent/native}/ext/StringView.h (100%) rename {src => agent/native}/ext/SystemMetrics.c (100%) rename {src => agent/native}/ext/SystemMetrics.h (100%) rename {src => agent/native}/ext/TextOutputStream.c (100%) rename {src => agent/native}/ext/TextOutputStream.h (100%) rename {src => agent/native}/ext/Tracer.c (100%) rename {src => agent/native}/ext/Tracer.h (100%) rename {src => agent/native}/ext/backend_comm.c (100%) rename {src => agent/native}/ext/backend_comm.h (100%) rename {src => agent/native}/ext/basic_macros.h (100%) rename {src => agent/native}/ext/basic_types.h (100%) rename {src => agent/native}/ext/basic_util.h (100%) rename {src => agent/native}/ext/config.m4 (100%) rename {src => agent/native}/ext/config.w32 (100%) rename {src => agent/native}/ext/constants.h (100%) rename {src => agent/native}/ext/elastic_apm.c (100%) rename {src => agent/native}/ext/elastic_apm.ini (100%) rename {src => agent/native}/ext/elastic_apm_API.c (100%) rename {src => agent/native}/ext/elastic_apm_API.h (100%) rename {src => agent/native}/ext/elastic_apm_alloc.h (100%) rename {src => agent/native}/ext/elastic_apm_assert.c (100%) rename {src => agent/native}/ext/elastic_apm_assert.h (100%) rename {src => agent/native}/ext/elastic_apm_clock.h (100%) rename {src => agent/native}/ext/elastic_apm_is_debug_build.h (100%) rename {src => agent/native}/ext/elastic_apm_version.h (100%) rename {src => agent/native}/ext/internal_checks.c (100%) rename {src => agent/native}/ext/internal_checks.h (100%) rename {src => agent/native}/ext/lifecycle.c (100%) rename {src => agent/native}/ext/lifecycle.h (100%) rename {src => agent/native}/ext/log.c (100%) rename {src => agent/native}/ext/log.h (100%) rename {src => agent/native}/ext/numbered_intercepting_callbacks.h (100%) rename {src => agent/native}/ext/php_elastic_apm.h (100%) rename {src => agent/native}/ext/php_error.c (100%) rename {src => agent/native}/ext/php_error.h (100%) rename {src => agent/native}/ext/platform.c (100%) rename {src => agent/native}/ext/platform.h (100%) rename {src => agent/native}/ext/platform_threads.h (100%) rename {src => agent/native}/ext/platform_threads_linux.c (100%) rename {src => agent/native}/ext/sample_prof.c (100%) rename {src => agent/native}/ext/supportability.c (100%) rename {src => agent/native}/ext/supportability.h (100%) rename {src => agent/native}/ext/supportability_zend.h (100%) rename {src => agent/native}/ext/tests/config_boolean_0_using_env_var_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_0_using_ini_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_1_using_env_var_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_1_using_ini_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_FaLSe_using_env_var_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_FaLSe_using_ini_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_No_using_env_var_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_No_using_ini_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_OFF_using_env_var_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_OFF_using_ini_is_false.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_TRue_using_env_var_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_TRue_using_ini_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_oN_using_env_var_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_oN_using_ini_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_yEs_using_env_var_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_boolean_yEs_using_ini_is_true.phpt (100%) rename {src => agent/native}/ext/tests/config_defaults.phpt (100%) rename {src => agent/native}/ext/tests/config_dynamic_options.phpt (100%) rename {src => agent/native}/ext/tests/config_enabled_ini_setting_cannot_be_changed_after_start.phpt (100%) rename {src => agent/native}/ext/tests/config_ini_has_higher_precedence_than_env_vars.phpt (100%) rename {src => agent/native}/ext/tests/config_invalid_ini_fallback_default_not_env_var.phpt (100%) rename {src => agent/native}/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt (100%) rename {src => agent/native}/ext/tests/config_setting_to_invalid_values_using_ini.phpt (100%) rename {src => agent/native}/ext/tests/config_setting_to_non-defaults_using_env_vars.phpt (100%) rename {src => agent/native}/ext/tests/config_setting_to_non-defaults_using_ini.phpt (100%) rename {src => agent/native}/ext/tests/config_type_LogLevel_is_case_insensitive.phpt (100%) rename {src => agent/native}/ext/tests/config_type_LogLevel_unambiguous_prefix_is_enough.phpt (100%) rename {src => agent/native}/ext/tests/opcache_preload_detection.inc (100%) rename {src => agent/native}/ext/tests/opcache_preload_detection.phpt (100%) rename {src => agent/native}/ext/tests/opcache_preload_detection_double.phpt (100%) rename {src => agent/native}/ext/tests_util/tests_util.php (100%) rename {src => agent/native}/ext/time_util.c (100%) rename {src => agent/native}/ext/time_util.h (100%) rename {src => agent/native}/ext/tracer_PHP_part.c (100%) rename {src => agent/native}/ext/tracer_PHP_part.h (100%) rename {src => agent/native}/ext/unit_tests/CMakeLists.txt (100%) rename {src => agent/native}/ext/unit_tests/DynamicArray.c (100%) rename {src => agent/native}/ext/unit_tests/DynamicArray.h (100%) rename {src => agent/native}/ext/unit_tests/DynamicArray_tests.c (100%) rename {src => agent/native}/ext/unit_tests/IntrusiveDoublyLinkedList_tests.c (100%) rename {src => agent/native}/ext/unit_tests/Logger_tests.c (100%) rename {src => agent/native}/ext/unit_tests/MemoryTracker_tests.c (100%) rename {src => agent/native}/ext/unit_tests/ResultCode_tests.c (100%) rename {src => agent/native}/ext/unit_tests/StringToStringMap.c (100%) rename {src => agent/native}/ext/unit_tests/StringToStringMap.h (100%) rename {src => agent/native}/ext/unit_tests/StringToStringMap_tests.c (100%) rename {src => agent/native}/ext/unit_tests/TextOutputStream_tests.c (100%) rename {src => agent/native}/ext/unit_tests/TextOutputStream_tests.h (100%) rename {src => agent/native}/ext/unit_tests/basic_macros_tests.c (100%) rename {src => agent/native}/ext/unit_tests/basic_types_tests.c (100%) rename {src => agent/native}/ext/unit_tests/cmocka_wrapped_for_unit_tests.h (100%) rename {src => agent/native}/ext/unit_tests/config_tests.c (100%) rename {src => agent/native}/ext/unit_tests/default_test_fixture.c (100%) rename {src => agent/native}/ext/unit_tests/default_test_fixture.h (100%) rename {src => agent/native}/ext/unit_tests/gen_numbered_intercepting_callbacks_src.h (100%) rename {src => agent/native}/ext/unit_tests/iterateOverCStackTrace_tests.c (100%) rename {src => agent/native}/ext/unit_tests/main.c (100%) rename {src => agent/native}/ext/unit_tests/mock_alloc.c (100%) rename {src => agent/native}/ext/unit_tests/mock_assert.c (100%) rename {src => agent/native}/ext/unit_tests/mock_assert.h (100%) rename {src => agent/native}/ext/unit_tests/mock_clock.c (100%) rename {src => agent/native}/ext/unit_tests/mock_clock.h (100%) rename {src => agent/native}/ext/unit_tests/mock_env_vars.c (100%) rename {src => agent/native}/ext/unit_tests/mock_env_vars.h (100%) rename {src => agent/native}/ext/unit_tests/mock_global_tracer.c (100%) rename {src => agent/native}/ext/unit_tests/mock_log_custom_sink.c (100%) rename {src => agent/native}/ext/unit_tests/mock_log_custom_sink.h (100%) rename {src => agent/native}/ext/unit_tests/mock_php.h (100%) rename {src => agent/native}/ext/unit_tests/mock_php_ini.c (100%) rename {src => agent/native}/ext/unit_tests/mock_php_ini.h (100%) rename {src => agent/native}/ext/unit_tests/mock_stdlib.h (100%) rename {src => agent/native}/ext/unit_tests/mock_syslog.h (100%) rename {src => agent/native}/ext/unit_tests/parse_value_with_units_tests.c (100%) rename {src => agent/native}/ext/unit_tests/platform_tests.c (100%) rename {src => agent/native}/ext/unit_tests/time_util_tests.c (100%) rename {src => agent/native}/ext/unit_tests/unit_test_util.c (100%) rename {src => agent/native}/ext/unit_tests/unit_test_util.h (100%) rename {src => agent/native}/ext/unit_tests/util_tests.c (100%) rename {src => agent/native}/ext/util.c (100%) rename {src => agent/native}/ext/util.h (100%) rename {src => agent/native}/ext/util_for_PHP.c (100%) rename {src => agent/native}/ext/util_for_PHP.h (100%) rename {src => agent/php}/ElasticApm/CustomErrorData.php (100%) rename {src => agent/php}/ElasticApm/DistributedTracingData.php (100%) rename {src => agent/php}/ElasticApm/ElasticApm.php (100%) rename {src => agent/php}/ElasticApm/ExecutionSegmentContextInterface.php (100%) rename {src => agent/php}/ElasticApm/ExecutionSegmentInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/AutoInstrumentationBase.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/AutoInstrumentationInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Autoloader.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/BootstrapStageLogger.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/BuiltinPlugin.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/CurlAutoInstrumentation.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/CurlHandleTracker.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/CurlHandleWrapped.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/CurlHandleWrappedTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/InstrumentationNames.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/InterceptionManager.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/MySQLiAutoInstrumentation.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/PDOAutoInstrumentation.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/PhpErrorData.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/PluginBase.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/PluginInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Registration.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/RegistrationContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/RegistrationContextInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Util/AutoInstrumentationUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Util/DbAutoInstrumentationUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Util/DbConnectionStringParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObject.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplDynamicProperties.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplWeakMap.php (100%) rename {src => agent/php}/ElasticApm/Impl/AutoInstrument/bootstrap_php_part.php (100%) rename {src => agent/php}/ElasticApm/Impl/BackendComm/EventSender.php (100%) rename {src => agent/php}/ElasticApm/Impl/BackendComm/SerializationException.php (100%) rename {src => agent/php}/ElasticApm/Impl/BackendComm/SerializationUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/BreakdownMetrics/LeafData.php (100%) rename {src => agent/php}/ElasticApm/Impl/BreakdownMetrics/PerSpanTypeData.php (100%) rename {src => agent/php}/ElasticApm/Impl/BreakdownMetrics/PerTransaction.php (100%) rename {src => agent/php}/ElasticApm/Impl/BreakdownMetrics/SelfTimeTracker.php (100%) rename {src => agent/php}/ElasticApm/Impl/Clock.php (100%) rename {src => agent/php}/ElasticApm/Impl/ClockInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/AllOptionsMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/BoolOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/BoolOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/CompositeRawSnapshot.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/CompositeRawSnapshotSource.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/DevInternalSubOptionNames.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/DurationOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/DurationOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/DurationUnits.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/EnumOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/EnvVarsRawSnapshotSource.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/FloatOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/FloatOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/IniRawSnapshotSource.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/IntOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/IntOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/LogLevelOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/LogLevelOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/NullableIntOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/NullableLogLevelOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/NullableOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/NullableStringOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/NullableWildcardListOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/NumericOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/OptionDefaultValues.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/OptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/OptionNames.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/OptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/OptionWithDefaultValueMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/ParseException.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/Parser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/RawSnapshotFromArray.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/RawSnapshotInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/RawSnapshotSourceInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/Snapshot.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/SnapshotDevInternal.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/SnapshotTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/StringOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/StringOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/WildcardListOptionMetadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/Config/WildcardListOptionParser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Constants.php (100%) rename {src => agent/php}/ElasticApm/Impl/ContextPartWrapper.php (100%) rename {src => agent/php}/ElasticApm/Impl/DistributedTracingDataInternal.php (100%) rename {src => agent/php}/ElasticApm/Impl/Error.php (100%) rename {src => agent/php}/ElasticApm/Impl/ErrorExceptionData.php (100%) rename {src => agent/php}/ElasticApm/Impl/ErrorTransactionData.php (100%) rename {src => agent/php}/ElasticApm/Impl/EventSinkInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/ExecutionSegment.php (100%) rename {src => agent/php}/ElasticApm/Impl/ExecutionSegmentContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/GlobalTracerHolder.php (100%) rename {src => agent/php}/ElasticApm/Impl/HttpDistributedTracing.php (100%) rename {src => agent/php}/ElasticApm/Impl/InferredSpanFrame.php (100%) rename {src => agent/php}/ElasticApm/Impl/InferredSpansBuilder.php (100%) rename {src => agent/php}/ElasticApm/Impl/InferredSpansManager.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/AdhocLoggableObject.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/Backend.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/EnabledLoggerProxy.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/EnabledLoggerProxyNoLine.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/Level.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LogCategory.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LogConsts.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LogStream.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LogStreamInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableArray.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableStackTrace.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableToEncodedJson.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableToJsonEncodable.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableToString.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggableTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/Logger.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggerData.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggerFactory.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggingSubsystem.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/LoggingSubsystemException.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/NoopLogSink.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/NoopLoggerFactory.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/PropertyLogPriority.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/SinkBase.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/SinkInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Log/SinkToCExt.php (100%) rename {src => agent/php}/ElasticApm/Impl/Metadata.php (100%) rename {src => agent/php}/ElasticApm/Impl/MetadataDiscoverer.php (100%) rename {src => agent/php}/ElasticApm/Impl/MetricSet.php (100%) rename {src => agent/php}/ElasticApm/Impl/NameVersionData.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopDistributedTracingData.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopEventSink.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopExecutionSegment.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopExecutionSegmentContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpan.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpanContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpanContextDb.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpanContextDestination.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpanContextHttp.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpanContextService.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopSpanContextServiceTarget.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTracer.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTransaction.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTransactionBuilder.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTransactionContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTransactionContextRequest.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTransactionContextRequestUrl.php (100%) rename {src => agent/php}/ElasticApm/Impl/NoopTransactionContextUser.php (100%) rename {src => agent/php}/ElasticApm/Impl/OptionalSerializableDataInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/ProcessData.php (100%) rename {src => agent/php}/ElasticApm/Impl/SerializableDataInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/ServiceAgentData.php (100%) rename {src => agent/php}/ElasticApm/Impl/ServiceData.php (100%) rename {src => agent/php}/ElasticApm/Impl/Span.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContextDb.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContextDestination.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContextDestinationServiceData.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContextHttp.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContextService.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanContextServiceTarget.php (100%) rename {src => agent/php}/ElasticApm/Impl/SpanToSendInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/SrcRootDir.php (100%) rename {src => agent/php}/ElasticApm/Impl/StackTraceFrame.php (100%) rename {src => agent/php}/ElasticApm/Impl/SystemData.php (100%) rename {src => agent/php}/ElasticApm/Impl/Tracer.php (100%) rename {src => agent/php}/ElasticApm/Impl/TracerBuilder.php (100%) rename {src => agent/php}/ElasticApm/Impl/TracerDependencies.php (100%) rename {src => agent/php}/ElasticApm/Impl/TracerInterface.php (100%) rename {src => agent/php}/ElasticApm/Impl/Transaction.php (100%) rename {src => agent/php}/ElasticApm/Impl/TransactionBuilder.php (100%) rename {src => agent/php}/ElasticApm/Impl/TransactionContext.php (100%) rename {src => agent/php}/ElasticApm/Impl/TransactionContextRequest.php (100%) rename {src => agent/php}/ElasticApm/Impl/TransactionContextRequestUrl.php (100%) rename {src => agent/php}/ElasticApm/Impl/TransactionContextUser.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/ArrayUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/Assert.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/AssertException.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/AssertLevel.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/BoolUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/CallerInfo.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/ClassNameUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/ClassicFormatStackTraceFrame.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/DbgUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/ElasticApmExtensionUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/EnabledAssertProxy.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/ExceptionUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/HiddenConstructorTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/IdGenerator.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/IdValidationUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/InternalFailureException.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/JsonException.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/JsonUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/NoopObjectTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/NumericUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/ObserverSet.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/PhpErrorUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/PhpFormatStackTraceFrame.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/RandomUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/RangeUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/SingletonInstanceTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/StackTraceFrameBase.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/StackTraceUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/StaticClassTrait.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/TextUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/TimeUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/UrlParts.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/UrlUtil.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/WildcardListMatcher.php (100%) rename {src => agent/php}/ElasticApm/Impl/Util/WildcardMatcher.php (100%) rename {src => agent/php}/ElasticApm/SpanContextDbInterface.php (100%) rename {src => agent/php}/ElasticApm/SpanContextDestinationInterface.php (100%) rename {src => agent/php}/ElasticApm/SpanContextHttpInterface.php (100%) rename {src => agent/php}/ElasticApm/SpanContextInterface.php (100%) rename {src => agent/php}/ElasticApm/SpanContextServiceInterface.php (100%) rename {src => agent/php}/ElasticApm/SpanContextServiceTargetInterface.php (100%) rename {src => agent/php}/ElasticApm/SpanInterface.php (100%) rename {src => agent/php}/ElasticApm/TransactionBuilderInterface.php (100%) rename {src => agent/php}/ElasticApm/TransactionContextInterface.php (100%) rename {src => agent/php}/ElasticApm/TransactionContextRequestInterface.php (100%) rename {src => agent/php}/ElasticApm/TransactionContextRequestUrlInterface.php (100%) rename {src => agent/php}/ElasticApm/TransactionContextUserInterface.php (100%) rename {src => agent/php}/ElasticApm/TransactionInterface.php (100%) rename {src => agent/php}/bootstrap_php_part.php (100%) delete mode 100644 modernbuild/docker-compose.yml diff --git a/modernbuild/project/CMakeLists.txt b/agent/native/CMakeLists.txt similarity index 96% rename from modernbuild/project/CMakeLists.txt rename to agent/native/CMakeLists.txt index a70b5e60e..7907040f3 100644 --- a/modernbuild/project/CMakeLists.txt +++ b/agent/native/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.26.0) # set path for our local includes -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/building/cmake") include(elastic_get_git_version) elastic_get_git_version(_ELASTIC_PROJECT_VERSION _ELASTIC_SIMPLE_VERSION _ELASTIC_PROJECT_REVISION) @@ -62,7 +62,7 @@ endfunction() message(STATUS "Creating dependencies from local directories") foreach(_php_version ${_supported_php_versions}) elastic_conan_create( - PATH ${CMAKE_SOURCE_DIR}/dependencies/php${_php_version} + PATH ${CMAKE_SOURCE_DIR}/building/dependencies/php${_php_version} REFERENCE php-headers-${_php_version}/1.0@elastic/local PROFILE ${_CONAN_PROFILE} ) @@ -96,4 +96,4 @@ conan_cmake_run(REQUIRES ${dependencies} BASIC_SETUP CMAKE_TARGETS UPDATE NO_OUTPUT_DIRS ) -add_subdirectory(agent) +add_subdirectory(ext) diff --git a/modernbuild/project/CMakePresets.json b/agent/native/CMakePresets.json similarity index 100% rename from modernbuild/project/CMakePresets.json rename to agent/native/CMakePresets.json diff --git a/modernbuild/project/cmake/conan.cmake b/agent/native/building/cmake/conan.cmake similarity index 100% rename from modernbuild/project/cmake/conan.cmake rename to agent/native/building/cmake/conan.cmake diff --git a/modernbuild/project/cmake/elastic_conan_export.cmake b/agent/native/building/cmake/elastic_conan_export.cmake similarity index 100% rename from modernbuild/project/cmake/elastic_conan_export.cmake rename to agent/native/building/cmake/elastic_conan_export.cmake diff --git a/modernbuild/project/cmake/elastic_conan_installer.cmake b/agent/native/building/cmake/elastic_conan_installer.cmake similarity index 90% rename from modernbuild/project/cmake/elastic_conan_installer.cmake rename to agent/native/building/cmake/elastic_conan_installer.cmake index 8471d70f7..7bc9040bc 100644 --- a/modernbuild/project/cmake/elastic_conan_installer.cmake +++ b/agent/native/building/cmake/elastic_conan_installer.cmake @@ -19,7 +19,7 @@ if(NOT EXISTS ${VENV_PATH}) COMMAND ${python} -m venv ${VENV_PATH} COMMAND_ERROR_IS_FATAL ANY ) - file(COPY cmake/test_venv.py DESTINATION ${CMAKE_BINARY_DIR}/) + file(COPY ${CMAKE_SOURCE_DIR}/building/cmake/test_venv.py DESTINATION ${CMAKE_BINARY_DIR}/) set(_VENV_CREATED TRUE) endif() @@ -70,7 +70,7 @@ list(GET _PRV_COMPILER_VERSION_TOKENIZED 1 _PRV_COMPILER_VERSION_MINOR) set(_PRV_COMPILER_VERSION_SHORT "${_PRV_COMPILER_VERSION_MAJOR}.${_PRV_COMPILER_VERSION_MINOR}") set(_CONAN_PROFILE "${CMAKE_BINARY_DIR}/conan_compiler") -configure_file("${CMAKE_SOURCE_DIR}/conan/conan_profile.in" "${_CONAN_PROFILE}" @ONLY) +configure_file("${CMAKE_SOURCE_DIR}/building/conan/conan_profile.in" "${_CONAN_PROFILE}" @ONLY) if(_VENV_CREATED) @@ -92,9 +92,9 @@ if(_VENV_CREATED) endif() -message(STATUS "Installing conan configuration from ${CMAKE_SOURCE_DIR}/conan/settings.yml") +message(STATUS "Installing conan configuration from ${CMAKE_SOURCE_DIR}/building/conan/settings.yml") execute_process( - COMMAND conan config install ${CMAKE_SOURCE_DIR}/conan/settings.yml + COMMAND conan config install ${CMAKE_SOURCE_DIR}/building/conan/settings.yml COMMAND_ERROR_IS_FATAL ANY ) diff --git a/modernbuild/project/cmake/elastic_get_git_version.cmake b/agent/native/building/cmake/elastic_get_git_version.cmake similarity index 100% rename from modernbuild/project/cmake/elastic_get_git_version.cmake rename to agent/native/building/cmake/elastic_get_git_version.cmake diff --git a/modernbuild/project/cmake/elastic_set_default_build_options.cmake b/agent/native/building/cmake/elastic_set_default_build_options.cmake similarity index 100% rename from modernbuild/project/cmake/elastic_set_default_build_options.cmake rename to agent/native/building/cmake/elastic_set_default_build_options.cmake diff --git a/modernbuild/project/cmake/test_venv.py b/agent/native/building/cmake/test_venv.py similarity index 100% rename from modernbuild/project/cmake/test_venv.py rename to agent/native/building/cmake/test_venv.py diff --git a/modernbuild/project/conan/conan_profile.in b/agent/native/building/conan/conan_profile.in similarity index 100% rename from modernbuild/project/conan/conan_profile.in rename to agent/native/building/conan/conan_profile.in diff --git a/modernbuild/project/conan/settings.yml b/agent/native/building/conan/settings.yml similarity index 100% rename from modernbuild/project/conan/settings.yml rename to agent/native/building/conan/settings.yml diff --git a/modernbuild/project/dependencies/php72/conandata.yml b/agent/native/building/dependencies/php72/conandata.yml similarity index 100% rename from modernbuild/project/dependencies/php72/conandata.yml rename to agent/native/building/dependencies/php72/conandata.yml diff --git a/modernbuild/project/dependencies/php72/conanfile.py b/agent/native/building/dependencies/php72/conanfile.py similarity index 100% rename from modernbuild/project/dependencies/php72/conanfile.py rename to agent/native/building/dependencies/php72/conanfile.py diff --git a/modernbuild/project/dependencies/php73/conandata.yml b/agent/native/building/dependencies/php73/conandata.yml similarity index 100% rename from modernbuild/project/dependencies/php73/conandata.yml rename to agent/native/building/dependencies/php73/conandata.yml diff --git a/modernbuild/project/dependencies/php73/conanfile.py b/agent/native/building/dependencies/php73/conanfile.py similarity index 100% rename from modernbuild/project/dependencies/php73/conanfile.py rename to agent/native/building/dependencies/php73/conanfile.py diff --git a/modernbuild/project/dependencies/php74/conandata.yml b/agent/native/building/dependencies/php74/conandata.yml similarity index 100% rename from modernbuild/project/dependencies/php74/conandata.yml rename to agent/native/building/dependencies/php74/conandata.yml diff --git a/modernbuild/project/dependencies/php74/conanfile.py b/agent/native/building/dependencies/php74/conanfile.py similarity index 100% rename from modernbuild/project/dependencies/php74/conanfile.py rename to agent/native/building/dependencies/php74/conanfile.py diff --git a/modernbuild/project/dependencies/php80/conandata.yml b/agent/native/building/dependencies/php80/conandata.yml similarity index 100% rename from modernbuild/project/dependencies/php80/conandata.yml rename to agent/native/building/dependencies/php80/conandata.yml diff --git a/modernbuild/project/dependencies/php80/conanfile.py b/agent/native/building/dependencies/php80/conanfile.py similarity index 100% rename from modernbuild/project/dependencies/php80/conanfile.py rename to agent/native/building/dependencies/php80/conanfile.py diff --git a/modernbuild/project/dependencies/php81/conandata.yml b/agent/native/building/dependencies/php81/conandata.yml similarity index 100% rename from modernbuild/project/dependencies/php81/conandata.yml rename to agent/native/building/dependencies/php81/conandata.yml diff --git a/modernbuild/project/dependencies/php81/conanfile.py b/agent/native/building/dependencies/php81/conanfile.py similarity index 100% rename from modernbuild/project/dependencies/php81/conanfile.py rename to agent/native/building/dependencies/php81/conanfile.py diff --git a/modernbuild/project/dependencies/php82/conandata.yml b/agent/native/building/dependencies/php82/conandata.yml similarity index 100% rename from modernbuild/project/dependencies/php82/conandata.yml rename to agent/native/building/dependencies/php82/conandata.yml diff --git a/modernbuild/project/dependencies/php82/conanfile.py b/agent/native/building/dependencies/php82/conanfile.py similarity index 100% rename from modernbuild/project/dependencies/php82/conanfile.py rename to agent/native/building/dependencies/php82/conanfile.py diff --git a/agent/native/building/dockerized/docker-compose.yml b/agent/native/building/dockerized/docker-compose.yml new file mode 100644 index 000000000..7785ad24d --- /dev/null +++ b/agent/native/building/dockerized/docker-compose.yml @@ -0,0 +1,17 @@ +version: "2.1" +services: + build_apm_php: + build: + context: . + dockerfile: images/Dockerfile_glibc + volumes: + - ../../../../:/source + command: sh -c "cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" + + build_apm_php_musl: + build: + context: . + dockerfile: images/Dockerfile_musl + volumes: + - ../../../../:/source + command: sh -c "cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" diff --git a/modernbuild/image/Dockerfile b/agent/native/building/dockerized/images/Dockerfile_glibc similarity index 99% rename from modernbuild/image/Dockerfile rename to agent/native/building/dockerized/images/Dockerfile_glibc index e82cc9ca6..5c86e588b 100644 --- a/modernbuild/image/Dockerfile +++ b/agent/native/building/dockerized/images/Dockerfile_glibc @@ -98,7 +98,7 @@ RUN adduser -p password ${USER_NAME} \ USER ${USER_NAME} -WORKDIR /source/modernbuild +WORKDIR /source/agent/native ENV PATH="/opt/binutils-${BINUTILS_VERSION}/bin:/opt/cmake-${CMAKE_VERSION}/bin:/opt/python-${PYTHON_VERSION}/bin:${PATH}" ENV CMAKE_INSTALL_PREFIX=/opt/cmake-${CMAKE_VERSION} diff --git a/modernbuild/image/Dockerfile_musl b/agent/native/building/dockerized/images/Dockerfile_musl similarity index 98% rename from modernbuild/image/Dockerfile_musl rename to agent/native/building/dockerized/images/Dockerfile_musl index bba65b978..5d1b87b96 100644 --- a/modernbuild/image/Dockerfile_musl +++ b/agent/native/building/dockerized/images/Dockerfile_musl @@ -62,7 +62,7 @@ RUN cd cmake-${CMAKE_VERSION} \ && make -j$(nproc)\ && sudo make install -FROM alpine:3.16 +FROM alpine:3.10 COPY --from=devtools_alpine /opt /opt @@ -80,7 +80,7 @@ RUN adduser --disabled-password --gecos '' ${USER_NAME} \ USER ${USER_NAME} -WORKDIR /source/modernbuild +WORKDIR /source/agent/native ENV PATH="/opt/binutils-${BINUTILS_VERSION}/bin:/opt/cmake-${CMAKE_VERSION}/bin:${PATH}" ENV CMAKE_INSTALL_PREFIX=/opt/cmake-${CMAKE_VERSION} diff --git a/src/ext/.gitignore b/agent/native/ext/.gitignore similarity index 100% rename from src/ext/.gitignore rename to agent/native/ext/.gitignore diff --git a/src/ext/AST_instrumentation.c b/agent/native/ext/AST_instrumentation.c similarity index 100% rename from src/ext/AST_instrumentation.c rename to agent/native/ext/AST_instrumentation.c diff --git a/src/ext/AST_instrumentation.h b/agent/native/ext/AST_instrumentation.h similarity index 100% rename from src/ext/AST_instrumentation.h rename to agent/native/ext/AST_instrumentation.h diff --git a/src/ext/CMakeLists.txt b/agent/native/ext/CMakeLists.txt similarity index 100% rename from src/ext/CMakeLists.txt rename to agent/native/ext/CMakeLists.txt diff --git a/src/ext/ConfigManager.c b/agent/native/ext/ConfigManager.c similarity index 100% rename from src/ext/ConfigManager.c rename to agent/native/ext/ConfigManager.c diff --git a/src/ext/ConfigManager.h b/agent/native/ext/ConfigManager.h similarity index 100% rename from src/ext/ConfigManager.h rename to agent/native/ext/ConfigManager.h diff --git a/src/ext/IntrusiveDoublyLinkedList.h b/agent/native/ext/IntrusiveDoublyLinkedList.h similarity index 100% rename from src/ext/IntrusiveDoublyLinkedList.h rename to agent/native/ext/IntrusiveDoublyLinkedList.h diff --git a/src/ext/MemoryTracker.c b/agent/native/ext/MemoryTracker.c similarity index 100% rename from src/ext/MemoryTracker.c rename to agent/native/ext/MemoryTracker.c diff --git a/src/ext/MemoryTracker.h b/agent/native/ext/MemoryTracker.h similarity index 100% rename from src/ext/MemoryTracker.h rename to agent/native/ext/MemoryTracker.h diff --git a/src/ext/ResultCode.c b/agent/native/ext/ResultCode.c similarity index 100% rename from src/ext/ResultCode.c rename to agent/native/ext/ResultCode.c diff --git a/src/ext/ResultCode.h b/agent/native/ext/ResultCode.h similarity index 100% rename from src/ext/ResultCode.h rename to agent/native/ext/ResultCode.h diff --git a/src/ext/StringView.h b/agent/native/ext/StringView.h similarity index 100% rename from src/ext/StringView.h rename to agent/native/ext/StringView.h diff --git a/src/ext/SystemMetrics.c b/agent/native/ext/SystemMetrics.c similarity index 100% rename from src/ext/SystemMetrics.c rename to agent/native/ext/SystemMetrics.c diff --git a/src/ext/SystemMetrics.h b/agent/native/ext/SystemMetrics.h similarity index 100% rename from src/ext/SystemMetrics.h rename to agent/native/ext/SystemMetrics.h diff --git a/src/ext/TextOutputStream.c b/agent/native/ext/TextOutputStream.c similarity index 100% rename from src/ext/TextOutputStream.c rename to agent/native/ext/TextOutputStream.c diff --git a/src/ext/TextOutputStream.h b/agent/native/ext/TextOutputStream.h similarity index 100% rename from src/ext/TextOutputStream.h rename to agent/native/ext/TextOutputStream.h diff --git a/src/ext/Tracer.c b/agent/native/ext/Tracer.c similarity index 100% rename from src/ext/Tracer.c rename to agent/native/ext/Tracer.c diff --git a/src/ext/Tracer.h b/agent/native/ext/Tracer.h similarity index 100% rename from src/ext/Tracer.h rename to agent/native/ext/Tracer.h diff --git a/src/ext/backend_comm.c b/agent/native/ext/backend_comm.c similarity index 100% rename from src/ext/backend_comm.c rename to agent/native/ext/backend_comm.c diff --git a/src/ext/backend_comm.h b/agent/native/ext/backend_comm.h similarity index 100% rename from src/ext/backend_comm.h rename to agent/native/ext/backend_comm.h diff --git a/src/ext/basic_macros.h b/agent/native/ext/basic_macros.h similarity index 100% rename from src/ext/basic_macros.h rename to agent/native/ext/basic_macros.h diff --git a/src/ext/basic_types.h b/agent/native/ext/basic_types.h similarity index 100% rename from src/ext/basic_types.h rename to agent/native/ext/basic_types.h diff --git a/src/ext/basic_util.h b/agent/native/ext/basic_util.h similarity index 100% rename from src/ext/basic_util.h rename to agent/native/ext/basic_util.h diff --git a/src/ext/config.m4 b/agent/native/ext/config.m4 similarity index 100% rename from src/ext/config.m4 rename to agent/native/ext/config.m4 diff --git a/src/ext/config.w32 b/agent/native/ext/config.w32 similarity index 100% rename from src/ext/config.w32 rename to agent/native/ext/config.w32 diff --git a/src/ext/constants.h b/agent/native/ext/constants.h similarity index 100% rename from src/ext/constants.h rename to agent/native/ext/constants.h diff --git a/src/ext/elastic_apm.c b/agent/native/ext/elastic_apm.c similarity index 100% rename from src/ext/elastic_apm.c rename to agent/native/ext/elastic_apm.c diff --git a/src/ext/elastic_apm.ini b/agent/native/ext/elastic_apm.ini similarity index 100% rename from src/ext/elastic_apm.ini rename to agent/native/ext/elastic_apm.ini diff --git a/src/ext/elastic_apm_API.c b/agent/native/ext/elastic_apm_API.c similarity index 100% rename from src/ext/elastic_apm_API.c rename to agent/native/ext/elastic_apm_API.c diff --git a/src/ext/elastic_apm_API.h b/agent/native/ext/elastic_apm_API.h similarity index 100% rename from src/ext/elastic_apm_API.h rename to agent/native/ext/elastic_apm_API.h diff --git a/src/ext/elastic_apm_alloc.h b/agent/native/ext/elastic_apm_alloc.h similarity index 100% rename from src/ext/elastic_apm_alloc.h rename to agent/native/ext/elastic_apm_alloc.h diff --git a/src/ext/elastic_apm_assert.c b/agent/native/ext/elastic_apm_assert.c similarity index 100% rename from src/ext/elastic_apm_assert.c rename to agent/native/ext/elastic_apm_assert.c diff --git a/src/ext/elastic_apm_assert.h b/agent/native/ext/elastic_apm_assert.h similarity index 100% rename from src/ext/elastic_apm_assert.h rename to agent/native/ext/elastic_apm_assert.h diff --git a/src/ext/elastic_apm_clock.h b/agent/native/ext/elastic_apm_clock.h similarity index 100% rename from src/ext/elastic_apm_clock.h rename to agent/native/ext/elastic_apm_clock.h diff --git a/src/ext/elastic_apm_is_debug_build.h b/agent/native/ext/elastic_apm_is_debug_build.h similarity index 100% rename from src/ext/elastic_apm_is_debug_build.h rename to agent/native/ext/elastic_apm_is_debug_build.h diff --git a/src/ext/elastic_apm_version.h b/agent/native/ext/elastic_apm_version.h similarity index 100% rename from src/ext/elastic_apm_version.h rename to agent/native/ext/elastic_apm_version.h diff --git a/src/ext/internal_checks.c b/agent/native/ext/internal_checks.c similarity index 100% rename from src/ext/internal_checks.c rename to agent/native/ext/internal_checks.c diff --git a/src/ext/internal_checks.h b/agent/native/ext/internal_checks.h similarity index 100% rename from src/ext/internal_checks.h rename to agent/native/ext/internal_checks.h diff --git a/src/ext/lifecycle.c b/agent/native/ext/lifecycle.c similarity index 100% rename from src/ext/lifecycle.c rename to agent/native/ext/lifecycle.c diff --git a/src/ext/lifecycle.h b/agent/native/ext/lifecycle.h similarity index 100% rename from src/ext/lifecycle.h rename to agent/native/ext/lifecycle.h diff --git a/src/ext/log.c b/agent/native/ext/log.c similarity index 100% rename from src/ext/log.c rename to agent/native/ext/log.c diff --git a/src/ext/log.h b/agent/native/ext/log.h similarity index 100% rename from src/ext/log.h rename to agent/native/ext/log.h diff --git a/src/ext/numbered_intercepting_callbacks.h b/agent/native/ext/numbered_intercepting_callbacks.h similarity index 100% rename from src/ext/numbered_intercepting_callbacks.h rename to agent/native/ext/numbered_intercepting_callbacks.h diff --git a/src/ext/php_elastic_apm.h b/agent/native/ext/php_elastic_apm.h similarity index 100% rename from src/ext/php_elastic_apm.h rename to agent/native/ext/php_elastic_apm.h diff --git a/src/ext/php_error.c b/agent/native/ext/php_error.c similarity index 100% rename from src/ext/php_error.c rename to agent/native/ext/php_error.c diff --git a/src/ext/php_error.h b/agent/native/ext/php_error.h similarity index 100% rename from src/ext/php_error.h rename to agent/native/ext/php_error.h diff --git a/src/ext/platform.c b/agent/native/ext/platform.c similarity index 100% rename from src/ext/platform.c rename to agent/native/ext/platform.c diff --git a/src/ext/platform.h b/agent/native/ext/platform.h similarity index 100% rename from src/ext/platform.h rename to agent/native/ext/platform.h diff --git a/src/ext/platform_threads.h b/agent/native/ext/platform_threads.h similarity index 100% rename from src/ext/platform_threads.h rename to agent/native/ext/platform_threads.h diff --git a/src/ext/platform_threads_linux.c b/agent/native/ext/platform_threads_linux.c similarity index 100% rename from src/ext/platform_threads_linux.c rename to agent/native/ext/platform_threads_linux.c diff --git a/src/ext/sample_prof.c b/agent/native/ext/sample_prof.c similarity index 100% rename from src/ext/sample_prof.c rename to agent/native/ext/sample_prof.c diff --git a/src/ext/supportability.c b/agent/native/ext/supportability.c similarity index 100% rename from src/ext/supportability.c rename to agent/native/ext/supportability.c diff --git a/src/ext/supportability.h b/agent/native/ext/supportability.h similarity index 100% rename from src/ext/supportability.h rename to agent/native/ext/supportability.h diff --git a/src/ext/supportability_zend.h b/agent/native/ext/supportability_zend.h similarity index 100% rename from src/ext/supportability_zend.h rename to agent/native/ext/supportability_zend.h diff --git a/src/ext/tests/config_boolean_0_using_env_var_is_false.phpt b/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_0_using_env_var_is_false.phpt rename to agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt diff --git a/src/ext/tests/config_boolean_0_using_ini_is_false.phpt b/agent/native/ext/tests/config_boolean_0_using_ini_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_0_using_ini_is_false.phpt rename to agent/native/ext/tests/config_boolean_0_using_ini_is_false.phpt diff --git a/src/ext/tests/config_boolean_1_using_env_var_is_true.phpt b/agent/native/ext/tests/config_boolean_1_using_env_var_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_1_using_env_var_is_true.phpt rename to agent/native/ext/tests/config_boolean_1_using_env_var_is_true.phpt diff --git a/src/ext/tests/config_boolean_1_using_ini_is_true.phpt b/agent/native/ext/tests/config_boolean_1_using_ini_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_1_using_ini_is_true.phpt rename to agent/native/ext/tests/config_boolean_1_using_ini_is_true.phpt diff --git a/src/ext/tests/config_boolean_FaLSe_using_env_var_is_false.phpt b/agent/native/ext/tests/config_boolean_FaLSe_using_env_var_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_FaLSe_using_env_var_is_false.phpt rename to agent/native/ext/tests/config_boolean_FaLSe_using_env_var_is_false.phpt diff --git a/src/ext/tests/config_boolean_FaLSe_using_ini_is_false.phpt b/agent/native/ext/tests/config_boolean_FaLSe_using_ini_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_FaLSe_using_ini_is_false.phpt rename to agent/native/ext/tests/config_boolean_FaLSe_using_ini_is_false.phpt diff --git a/src/ext/tests/config_boolean_No_using_env_var_is_false.phpt b/agent/native/ext/tests/config_boolean_No_using_env_var_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_No_using_env_var_is_false.phpt rename to agent/native/ext/tests/config_boolean_No_using_env_var_is_false.phpt diff --git a/src/ext/tests/config_boolean_No_using_ini_is_false.phpt b/agent/native/ext/tests/config_boolean_No_using_ini_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_No_using_ini_is_false.phpt rename to agent/native/ext/tests/config_boolean_No_using_ini_is_false.phpt diff --git a/src/ext/tests/config_boolean_OFF_using_env_var_is_false.phpt b/agent/native/ext/tests/config_boolean_OFF_using_env_var_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_OFF_using_env_var_is_false.phpt rename to agent/native/ext/tests/config_boolean_OFF_using_env_var_is_false.phpt diff --git a/src/ext/tests/config_boolean_OFF_using_ini_is_false.phpt b/agent/native/ext/tests/config_boolean_OFF_using_ini_is_false.phpt similarity index 100% rename from src/ext/tests/config_boolean_OFF_using_ini_is_false.phpt rename to agent/native/ext/tests/config_boolean_OFF_using_ini_is_false.phpt diff --git a/src/ext/tests/config_boolean_TRue_using_env_var_is_true.phpt b/agent/native/ext/tests/config_boolean_TRue_using_env_var_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_TRue_using_env_var_is_true.phpt rename to agent/native/ext/tests/config_boolean_TRue_using_env_var_is_true.phpt diff --git a/src/ext/tests/config_boolean_TRue_using_ini_is_true.phpt b/agent/native/ext/tests/config_boolean_TRue_using_ini_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_TRue_using_ini_is_true.phpt rename to agent/native/ext/tests/config_boolean_TRue_using_ini_is_true.phpt diff --git a/src/ext/tests/config_boolean_oN_using_env_var_is_true.phpt b/agent/native/ext/tests/config_boolean_oN_using_env_var_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_oN_using_env_var_is_true.phpt rename to agent/native/ext/tests/config_boolean_oN_using_env_var_is_true.phpt diff --git a/src/ext/tests/config_boolean_oN_using_ini_is_true.phpt b/agent/native/ext/tests/config_boolean_oN_using_ini_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_oN_using_ini_is_true.phpt rename to agent/native/ext/tests/config_boolean_oN_using_ini_is_true.phpt diff --git a/src/ext/tests/config_boolean_yEs_using_env_var_is_true.phpt b/agent/native/ext/tests/config_boolean_yEs_using_env_var_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_yEs_using_env_var_is_true.phpt rename to agent/native/ext/tests/config_boolean_yEs_using_env_var_is_true.phpt diff --git a/src/ext/tests/config_boolean_yEs_using_ini_is_true.phpt b/agent/native/ext/tests/config_boolean_yEs_using_ini_is_true.phpt similarity index 100% rename from src/ext/tests/config_boolean_yEs_using_ini_is_true.phpt rename to agent/native/ext/tests/config_boolean_yEs_using_ini_is_true.phpt diff --git a/src/ext/tests/config_defaults.phpt b/agent/native/ext/tests/config_defaults.phpt similarity index 100% rename from src/ext/tests/config_defaults.phpt rename to agent/native/ext/tests/config_defaults.phpt diff --git a/src/ext/tests/config_dynamic_options.phpt b/agent/native/ext/tests/config_dynamic_options.phpt similarity index 100% rename from src/ext/tests/config_dynamic_options.phpt rename to agent/native/ext/tests/config_dynamic_options.phpt diff --git a/src/ext/tests/config_enabled_ini_setting_cannot_be_changed_after_start.phpt b/agent/native/ext/tests/config_enabled_ini_setting_cannot_be_changed_after_start.phpt similarity index 100% rename from src/ext/tests/config_enabled_ini_setting_cannot_be_changed_after_start.phpt rename to agent/native/ext/tests/config_enabled_ini_setting_cannot_be_changed_after_start.phpt diff --git a/src/ext/tests/config_ini_has_higher_precedence_than_env_vars.phpt b/agent/native/ext/tests/config_ini_has_higher_precedence_than_env_vars.phpt similarity index 100% rename from src/ext/tests/config_ini_has_higher_precedence_than_env_vars.phpt rename to agent/native/ext/tests/config_ini_has_higher_precedence_than_env_vars.phpt diff --git a/src/ext/tests/config_invalid_ini_fallback_default_not_env_var.phpt b/agent/native/ext/tests/config_invalid_ini_fallback_default_not_env_var.phpt similarity index 100% rename from src/ext/tests/config_invalid_ini_fallback_default_not_env_var.phpt rename to agent/native/ext/tests/config_invalid_ini_fallback_default_not_env_var.phpt diff --git a/src/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt b/agent/native/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt similarity index 100% rename from src/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt rename to agent/native/ext/tests/config_setting_to_invalid_values_using_env_vars.phpt diff --git a/src/ext/tests/config_setting_to_invalid_values_using_ini.phpt b/agent/native/ext/tests/config_setting_to_invalid_values_using_ini.phpt similarity index 100% rename from src/ext/tests/config_setting_to_invalid_values_using_ini.phpt rename to agent/native/ext/tests/config_setting_to_invalid_values_using_ini.phpt diff --git a/src/ext/tests/config_setting_to_non-defaults_using_env_vars.phpt b/agent/native/ext/tests/config_setting_to_non-defaults_using_env_vars.phpt similarity index 100% rename from src/ext/tests/config_setting_to_non-defaults_using_env_vars.phpt rename to agent/native/ext/tests/config_setting_to_non-defaults_using_env_vars.phpt diff --git a/src/ext/tests/config_setting_to_non-defaults_using_ini.phpt b/agent/native/ext/tests/config_setting_to_non-defaults_using_ini.phpt similarity index 100% rename from src/ext/tests/config_setting_to_non-defaults_using_ini.phpt rename to agent/native/ext/tests/config_setting_to_non-defaults_using_ini.phpt diff --git a/src/ext/tests/config_type_LogLevel_is_case_insensitive.phpt b/agent/native/ext/tests/config_type_LogLevel_is_case_insensitive.phpt similarity index 100% rename from src/ext/tests/config_type_LogLevel_is_case_insensitive.phpt rename to agent/native/ext/tests/config_type_LogLevel_is_case_insensitive.phpt diff --git a/src/ext/tests/config_type_LogLevel_unambiguous_prefix_is_enough.phpt b/agent/native/ext/tests/config_type_LogLevel_unambiguous_prefix_is_enough.phpt similarity index 100% rename from src/ext/tests/config_type_LogLevel_unambiguous_prefix_is_enough.phpt rename to agent/native/ext/tests/config_type_LogLevel_unambiguous_prefix_is_enough.phpt diff --git a/src/ext/tests/opcache_preload_detection.inc b/agent/native/ext/tests/opcache_preload_detection.inc similarity index 100% rename from src/ext/tests/opcache_preload_detection.inc rename to agent/native/ext/tests/opcache_preload_detection.inc diff --git a/src/ext/tests/opcache_preload_detection.phpt b/agent/native/ext/tests/opcache_preload_detection.phpt similarity index 100% rename from src/ext/tests/opcache_preload_detection.phpt rename to agent/native/ext/tests/opcache_preload_detection.phpt diff --git a/src/ext/tests/opcache_preload_detection_double.phpt b/agent/native/ext/tests/opcache_preload_detection_double.phpt similarity index 100% rename from src/ext/tests/opcache_preload_detection_double.phpt rename to agent/native/ext/tests/opcache_preload_detection_double.phpt diff --git a/src/ext/tests_util/tests_util.php b/agent/native/ext/tests_util/tests_util.php similarity index 100% rename from src/ext/tests_util/tests_util.php rename to agent/native/ext/tests_util/tests_util.php diff --git a/src/ext/time_util.c b/agent/native/ext/time_util.c similarity index 100% rename from src/ext/time_util.c rename to agent/native/ext/time_util.c diff --git a/src/ext/time_util.h b/agent/native/ext/time_util.h similarity index 100% rename from src/ext/time_util.h rename to agent/native/ext/time_util.h diff --git a/src/ext/tracer_PHP_part.c b/agent/native/ext/tracer_PHP_part.c similarity index 100% rename from src/ext/tracer_PHP_part.c rename to agent/native/ext/tracer_PHP_part.c diff --git a/src/ext/tracer_PHP_part.h b/agent/native/ext/tracer_PHP_part.h similarity index 100% rename from src/ext/tracer_PHP_part.h rename to agent/native/ext/tracer_PHP_part.h diff --git a/src/ext/unit_tests/CMakeLists.txt b/agent/native/ext/unit_tests/CMakeLists.txt similarity index 100% rename from src/ext/unit_tests/CMakeLists.txt rename to agent/native/ext/unit_tests/CMakeLists.txt diff --git a/src/ext/unit_tests/DynamicArray.c b/agent/native/ext/unit_tests/DynamicArray.c similarity index 100% rename from src/ext/unit_tests/DynamicArray.c rename to agent/native/ext/unit_tests/DynamicArray.c diff --git a/src/ext/unit_tests/DynamicArray.h b/agent/native/ext/unit_tests/DynamicArray.h similarity index 100% rename from src/ext/unit_tests/DynamicArray.h rename to agent/native/ext/unit_tests/DynamicArray.h diff --git a/src/ext/unit_tests/DynamicArray_tests.c b/agent/native/ext/unit_tests/DynamicArray_tests.c similarity index 100% rename from src/ext/unit_tests/DynamicArray_tests.c rename to agent/native/ext/unit_tests/DynamicArray_tests.c diff --git a/src/ext/unit_tests/IntrusiveDoublyLinkedList_tests.c b/agent/native/ext/unit_tests/IntrusiveDoublyLinkedList_tests.c similarity index 100% rename from src/ext/unit_tests/IntrusiveDoublyLinkedList_tests.c rename to agent/native/ext/unit_tests/IntrusiveDoublyLinkedList_tests.c diff --git a/src/ext/unit_tests/Logger_tests.c b/agent/native/ext/unit_tests/Logger_tests.c similarity index 100% rename from src/ext/unit_tests/Logger_tests.c rename to agent/native/ext/unit_tests/Logger_tests.c diff --git a/src/ext/unit_tests/MemoryTracker_tests.c b/agent/native/ext/unit_tests/MemoryTracker_tests.c similarity index 100% rename from src/ext/unit_tests/MemoryTracker_tests.c rename to agent/native/ext/unit_tests/MemoryTracker_tests.c diff --git a/src/ext/unit_tests/ResultCode_tests.c b/agent/native/ext/unit_tests/ResultCode_tests.c similarity index 100% rename from src/ext/unit_tests/ResultCode_tests.c rename to agent/native/ext/unit_tests/ResultCode_tests.c diff --git a/src/ext/unit_tests/StringToStringMap.c b/agent/native/ext/unit_tests/StringToStringMap.c similarity index 100% rename from src/ext/unit_tests/StringToStringMap.c rename to agent/native/ext/unit_tests/StringToStringMap.c diff --git a/src/ext/unit_tests/StringToStringMap.h b/agent/native/ext/unit_tests/StringToStringMap.h similarity index 100% rename from src/ext/unit_tests/StringToStringMap.h rename to agent/native/ext/unit_tests/StringToStringMap.h diff --git a/src/ext/unit_tests/StringToStringMap_tests.c b/agent/native/ext/unit_tests/StringToStringMap_tests.c similarity index 100% rename from src/ext/unit_tests/StringToStringMap_tests.c rename to agent/native/ext/unit_tests/StringToStringMap_tests.c diff --git a/src/ext/unit_tests/TextOutputStream_tests.c b/agent/native/ext/unit_tests/TextOutputStream_tests.c similarity index 100% rename from src/ext/unit_tests/TextOutputStream_tests.c rename to agent/native/ext/unit_tests/TextOutputStream_tests.c diff --git a/src/ext/unit_tests/TextOutputStream_tests.h b/agent/native/ext/unit_tests/TextOutputStream_tests.h similarity index 100% rename from src/ext/unit_tests/TextOutputStream_tests.h rename to agent/native/ext/unit_tests/TextOutputStream_tests.h diff --git a/src/ext/unit_tests/basic_macros_tests.c b/agent/native/ext/unit_tests/basic_macros_tests.c similarity index 100% rename from src/ext/unit_tests/basic_macros_tests.c rename to agent/native/ext/unit_tests/basic_macros_tests.c diff --git a/src/ext/unit_tests/basic_types_tests.c b/agent/native/ext/unit_tests/basic_types_tests.c similarity index 100% rename from src/ext/unit_tests/basic_types_tests.c rename to agent/native/ext/unit_tests/basic_types_tests.c diff --git a/src/ext/unit_tests/cmocka_wrapped_for_unit_tests.h b/agent/native/ext/unit_tests/cmocka_wrapped_for_unit_tests.h similarity index 100% rename from src/ext/unit_tests/cmocka_wrapped_for_unit_tests.h rename to agent/native/ext/unit_tests/cmocka_wrapped_for_unit_tests.h diff --git a/src/ext/unit_tests/config_tests.c b/agent/native/ext/unit_tests/config_tests.c similarity index 100% rename from src/ext/unit_tests/config_tests.c rename to agent/native/ext/unit_tests/config_tests.c diff --git a/src/ext/unit_tests/default_test_fixture.c b/agent/native/ext/unit_tests/default_test_fixture.c similarity index 100% rename from src/ext/unit_tests/default_test_fixture.c rename to agent/native/ext/unit_tests/default_test_fixture.c diff --git a/src/ext/unit_tests/default_test_fixture.h b/agent/native/ext/unit_tests/default_test_fixture.h similarity index 100% rename from src/ext/unit_tests/default_test_fixture.h rename to agent/native/ext/unit_tests/default_test_fixture.h diff --git a/src/ext/unit_tests/gen_numbered_intercepting_callbacks_src.h b/agent/native/ext/unit_tests/gen_numbered_intercepting_callbacks_src.h similarity index 100% rename from src/ext/unit_tests/gen_numbered_intercepting_callbacks_src.h rename to agent/native/ext/unit_tests/gen_numbered_intercepting_callbacks_src.h diff --git a/src/ext/unit_tests/iterateOverCStackTrace_tests.c b/agent/native/ext/unit_tests/iterateOverCStackTrace_tests.c similarity index 100% rename from src/ext/unit_tests/iterateOverCStackTrace_tests.c rename to agent/native/ext/unit_tests/iterateOverCStackTrace_tests.c diff --git a/src/ext/unit_tests/main.c b/agent/native/ext/unit_tests/main.c similarity index 100% rename from src/ext/unit_tests/main.c rename to agent/native/ext/unit_tests/main.c diff --git a/src/ext/unit_tests/mock_alloc.c b/agent/native/ext/unit_tests/mock_alloc.c similarity index 100% rename from src/ext/unit_tests/mock_alloc.c rename to agent/native/ext/unit_tests/mock_alloc.c diff --git a/src/ext/unit_tests/mock_assert.c b/agent/native/ext/unit_tests/mock_assert.c similarity index 100% rename from src/ext/unit_tests/mock_assert.c rename to agent/native/ext/unit_tests/mock_assert.c diff --git a/src/ext/unit_tests/mock_assert.h b/agent/native/ext/unit_tests/mock_assert.h similarity index 100% rename from src/ext/unit_tests/mock_assert.h rename to agent/native/ext/unit_tests/mock_assert.h diff --git a/src/ext/unit_tests/mock_clock.c b/agent/native/ext/unit_tests/mock_clock.c similarity index 100% rename from src/ext/unit_tests/mock_clock.c rename to agent/native/ext/unit_tests/mock_clock.c diff --git a/src/ext/unit_tests/mock_clock.h b/agent/native/ext/unit_tests/mock_clock.h similarity index 100% rename from src/ext/unit_tests/mock_clock.h rename to agent/native/ext/unit_tests/mock_clock.h diff --git a/src/ext/unit_tests/mock_env_vars.c b/agent/native/ext/unit_tests/mock_env_vars.c similarity index 100% rename from src/ext/unit_tests/mock_env_vars.c rename to agent/native/ext/unit_tests/mock_env_vars.c diff --git a/src/ext/unit_tests/mock_env_vars.h b/agent/native/ext/unit_tests/mock_env_vars.h similarity index 100% rename from src/ext/unit_tests/mock_env_vars.h rename to agent/native/ext/unit_tests/mock_env_vars.h diff --git a/src/ext/unit_tests/mock_global_tracer.c b/agent/native/ext/unit_tests/mock_global_tracer.c similarity index 100% rename from src/ext/unit_tests/mock_global_tracer.c rename to agent/native/ext/unit_tests/mock_global_tracer.c diff --git a/src/ext/unit_tests/mock_log_custom_sink.c b/agent/native/ext/unit_tests/mock_log_custom_sink.c similarity index 100% rename from src/ext/unit_tests/mock_log_custom_sink.c rename to agent/native/ext/unit_tests/mock_log_custom_sink.c diff --git a/src/ext/unit_tests/mock_log_custom_sink.h b/agent/native/ext/unit_tests/mock_log_custom_sink.h similarity index 100% rename from src/ext/unit_tests/mock_log_custom_sink.h rename to agent/native/ext/unit_tests/mock_log_custom_sink.h diff --git a/src/ext/unit_tests/mock_php.h b/agent/native/ext/unit_tests/mock_php.h similarity index 100% rename from src/ext/unit_tests/mock_php.h rename to agent/native/ext/unit_tests/mock_php.h diff --git a/src/ext/unit_tests/mock_php_ini.c b/agent/native/ext/unit_tests/mock_php_ini.c similarity index 100% rename from src/ext/unit_tests/mock_php_ini.c rename to agent/native/ext/unit_tests/mock_php_ini.c diff --git a/src/ext/unit_tests/mock_php_ini.h b/agent/native/ext/unit_tests/mock_php_ini.h similarity index 100% rename from src/ext/unit_tests/mock_php_ini.h rename to agent/native/ext/unit_tests/mock_php_ini.h diff --git a/src/ext/unit_tests/mock_stdlib.h b/agent/native/ext/unit_tests/mock_stdlib.h similarity index 100% rename from src/ext/unit_tests/mock_stdlib.h rename to agent/native/ext/unit_tests/mock_stdlib.h diff --git a/src/ext/unit_tests/mock_syslog.h b/agent/native/ext/unit_tests/mock_syslog.h similarity index 100% rename from src/ext/unit_tests/mock_syslog.h rename to agent/native/ext/unit_tests/mock_syslog.h diff --git a/src/ext/unit_tests/parse_value_with_units_tests.c b/agent/native/ext/unit_tests/parse_value_with_units_tests.c similarity index 100% rename from src/ext/unit_tests/parse_value_with_units_tests.c rename to agent/native/ext/unit_tests/parse_value_with_units_tests.c diff --git a/src/ext/unit_tests/platform_tests.c b/agent/native/ext/unit_tests/platform_tests.c similarity index 100% rename from src/ext/unit_tests/platform_tests.c rename to agent/native/ext/unit_tests/platform_tests.c diff --git a/src/ext/unit_tests/time_util_tests.c b/agent/native/ext/unit_tests/time_util_tests.c similarity index 100% rename from src/ext/unit_tests/time_util_tests.c rename to agent/native/ext/unit_tests/time_util_tests.c diff --git a/src/ext/unit_tests/unit_test_util.c b/agent/native/ext/unit_tests/unit_test_util.c similarity index 100% rename from src/ext/unit_tests/unit_test_util.c rename to agent/native/ext/unit_tests/unit_test_util.c diff --git a/src/ext/unit_tests/unit_test_util.h b/agent/native/ext/unit_tests/unit_test_util.h similarity index 100% rename from src/ext/unit_tests/unit_test_util.h rename to agent/native/ext/unit_tests/unit_test_util.h diff --git a/src/ext/unit_tests/util_tests.c b/agent/native/ext/unit_tests/util_tests.c similarity index 100% rename from src/ext/unit_tests/util_tests.c rename to agent/native/ext/unit_tests/util_tests.c diff --git a/src/ext/util.c b/agent/native/ext/util.c similarity index 100% rename from src/ext/util.c rename to agent/native/ext/util.c diff --git a/src/ext/util.h b/agent/native/ext/util.h similarity index 100% rename from src/ext/util.h rename to agent/native/ext/util.h diff --git a/src/ext/util_for_PHP.c b/agent/native/ext/util_for_PHP.c similarity index 100% rename from src/ext/util_for_PHP.c rename to agent/native/ext/util_for_PHP.c diff --git a/src/ext/util_for_PHP.h b/agent/native/ext/util_for_PHP.h similarity index 100% rename from src/ext/util_for_PHP.h rename to agent/native/ext/util_for_PHP.h diff --git a/src/ElasticApm/CustomErrorData.php b/agent/php/ElasticApm/CustomErrorData.php similarity index 100% rename from src/ElasticApm/CustomErrorData.php rename to agent/php/ElasticApm/CustomErrorData.php diff --git a/src/ElasticApm/DistributedTracingData.php b/agent/php/ElasticApm/DistributedTracingData.php similarity index 100% rename from src/ElasticApm/DistributedTracingData.php rename to agent/php/ElasticApm/DistributedTracingData.php diff --git a/src/ElasticApm/ElasticApm.php b/agent/php/ElasticApm/ElasticApm.php similarity index 100% rename from src/ElasticApm/ElasticApm.php rename to agent/php/ElasticApm/ElasticApm.php diff --git a/src/ElasticApm/ExecutionSegmentContextInterface.php b/agent/php/ElasticApm/ExecutionSegmentContextInterface.php similarity index 100% rename from src/ElasticApm/ExecutionSegmentContextInterface.php rename to agent/php/ElasticApm/ExecutionSegmentContextInterface.php diff --git a/src/ElasticApm/ExecutionSegmentInterface.php b/agent/php/ElasticApm/ExecutionSegmentInterface.php similarity index 100% rename from src/ElasticApm/ExecutionSegmentInterface.php rename to agent/php/ElasticApm/ExecutionSegmentInterface.php diff --git a/src/ElasticApm/Impl/AutoInstrument/AutoInstrumentationBase.php b/agent/php/ElasticApm/Impl/AutoInstrument/AutoInstrumentationBase.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/AutoInstrumentationBase.php rename to agent/php/ElasticApm/Impl/AutoInstrument/AutoInstrumentationBase.php diff --git a/src/ElasticApm/Impl/AutoInstrument/AutoInstrumentationInterface.php b/agent/php/ElasticApm/Impl/AutoInstrument/AutoInstrumentationInterface.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/AutoInstrumentationInterface.php rename to agent/php/ElasticApm/Impl/AutoInstrument/AutoInstrumentationInterface.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Autoloader.php b/agent/php/ElasticApm/Impl/AutoInstrument/Autoloader.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Autoloader.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Autoloader.php diff --git a/src/ElasticApm/Impl/AutoInstrument/BootstrapStageLogger.php b/agent/php/ElasticApm/Impl/AutoInstrument/BootstrapStageLogger.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/BootstrapStageLogger.php rename to agent/php/ElasticApm/Impl/AutoInstrument/BootstrapStageLogger.php diff --git a/src/ElasticApm/Impl/AutoInstrument/BuiltinPlugin.php b/agent/php/ElasticApm/Impl/AutoInstrument/BuiltinPlugin.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/BuiltinPlugin.php rename to agent/php/ElasticApm/Impl/AutoInstrument/BuiltinPlugin.php diff --git a/src/ElasticApm/Impl/AutoInstrument/CurlAutoInstrumentation.php b/agent/php/ElasticApm/Impl/AutoInstrument/CurlAutoInstrumentation.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/CurlAutoInstrumentation.php rename to agent/php/ElasticApm/Impl/AutoInstrument/CurlAutoInstrumentation.php diff --git a/src/ElasticApm/Impl/AutoInstrument/CurlHandleTracker.php b/agent/php/ElasticApm/Impl/AutoInstrument/CurlHandleTracker.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/CurlHandleTracker.php rename to agent/php/ElasticApm/Impl/AutoInstrument/CurlHandleTracker.php diff --git a/src/ElasticApm/Impl/AutoInstrument/CurlHandleWrapped.php b/agent/php/ElasticApm/Impl/AutoInstrument/CurlHandleWrapped.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/CurlHandleWrapped.php rename to agent/php/ElasticApm/Impl/AutoInstrument/CurlHandleWrapped.php diff --git a/src/ElasticApm/Impl/AutoInstrument/CurlHandleWrappedTrait.php b/agent/php/ElasticApm/Impl/AutoInstrument/CurlHandleWrappedTrait.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/CurlHandleWrappedTrait.php rename to agent/php/ElasticApm/Impl/AutoInstrument/CurlHandleWrappedTrait.php diff --git a/src/ElasticApm/Impl/AutoInstrument/InstrumentationNames.php b/agent/php/ElasticApm/Impl/AutoInstrument/InstrumentationNames.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/InstrumentationNames.php rename to agent/php/ElasticApm/Impl/AutoInstrument/InstrumentationNames.php diff --git a/src/ElasticApm/Impl/AutoInstrument/InterceptionManager.php b/agent/php/ElasticApm/Impl/AutoInstrument/InterceptionManager.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/InterceptionManager.php rename to agent/php/ElasticApm/Impl/AutoInstrument/InterceptionManager.php diff --git a/src/ElasticApm/Impl/AutoInstrument/MySQLiAutoInstrumentation.php b/agent/php/ElasticApm/Impl/AutoInstrument/MySQLiAutoInstrumentation.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/MySQLiAutoInstrumentation.php rename to agent/php/ElasticApm/Impl/AutoInstrument/MySQLiAutoInstrumentation.php diff --git a/src/ElasticApm/Impl/AutoInstrument/PDOAutoInstrumentation.php b/agent/php/ElasticApm/Impl/AutoInstrument/PDOAutoInstrumentation.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/PDOAutoInstrumentation.php rename to agent/php/ElasticApm/Impl/AutoInstrument/PDOAutoInstrumentation.php diff --git a/src/ElasticApm/Impl/AutoInstrument/PhpErrorData.php b/agent/php/ElasticApm/Impl/AutoInstrument/PhpErrorData.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/PhpErrorData.php rename to agent/php/ElasticApm/Impl/AutoInstrument/PhpErrorData.php diff --git a/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php b/agent/php/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php rename to agent/php/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php diff --git a/src/ElasticApm/Impl/AutoInstrument/PluginBase.php b/agent/php/ElasticApm/Impl/AutoInstrument/PluginBase.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/PluginBase.php rename to agent/php/ElasticApm/Impl/AutoInstrument/PluginBase.php diff --git a/src/ElasticApm/Impl/AutoInstrument/PluginInterface.php b/agent/php/ElasticApm/Impl/AutoInstrument/PluginInterface.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/PluginInterface.php rename to agent/php/ElasticApm/Impl/AutoInstrument/PluginInterface.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Registration.php b/agent/php/ElasticApm/Impl/AutoInstrument/Registration.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Registration.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Registration.php diff --git a/src/ElasticApm/Impl/AutoInstrument/RegistrationContext.php b/agent/php/ElasticApm/Impl/AutoInstrument/RegistrationContext.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/RegistrationContext.php rename to agent/php/ElasticApm/Impl/AutoInstrument/RegistrationContext.php diff --git a/src/ElasticApm/Impl/AutoInstrument/RegistrationContextInterface.php b/agent/php/ElasticApm/Impl/AutoInstrument/RegistrationContextInterface.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/RegistrationContextInterface.php rename to agent/php/ElasticApm/Impl/AutoInstrument/RegistrationContextInterface.php diff --git a/src/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php b/agent/php/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php rename to agent/php/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Util/AutoInstrumentationUtil.php b/agent/php/ElasticApm/Impl/AutoInstrument/Util/AutoInstrumentationUtil.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Util/AutoInstrumentationUtil.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Util/AutoInstrumentationUtil.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Util/DbAutoInstrumentationUtil.php b/agent/php/ElasticApm/Impl/AutoInstrument/Util/DbAutoInstrumentationUtil.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Util/DbAutoInstrumentationUtil.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Util/DbAutoInstrumentationUtil.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Util/DbConnectionStringParser.php b/agent/php/ElasticApm/Impl/AutoInstrument/Util/DbConnectionStringParser.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Util/DbConnectionStringParser.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Util/DbConnectionStringParser.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObject.php b/agent/php/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObject.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObject.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObject.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplDynamicProperties.php b/agent/php/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplDynamicProperties.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplDynamicProperties.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplDynamicProperties.php diff --git a/src/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplWeakMap.php b/agent/php/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplWeakMap.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplWeakMap.php rename to agent/php/ElasticApm/Impl/AutoInstrument/Util/MapPerWeakObjectImplWeakMap.php diff --git a/src/ElasticApm/Impl/AutoInstrument/bootstrap_php_part.php b/agent/php/ElasticApm/Impl/AutoInstrument/bootstrap_php_part.php similarity index 100% rename from src/ElasticApm/Impl/AutoInstrument/bootstrap_php_part.php rename to agent/php/ElasticApm/Impl/AutoInstrument/bootstrap_php_part.php diff --git a/src/ElasticApm/Impl/BackendComm/EventSender.php b/agent/php/ElasticApm/Impl/BackendComm/EventSender.php similarity index 100% rename from src/ElasticApm/Impl/BackendComm/EventSender.php rename to agent/php/ElasticApm/Impl/BackendComm/EventSender.php diff --git a/src/ElasticApm/Impl/BackendComm/SerializationException.php b/agent/php/ElasticApm/Impl/BackendComm/SerializationException.php similarity index 100% rename from src/ElasticApm/Impl/BackendComm/SerializationException.php rename to agent/php/ElasticApm/Impl/BackendComm/SerializationException.php diff --git a/src/ElasticApm/Impl/BackendComm/SerializationUtil.php b/agent/php/ElasticApm/Impl/BackendComm/SerializationUtil.php similarity index 100% rename from src/ElasticApm/Impl/BackendComm/SerializationUtil.php rename to agent/php/ElasticApm/Impl/BackendComm/SerializationUtil.php diff --git a/src/ElasticApm/Impl/BreakdownMetrics/LeafData.php b/agent/php/ElasticApm/Impl/BreakdownMetrics/LeafData.php similarity index 100% rename from src/ElasticApm/Impl/BreakdownMetrics/LeafData.php rename to agent/php/ElasticApm/Impl/BreakdownMetrics/LeafData.php diff --git a/src/ElasticApm/Impl/BreakdownMetrics/PerSpanTypeData.php b/agent/php/ElasticApm/Impl/BreakdownMetrics/PerSpanTypeData.php similarity index 100% rename from src/ElasticApm/Impl/BreakdownMetrics/PerSpanTypeData.php rename to agent/php/ElasticApm/Impl/BreakdownMetrics/PerSpanTypeData.php diff --git a/src/ElasticApm/Impl/BreakdownMetrics/PerTransaction.php b/agent/php/ElasticApm/Impl/BreakdownMetrics/PerTransaction.php similarity index 100% rename from src/ElasticApm/Impl/BreakdownMetrics/PerTransaction.php rename to agent/php/ElasticApm/Impl/BreakdownMetrics/PerTransaction.php diff --git a/src/ElasticApm/Impl/BreakdownMetrics/SelfTimeTracker.php b/agent/php/ElasticApm/Impl/BreakdownMetrics/SelfTimeTracker.php similarity index 100% rename from src/ElasticApm/Impl/BreakdownMetrics/SelfTimeTracker.php rename to agent/php/ElasticApm/Impl/BreakdownMetrics/SelfTimeTracker.php diff --git a/src/ElasticApm/Impl/Clock.php b/agent/php/ElasticApm/Impl/Clock.php similarity index 100% rename from src/ElasticApm/Impl/Clock.php rename to agent/php/ElasticApm/Impl/Clock.php diff --git a/src/ElasticApm/Impl/ClockInterface.php b/agent/php/ElasticApm/Impl/ClockInterface.php similarity index 100% rename from src/ElasticApm/Impl/ClockInterface.php rename to agent/php/ElasticApm/Impl/ClockInterface.php diff --git a/src/ElasticApm/Impl/Config/AllOptionsMetadata.php b/agent/php/ElasticApm/Impl/Config/AllOptionsMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/AllOptionsMetadata.php rename to agent/php/ElasticApm/Impl/Config/AllOptionsMetadata.php diff --git a/src/ElasticApm/Impl/Config/BoolOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/BoolOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/BoolOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/BoolOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/BoolOptionParser.php b/agent/php/ElasticApm/Impl/Config/BoolOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/BoolOptionParser.php rename to agent/php/ElasticApm/Impl/Config/BoolOptionParser.php diff --git a/src/ElasticApm/Impl/Config/CompositeRawSnapshot.php b/agent/php/ElasticApm/Impl/Config/CompositeRawSnapshot.php similarity index 100% rename from src/ElasticApm/Impl/Config/CompositeRawSnapshot.php rename to agent/php/ElasticApm/Impl/Config/CompositeRawSnapshot.php diff --git a/src/ElasticApm/Impl/Config/CompositeRawSnapshotSource.php b/agent/php/ElasticApm/Impl/Config/CompositeRawSnapshotSource.php similarity index 100% rename from src/ElasticApm/Impl/Config/CompositeRawSnapshotSource.php rename to agent/php/ElasticApm/Impl/Config/CompositeRawSnapshotSource.php diff --git a/src/ElasticApm/Impl/Config/DevInternalSubOptionNames.php b/agent/php/ElasticApm/Impl/Config/DevInternalSubOptionNames.php similarity index 100% rename from src/ElasticApm/Impl/Config/DevInternalSubOptionNames.php rename to agent/php/ElasticApm/Impl/Config/DevInternalSubOptionNames.php diff --git a/src/ElasticApm/Impl/Config/DurationOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/DurationOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/DurationOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/DurationOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/DurationOptionParser.php b/agent/php/ElasticApm/Impl/Config/DurationOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/DurationOptionParser.php rename to agent/php/ElasticApm/Impl/Config/DurationOptionParser.php diff --git a/src/ElasticApm/Impl/Config/DurationUnits.php b/agent/php/ElasticApm/Impl/Config/DurationUnits.php similarity index 100% rename from src/ElasticApm/Impl/Config/DurationUnits.php rename to agent/php/ElasticApm/Impl/Config/DurationUnits.php diff --git a/src/ElasticApm/Impl/Config/EnumOptionParser.php b/agent/php/ElasticApm/Impl/Config/EnumOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/EnumOptionParser.php rename to agent/php/ElasticApm/Impl/Config/EnumOptionParser.php diff --git a/src/ElasticApm/Impl/Config/EnvVarsRawSnapshotSource.php b/agent/php/ElasticApm/Impl/Config/EnvVarsRawSnapshotSource.php similarity index 100% rename from src/ElasticApm/Impl/Config/EnvVarsRawSnapshotSource.php rename to agent/php/ElasticApm/Impl/Config/EnvVarsRawSnapshotSource.php diff --git a/src/ElasticApm/Impl/Config/FloatOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/FloatOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/FloatOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/FloatOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/FloatOptionParser.php b/agent/php/ElasticApm/Impl/Config/FloatOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/FloatOptionParser.php rename to agent/php/ElasticApm/Impl/Config/FloatOptionParser.php diff --git a/src/ElasticApm/Impl/Config/IniRawSnapshotSource.php b/agent/php/ElasticApm/Impl/Config/IniRawSnapshotSource.php similarity index 100% rename from src/ElasticApm/Impl/Config/IniRawSnapshotSource.php rename to agent/php/ElasticApm/Impl/Config/IniRawSnapshotSource.php diff --git a/src/ElasticApm/Impl/Config/IntOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/IntOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/IntOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/IntOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/IntOptionParser.php b/agent/php/ElasticApm/Impl/Config/IntOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/IntOptionParser.php rename to agent/php/ElasticApm/Impl/Config/IntOptionParser.php diff --git a/src/ElasticApm/Impl/Config/LogLevelOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/LogLevelOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/LogLevelOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/LogLevelOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/LogLevelOptionParser.php b/agent/php/ElasticApm/Impl/Config/LogLevelOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/LogLevelOptionParser.php rename to agent/php/ElasticApm/Impl/Config/LogLevelOptionParser.php diff --git a/src/ElasticApm/Impl/Config/NullableIntOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/NullableIntOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/NullableIntOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/NullableIntOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/NullableLogLevelOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/NullableLogLevelOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/NullableLogLevelOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/NullableLogLevelOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/NullableOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/NullableOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/NullableOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/NullableOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/NullableStringOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/NullableStringOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/NullableStringOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/NullableStringOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/NullableWildcardListOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/NullableWildcardListOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/NullableWildcardListOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/NullableWildcardListOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/NumericOptionParser.php b/agent/php/ElasticApm/Impl/Config/NumericOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/NumericOptionParser.php rename to agent/php/ElasticApm/Impl/Config/NumericOptionParser.php diff --git a/src/ElasticApm/Impl/Config/OptionDefaultValues.php b/agent/php/ElasticApm/Impl/Config/OptionDefaultValues.php similarity index 100% rename from src/ElasticApm/Impl/Config/OptionDefaultValues.php rename to agent/php/ElasticApm/Impl/Config/OptionDefaultValues.php diff --git a/src/ElasticApm/Impl/Config/OptionMetadata.php b/agent/php/ElasticApm/Impl/Config/OptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/OptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/OptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/OptionNames.php b/agent/php/ElasticApm/Impl/Config/OptionNames.php similarity index 100% rename from src/ElasticApm/Impl/Config/OptionNames.php rename to agent/php/ElasticApm/Impl/Config/OptionNames.php diff --git a/src/ElasticApm/Impl/Config/OptionParser.php b/agent/php/ElasticApm/Impl/Config/OptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/OptionParser.php rename to agent/php/ElasticApm/Impl/Config/OptionParser.php diff --git a/src/ElasticApm/Impl/Config/OptionWithDefaultValueMetadata.php b/agent/php/ElasticApm/Impl/Config/OptionWithDefaultValueMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/OptionWithDefaultValueMetadata.php rename to agent/php/ElasticApm/Impl/Config/OptionWithDefaultValueMetadata.php diff --git a/src/ElasticApm/Impl/Config/ParseException.php b/agent/php/ElasticApm/Impl/Config/ParseException.php similarity index 100% rename from src/ElasticApm/Impl/Config/ParseException.php rename to agent/php/ElasticApm/Impl/Config/ParseException.php diff --git a/src/ElasticApm/Impl/Config/Parser.php b/agent/php/ElasticApm/Impl/Config/Parser.php similarity index 100% rename from src/ElasticApm/Impl/Config/Parser.php rename to agent/php/ElasticApm/Impl/Config/Parser.php diff --git a/src/ElasticApm/Impl/Config/RawSnapshotFromArray.php b/agent/php/ElasticApm/Impl/Config/RawSnapshotFromArray.php similarity index 100% rename from src/ElasticApm/Impl/Config/RawSnapshotFromArray.php rename to agent/php/ElasticApm/Impl/Config/RawSnapshotFromArray.php diff --git a/src/ElasticApm/Impl/Config/RawSnapshotInterface.php b/agent/php/ElasticApm/Impl/Config/RawSnapshotInterface.php similarity index 100% rename from src/ElasticApm/Impl/Config/RawSnapshotInterface.php rename to agent/php/ElasticApm/Impl/Config/RawSnapshotInterface.php diff --git a/src/ElasticApm/Impl/Config/RawSnapshotSourceInterface.php b/agent/php/ElasticApm/Impl/Config/RawSnapshotSourceInterface.php similarity index 100% rename from src/ElasticApm/Impl/Config/RawSnapshotSourceInterface.php rename to agent/php/ElasticApm/Impl/Config/RawSnapshotSourceInterface.php diff --git a/src/ElasticApm/Impl/Config/Snapshot.php b/agent/php/ElasticApm/Impl/Config/Snapshot.php similarity index 100% rename from src/ElasticApm/Impl/Config/Snapshot.php rename to agent/php/ElasticApm/Impl/Config/Snapshot.php diff --git a/src/ElasticApm/Impl/Config/SnapshotDevInternal.php b/agent/php/ElasticApm/Impl/Config/SnapshotDevInternal.php similarity index 100% rename from src/ElasticApm/Impl/Config/SnapshotDevInternal.php rename to agent/php/ElasticApm/Impl/Config/SnapshotDevInternal.php diff --git a/src/ElasticApm/Impl/Config/SnapshotTrait.php b/agent/php/ElasticApm/Impl/Config/SnapshotTrait.php similarity index 100% rename from src/ElasticApm/Impl/Config/SnapshotTrait.php rename to agent/php/ElasticApm/Impl/Config/SnapshotTrait.php diff --git a/src/ElasticApm/Impl/Config/StringOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/StringOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/StringOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/StringOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/StringOptionParser.php b/agent/php/ElasticApm/Impl/Config/StringOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/StringOptionParser.php rename to agent/php/ElasticApm/Impl/Config/StringOptionParser.php diff --git a/src/ElasticApm/Impl/Config/WildcardListOptionMetadata.php b/agent/php/ElasticApm/Impl/Config/WildcardListOptionMetadata.php similarity index 100% rename from src/ElasticApm/Impl/Config/WildcardListOptionMetadata.php rename to agent/php/ElasticApm/Impl/Config/WildcardListOptionMetadata.php diff --git a/src/ElasticApm/Impl/Config/WildcardListOptionParser.php b/agent/php/ElasticApm/Impl/Config/WildcardListOptionParser.php similarity index 100% rename from src/ElasticApm/Impl/Config/WildcardListOptionParser.php rename to agent/php/ElasticApm/Impl/Config/WildcardListOptionParser.php diff --git a/src/ElasticApm/Impl/Constants.php b/agent/php/ElasticApm/Impl/Constants.php similarity index 100% rename from src/ElasticApm/Impl/Constants.php rename to agent/php/ElasticApm/Impl/Constants.php diff --git a/src/ElasticApm/Impl/ContextPartWrapper.php b/agent/php/ElasticApm/Impl/ContextPartWrapper.php similarity index 100% rename from src/ElasticApm/Impl/ContextPartWrapper.php rename to agent/php/ElasticApm/Impl/ContextPartWrapper.php diff --git a/src/ElasticApm/Impl/DistributedTracingDataInternal.php b/agent/php/ElasticApm/Impl/DistributedTracingDataInternal.php similarity index 100% rename from src/ElasticApm/Impl/DistributedTracingDataInternal.php rename to agent/php/ElasticApm/Impl/DistributedTracingDataInternal.php diff --git a/src/ElasticApm/Impl/Error.php b/agent/php/ElasticApm/Impl/Error.php similarity index 100% rename from src/ElasticApm/Impl/Error.php rename to agent/php/ElasticApm/Impl/Error.php diff --git a/src/ElasticApm/Impl/ErrorExceptionData.php b/agent/php/ElasticApm/Impl/ErrorExceptionData.php similarity index 100% rename from src/ElasticApm/Impl/ErrorExceptionData.php rename to agent/php/ElasticApm/Impl/ErrorExceptionData.php diff --git a/src/ElasticApm/Impl/ErrorTransactionData.php b/agent/php/ElasticApm/Impl/ErrorTransactionData.php similarity index 100% rename from src/ElasticApm/Impl/ErrorTransactionData.php rename to agent/php/ElasticApm/Impl/ErrorTransactionData.php diff --git a/src/ElasticApm/Impl/EventSinkInterface.php b/agent/php/ElasticApm/Impl/EventSinkInterface.php similarity index 100% rename from src/ElasticApm/Impl/EventSinkInterface.php rename to agent/php/ElasticApm/Impl/EventSinkInterface.php diff --git a/src/ElasticApm/Impl/ExecutionSegment.php b/agent/php/ElasticApm/Impl/ExecutionSegment.php similarity index 100% rename from src/ElasticApm/Impl/ExecutionSegment.php rename to agent/php/ElasticApm/Impl/ExecutionSegment.php diff --git a/src/ElasticApm/Impl/ExecutionSegmentContext.php b/agent/php/ElasticApm/Impl/ExecutionSegmentContext.php similarity index 100% rename from src/ElasticApm/Impl/ExecutionSegmentContext.php rename to agent/php/ElasticApm/Impl/ExecutionSegmentContext.php diff --git a/src/ElasticApm/Impl/GlobalTracerHolder.php b/agent/php/ElasticApm/Impl/GlobalTracerHolder.php similarity index 100% rename from src/ElasticApm/Impl/GlobalTracerHolder.php rename to agent/php/ElasticApm/Impl/GlobalTracerHolder.php diff --git a/src/ElasticApm/Impl/HttpDistributedTracing.php b/agent/php/ElasticApm/Impl/HttpDistributedTracing.php similarity index 100% rename from src/ElasticApm/Impl/HttpDistributedTracing.php rename to agent/php/ElasticApm/Impl/HttpDistributedTracing.php diff --git a/src/ElasticApm/Impl/InferredSpanFrame.php b/agent/php/ElasticApm/Impl/InferredSpanFrame.php similarity index 100% rename from src/ElasticApm/Impl/InferredSpanFrame.php rename to agent/php/ElasticApm/Impl/InferredSpanFrame.php diff --git a/src/ElasticApm/Impl/InferredSpansBuilder.php b/agent/php/ElasticApm/Impl/InferredSpansBuilder.php similarity index 100% rename from src/ElasticApm/Impl/InferredSpansBuilder.php rename to agent/php/ElasticApm/Impl/InferredSpansBuilder.php diff --git a/src/ElasticApm/Impl/InferredSpansManager.php b/agent/php/ElasticApm/Impl/InferredSpansManager.php similarity index 100% rename from src/ElasticApm/Impl/InferredSpansManager.php rename to agent/php/ElasticApm/Impl/InferredSpansManager.php diff --git a/src/ElasticApm/Impl/Log/AdhocLoggableObject.php b/agent/php/ElasticApm/Impl/Log/AdhocLoggableObject.php similarity index 100% rename from src/ElasticApm/Impl/Log/AdhocLoggableObject.php rename to agent/php/ElasticApm/Impl/Log/AdhocLoggableObject.php diff --git a/src/ElasticApm/Impl/Log/Backend.php b/agent/php/ElasticApm/Impl/Log/Backend.php similarity index 100% rename from src/ElasticApm/Impl/Log/Backend.php rename to agent/php/ElasticApm/Impl/Log/Backend.php diff --git a/src/ElasticApm/Impl/Log/EnabledLoggerProxy.php b/agent/php/ElasticApm/Impl/Log/EnabledLoggerProxy.php similarity index 100% rename from src/ElasticApm/Impl/Log/EnabledLoggerProxy.php rename to agent/php/ElasticApm/Impl/Log/EnabledLoggerProxy.php diff --git a/src/ElasticApm/Impl/Log/EnabledLoggerProxyNoLine.php b/agent/php/ElasticApm/Impl/Log/EnabledLoggerProxyNoLine.php similarity index 100% rename from src/ElasticApm/Impl/Log/EnabledLoggerProxyNoLine.php rename to agent/php/ElasticApm/Impl/Log/EnabledLoggerProxyNoLine.php diff --git a/src/ElasticApm/Impl/Log/Level.php b/agent/php/ElasticApm/Impl/Log/Level.php similarity index 100% rename from src/ElasticApm/Impl/Log/Level.php rename to agent/php/ElasticApm/Impl/Log/Level.php diff --git a/src/ElasticApm/Impl/Log/LogCategory.php b/agent/php/ElasticApm/Impl/Log/LogCategory.php similarity index 100% rename from src/ElasticApm/Impl/Log/LogCategory.php rename to agent/php/ElasticApm/Impl/Log/LogCategory.php diff --git a/src/ElasticApm/Impl/Log/LogConsts.php b/agent/php/ElasticApm/Impl/Log/LogConsts.php similarity index 100% rename from src/ElasticApm/Impl/Log/LogConsts.php rename to agent/php/ElasticApm/Impl/Log/LogConsts.php diff --git a/src/ElasticApm/Impl/Log/LogStream.php b/agent/php/ElasticApm/Impl/Log/LogStream.php similarity index 100% rename from src/ElasticApm/Impl/Log/LogStream.php rename to agent/php/ElasticApm/Impl/Log/LogStream.php diff --git a/src/ElasticApm/Impl/Log/LogStreamInterface.php b/agent/php/ElasticApm/Impl/Log/LogStreamInterface.php similarity index 100% rename from src/ElasticApm/Impl/Log/LogStreamInterface.php rename to agent/php/ElasticApm/Impl/Log/LogStreamInterface.php diff --git a/src/ElasticApm/Impl/Log/LoggableArray.php b/agent/php/ElasticApm/Impl/Log/LoggableArray.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableArray.php rename to agent/php/ElasticApm/Impl/Log/LoggableArray.php diff --git a/src/ElasticApm/Impl/Log/LoggableInterface.php b/agent/php/ElasticApm/Impl/Log/LoggableInterface.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableInterface.php rename to agent/php/ElasticApm/Impl/Log/LoggableInterface.php diff --git a/src/ElasticApm/Impl/Log/LoggableStackTrace.php b/agent/php/ElasticApm/Impl/Log/LoggableStackTrace.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableStackTrace.php rename to agent/php/ElasticApm/Impl/Log/LoggableStackTrace.php diff --git a/src/ElasticApm/Impl/Log/LoggableToEncodedJson.php b/agent/php/ElasticApm/Impl/Log/LoggableToEncodedJson.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableToEncodedJson.php rename to agent/php/ElasticApm/Impl/Log/LoggableToEncodedJson.php diff --git a/src/ElasticApm/Impl/Log/LoggableToJsonEncodable.php b/agent/php/ElasticApm/Impl/Log/LoggableToJsonEncodable.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableToJsonEncodable.php rename to agent/php/ElasticApm/Impl/Log/LoggableToJsonEncodable.php diff --git a/src/ElasticApm/Impl/Log/LoggableToString.php b/agent/php/ElasticApm/Impl/Log/LoggableToString.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableToString.php rename to agent/php/ElasticApm/Impl/Log/LoggableToString.php diff --git a/src/ElasticApm/Impl/Log/LoggableTrait.php b/agent/php/ElasticApm/Impl/Log/LoggableTrait.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggableTrait.php rename to agent/php/ElasticApm/Impl/Log/LoggableTrait.php diff --git a/src/ElasticApm/Impl/Log/Logger.php b/agent/php/ElasticApm/Impl/Log/Logger.php similarity index 100% rename from src/ElasticApm/Impl/Log/Logger.php rename to agent/php/ElasticApm/Impl/Log/Logger.php diff --git a/src/ElasticApm/Impl/Log/LoggerData.php b/agent/php/ElasticApm/Impl/Log/LoggerData.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggerData.php rename to agent/php/ElasticApm/Impl/Log/LoggerData.php diff --git a/src/ElasticApm/Impl/Log/LoggerFactory.php b/agent/php/ElasticApm/Impl/Log/LoggerFactory.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggerFactory.php rename to agent/php/ElasticApm/Impl/Log/LoggerFactory.php diff --git a/src/ElasticApm/Impl/Log/LoggingSubsystem.php b/agent/php/ElasticApm/Impl/Log/LoggingSubsystem.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggingSubsystem.php rename to agent/php/ElasticApm/Impl/Log/LoggingSubsystem.php diff --git a/src/ElasticApm/Impl/Log/LoggingSubsystemException.php b/agent/php/ElasticApm/Impl/Log/LoggingSubsystemException.php similarity index 100% rename from src/ElasticApm/Impl/Log/LoggingSubsystemException.php rename to agent/php/ElasticApm/Impl/Log/LoggingSubsystemException.php diff --git a/src/ElasticApm/Impl/Log/NoopLogSink.php b/agent/php/ElasticApm/Impl/Log/NoopLogSink.php similarity index 100% rename from src/ElasticApm/Impl/Log/NoopLogSink.php rename to agent/php/ElasticApm/Impl/Log/NoopLogSink.php diff --git a/src/ElasticApm/Impl/Log/NoopLoggerFactory.php b/agent/php/ElasticApm/Impl/Log/NoopLoggerFactory.php similarity index 100% rename from src/ElasticApm/Impl/Log/NoopLoggerFactory.php rename to agent/php/ElasticApm/Impl/Log/NoopLoggerFactory.php diff --git a/src/ElasticApm/Impl/Log/PropertyLogPriority.php b/agent/php/ElasticApm/Impl/Log/PropertyLogPriority.php similarity index 100% rename from src/ElasticApm/Impl/Log/PropertyLogPriority.php rename to agent/php/ElasticApm/Impl/Log/PropertyLogPriority.php diff --git a/src/ElasticApm/Impl/Log/SinkBase.php b/agent/php/ElasticApm/Impl/Log/SinkBase.php similarity index 100% rename from src/ElasticApm/Impl/Log/SinkBase.php rename to agent/php/ElasticApm/Impl/Log/SinkBase.php diff --git a/src/ElasticApm/Impl/Log/SinkInterface.php b/agent/php/ElasticApm/Impl/Log/SinkInterface.php similarity index 100% rename from src/ElasticApm/Impl/Log/SinkInterface.php rename to agent/php/ElasticApm/Impl/Log/SinkInterface.php diff --git a/src/ElasticApm/Impl/Log/SinkToCExt.php b/agent/php/ElasticApm/Impl/Log/SinkToCExt.php similarity index 100% rename from src/ElasticApm/Impl/Log/SinkToCExt.php rename to agent/php/ElasticApm/Impl/Log/SinkToCExt.php diff --git a/src/ElasticApm/Impl/Metadata.php b/agent/php/ElasticApm/Impl/Metadata.php similarity index 100% rename from src/ElasticApm/Impl/Metadata.php rename to agent/php/ElasticApm/Impl/Metadata.php diff --git a/src/ElasticApm/Impl/MetadataDiscoverer.php b/agent/php/ElasticApm/Impl/MetadataDiscoverer.php similarity index 100% rename from src/ElasticApm/Impl/MetadataDiscoverer.php rename to agent/php/ElasticApm/Impl/MetadataDiscoverer.php diff --git a/src/ElasticApm/Impl/MetricSet.php b/agent/php/ElasticApm/Impl/MetricSet.php similarity index 100% rename from src/ElasticApm/Impl/MetricSet.php rename to agent/php/ElasticApm/Impl/MetricSet.php diff --git a/src/ElasticApm/Impl/NameVersionData.php b/agent/php/ElasticApm/Impl/NameVersionData.php similarity index 100% rename from src/ElasticApm/Impl/NameVersionData.php rename to agent/php/ElasticApm/Impl/NameVersionData.php diff --git a/src/ElasticApm/Impl/NoopDistributedTracingData.php b/agent/php/ElasticApm/Impl/NoopDistributedTracingData.php similarity index 100% rename from src/ElasticApm/Impl/NoopDistributedTracingData.php rename to agent/php/ElasticApm/Impl/NoopDistributedTracingData.php diff --git a/src/ElasticApm/Impl/NoopEventSink.php b/agent/php/ElasticApm/Impl/NoopEventSink.php similarity index 100% rename from src/ElasticApm/Impl/NoopEventSink.php rename to agent/php/ElasticApm/Impl/NoopEventSink.php diff --git a/src/ElasticApm/Impl/NoopExecutionSegment.php b/agent/php/ElasticApm/Impl/NoopExecutionSegment.php similarity index 100% rename from src/ElasticApm/Impl/NoopExecutionSegment.php rename to agent/php/ElasticApm/Impl/NoopExecutionSegment.php diff --git a/src/ElasticApm/Impl/NoopExecutionSegmentContext.php b/agent/php/ElasticApm/Impl/NoopExecutionSegmentContext.php similarity index 100% rename from src/ElasticApm/Impl/NoopExecutionSegmentContext.php rename to agent/php/ElasticApm/Impl/NoopExecutionSegmentContext.php diff --git a/src/ElasticApm/Impl/NoopSpan.php b/agent/php/ElasticApm/Impl/NoopSpan.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpan.php rename to agent/php/ElasticApm/Impl/NoopSpan.php diff --git a/src/ElasticApm/Impl/NoopSpanContext.php b/agent/php/ElasticApm/Impl/NoopSpanContext.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpanContext.php rename to agent/php/ElasticApm/Impl/NoopSpanContext.php diff --git a/src/ElasticApm/Impl/NoopSpanContextDb.php b/agent/php/ElasticApm/Impl/NoopSpanContextDb.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpanContextDb.php rename to agent/php/ElasticApm/Impl/NoopSpanContextDb.php diff --git a/src/ElasticApm/Impl/NoopSpanContextDestination.php b/agent/php/ElasticApm/Impl/NoopSpanContextDestination.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpanContextDestination.php rename to agent/php/ElasticApm/Impl/NoopSpanContextDestination.php diff --git a/src/ElasticApm/Impl/NoopSpanContextHttp.php b/agent/php/ElasticApm/Impl/NoopSpanContextHttp.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpanContextHttp.php rename to agent/php/ElasticApm/Impl/NoopSpanContextHttp.php diff --git a/src/ElasticApm/Impl/NoopSpanContextService.php b/agent/php/ElasticApm/Impl/NoopSpanContextService.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpanContextService.php rename to agent/php/ElasticApm/Impl/NoopSpanContextService.php diff --git a/src/ElasticApm/Impl/NoopSpanContextServiceTarget.php b/agent/php/ElasticApm/Impl/NoopSpanContextServiceTarget.php similarity index 100% rename from src/ElasticApm/Impl/NoopSpanContextServiceTarget.php rename to agent/php/ElasticApm/Impl/NoopSpanContextServiceTarget.php diff --git a/src/ElasticApm/Impl/NoopTracer.php b/agent/php/ElasticApm/Impl/NoopTracer.php similarity index 100% rename from src/ElasticApm/Impl/NoopTracer.php rename to agent/php/ElasticApm/Impl/NoopTracer.php diff --git a/src/ElasticApm/Impl/NoopTransaction.php b/agent/php/ElasticApm/Impl/NoopTransaction.php similarity index 100% rename from src/ElasticApm/Impl/NoopTransaction.php rename to agent/php/ElasticApm/Impl/NoopTransaction.php diff --git a/src/ElasticApm/Impl/NoopTransactionBuilder.php b/agent/php/ElasticApm/Impl/NoopTransactionBuilder.php similarity index 100% rename from src/ElasticApm/Impl/NoopTransactionBuilder.php rename to agent/php/ElasticApm/Impl/NoopTransactionBuilder.php diff --git a/src/ElasticApm/Impl/NoopTransactionContext.php b/agent/php/ElasticApm/Impl/NoopTransactionContext.php similarity index 100% rename from src/ElasticApm/Impl/NoopTransactionContext.php rename to agent/php/ElasticApm/Impl/NoopTransactionContext.php diff --git a/src/ElasticApm/Impl/NoopTransactionContextRequest.php b/agent/php/ElasticApm/Impl/NoopTransactionContextRequest.php similarity index 100% rename from src/ElasticApm/Impl/NoopTransactionContextRequest.php rename to agent/php/ElasticApm/Impl/NoopTransactionContextRequest.php diff --git a/src/ElasticApm/Impl/NoopTransactionContextRequestUrl.php b/agent/php/ElasticApm/Impl/NoopTransactionContextRequestUrl.php similarity index 100% rename from src/ElasticApm/Impl/NoopTransactionContextRequestUrl.php rename to agent/php/ElasticApm/Impl/NoopTransactionContextRequestUrl.php diff --git a/src/ElasticApm/Impl/NoopTransactionContextUser.php b/agent/php/ElasticApm/Impl/NoopTransactionContextUser.php similarity index 100% rename from src/ElasticApm/Impl/NoopTransactionContextUser.php rename to agent/php/ElasticApm/Impl/NoopTransactionContextUser.php diff --git a/src/ElasticApm/Impl/OptionalSerializableDataInterface.php b/agent/php/ElasticApm/Impl/OptionalSerializableDataInterface.php similarity index 100% rename from src/ElasticApm/Impl/OptionalSerializableDataInterface.php rename to agent/php/ElasticApm/Impl/OptionalSerializableDataInterface.php diff --git a/src/ElasticApm/Impl/ProcessData.php b/agent/php/ElasticApm/Impl/ProcessData.php similarity index 100% rename from src/ElasticApm/Impl/ProcessData.php rename to agent/php/ElasticApm/Impl/ProcessData.php diff --git a/src/ElasticApm/Impl/SerializableDataInterface.php b/agent/php/ElasticApm/Impl/SerializableDataInterface.php similarity index 100% rename from src/ElasticApm/Impl/SerializableDataInterface.php rename to agent/php/ElasticApm/Impl/SerializableDataInterface.php diff --git a/src/ElasticApm/Impl/ServiceAgentData.php b/agent/php/ElasticApm/Impl/ServiceAgentData.php similarity index 100% rename from src/ElasticApm/Impl/ServiceAgentData.php rename to agent/php/ElasticApm/Impl/ServiceAgentData.php diff --git a/src/ElasticApm/Impl/ServiceData.php b/agent/php/ElasticApm/Impl/ServiceData.php similarity index 100% rename from src/ElasticApm/Impl/ServiceData.php rename to agent/php/ElasticApm/Impl/ServiceData.php diff --git a/src/ElasticApm/Impl/Span.php b/agent/php/ElasticApm/Impl/Span.php similarity index 100% rename from src/ElasticApm/Impl/Span.php rename to agent/php/ElasticApm/Impl/Span.php diff --git a/src/ElasticApm/Impl/SpanContext.php b/agent/php/ElasticApm/Impl/SpanContext.php similarity index 100% rename from src/ElasticApm/Impl/SpanContext.php rename to agent/php/ElasticApm/Impl/SpanContext.php diff --git a/src/ElasticApm/Impl/SpanContextDb.php b/agent/php/ElasticApm/Impl/SpanContextDb.php similarity index 100% rename from src/ElasticApm/Impl/SpanContextDb.php rename to agent/php/ElasticApm/Impl/SpanContextDb.php diff --git a/src/ElasticApm/Impl/SpanContextDestination.php b/agent/php/ElasticApm/Impl/SpanContextDestination.php similarity index 100% rename from src/ElasticApm/Impl/SpanContextDestination.php rename to agent/php/ElasticApm/Impl/SpanContextDestination.php diff --git a/src/ElasticApm/Impl/SpanContextDestinationServiceData.php b/agent/php/ElasticApm/Impl/SpanContextDestinationServiceData.php similarity index 100% rename from src/ElasticApm/Impl/SpanContextDestinationServiceData.php rename to agent/php/ElasticApm/Impl/SpanContextDestinationServiceData.php diff --git a/src/ElasticApm/Impl/SpanContextHttp.php b/agent/php/ElasticApm/Impl/SpanContextHttp.php similarity index 100% rename from src/ElasticApm/Impl/SpanContextHttp.php rename to agent/php/ElasticApm/Impl/SpanContextHttp.php diff --git a/src/ElasticApm/Impl/SpanContextService.php b/agent/php/ElasticApm/Impl/SpanContextService.php similarity index 100% rename from src/ElasticApm/Impl/SpanContextService.php rename to agent/php/ElasticApm/Impl/SpanContextService.php diff --git a/src/ElasticApm/Impl/SpanContextServiceTarget.php b/agent/php/ElasticApm/Impl/SpanContextServiceTarget.php similarity index 100% rename from src/ElasticApm/Impl/SpanContextServiceTarget.php rename to agent/php/ElasticApm/Impl/SpanContextServiceTarget.php diff --git a/src/ElasticApm/Impl/SpanToSendInterface.php b/agent/php/ElasticApm/Impl/SpanToSendInterface.php similarity index 100% rename from src/ElasticApm/Impl/SpanToSendInterface.php rename to agent/php/ElasticApm/Impl/SpanToSendInterface.php diff --git a/src/ElasticApm/Impl/SrcRootDir.php b/agent/php/ElasticApm/Impl/SrcRootDir.php similarity index 100% rename from src/ElasticApm/Impl/SrcRootDir.php rename to agent/php/ElasticApm/Impl/SrcRootDir.php diff --git a/src/ElasticApm/Impl/StackTraceFrame.php b/agent/php/ElasticApm/Impl/StackTraceFrame.php similarity index 100% rename from src/ElasticApm/Impl/StackTraceFrame.php rename to agent/php/ElasticApm/Impl/StackTraceFrame.php diff --git a/src/ElasticApm/Impl/SystemData.php b/agent/php/ElasticApm/Impl/SystemData.php similarity index 100% rename from src/ElasticApm/Impl/SystemData.php rename to agent/php/ElasticApm/Impl/SystemData.php diff --git a/src/ElasticApm/Impl/Tracer.php b/agent/php/ElasticApm/Impl/Tracer.php similarity index 100% rename from src/ElasticApm/Impl/Tracer.php rename to agent/php/ElasticApm/Impl/Tracer.php diff --git a/src/ElasticApm/Impl/TracerBuilder.php b/agent/php/ElasticApm/Impl/TracerBuilder.php similarity index 100% rename from src/ElasticApm/Impl/TracerBuilder.php rename to agent/php/ElasticApm/Impl/TracerBuilder.php diff --git a/src/ElasticApm/Impl/TracerDependencies.php b/agent/php/ElasticApm/Impl/TracerDependencies.php similarity index 100% rename from src/ElasticApm/Impl/TracerDependencies.php rename to agent/php/ElasticApm/Impl/TracerDependencies.php diff --git a/src/ElasticApm/Impl/TracerInterface.php b/agent/php/ElasticApm/Impl/TracerInterface.php similarity index 100% rename from src/ElasticApm/Impl/TracerInterface.php rename to agent/php/ElasticApm/Impl/TracerInterface.php diff --git a/src/ElasticApm/Impl/Transaction.php b/agent/php/ElasticApm/Impl/Transaction.php similarity index 100% rename from src/ElasticApm/Impl/Transaction.php rename to agent/php/ElasticApm/Impl/Transaction.php diff --git a/src/ElasticApm/Impl/TransactionBuilder.php b/agent/php/ElasticApm/Impl/TransactionBuilder.php similarity index 100% rename from src/ElasticApm/Impl/TransactionBuilder.php rename to agent/php/ElasticApm/Impl/TransactionBuilder.php diff --git a/src/ElasticApm/Impl/TransactionContext.php b/agent/php/ElasticApm/Impl/TransactionContext.php similarity index 100% rename from src/ElasticApm/Impl/TransactionContext.php rename to agent/php/ElasticApm/Impl/TransactionContext.php diff --git a/src/ElasticApm/Impl/TransactionContextRequest.php b/agent/php/ElasticApm/Impl/TransactionContextRequest.php similarity index 100% rename from src/ElasticApm/Impl/TransactionContextRequest.php rename to agent/php/ElasticApm/Impl/TransactionContextRequest.php diff --git a/src/ElasticApm/Impl/TransactionContextRequestUrl.php b/agent/php/ElasticApm/Impl/TransactionContextRequestUrl.php similarity index 100% rename from src/ElasticApm/Impl/TransactionContextRequestUrl.php rename to agent/php/ElasticApm/Impl/TransactionContextRequestUrl.php diff --git a/src/ElasticApm/Impl/TransactionContextUser.php b/agent/php/ElasticApm/Impl/TransactionContextUser.php similarity index 100% rename from src/ElasticApm/Impl/TransactionContextUser.php rename to agent/php/ElasticApm/Impl/TransactionContextUser.php diff --git a/src/ElasticApm/Impl/Util/ArrayUtil.php b/agent/php/ElasticApm/Impl/Util/ArrayUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/ArrayUtil.php rename to agent/php/ElasticApm/Impl/Util/ArrayUtil.php diff --git a/src/ElasticApm/Impl/Util/Assert.php b/agent/php/ElasticApm/Impl/Util/Assert.php similarity index 100% rename from src/ElasticApm/Impl/Util/Assert.php rename to agent/php/ElasticApm/Impl/Util/Assert.php diff --git a/src/ElasticApm/Impl/Util/AssertException.php b/agent/php/ElasticApm/Impl/Util/AssertException.php similarity index 100% rename from src/ElasticApm/Impl/Util/AssertException.php rename to agent/php/ElasticApm/Impl/Util/AssertException.php diff --git a/src/ElasticApm/Impl/Util/AssertLevel.php b/agent/php/ElasticApm/Impl/Util/AssertLevel.php similarity index 100% rename from src/ElasticApm/Impl/Util/AssertLevel.php rename to agent/php/ElasticApm/Impl/Util/AssertLevel.php diff --git a/src/ElasticApm/Impl/Util/BoolUtil.php b/agent/php/ElasticApm/Impl/Util/BoolUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/BoolUtil.php rename to agent/php/ElasticApm/Impl/Util/BoolUtil.php diff --git a/src/ElasticApm/Impl/Util/CallerInfo.php b/agent/php/ElasticApm/Impl/Util/CallerInfo.php similarity index 100% rename from src/ElasticApm/Impl/Util/CallerInfo.php rename to agent/php/ElasticApm/Impl/Util/CallerInfo.php diff --git a/src/ElasticApm/Impl/Util/ClassNameUtil.php b/agent/php/ElasticApm/Impl/Util/ClassNameUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/ClassNameUtil.php rename to agent/php/ElasticApm/Impl/Util/ClassNameUtil.php diff --git a/src/ElasticApm/Impl/Util/ClassicFormatStackTraceFrame.php b/agent/php/ElasticApm/Impl/Util/ClassicFormatStackTraceFrame.php similarity index 100% rename from src/ElasticApm/Impl/Util/ClassicFormatStackTraceFrame.php rename to agent/php/ElasticApm/Impl/Util/ClassicFormatStackTraceFrame.php diff --git a/src/ElasticApm/Impl/Util/DbgUtil.php b/agent/php/ElasticApm/Impl/Util/DbgUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/DbgUtil.php rename to agent/php/ElasticApm/Impl/Util/DbgUtil.php diff --git a/src/ElasticApm/Impl/Util/ElasticApmExtensionUtil.php b/agent/php/ElasticApm/Impl/Util/ElasticApmExtensionUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/ElasticApmExtensionUtil.php rename to agent/php/ElasticApm/Impl/Util/ElasticApmExtensionUtil.php diff --git a/src/ElasticApm/Impl/Util/EnabledAssertProxy.php b/agent/php/ElasticApm/Impl/Util/EnabledAssertProxy.php similarity index 100% rename from src/ElasticApm/Impl/Util/EnabledAssertProxy.php rename to agent/php/ElasticApm/Impl/Util/EnabledAssertProxy.php diff --git a/src/ElasticApm/Impl/Util/ExceptionUtil.php b/agent/php/ElasticApm/Impl/Util/ExceptionUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/ExceptionUtil.php rename to agent/php/ElasticApm/Impl/Util/ExceptionUtil.php diff --git a/src/ElasticApm/Impl/Util/HiddenConstructorTrait.php b/agent/php/ElasticApm/Impl/Util/HiddenConstructorTrait.php similarity index 100% rename from src/ElasticApm/Impl/Util/HiddenConstructorTrait.php rename to agent/php/ElasticApm/Impl/Util/HiddenConstructorTrait.php diff --git a/src/ElasticApm/Impl/Util/IdGenerator.php b/agent/php/ElasticApm/Impl/Util/IdGenerator.php similarity index 100% rename from src/ElasticApm/Impl/Util/IdGenerator.php rename to agent/php/ElasticApm/Impl/Util/IdGenerator.php diff --git a/src/ElasticApm/Impl/Util/IdValidationUtil.php b/agent/php/ElasticApm/Impl/Util/IdValidationUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/IdValidationUtil.php rename to agent/php/ElasticApm/Impl/Util/IdValidationUtil.php diff --git a/src/ElasticApm/Impl/Util/InternalFailureException.php b/agent/php/ElasticApm/Impl/Util/InternalFailureException.php similarity index 100% rename from src/ElasticApm/Impl/Util/InternalFailureException.php rename to agent/php/ElasticApm/Impl/Util/InternalFailureException.php diff --git a/src/ElasticApm/Impl/Util/JsonException.php b/agent/php/ElasticApm/Impl/Util/JsonException.php similarity index 100% rename from src/ElasticApm/Impl/Util/JsonException.php rename to agent/php/ElasticApm/Impl/Util/JsonException.php diff --git a/src/ElasticApm/Impl/Util/JsonUtil.php b/agent/php/ElasticApm/Impl/Util/JsonUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/JsonUtil.php rename to agent/php/ElasticApm/Impl/Util/JsonUtil.php diff --git a/src/ElasticApm/Impl/Util/NoopObjectTrait.php b/agent/php/ElasticApm/Impl/Util/NoopObjectTrait.php similarity index 100% rename from src/ElasticApm/Impl/Util/NoopObjectTrait.php rename to agent/php/ElasticApm/Impl/Util/NoopObjectTrait.php diff --git a/src/ElasticApm/Impl/Util/NumericUtil.php b/agent/php/ElasticApm/Impl/Util/NumericUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/NumericUtil.php rename to agent/php/ElasticApm/Impl/Util/NumericUtil.php diff --git a/src/ElasticApm/Impl/Util/ObserverSet.php b/agent/php/ElasticApm/Impl/Util/ObserverSet.php similarity index 100% rename from src/ElasticApm/Impl/Util/ObserverSet.php rename to agent/php/ElasticApm/Impl/Util/ObserverSet.php diff --git a/src/ElasticApm/Impl/Util/PhpErrorUtil.php b/agent/php/ElasticApm/Impl/Util/PhpErrorUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/PhpErrorUtil.php rename to agent/php/ElasticApm/Impl/Util/PhpErrorUtil.php diff --git a/src/ElasticApm/Impl/Util/PhpFormatStackTraceFrame.php b/agent/php/ElasticApm/Impl/Util/PhpFormatStackTraceFrame.php similarity index 100% rename from src/ElasticApm/Impl/Util/PhpFormatStackTraceFrame.php rename to agent/php/ElasticApm/Impl/Util/PhpFormatStackTraceFrame.php diff --git a/src/ElasticApm/Impl/Util/RandomUtil.php b/agent/php/ElasticApm/Impl/Util/RandomUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/RandomUtil.php rename to agent/php/ElasticApm/Impl/Util/RandomUtil.php diff --git a/src/ElasticApm/Impl/Util/RangeUtil.php b/agent/php/ElasticApm/Impl/Util/RangeUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/RangeUtil.php rename to agent/php/ElasticApm/Impl/Util/RangeUtil.php diff --git a/src/ElasticApm/Impl/Util/SingletonInstanceTrait.php b/agent/php/ElasticApm/Impl/Util/SingletonInstanceTrait.php similarity index 100% rename from src/ElasticApm/Impl/Util/SingletonInstanceTrait.php rename to agent/php/ElasticApm/Impl/Util/SingletonInstanceTrait.php diff --git a/src/ElasticApm/Impl/Util/StackTraceFrameBase.php b/agent/php/ElasticApm/Impl/Util/StackTraceFrameBase.php similarity index 100% rename from src/ElasticApm/Impl/Util/StackTraceFrameBase.php rename to agent/php/ElasticApm/Impl/Util/StackTraceFrameBase.php diff --git a/src/ElasticApm/Impl/Util/StackTraceUtil.php b/agent/php/ElasticApm/Impl/Util/StackTraceUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/StackTraceUtil.php rename to agent/php/ElasticApm/Impl/Util/StackTraceUtil.php diff --git a/src/ElasticApm/Impl/Util/StaticClassTrait.php b/agent/php/ElasticApm/Impl/Util/StaticClassTrait.php similarity index 100% rename from src/ElasticApm/Impl/Util/StaticClassTrait.php rename to agent/php/ElasticApm/Impl/Util/StaticClassTrait.php diff --git a/src/ElasticApm/Impl/Util/TextUtil.php b/agent/php/ElasticApm/Impl/Util/TextUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/TextUtil.php rename to agent/php/ElasticApm/Impl/Util/TextUtil.php diff --git a/src/ElasticApm/Impl/Util/TimeUtil.php b/agent/php/ElasticApm/Impl/Util/TimeUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/TimeUtil.php rename to agent/php/ElasticApm/Impl/Util/TimeUtil.php diff --git a/src/ElasticApm/Impl/Util/UrlParts.php b/agent/php/ElasticApm/Impl/Util/UrlParts.php similarity index 100% rename from src/ElasticApm/Impl/Util/UrlParts.php rename to agent/php/ElasticApm/Impl/Util/UrlParts.php diff --git a/src/ElasticApm/Impl/Util/UrlUtil.php b/agent/php/ElasticApm/Impl/Util/UrlUtil.php similarity index 100% rename from src/ElasticApm/Impl/Util/UrlUtil.php rename to agent/php/ElasticApm/Impl/Util/UrlUtil.php diff --git a/src/ElasticApm/Impl/Util/WildcardListMatcher.php b/agent/php/ElasticApm/Impl/Util/WildcardListMatcher.php similarity index 100% rename from src/ElasticApm/Impl/Util/WildcardListMatcher.php rename to agent/php/ElasticApm/Impl/Util/WildcardListMatcher.php diff --git a/src/ElasticApm/Impl/Util/WildcardMatcher.php b/agent/php/ElasticApm/Impl/Util/WildcardMatcher.php similarity index 100% rename from src/ElasticApm/Impl/Util/WildcardMatcher.php rename to agent/php/ElasticApm/Impl/Util/WildcardMatcher.php diff --git a/src/ElasticApm/SpanContextDbInterface.php b/agent/php/ElasticApm/SpanContextDbInterface.php similarity index 100% rename from src/ElasticApm/SpanContextDbInterface.php rename to agent/php/ElasticApm/SpanContextDbInterface.php diff --git a/src/ElasticApm/SpanContextDestinationInterface.php b/agent/php/ElasticApm/SpanContextDestinationInterface.php similarity index 100% rename from src/ElasticApm/SpanContextDestinationInterface.php rename to agent/php/ElasticApm/SpanContextDestinationInterface.php diff --git a/src/ElasticApm/SpanContextHttpInterface.php b/agent/php/ElasticApm/SpanContextHttpInterface.php similarity index 100% rename from src/ElasticApm/SpanContextHttpInterface.php rename to agent/php/ElasticApm/SpanContextHttpInterface.php diff --git a/src/ElasticApm/SpanContextInterface.php b/agent/php/ElasticApm/SpanContextInterface.php similarity index 100% rename from src/ElasticApm/SpanContextInterface.php rename to agent/php/ElasticApm/SpanContextInterface.php diff --git a/src/ElasticApm/SpanContextServiceInterface.php b/agent/php/ElasticApm/SpanContextServiceInterface.php similarity index 100% rename from src/ElasticApm/SpanContextServiceInterface.php rename to agent/php/ElasticApm/SpanContextServiceInterface.php diff --git a/src/ElasticApm/SpanContextServiceTargetInterface.php b/agent/php/ElasticApm/SpanContextServiceTargetInterface.php similarity index 100% rename from src/ElasticApm/SpanContextServiceTargetInterface.php rename to agent/php/ElasticApm/SpanContextServiceTargetInterface.php diff --git a/src/ElasticApm/SpanInterface.php b/agent/php/ElasticApm/SpanInterface.php similarity index 100% rename from src/ElasticApm/SpanInterface.php rename to agent/php/ElasticApm/SpanInterface.php diff --git a/src/ElasticApm/TransactionBuilderInterface.php b/agent/php/ElasticApm/TransactionBuilderInterface.php similarity index 100% rename from src/ElasticApm/TransactionBuilderInterface.php rename to agent/php/ElasticApm/TransactionBuilderInterface.php diff --git a/src/ElasticApm/TransactionContextInterface.php b/agent/php/ElasticApm/TransactionContextInterface.php similarity index 100% rename from src/ElasticApm/TransactionContextInterface.php rename to agent/php/ElasticApm/TransactionContextInterface.php diff --git a/src/ElasticApm/TransactionContextRequestInterface.php b/agent/php/ElasticApm/TransactionContextRequestInterface.php similarity index 100% rename from src/ElasticApm/TransactionContextRequestInterface.php rename to agent/php/ElasticApm/TransactionContextRequestInterface.php diff --git a/src/ElasticApm/TransactionContextRequestUrlInterface.php b/agent/php/ElasticApm/TransactionContextRequestUrlInterface.php similarity index 100% rename from src/ElasticApm/TransactionContextRequestUrlInterface.php rename to agent/php/ElasticApm/TransactionContextRequestUrlInterface.php diff --git a/src/ElasticApm/TransactionContextUserInterface.php b/agent/php/ElasticApm/TransactionContextUserInterface.php similarity index 100% rename from src/ElasticApm/TransactionContextUserInterface.php rename to agent/php/ElasticApm/TransactionContextUserInterface.php diff --git a/src/ElasticApm/TransactionInterface.php b/agent/php/ElasticApm/TransactionInterface.php similarity index 100% rename from src/ElasticApm/TransactionInterface.php rename to agent/php/ElasticApm/TransactionInterface.php diff --git a/src/bootstrap_php_part.php b/agent/php/bootstrap_php_part.php similarity index 100% rename from src/bootstrap_php_part.php rename to agent/php/bootstrap_php_part.php diff --git a/modernbuild/docker-compose.yml b/modernbuild/docker-compose.yml deleted file mode 100644 index 7f5f66491..000000000 --- a/modernbuild/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "2.1" -services: - build_apm_php: - build: - context: . - dockerfile: image/Dockerfile - volumes: - - ../:/source -# command: sleep 100000 - command: sh -c "cd project && cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release " - - build_apm_php_musl: - build: - context: . - dockerfile: image/Dockerfile_musl - volumes: - - ../:/source - command: sleep 100000 From 2438d956d02c6ac2dd4fa51a47d679dc3b3e72ec Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Thu, 18 May 2023 14:00:13 +0200 Subject: [PATCH 03/50] removed workdir from dockerfile to make it project independent --- agent/native/building/dockerized/docker-compose.yml | 4 ++-- agent/native/building/dockerized/images/Dockerfile_glibc | 2 -- agent/native/building/dockerized/images/Dockerfile_musl | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/agent/native/building/dockerized/docker-compose.yml b/agent/native/building/dockerized/docker-compose.yml index 7785ad24d..85bdae5b7 100644 --- a/agent/native/building/dockerized/docker-compose.yml +++ b/agent/native/building/dockerized/docker-compose.yml @@ -6,7 +6,7 @@ services: dockerfile: images/Dockerfile_glibc volumes: - ../../../../:/source - command: sh -c "cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" + command: sh -c "cd /source/agent/native && cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" build_apm_php_musl: build: @@ -14,4 +14,4 @@ services: dockerfile: images/Dockerfile_musl volumes: - ../../../../:/source - command: sh -c "cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" + command: sh -c "cd /source/agent/native && cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" diff --git a/agent/native/building/dockerized/images/Dockerfile_glibc b/agent/native/building/dockerized/images/Dockerfile_glibc index 5c86e588b..b62a77ce4 100644 --- a/agent/native/building/dockerized/images/Dockerfile_glibc +++ b/agent/native/building/dockerized/images/Dockerfile_glibc @@ -98,7 +98,5 @@ RUN adduser -p password ${USER_NAME} \ USER ${USER_NAME} -WORKDIR /source/agent/native - ENV PATH="/opt/binutils-${BINUTILS_VERSION}/bin:/opt/cmake-${CMAKE_VERSION}/bin:/opt/python-${PYTHON_VERSION}/bin:${PATH}" ENV CMAKE_INSTALL_PREFIX=/opt/cmake-${CMAKE_VERSION} diff --git a/agent/native/building/dockerized/images/Dockerfile_musl b/agent/native/building/dockerized/images/Dockerfile_musl index 5d1b87b96..e8c132545 100644 --- a/agent/native/building/dockerized/images/Dockerfile_musl +++ b/agent/native/building/dockerized/images/Dockerfile_musl @@ -80,8 +80,6 @@ RUN adduser --disabled-password --gecos '' ${USER_NAME} \ USER ${USER_NAME} -WORKDIR /source/agent/native - ENV PATH="/opt/binutils-${BINUTILS_VERSION}/bin:/opt/cmake-${CMAKE_VERSION}/bin:${PATH}" ENV CMAKE_INSTALL_PREFIX=/opt/cmake-${CMAKE_VERSION} From 5f9b4ea54150398ffb31932f84a943349298d2d0 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 24 May 2023 15:32:03 +0200 Subject: [PATCH 04/50] Enabled modern build in github actions --- .ci/Makefile | 11 +++++++ .github/workflows/test.yml | 31 ++++++++++++++----- .../building/dockerized/docker-compose.yml | 2 ++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.ci/Makefile b/.ci/Makefile index 2ecfbef6b..147e3937f 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -41,6 +41,17 @@ build: prepare ## Build the project $(IMAGE):${PHP_VERSION}$(SUFFIX) @echo "::endgroup::" +.PHONY: modernbuild +modernbuild: + @echo "::group::$@" # Helping to group logs in GitHub actions + # docker as the current user + docker run --rm -t \ + -u $(CURRENT_UID):$(CURRENT_GID) \ + -v $(PWD):/source \ + -w /source/agent/native elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.1 \ + sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release && cmake --build --preset $(BUILD_ARCHITECTURE)-release && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" + @echo "::endgroup::" + .PHONY: static-check-unit-test static-check-unit-test: prepare ## Test the static check and unit tests @echo "::group::$@" # Helping to group logs in GitHub actions diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d43d5c058..5230c1fd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,28 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} jobs: + build: + name: build-agent-library + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + arch: + - "linux-x86-64" + - "linuxmusl-x86-64" + env: + BUILD_ARCHITECTURE: ${{ matrix.arch }} + steps: + - uses: actions/checkout@v3 + - name: Build + run: make -f .ci/Makefile modernbuild + - uses: actions/upload-artifact@v3 + with: + name: package-parts + path: | + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.so + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.debug test: name: static-checks-unit-tests runs-on: ubuntu-latest @@ -48,16 +70,10 @@ jobs: - uses: actions/checkout@v3 - name: Prepare run: make -f .ci/Makefile prepare - - name: Build - run: make -f .ci/Makefile build - name: Static Check / Unit tests run: make -f .ci/Makefile static-check-unit-test - name: Build parts for packages run: make -f .ci/Makefile generate-for-package - - uses: actions/upload-artifact@v3 - with: - name: package-parts - path: src/ext/modules/*.so - if: success() || failure() name: Prepare Upload run: >- @@ -80,7 +96,8 @@ jobs: - uses: actions/download-artifact@v3 with: name: package-parts - path: src/ext/modules + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.so + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.debug - name: package run: make -C packaging package - name: package info diff --git a/agent/native/building/dockerized/docker-compose.yml b/agent/native/building/dockerized/docker-compose.yml index 85bdae5b7..0e4c9142c 100644 --- a/agent/native/building/dockerized/docker-compose.yml +++ b/agent/native/building/dockerized/docker-compose.yml @@ -4,6 +4,7 @@ services: build: context: . dockerfile: images/Dockerfile_glibc + image: elasticobservability/apm-agent-php-dev/native-build-gcc-12.2.0-linux-x86-64-0.0.1 volumes: - ../../../../:/source command: sh -c "cd /source/agent/native && cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" @@ -12,6 +13,7 @@ services: build: context: . dockerfile: images/Dockerfile_musl + image: elasticobservability/apm-agent-php-dev/native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.1 volumes: - ../../../../:/source command: sh -c "cd /source/agent/native && cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" From 310d7daacc9e115edc0530c1a59a84f87815d9bd Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 24 May 2023 15:51:37 +0200 Subject: [PATCH 05/50] Disabled git version discovery --- .ci/Makefile | 50 ++++++--- .ci/bump_version.sh | 6 +- .ci/run-phpt-tests.sh | 97 ++++++++++++++++ .ci/static-check-unit-test.sh | 105 +++++++++--------- .github/workflows/test.yml | 64 +++++++++-- Dockerfile | 2 +- Dockerfile.alpine | 2 +- agent/native/CMakeLists.txt | 10 +- agent/native/ext/CMakeLists.txt | 6 +- .../ext/numbered_intercepting_callbacks.h | 2 +- ...nfig_boolean_0_using_env_var_is_false.phpt | 2 +- .../config_boolean_0_using_ini_is_false.phpt | 2 +- ...onfig_boolean_1_using_env_var_is_true.phpt | 2 +- .../config_boolean_1_using_ini_is_true.phpt | 2 +- ..._boolean_FaLSe_using_env_var_is_false.phpt | 2 +- ...nfig_boolean_FaLSe_using_ini_is_false.phpt | 2 +- ...fig_boolean_No_using_env_var_is_false.phpt | 2 +- .../config_boolean_No_using_ini_is_false.phpt | 2 +- ...ig_boolean_OFF_using_env_var_is_false.phpt | 2 +- ...config_boolean_OFF_using_ini_is_false.phpt | 2 +- ...ig_boolean_TRue_using_env_var_is_true.phpt | 2 +- ...config_boolean_TRue_using_ini_is_true.phpt | 2 +- ...nfig_boolean_oN_using_env_var_is_true.phpt | 2 +- .../config_boolean_oN_using_ini_is_true.phpt | 2 +- ...fig_boolean_yEs_using_env_var_is_true.phpt | 2 +- .../config_boolean_yEs_using_ini_is_true.phpt | 2 +- agent/native/ext/tests/config_defaults.phpt | 2 +- .../ext/tests/config_dynamic_options.phpt | 2 +- ...setting_cannot_be_changed_after_start.phpt | 2 +- ...i_has_higher_precedence_than_env_vars.phpt | 2 +- ...alid_ini_fallback_default_not_env_var.phpt | 2 +- ...ting_to_invalid_values_using_env_vars.phpt | 2 +- ...g_setting_to_invalid_values_using_ini.phpt | 2 +- ...etting_to_non-defaults_using_env_vars.phpt | 2 +- ...fig_setting_to_non-defaults_using_ini.phpt | 2 +- ...fig_type_LogLevel_is_case_insensitive.phpt | 2 +- ...LogLevel_unambiguous_prefix_is_enough.phpt | 2 +- .../ext/tests/opcache_preload_detection.phpt | 2 +- .../opcache_preload_detection_double.phpt | 2 +- agent/native/ext/tests_util/tests_util.php | 2 +- .../gen_numbered_intercepting_callbacks_src.h | 2 +- agent/php/ElasticApm/Impl/Config/Snapshot.php | 2 +- composer.json | 12 +- demos/shared/install_agent.sh | 4 +- packaging/Makefile | 6 +- packaging/before-uninstall.sh | 6 +- packaging/create-package.sh | 59 +++++----- packaging/post-install.sh | 6 +- packaging/test/centos/entrypoint.sh | 4 +- packaging/test/ubuntu/entrypoint.sh | 4 +- 50 files changed, 337 insertions(+), 172 deletions(-) create mode 100755 .ci/run-phpt-tests.sh diff --git a/.ci/Makefile b/.ci/Makefile index 147e3937f..1dfcb84d8 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -1,3 +1,10 @@ +ifeq ($(DOCKERFILE),) + ifeq ($(BUILD_ARCHITECTURE), linuxmusl-x86-64) + DOCKERFILE := Dockerfile.alpine + else + DOCKERFILE := Dockerfile + endif +endif SHELL=/bin/bash -o pipefail MAKEFLAGS += --no-print-directory @@ -15,6 +22,7 @@ endif CURRENT_UID := $(shell id -u) CURRENT_GID := $(shell id -g) +CURRENT_USER_HOME := $(shell echo ~) .PHONY: help .DEFAULT_GOAL := help @@ -31,15 +39,15 @@ prepare: ## Build docker image for building and testing the project -f ${DOCKERFILE} . @echo "::endgroup::" -.PHONY: build -build: prepare ## Build the project - @echo "::group::$@" # Helping to group logs in GitHub actions - # docker as the current user - docker run --rm -t \ - -u $(CURRENT_UID):$(CURRENT_GID) \ - -v $(PWD):/app \ - $(IMAGE):${PHP_VERSION}$(SUFFIX) - @echo "::endgroup::" +# .PHONY: build +# build: prepare ## Build the project +# @echo "::group::$@" # Helping to group logs in GitHub actions +# # docker as the current user +# docker run --rm -t \ +# -u $(CURRENT_UID):$(CURRENT_GID) \ +# -v $(PWD):/app \ +# $(IMAGE):${PHP_VERSION}$(SUFFIX) +# @echo "::endgroup::" .PHONY: modernbuild modernbuild: @@ -48,7 +56,9 @@ modernbuild: docker run --rm -t \ -u $(CURRENT_UID):$(CURRENT_GID) \ -v $(PWD):/source \ - -w /source/agent/native elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.1 \ + -w /source/agent/native \ + -e CONAN_USER_HOME=/tmp/conan \ + elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.1 \ sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release && cmake --build --preset $(BUILD_ARCHITECTURE)-release && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" @echo "::endgroup::" @@ -63,17 +73,29 @@ static-check-unit-test: prepare ## Test the static check and unit tests /app/.ci/static-check-unit-test.sh @echo "::endgroup::" -.PHONY: generate-for-package -generate-for-package: prepare ## Generate the agent extension for the package +.PHONY: run-phpt-tests +run-phpt-tests: prepare ## Runs phpt tests @echo "::group::$@" # Helping to group logs in GitHub actions # docker as the current user docker run --rm -t \ + -e CHOWN_RESULTS_UID=$(CURRENT_UID) -e CHOWN_RESULTS_GID=$(CURRENT_GID) \ + -e BUILD_ARCHITECTURE=$(BUILD_ARCHITECTURE) \ -v $(PWD):/app \ - -u $(CURRENT_UID):$(CURRENT_GID) \ $(IMAGE):${PHP_VERSION}$(SUFFIX) \ - /app/.ci/generate-for-package.sh + /app/.ci/run-phpt-tests.sh @echo "::endgroup::" +# .PHONY: generate-for-package +# generate-for-package: prepare ## Generate the agent extension for the package +# @echo "::group::$@" # Helping to group logs in GitHub actions +# # docker as the current user +# docker run --rm -t \ +# -v $(PWD):/app \ +# -u $(CURRENT_UID):$(CURRENT_GID) \ +# $(IMAGE):${PHP_VERSION}$(SUFFIX) \ +# /app/.ci/generate-for-package.sh +# @echo "::endgroup::" + .PHONY: interactive interactive: prepare ## Run an interactive docker shell docker run -it --rm \ diff --git a/.ci/bump_version.sh b/.ci/bump_version.sh index 269b1b261..d432cbe19 100755 --- a/.ci/bump_version.sh +++ b/.ci/bump_version.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -xe -sed -i.bck "s#\(VERSION = \).*;#\1'${VERSION}';#g" src/ElasticApm/ElasticApm.php -sed -i.bck "s#\(PHP_ELASTIC_APM_VERSION\).*#\1 \"${VERSION}\"#g" src/ext/elastic_apm_version.h +sed -i.bck "s#\(VERSION = \).*;#\1'${VERSION}';#g" agent/php/ElasticApm/ElasticApm.php +sed -i.bck "s#\(PHP_ELASTIC_APM_VERSION\).*#\1 \"${VERSION}\"#g" agent/native/ext/elastic_apm_version.h -git add src/ElasticApm/ElasticApm.php src/ext/elastic_apm_version.h +git add agent/php/ElasticApm/ElasticApm.php agent/native/ext/elastic_apm_version.h diff --git a/.ci/run-phpt-tests.sh b/.ci/run-phpt-tests.sh new file mode 100755 index 000000000..6888db18b --- /dev/null +++ b/.ci/run-phpt-tests.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +set -xe + +## Location for the generated test report files +APP_FOLDER=/app + + +## Fetch PHP api version to be added to the so file that has been generated +PHP_API=$(php -i | grep -i 'PHP API' | sed -e 's#.* =>##g' | awk '{print $1}') +PHP_EXECUTABLE=$(which php) + +thisScriptDir="$( dirname "${BASH_SOURCE[0]}" )" +thisScriptDir="$( realpath "${thisScriptDir}" )" +source "${thisScriptDir}/shared.sh" + +function onScriptExit () { + if [ -n "${scriptFinishedSuccessfully}" ] && [ "${scriptFinishedSuccessfully}" == "true" ] ; then + local shouldPrintTheMostRecentSyslogFile=false + else + local shouldPrintTheMostRecentSyslogFile=true + fi + + copySyslogFilesAndPrintTheMostRecentOne ${shouldPrintTheMostRecentSyslogFile} + if [ -n "${CHOWN_RESULTS_UID}" ] && [ -n "${CHOWN_RESULTS_GID}" ]; then + chown --recursive "${CHOWN_RESULTS_UID}:${CHOWN_RESULTS_GID}" "${APP_FOLDER}" + fi +} + +trap onScriptExit EXIT + +ensureSyslogIsRunning + +if [ -z "$BUILD_ARCHITECTURE" ] +then + echo "\$BUILD_ARCHITECTURE is not specified, assuming linux-x86-64" + BUILD_ARCHITECTURE=linux-x86-64 +fi +echo "BUILD ARCHITECTURE: $BUILD_ARCHITECTURE" + + +cd $APP_FOLDER/agent/native/ext +mkdir -p $APP_FOLDER/build + +AGENT_EXTENSION_DIR=$APP_FOLDER/agent/native/_build/$BUILD_ARCHITECTURE-release/ext +AGENT_EXTENSION=$AGENT_EXTENSION_DIR/elastic_apm-$PHP_API.so + +ls -al $AGENT_EXTENSION_DIR + +RUN_TESTS=$(find /usr/local/lib/php -type f -name run-tests.php) + +#Disable agent for auxiliary PHP processes to reduce noise in logs +export ELASTIC_APM_ENABLED=false +for phptFile in ./tests/*.phpt; do + msg="Running tests in \`${phptFile}' ..." + echo "${msg}" + this_script_name="$( basename "${BASH_SOURCE[0]}" )" + logger -t "${this_script_name}" "${msg}" + + # Disable exit-on-error + # set +e + TESTS="--show-all ${phptFile}" + + + top_srcdir=$APP_FOLDER/agent/native/ext + + INI_FILE=`php -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null` + + if test "$INI_FILE"; then + egrep -h -v $PHP_DEPRECATED_DIRECTIVES_REGEX "$INI_FILE" > /tmp/tmp-php.ini + else + echo > /tmp/tmp-php.ini + fi + + TEST_PHP_SRCDIR=$top_srcdir TEST_PHP_EXECUTABLE=$PHP_EXECUTABLE $PHP_EXECUTABLE -n -c /tmp/tmp-php.ini $PHP_TEST_SETTINGS $RUN_TESTS -n -c /tmp/tmp-php.ini -d extension_dir=$AGENT_EXTENSION_DIR -d extension=$AGENT_EXTENSION $PHP_TEST_SHARED_EXTENSIONS $TESTS + exitCode=$? + rm /tmp/tmp-php.ini + + + if [ ${exitCode} -ne 0 ] ; then + echo "Tests in \`${phptFile}' failed" + phptFileName="${phptFile%.phpt}" + cat "${phptFileName}.log" + cat "${phptFileName}.out" + exit 1 + fi + + # Re-enable exit-on-error + set -e +done + + +# Re-enable exit-on-error +set -e + +cd $APP_FOLDER + +scriptFinishedSuccessfully=true \ No newline at end of file diff --git a/.ci/static-check-unit-test.sh b/.ci/static-check-unit-test.sh index 7b7e7dfc5..a6cddf771 100755 --- a/.ci/static-check-unit-test.sh +++ b/.ci/static-check-unit-test.sh @@ -29,61 +29,64 @@ ensureSyslogIsRunning ## This make runs PHPT # Disable agent for auxiliary PHP processes to reduce noise in logs -export ELASTIC_APM_ENABLED=false -for phptFile in ./tests/*.phpt; do - msg="Running tests in \`${phptFile}' ..." - echo "${msg}" - this_script_name="$( basename "${BASH_SOURCE[0]}" )" - logger -t "${this_script_name}" "${msg}" - - # Disable exit-on-error - set +e - make test TESTS="--show-all ${phptFile}" - exitCode=$? - - if [ ${exitCode} -ne 0 ] ; then - echo "Tests in \`${phptFile}' failed" - phptFileName="${phptFile%.phpt}" - cat "${phptFileName}.log" - cat "${phptFileName}.out" - exit 1 - fi - - # Re-enable exit-on-error - set -e -done +# export ELASTIC_APM_ENABLED=false +# for phptFile in ./tests/*.phpt; do +# msg="Running tests in \`${phptFile}' ..." +# echo "${msg}" +# this_script_name="$( basename "${BASH_SOURCE[0]}" )" +# logger -t "${this_script_name}" "${msg}" + +# # Disable exit-on-error +# set +e +# make test TESTS="--show-all ${phptFile}" +# exitCode=$? + +# if [ ${exitCode} -ne 0 ] ; then +# echo "Tests in \`${phptFile}' failed" +# phptFileName="${phptFile%.phpt}" +# cat "${phptFileName}.log" +# cat "${phptFileName}.out" +# exit 1 +# fi + +# # Re-enable exit-on-error +# set -e +# done + +# native unit tests will be triggered just after build # Disable exit-on-error -set +e +#set +e ## Run cmocka tests -function buildAndRunUnitTests () { - pushd /app/src/ext/unit_tests - for buildType in Debug Release - do - cmake -DCMAKE_BUILD_TYPE=${buildType} . - make - ./unit_tests - unitTestsExitCode=$? - if [ ${unitTestsExitCode} -ne 0 ] ; then - popd - return ${unitTestsExitCode} - fi - done - popd -} -buildAndRunUnitTests +#function buildAndRunUnitTests () { +# pushd /app/src/ext/unit_tests +# for buildType in Debug Release +# do +# cmake -DCMAKE_BUILD_TYPE=${buildType} . +# make +# ./unit_tests +# unitTestsExitCode=$? +# if [ ${unitTestsExitCode} -ne 0 ] ; then +# popd +# return ${unitTestsExitCode} +# fi +# done +# popd +#} +#buildAndRunUnitTests ## Save errorlevel to be reported later on -ret=$? - -## Manipulate JUnit report without multiple testsuites entries. -for file in "${BUILD_FOLDER}"/*-unit-tests-junit.xml; do - sed -i.bck ':begin;$!N;s#\n##;tbegin;P;D' "${file}" -done - -## Return the error if any -if [ $ret -ne 0 ] ; then - exit 1 -fi +# ret=$? + +# TODO pawel - makes no sense to me here, should be located after last call to composer +# ## Manipulate JUnit report without multiple testsuites entries. +# for file in "${BUILD_FOLDER}"/*-unit-tests-junit.xml; do +# sed -i.bck ':begin;$!N;s#\n##;tbegin;P;D' "${file}" +# done + +# ## Return the error if any +# if [ $ret -ne 0 ] ; then +# exit 1 +# fi # Re-enable exit-on-error set -e diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5230c1fd7..b628cbbe2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,10 +42,43 @@ jobs: run: make -f .ci/Makefile modernbuild - uses: actions/upload-artifact@v3 with: - name: package-parts + name: package-parts-${{ matrix.arch }} path: | - agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.so - agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.debug + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm*.so + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm*.debug + phpt-tests: + name: phpt-tests + runs-on: ubuntu-latest + needs: + - build + timeout-minutes: 10 + strategy: + fail-fast: false + matrix: + php-version: + - "7.2" + - "7.3" + - "7.4" + - "8.0" + - "8.1" + - "8.2" + arch: + - "linux-x86-64" + - "linuxmusl-x86-64" + env: + PHP_VERSION: ${{ matrix.php-version }} + BUILD_ARCHITECTURE: ${{ matrix.arch }} + steps: + - uses: actions/checkout@v3 + - name: Prepare + run: make -f .ci/Makefile prepare + - uses: actions/download-artifact@v3 + with: + name: package-parts-${{ matrix.arch }} + path: agent/native/_build/${{ matrix.arch }}-release/ext/ + - name: phpt-unit-tests + run: make -f .ci/Makefile run-phpt-tests + test: name: static-checks-unit-tests runs-on: ubuntu-latest @@ -72,8 +105,8 @@ jobs: run: make -f .ci/Makefile prepare - name: Static Check / Unit tests run: make -f .ci/Makefile static-check-unit-test - - name: Build parts for packages - run: make -f .ci/Makefile generate-for-package + # - name: Build parts for packages + # run: make -f .ci/Makefile generate-for-package - if: success() || failure() name: Prepare Upload run: >- @@ -90,14 +123,19 @@ jobs: build-packages: runs-on: ubuntu-latest needs: + - build - test + - phpt-tests steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: - name: package-parts - agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.so - agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm_*.debug + name: package-parts-linux-x86-64 + path: build/ext/linux-x86-64 + - uses: actions/download-artifact@v3 + with: + name: package-parts-linuxmusl-x86-64 + path: build/ext/linuxmusl-x86-64 - name: package run: make -C packaging package - name: package info @@ -145,9 +183,13 @@ jobs: - uses: actions/download-artifact@v3 with: - name: package-parts - path: src/ext/modules - + name: package-parts-linux-x86-64 + path: build/ext/linux-x86-64 + - uses: actions/download-artifact@v3 + with: + name: package-parts-linuxmusl-x86-64 + path: build/ext/linuxmusl-x86-64 + - if: ${{ env.TESTING_TYPE == 'lifecycle' }} name: lifecycle test run: | diff --git a/Dockerfile b/Dockerfile index 6153a9df9..bfe68e0e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.2 ENV PATH="/usr/bin/cmake/bin:${PATH}" -WORKDIR /app/src/ext +WORKDIR /app/agent/native/ext ENV REPORT_EXIT_STATUS=1 ENV TEST_PHP_DETAILED=1 diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 8bebd7e19..a0910f494 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -32,7 +32,7 @@ RUN docker-php-ext-install \ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -WORKDIR /app/src/ext +WORKDIR /app/agent/native/ext ENV REPORT_EXIT_STATUS=1 ENV TEST_PHP_DETAILED=1 diff --git a/agent/native/CMakeLists.txt b/agent/native/CMakeLists.txt index 7907040f3..a46bea375 100644 --- a/agent/native/CMakeLists.txt +++ b/agent/native/CMakeLists.txt @@ -3,18 +3,18 @@ cmake_minimum_required(VERSION 3.26.0) # set path for our local includes set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/building/cmake") -include(elastic_get_git_version) -elastic_get_git_version(_ELASTIC_PROJECT_VERSION _ELASTIC_SIMPLE_VERSION _ELASTIC_PROJECT_REVISION) +#include(elastic_get_git_version) +#elastic_get_git_version(_ELASTIC_PROJECT_VERSION _ELASTIC_SIMPLE_VERSION _ELASTIC_PROJECT_REVISION) -message(STATUS "Project version: ${_ELASTIC_PROJECT_VERSION} (${_ELASTIC_SIMPLE_VERSION}) / ${_ELASTIC_PROJECT_REVISION}") +#message(STATUS "Project version: ${_ELASTIC_PROJECT_VERSION} (${_ELASTIC_SIMPLE_VERSION}) / ${_ELASTIC_PROJECT_REVISION}") project("apm-agent-php" #TODO need to handle versioning somehow and generate C++ and PHP version automatically - VERSION "${_ELASTIC_PROJECT_VERSION}" + # VERSION "${_ELASTIC_PROJECT_VERSION}" + VERSION "1.0" LANGUAGES C CXX ) - set(RELEASE_BUILD false) set(DEBUG_BUILD false) if(CMAKE_BUILD_TYPE STREQUAL "Release") diff --git a/agent/native/ext/CMakeLists.txt b/agent/native/ext/CMakeLists.txt index 682eab557..e9b9c85c9 100644 --- a/agent/native/ext/CMakeLists.txt +++ b/agent/native/ext/CMakeLists.txt @@ -48,14 +48,14 @@ foreach(_php_version ${_supported_php_versions}) get_php_api_from_release(${_php_version} _ZEND_API_version) set_target_properties(${_Target} - PROPERTIES OUTPUT_NAME elastic_apm_${_ZEND_API_version} + PROPERTIES OUTPUT_NAME elastic_apm-${_ZEND_API_version} PREFIX "" ) set_target_properties(${_Target} - PROPERTIES OUTPUT_NAME elastic_apm_${_ZEND_API_version} + PROPERTIES OUTPUT_NAME elastic_apm-${_ZEND_API_version} PREFIX "" - DEBUG_SYMBOL_FILE "elastic_apm_${_ZEND_API_version}.debug" + DEBUG_SYMBOL_FILE "elastic_apm-${_ZEND_API_version}.debug" ) if (RELEASE_BUILD) diff --git a/agent/native/ext/numbered_intercepting_callbacks.h b/agent/native/ext/numbered_intercepting_callbacks.h index 77922bac0..cef6f55cd 100644 --- a/agent/native/ext/numbered_intercepting_callbacks.h +++ b/agent/native/ext/numbered_intercepting_callbacks.h @@ -40,7 +40,7 @@ numberedInterceptingCallback( uint32_t index, zend_execute_data* execute_data, z /**/ // Uncomment // gen_numbered_intercepting_callbacks_src( 1000 ); -// in main() in "src/ext/unit_tests/main.c" to generate the part below +// in main() in "agent/native/ext/unit_tests/main.c" to generate the part below ELASTIC_APM_DEFINE_NUMBERED_INTERCEPTING_CALLBACK( 0 ) ELASTIC_APM_DEFINE_NUMBERED_INTERCEPTING_CALLBACK( 1 ) diff --git a/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt b/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt index 013674cd5..30dd7ec60 100644 --- a/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt +++ b/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt @@ -4,7 +4,7 @@ Boolean configuration option value 0 (in this case using environment variable) s ELASTIC_APM_ENABLED=0 ELASTIC_APM_LOG_LEVEL_STDERR=CRITICAL --INI-- -elastic_apm.bootstrap_php_part_file=../bootstrap_php_part.php +elastic_apm.bootstrap_php_part_file=../../php/bootstrap_php_part.php --FILE-- |/ ELASTIC_APM_SERVER_URL=<\/\/> ELASTIC_APM_SERVICE_NAME=/\><\/ --INI-- -elastic_apm.bootstrap_php_part_file=../bootstrap_php_part.php +elastic_apm.bootstrap_php_part_file=../../php/bootstrap_php_part.php --FILE-- |/ elastic_apm.server_url=<\/\/> elastic_apm.service_name=/\><\/ -elastic_apm.bootstrap_php_part_file=../bootstrap_php_part.php +elastic_apm.bootstrap_php_part_file=../../php/bootstrap_php_part.php --FILE-- /src/ext/ConfigManager.h to add the new option for C part of the agent. + // 1) Follow the steps in /agent/native/ext/ConfigManager.h to add the new option for C part of the agent. // NOTE: Build C part of the agent after making the changes above and before proceeding to the steps below. // // diff --git a/composer.json b/composer.json index be9fdd8a6..954f263c9 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ }, "autoload": { "psr-4": { - "Elastic\\Apm\\": "./src/ElasticApm/" + "Elastic\\Apm\\": "./agent/php/ElasticApm/" } }, "autoload-dev": { @@ -57,25 +57,25 @@ }, "scripts": { "parallel-lint": [ - "parallel-lint ./src/ElasticApm/ ./tests/ --exclude ./tests/polyfills/" + "parallel-lint ./agent/php/ElasticApm/ ./tests/ --exclude ./tests/polyfills/" ], "php_codesniffer_check": [ - "phpcs -s ./src/ElasticApm/", + "phpcs -s ./agent/php/ElasticApm/", "phpcs -s ./tests/", "phpcs -s ./examples/" ], "php_codesniffer_fix": [ - "phpcbf ./src/ElasticApm", + "phpcbf ./agent/php/ElasticApm", "phpcbf ./tests", "phpcbf ./examples/" ], "phpstan-junit-report-for-ci": [ - "phpstan analyse --error-format=junit -c ./phpstan.neon ./src/ElasticApm/ --level max --memory-limit=1G | tee build/elasticapm-phpstan-junit.xml", + "phpstan analyse --error-format=junit -c ./phpstan.neon ./agent/php/ElasticApm/ --level max --memory-limit=1G | tee build/elasticapm-phpstan-junit.xml", "phpstan analyse --error-format=junit -c ./phpstan.neon ./tests/ --level max --memory-limit=1G --error-format=junit | tee build/tests-phpstan-junit.xml", "phpstan analyse --error-format=junit -c ./phpstan.neon ./examples/ --level max --memory-limit=1G --error-format=junit | tee build/examples-phpstan-junit.xml" ], "phpstan": [ - "phpstan analyse -c ./phpstan.neon ./src/ElasticApm/ --level max --memory-limit=1G", + "phpstan analyse -c ./phpstan.neon ./agent/php/ElasticApm/ --level max --memory-limit=1G", "phpstan analyse -c ./phpstan.neon ./tests/ --level max --memory-limit=1G", "phpstan analyse -c ./phpstan.neon ./examples/ --level max --memory-limit=1G" ], diff --git a/demos/shared/install_agent.sh b/demos/shared/install_agent.sh index 2f9b04e10..9957daf08 100644 --- a/demos/shared/install_agent.sh +++ b/demos/shared/install_agent.sh @@ -42,8 +42,8 @@ install_local_package_from_url () { ;; esac - grep PHP_ELASTIC_APM_VERSION "/opt/elastic/apm-agent-php/src/ext/elastic_apm_version.h" - grep VERSION "/opt/elastic/apm-agent-php/src/ElasticApm/ElasticApm.php" + grep PHP_ELASTIC_APM_VERSION "/opt/elastic/apm-agent-php/agent/native/ext/elastic_apm_version.h" + grep VERSION "/opt/elastic/apm-agent-php/agent/php/ElasticApm/ElasticApm.php" } detect_and_install () { diff --git a/packaging/Makefile b/packaging/Makefile index 19e8d157e..6c701ad86 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash MAKEFLAGS += --no-print-directory IMAGE:=php-packaging NAME:=apm-agent-php -VERSION?=$(shell grep 'VERSION' ../src/ElasticApm/ElasticApm.php | cut -d= -f2 | tr -d " " | sed "s/'\(.*\)'.*/\1/g") +VERSION?=$(shell grep 'VERSION' ../agent/php/ElasticApm/ElasticApm.php | cut -d= -f2 | tr -d " " | sed "s/'\(.*\)'.*/\1/g") OUTPUT:=build/packages PHP_AGENT_DIR:=/opt/elastic/apm-agent-php PHP_VERSION?=7.2 @@ -89,7 +89,9 @@ rpm-info: ## Show the rpm package metadata .PHONY: tar-info tar-info: ## Show the tar package metadata cd $(PWD) ;\ - BINARY=$$(ls -1 $(OUTPUT)/*.tar) ;\ + BINARY=$$(ls -1 $(OUTPUT)/*-linux-x86-64*.tar) ;\ + docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY ;\ + BINARY=$$(ls -1 $(OUTPUT)/*-linuxmusl-x86-64*.tar) ;\ docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY .PHONY: prepare-apk diff --git a/packaging/before-uninstall.sh b/packaging/before-uninstall.sh index 621b6c333..21f365a6f 100755 --- a/packaging/before-uninstall.sh +++ b/packaging/before-uninstall.sh @@ -103,9 +103,9 @@ function remove_extension_configuration_to_file() { function get_extension_filename() { PHP_API=$(php_api) ## If alpine then add another suffix - if grep -q -i alpine /etc/os-release; then - SUFFIX=-alpine - fi +# if grep -q -i alpine /etc/os-release; then +# SUFFIX=-alpine +# fi echo "elastic_apm-${PHP_API}${SUFFIX}.so" } diff --git a/packaging/create-package.sh b/packaging/create-package.sh index 3aca60a7b..b76a885a5 100755 --- a/packaging/create-package.sh +++ b/packaging/create-package.sh @@ -5,36 +5,19 @@ set -x ## - If alpine then use only alpine so files ## - If deb/rpm then skip alpine so files ## - If tar then use all the so files -BUILD_EXT_DIR=build/ext/modules/ -mkdir -p ${BUILD_EXT_DIR} -cp -rf src/ext/modules/*.so ${BUILD_EXT_DIR} -if [ "${TYPE}" = 'apk' ] ; then - find ${BUILD_EXT_DIR} -type f -name '*.so' ! -name '*-alpine.so' -delete -elif [ "${TYPE}" = 'deb' ] || [ "${TYPE}" = 'rpm' ] ; then - find ${BUILD_EXT_DIR} -type f -name '*-alpine.so' -delete -fi -## src/ext files to be archived in the package -BUILD_SRC_EXT_DIR=build/src -IGNORE_FILE=${BUILD_SRC_EXT_DIR}/ext/.gitignore -mkdir -p ${BUILD_SRC_EXT_DIR} -cp -rf src/ext ${BUILD_SRC_EXT_DIR} -if [ -e ${IGNORE_FILE} ] ; then - while IFS= read -r line - do - if [ -n "$line" ]; then - if case $line in "#"*) false;; *) true;; esac; then - # shellcheck disable=SC2086 - rm -rf ${BUILD_SRC_EXT_DIR}/ext/${line} || true - fi - fi - done < "${IGNORE_FILE}" - rm ${IGNORE_FILE} || true +BUILD_EXT_DIR="" + +if [ "${TYPE}" = 'apk' ] ; then + BUILD_EXT_DIR=build/ext/linuxmusl-x86-64/ +else + BUILD_EXT_DIR=build/ext/linux-x86-64/ fi touch build/elastic-apm.ini -## Create package +function createPackage () { + fpm --input-type dir \ --output-type "${TYPE}" \ --name "${NAME}" \ @@ -55,15 +38,31 @@ fpm --input-type dir \ build/elastic-apm.ini=${PHP_AGENT_DIR}/etc/ \ packaging/elastic-apm-custom-template.ini=${PHP_AGENT_DIR}/etc/elastic-apm-custom.ini \ packaging/before-uninstall.sh=${PHP_AGENT_DIR}/bin/before-uninstall.sh \ - ${BUILD_SRC_EXT_DIR}=${PHP_AGENT_DIR} \ + agent/php/=${PHP_AGENT_DIR}/src \ ${BUILD_EXT_DIR}=${PHP_AGENT_DIR}/extensions \ - README.md=${PHP_AGENT_DIR}/docs/README.md \ - src/ElasticApm=${PHP_AGENT_DIR}/src \ - src/bootstrap_php_part.php=${PHP_AGENT_DIR}/src/bootstrap_php_part.php + README.md=${PHP_AGENT_DIR}/docs/README.md ## Create sha512 -BINARY=$(ls -1 "${OUTPUT}"/*."${TYPE}") +BINARY=$(ls -1 "${OUTPUT}"/${NAME}*."${TYPE}") SHA=${BINARY}.sha512 sha512sum "${BINARY}" > "${SHA}" sed -i.bck "s#${OUTPUT}/##g" "${SHA}" rm "${OUTPUT}"/*.bck + +} + + + +# create second tar for musl +if [ "${TYPE}" = 'tar' ] ; then + NAME_BACKUP=${NAME} + NAME="${NAME_BACKUP}-linux-x86-64" + BUILD_EXT_DIR=build/ext/linux-x86-64/ + createPackage + + NAME="${NAME_BACKUP}-linuxmusl-x86-64" + BUILD_EXT_DIR=build/ext/linuxmusl-x86-64/ + createPackage +else + createPackage +fi \ No newline at end of file diff --git a/packaging/post-install.sh b/packaging/post-install.sh index 2b96f9b8c..460475570 100755 --- a/packaging/post-install.sh +++ b/packaging/post-install.sh @@ -186,9 +186,9 @@ function agent_extension_not_supported() { function get_extension_file() { PHP_API=$(php_api) ## If alpine then add another suffix - if grep -q -i alpine /etc/os-release; then - SUFFIX=-alpine - fi +# if grep -q -i alpine /etc/os-release; then +# SUFFIX=-alpine +# fi echo "${EXTENSION_DIR}/elastic_apm-${PHP_API}${SUFFIX}.so" } diff --git a/packaging/test/centos/entrypoint.sh b/packaging/test/centos/entrypoint.sh index dbb4684d0..d03273999 100755 --- a/packaging/test/centos/entrypoint.sh +++ b/packaging/test/centos/entrypoint.sh @@ -64,7 +64,7 @@ elif [ "${TYPE}" == "release-github" ] ; then download "${PACKAGE}" "${BUILD_RELEASES_FOLDER}" "${GITHUB_RELEASES_URL}/v${VERSION}" rpm -ivh "${BUILD_RELEASES_FOLDER}/${PACKAGE}" elif [ "${TYPE}" == "release-tar-github" ] ; then - PACKAGE=apm-agent-php.tar + PACKAGE=apm-agent-php-linux-x86-64.tar download "${PACKAGE}" "${BUILD_RELEASES_FOLDER}" "${GITHUB_RELEASES_URL}/v${VERSION}" ## Install tar package and configure the agent accordingly tar -xf ${BUILD_RELEASES_FOLDER}/${PACKAGE} -C / @@ -79,7 +79,7 @@ elif [ "${TYPE}" == "agent-upgrade-local" ] ; then rpm -ivh build/local/*.rpm else ## Install tar package and configure the agent accordingly - tar -xf $BUILD_PACKAGES/*.tar -C / + tar -xf $BUILD_PACKAGES/*-linux-x86-64*.tar -C / # shellcheck disable=SC1091 source /opt/elastic/apm-agent-php/bin/post-install.sh fi diff --git a/packaging/test/ubuntu/entrypoint.sh b/packaging/test/ubuntu/entrypoint.sh index 699a1becd..a1fc1566e 100755 --- a/packaging/test/ubuntu/entrypoint.sh +++ b/packaging/test/ubuntu/entrypoint.sh @@ -64,7 +64,7 @@ elif [ "${TYPE}" == "release-github" ] ; then dpkg-sig --verify "${BUILD_RELEASES_FOLDER}/${PACKAGE}" dpkg -i "${BUILD_RELEASES_FOLDER}/${PACKAGE}" elif [ "${TYPE}" == "release-tar-github" ] ; then - PACKAGE=apm-agent-php.tar + PACKAGE=apm-agent-php-linux-x86-64.tar download "${PACKAGE}" "${BUILD_RELEASES_FOLDER}" "${GITHUB_RELEASES_URL}/v${VERSION}" ## Install tar package and configure the agent accordingly tar -xf ${BUILD_RELEASES_FOLDER}/${PACKAGE} -C / @@ -78,7 +78,7 @@ elif [ "${TYPE}" == "agent-upgrade-local" ] ; then dpkg -i build/local/*.deb else ## Install tar package and configure the agent accordingly - tar -xf $BUILD_PACKAGES/*.tar -C / + tar -xf $BUILD_PACKAGES/*-linux-x86-64*.tar -C / ls -ltrah /opt/elastic/apm-agent-php/bin # shellcheck disable=SC1091 source /opt/elastic/apm-agent-php/bin/post-install.sh From ee3ffe439ed04a7b6d2d65d33f7133b2c05b1764 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 30 May 2023 21:42:22 +0200 Subject: [PATCH 06/50] updated release workflow --- .github/workflows/release.yml | 39 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1414d4007..fac5f7ba0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,44 +12,41 @@ on: jobs: build: + name: build-agent-library runs-on: ubuntu-latest timeout-minutes: 30 strategy: fail-fast: false matrix: - php-version: - - "7.2" - - "7.3" - - "7.4" - - "8.0" - - "8.1" - - "8.2" - dockerfile: - - "Dockerfile" - - "Dockerfile.alpine" + arch: + - "linux-x86-64" + - "linuxmusl-x86-64" env: - PHP_VERSION: ${{ matrix.php-version }} - DOCKERFILE: ${{ matrix.dockerfile }} + BUILD_ARCHITECTURE: ${{ matrix.arch }} steps: - uses: actions/checkout@v3 - name: Build - run: make -f .ci/Makefile build - - name: Build parts for packages - run: make -f .ci/Makefile generate-for-package + run: make -f .ci/Makefile modernbuild - uses: actions/upload-artifact@v3 with: - name: package-parts - path: src/ext/modules/*.so - generate-packages: + name: package-parts-${{ matrix.arch }} + path: | + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm*.so + agent/native/_build/${{ matrix.arch }}-release/ext/elastic_apm*.debug + build-packages: runs-on: ubuntu-latest needs: - - test + - build steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 with: - name: package-parts - path: src/ext/modules + name: package-parts-linux-x86-64 + path: build/ext/linux-x86-64 + - uses: actions/download-artifact@v3 + with: + name: package-parts-linuxmusl-x86-64 + path: build/ext/linuxmusl-x86-64 - name: package run: make -C packaging package - name: package info From b6e347e987244fd5d1b548e04f97262b0ba5797e Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 30 May 2023 21:42:39 +0200 Subject: [PATCH 07/50] separate tar package for debugsymbols --- packaging/create-package.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/packaging/create-package.sh b/packaging/create-package.sh index b76a885a5..5f2143d5f 100755 --- a/packaging/create-package.sh +++ b/packaging/create-package.sh @@ -34,6 +34,7 @@ fpm --input-type dir \ --before-remove=packaging/before-uninstall.sh \ --directories ${PHP_AGENT_DIR}/etc \ --config-files ${PHP_AGENT_DIR}/etc \ + --exclude ${BUILD_EXT_DIR}/*.debug \ packaging/post-install.sh=${PHP_AGENT_DIR}/bin/post-install.sh \ build/elastic-apm.ini=${PHP_AGENT_DIR}/etc/ \ packaging/elastic-apm-custom-template.ini=${PHP_AGENT_DIR}/etc/elastic-apm-custom.ini \ @@ -52,6 +53,34 @@ rm "${OUTPUT}"/*.bck } +function createDebugPackage () { + +fpm --input-type dir \ + --output-type "${TYPE}" \ + --name "${NAME}" \ + --version "${VERSION}" \ + --architecture all \ + --url 'https://github.com/elastic/apm-agent-php' \ + --maintainer 'APM Team ' \ + --license 'ASL 2.0' \ + --vendor 'Elasticsearch, Inc.' \ + --description "PHP debug symbols agent for Elastic APM\nGit Commit: ${GIT_SHA}" \ + --package "${OUTPUT}" \ + --chdir /app ${FPM_FLAGS} \ + --exclude ${BUILD_EXT_DIR}/*.so \ + ${BUILD_EXT_DIR}=${PHP_AGENT_DIR} + +## Create sha512 +BINARY=$(ls -1 "${OUTPUT}"/${NAME}*."${TYPE}") +SHA=${BINARY}.sha512 +sha512sum "${BINARY}" > "${SHA}" +sed -i.bck "s#${OUTPUT}/##g" "${SHA}" +rm "${OUTPUT}"/*.bck + +} + + + # create second tar for musl if [ "${TYPE}" = 'tar' ] ; then @@ -60,9 +89,15 @@ if [ "${TYPE}" = 'tar' ] ; then BUILD_EXT_DIR=build/ext/linux-x86-64/ createPackage + NAME="${NAME_BACKUP}-debugsymbols-linux-x86-64" + createDebugPackage + NAME="${NAME_BACKUP}-linuxmusl-x86-64" BUILD_EXT_DIR=build/ext/linuxmusl-x86-64/ createPackage + + NAME="${NAME_BACKUP}-debugsymbols-linuxmusl-x86-64" + createDebugPackage else createPackage fi \ No newline at end of file From 15bd54b0e92692cc0024caebc6e7946b6d29c0ac Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 31 May 2023 12:09:56 +0200 Subject: [PATCH 08/50] separate tar package for debugsymbols --- packaging/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packaging/Makefile b/packaging/Makefile index 6c701ad86..fa770615f 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -89,9 +89,13 @@ rpm-info: ## Show the rpm package metadata .PHONY: tar-info tar-info: ## Show the tar package metadata cd $(PWD) ;\ - BINARY=$$(ls -1 $(OUTPUT)/*-linux-x86-64*.tar) ;\ + BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-linux-x86-64*.tar) ;\ docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY ;\ - BINARY=$$(ls -1 $(OUTPUT)/*-linuxmusl-x86-64*.tar) ;\ + BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-debugsymbols-linux-x86-64*.tar) ;\ + docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY ;\ + BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-linuxmusl-x86-64*.tar) ;\ + docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY + BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-debugsymbols-linuxmusl-x86-64*.tar) ;\ docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY .PHONY: prepare-apk From 41337c8f2f75075814f35b2f7a3e2e82572959bb Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 31 May 2023 12:54:41 +0200 Subject: [PATCH 09/50] reverted back build target name and fixed packaging --- .ci/Makefile | 14 ++------------ .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 4 +--- packaging/create-package.sh | 6 +++--- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.ci/Makefile b/.ci/Makefile index 1dfcb84d8..2b1c2a42a 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -39,18 +39,8 @@ prepare: ## Build docker image for building and testing the project -f ${DOCKERFILE} . @echo "::endgroup::" -# .PHONY: build -# build: prepare ## Build the project -# @echo "::group::$@" # Helping to group logs in GitHub actions -# # docker as the current user -# docker run --rm -t \ -# -u $(CURRENT_UID):$(CURRENT_GID) \ -# -v $(PWD):/app \ -# $(IMAGE):${PHP_VERSION}$(SUFFIX) -# @echo "::endgroup::" - -.PHONY: modernbuild -modernbuild: +.PHONY: build +build: @echo "::group::$@" # Helping to group logs in GitHub actions # docker as the current user docker run --rm -t \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fac5f7ba0..7c10aba3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build - run: make -f .ci/Makefile modernbuild + run: make -f .ci/Makefile build - uses: actions/upload-artifact@v3 with: name: package-parts-${{ matrix.arch }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b628cbbe2..38da2e8c7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build - run: make -f .ci/Makefile modernbuild + run: make -f .ci/Makefile build - uses: actions/upload-artifact@v3 with: name: package-parts-${{ matrix.arch }} @@ -105,8 +105,6 @@ jobs: run: make -f .ci/Makefile prepare - name: Static Check / Unit tests run: make -f .ci/Makefile static-check-unit-test - # - name: Build parts for packages - # run: make -f .ci/Makefile generate-for-package - if: success() || failure() name: Prepare Upload run: >- diff --git a/packaging/create-package.sh b/packaging/create-package.sh index 5f2143d5f..130813f85 100755 --- a/packaging/create-package.sh +++ b/packaging/create-package.sh @@ -34,7 +34,7 @@ fpm --input-type dir \ --before-remove=packaging/before-uninstall.sh \ --directories ${PHP_AGENT_DIR}/etc \ --config-files ${PHP_AGENT_DIR}/etc \ - --exclude ${BUILD_EXT_DIR}/*.debug \ + --exclude *.debug \ packaging/post-install.sh=${PHP_AGENT_DIR}/bin/post-install.sh \ build/elastic-apm.ini=${PHP_AGENT_DIR}/etc/ \ packaging/elastic-apm-custom-template.ini=${PHP_AGENT_DIR}/etc/elastic-apm-custom.ini \ @@ -67,8 +67,8 @@ fpm --input-type dir \ --description "PHP debug symbols agent for Elastic APM\nGit Commit: ${GIT_SHA}" \ --package "${OUTPUT}" \ --chdir /app ${FPM_FLAGS} \ - --exclude ${BUILD_EXT_DIR}/*.so \ - ${BUILD_EXT_DIR}=${PHP_AGENT_DIR} + --exclude *.so \ + ${BUILD_EXT_DIR}=${PHP_AGENT_DIR}/extensions ## Create sha512 BINARY=$(ls -1 "${OUTPUT}"/${NAME}*."${TYPE}") From df2cfc2a46fee6aa31131f6dd637e5fd7d57109c Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 31 May 2023 13:01:17 +0200 Subject: [PATCH 10/50] cleanup --- .ci/Makefile | 11 ----------- .ci/generate-for-package.sh | 32 -------------------------------- packaging/Makefile | 6 +++--- 3 files changed, 3 insertions(+), 46 deletions(-) delete mode 100755 .ci/generate-for-package.sh diff --git a/.ci/Makefile b/.ci/Makefile index 2b1c2a42a..49bce8d71 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -75,17 +75,6 @@ run-phpt-tests: prepare ## Runs phpt tests /app/.ci/run-phpt-tests.sh @echo "::endgroup::" -# .PHONY: generate-for-package -# generate-for-package: prepare ## Generate the agent extension for the package -# @echo "::group::$@" # Helping to group logs in GitHub actions -# # docker as the current user -# docker run --rm -t \ -# -v $(PWD):/app \ -# -u $(CURRENT_UID):$(CURRENT_GID) \ -# $(IMAGE):${PHP_VERSION}$(SUFFIX) \ -# /app/.ci/generate-for-package.sh -# @echo "::endgroup::" - .PHONY: interactive interactive: prepare ## Run an interactive docker shell docker run -it --rm \ diff --git a/.ci/generate-for-package.sh b/.ci/generate-for-package.sh deleted file mode 100755 index b83f9d0d7..000000000 --- a/.ci/generate-for-package.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -exo pipefail - -HYPHEN="-" -MODULES_DIR=/app/src/ext/modules -NAME=elastic_apm -## Prepare context where to copy the previous generated so files -GENERATED_DIR=$(mktemp -d /tmp/dirXXXXXX) -find "${MODULES_DIR}" -name "*${HYPHEN}*.so" -exec cp {} ${GENERATED_DIR} \; -ls -l ${GENERATED_DIR} - -## If alpine then add another suffix -if grep -q -i alpine /etc/os-release; then - SUFFIX=${HYPHEN}alpine -fi - -## Generate so file -make clean -make - -## Fetch PHP api version to be added to the so file that has been generated -PHP_API=$(php -i | grep -i 'PHP API' | sed -e 's#.* =>##g' | awk '{print $1}') - -## Rename so file with the PHP api -mv "${MODULES_DIR}/${NAME}.so" "${MODULES_DIR}/${NAME}${HYPHEN}${PHP_API}${SUFFIX}.so" - -## Remove la files -find "${MODULES_DIR}" -name "*.la" -print0 | xargs -0 rm -f - -## Restore previous so files. -find "${GENERATED_DIR}" -name "*${HYPHEN}*.so" -exec cp -f {} ${MODULES_DIR}/ \; diff --git a/packaging/Makefile b/packaging/Makefile index fa770615f..4bb615df7 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -91,11 +91,11 @@ tar-info: ## Show the tar package metadata cd $(PWD) ;\ BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-linux-x86-64*.tar) ;\ docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY ;\ - BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-debugsymbols-linux-x86-64*.tar) ;\ + BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-debugsymbols-linux-x86-64.tar) ;\ docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY ;\ BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-linuxmusl-x86-64*.tar) ;\ - docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY - BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-debugsymbols-linuxmusl-x86-64*.tar) ;\ + docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY ;\ + BINARY=$$(ls -1 $(OUTPUT)/$(NAME)-debugsymbols-linuxmusl-x86-64.tar) ;\ docker run --rm -v $(PWD):/app -w /app --entrypoint /usr/bin/tar $(IMAGE) -tvf $$BINARY .PHONY: prepare-apk From f6f89f27f9db039795758f519dfc80584550fba6 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 31 May 2023 14:43:25 +0200 Subject: [PATCH 11/50] updated paths to work with local packaging --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 8 +++---- packaging/create-package.sh | 40 +++++++++++++++++++++-------------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c10aba3e..0c6b7113e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,11 +42,11 @@ jobs: - uses: actions/download-artifact@v3 with: name: package-parts-linux-x86-64 - path: build/ext/linux-x86-64 + path: agent/native/_build/linux-x86-64-release/ext - uses: actions/download-artifact@v3 with: name: package-parts-linuxmusl-x86-64 - path: build/ext/linuxmusl-x86-64 + path: agent/native/_build/linuxmusl-x86-64-release/ext - name: package run: make -C packaging package - name: package info diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 38da2e8c7..bdf00ec32 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -129,11 +129,11 @@ jobs: - uses: actions/download-artifact@v3 with: name: package-parts-linux-x86-64 - path: build/ext/linux-x86-64 + path: agent/native/_build/linux-x86-64-release/ext - uses: actions/download-artifact@v3 with: name: package-parts-linuxmusl-x86-64 - path: build/ext/linuxmusl-x86-64 + path: agent/native/_build/linuxmusl-x86-64-release/ext - name: package run: make -C packaging package - name: package info @@ -182,11 +182,11 @@ jobs: - uses: actions/download-artifact@v3 with: name: package-parts-linux-x86-64 - path: build/ext/linux-x86-64 + path: agent/native/_build/linux-x86-64-release/ext - uses: actions/download-artifact@v3 with: name: package-parts-linuxmusl-x86-64 - path: build/ext/linuxmusl-x86-64 + path: agent/native/_build/linuxmusl-x86-64-release/ext - if: ${{ env.TESTING_TYPE == 'lifecycle' }} name: lifecycle test diff --git a/packaging/create-package.sh b/packaging/create-package.sh index 130813f85..cc40af01d 100755 --- a/packaging/create-package.sh +++ b/packaging/create-package.sh @@ -9,15 +9,18 @@ set -x BUILD_EXT_DIR="" if [ "${TYPE}" = 'apk' ] ; then - BUILD_EXT_DIR=build/ext/linuxmusl-x86-64/ + BUILD_EXT_DIR=agent/native/_build/linuxmusl-x86-64-release/ext/ else - BUILD_EXT_DIR=build/ext/linux-x86-64/ + BUILD_EXT_DIR=agent/native/_build/linux-x86-64-release/ext/ fi touch build/elastic-apm.ini function createPackage () { +mkdir -p /tmp/extensions +cp ${BUILD_EXT_DIR}/*.so /tmp/extensions/ + fpm --input-type dir \ --output-type "${TYPE}" \ --name "${NAME}" \ @@ -29,19 +32,20 @@ fpm --input-type dir \ --vendor 'Elasticsearch, Inc.' \ --description "PHP agent for Elastic APM\nGit Commit: ${GIT_SHA}" \ --package "${OUTPUT}" \ - --chdir /app ${FPM_FLAGS} \ + ${FPM_FLAGS} \ --after-install=packaging/post-install.sh \ --before-remove=packaging/before-uninstall.sh \ --directories ${PHP_AGENT_DIR}/etc \ --config-files ${PHP_AGENT_DIR}/etc \ - --exclude *.debug \ - packaging/post-install.sh=${PHP_AGENT_DIR}/bin/post-install.sh \ - build/elastic-apm.ini=${PHP_AGENT_DIR}/etc/ \ - packaging/elastic-apm-custom-template.ini=${PHP_AGENT_DIR}/etc/elastic-apm-custom.ini \ - packaging/before-uninstall.sh=${PHP_AGENT_DIR}/bin/before-uninstall.sh \ - agent/php/=${PHP_AGENT_DIR}/src \ - ${BUILD_EXT_DIR}=${PHP_AGENT_DIR}/extensions \ - README.md=${PHP_AGENT_DIR}/docs/README.md + /app/packaging/post-install.sh=${PHP_AGENT_DIR}/bin/post-install.sh \ + /app/build/elastic-apm.ini=${PHP_AGENT_DIR}/etc/ \ + /app/packaging/elastic-apm-custom-template.ini=${PHP_AGENT_DIR}/etc/elastic-apm-custom.ini \ + /app/packaging/before-uninstall.sh=${PHP_AGENT_DIR}/bin/before-uninstall.sh \ + /app/agent/php/=${PHP_AGENT_DIR}/src \ + /tmp/extensions/=${PHP_AGENT_DIR}/extensions \ + /app/README.md=${PHP_AGENT_DIR}/docs/README.md + +rm -rf /tmp/extensions ## Create sha512 BINARY=$(ls -1 "${OUTPUT}"/${NAME}*."${TYPE}") @@ -55,6 +59,9 @@ rm "${OUTPUT}"/*.bck function createDebugPackage () { +mkdir -p /tmp/extensions +cp ${BUILD_EXT_DIR}/*.debug /tmp/extensions/ + fpm --input-type dir \ --output-type "${TYPE}" \ --name "${NAME}" \ @@ -66,9 +73,10 @@ fpm --input-type dir \ --vendor 'Elasticsearch, Inc.' \ --description "PHP debug symbols agent for Elastic APM\nGit Commit: ${GIT_SHA}" \ --package "${OUTPUT}" \ - --chdir /app ${FPM_FLAGS} \ - --exclude *.so \ - ${BUILD_EXT_DIR}=${PHP_AGENT_DIR}/extensions + ${FPM_FLAGS} \ + /tmp/extensions/=${PHP_AGENT_DIR}/extensions + +rm -rf /tmp/extensions ## Create sha512 BINARY=$(ls -1 "${OUTPUT}"/${NAME}*."${TYPE}") @@ -86,14 +94,14 @@ rm "${OUTPUT}"/*.bck if [ "${TYPE}" = 'tar' ] ; then NAME_BACKUP=${NAME} NAME="${NAME_BACKUP}-linux-x86-64" - BUILD_EXT_DIR=build/ext/linux-x86-64/ + BUILD_EXT_DIR=agent/native/_build/linux-x86-64-release/ext/ createPackage NAME="${NAME_BACKUP}-debugsymbols-linux-x86-64" createDebugPackage NAME="${NAME_BACKUP}-linuxmusl-x86-64" - BUILD_EXT_DIR=build/ext/linuxmusl-x86-64/ + BUILD_EXT_DIR=agent/native/_build/linuxmusl-x86-64-release/ext/ createPackage NAME="${NAME_BACKUP}-debugsymbols-linuxmusl-x86-64" From eed47a2f701c2264e407171065be2f87b9eb756d Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 31 May 2023 14:44:49 +0200 Subject: [PATCH 12/50] updated development guide --- DEVELOPMENT.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 4865d4199..d3498ddd3 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -7,27 +7,27 @@ If you don't want to install any of the dependencies you might need to compile and install the library then you can use the Dockerfile. ```bash -## To prepare the build docker container +## To compile the library for all supported PHP releases for glibc Linux distributions +BUILD_ARCHITECTURE=linux-x86-64 make -f .ci/Makefile build + +## To compile the library for all supported PHP releases for musl libc Linux distributions +BUILD_ARCHITECTURE=linuxmusl-x86-64 make -f .ci/Makefile build + +## To prepare the docker container for testing PHP_VERSION=7.2 make -f .ci/Makefile prepare -## To compile the library -PHP_VERSION=7.2 make -f .ci/Makefile build +## To run PHP tests of native extension (phpt) +PHP_VERSION=7.2 make -f .ci/Makefile run-phpt-tests ## To run the unit test and static check PHP_VERSION=7.2 make -f .ci/Makefile static-check-unit-test -## To generate the agent extension with the existing PHP API -PHP_VERSION=7.2 make -f .ci/Makefile generate-for-package - ## To run the component tests PHP_VERSION=7.2 make -f .ci/Makefile component-test ## To release given the GITHUB_TOKEN and TAG_NAME, it creates a draft release GITHUB_TOKEN=**** TAG_NAME=v1.0.0 make -f .ci/Makefile draft-release -## To generate the agent extension with the existing PHP API for alpine -PHP_VERSION=7.2 DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile generate-for-package - ## Help goal will provide further details make -f .ci/Makefile help ``` From 4c580133b1233c1ef2237308cbafde886b470b10 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 31 May 2023 14:53:00 +0200 Subject: [PATCH 13/50] fixed lifecycle tests for tar achives --- packaging/test/centos/entrypoint.sh | 2 +- packaging/test/ubuntu/entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/test/centos/entrypoint.sh b/packaging/test/centos/entrypoint.sh index d03273999..ff6d96c70 100755 --- a/packaging/test/centos/entrypoint.sh +++ b/packaging/test/centos/entrypoint.sh @@ -79,7 +79,7 @@ elif [ "${TYPE}" == "agent-upgrade-local" ] ; then rpm -ivh build/local/*.rpm else ## Install tar package and configure the agent accordingly - tar -xf $BUILD_PACKAGES/*-linux-x86-64*.tar -C / + tar -xf $BUILD_PACKAGES/apm-agent-php-linux-x86-64.tar -C / # shellcheck disable=SC1091 source /opt/elastic/apm-agent-php/bin/post-install.sh fi diff --git a/packaging/test/ubuntu/entrypoint.sh b/packaging/test/ubuntu/entrypoint.sh index a1fc1566e..7809ae404 100755 --- a/packaging/test/ubuntu/entrypoint.sh +++ b/packaging/test/ubuntu/entrypoint.sh @@ -78,7 +78,7 @@ elif [ "${TYPE}" == "agent-upgrade-local" ] ; then dpkg -i build/local/*.deb else ## Install tar package and configure the agent accordingly - tar -xf $BUILD_PACKAGES/*-linux-x86-64*.tar -C / + tar -xf $BUILD_PACKAGES/apm-agent-php-linux-x86-64.tar -C / ls -ltrah /opt/elastic/apm-agent-php/bin # shellcheck disable=SC1091 source /opt/elastic/apm-agent-php/bin/post-install.sh From e5b879ef1c998f8a5300c2bbf59f48e7ee1af1db Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Thu, 1 Jun 2023 15:04:02 +0200 Subject: [PATCH 14/50] updated development guide --- DEVELOPMENT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d3498ddd3..1455b3d6f 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -17,7 +17,7 @@ BUILD_ARCHITECTURE=linuxmusl-x86-64 make -f .ci/Makefile build PHP_VERSION=7.2 make -f .ci/Makefile prepare ## To run PHP tests of native extension (phpt) -PHP_VERSION=7.2 make -f .ci/Makefile run-phpt-tests +BUILD_ARCHITECTURE=linux-x86-64 PHP_VERSION=7.2 make -f .ci/Makefile run-phpt-tests ## To run the unit test and static check PHP_VERSION=7.2 make -f .ci/Makefile static-check-unit-test From ff01009adec2ff8552e61ac3f3a0426b26c404c5 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Thu, 1 Jun 2023 15:05:54 +0200 Subject: [PATCH 15/50] updated Jenkins pipeline --- .ci/Jenkinsfile | 81 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 8ca763ace..42c30fbfa 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -84,7 +84,7 @@ pipeline { } } } - stage('Build binaries and basic testing') { + stage('Build binaries') { options { skipDefaultCheckout() } when { beforeAgent true @@ -94,32 +94,85 @@ pipeline { matrix { agent { label 'ubuntu-18.04 && immutable' } axes { + axis { + name 'BUILD_ARCHITECTURE' + values 'linux-x86-64', 'linuxmusl-x86-64' + } + } + + stages { + stage('Build PHP extension') { + steps { + // paplo - not sure if should be here + initWorkspace(context: "Build-${BUILD_ARCHITECTURE}") { + sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} make -f .ci/Makefile build", label: 'build' + } + } + } + } + } + } + stage('PHP tests of extension') { + options { skipDefaultCheckout() } + when { + beforeAgent true + expression { return env.ONLY_DOCS == "false" } + } + failFast false + matrix { + agent { label 'ubuntu-18.04 && immutable' } + axes { + axis { + name 'BUILD_ARCHITECTURE' + values 'linux-x86-64', 'linuxmusl-x86-64' + } axis { name 'PHP_VERSION' // Make sure list of PHP versions supported by the Elastic APM PHP Agent is in sync. // See the comment in .ci/shared.sh values '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' } - axis { - name 'DOCKERFILE' - values 'Dockerfile', 'Dockerfile.alpine' - } } + stages { stage('Build PHP extension') { steps { - echo "params.INCLUDE_TESTING: ${params.INCLUDE_TESTING}" - echo "params.ADD_LIBUNWIND_DEPENDENCY: ${params.ADD_LIBUNWIND_DEPENDENCY}" - initWorkspace(context: "Build-${PHP_VERSION}") { + // paplo - not sure if should be here + initWorkspace(context: "PHPT-${PHP_VERSION}") { // When running in the CI with multiple parallel stages // the access could be considered as a DDOS attack. retryWithSleep(retries: 3, seconds: 5, backoff: true) { sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} ADD_LIBUNWIND_DEPENDENCY=${params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile prepare", label: 'prepare docker image' } - sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile build", label: 'build' + sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} make -f .ci/Makefile run-phpt-tests", label: 'run-phpt-tests' } } } + } + } + } + stage('Static analysis and tests') { + options { skipDefaultCheckout() } + when { + beforeAgent true + expression { return env.ONLY_DOCS == "false" } + } + failFast false + matrix { + agent { label 'ubuntu-18.04 && immutable' } + axes { + axis { + name 'PHP_VERSION' + // Make sure list of PHP versions supported by the Elastic APM PHP Agent is in sync. + // See the comment in .ci/shared.sh + values '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' + } + axis { + name 'DOCKERFILE' + values 'Dockerfile', 'Dockerfile.alpine' + } + } + stages { stage('Static analysis and unit tests') { when { beforeAgent true @@ -147,16 +200,6 @@ pipeline { } } } - stage('Build parts for packages') { - steps { - withGithubNotify(context: "Generate-For-Package-${PHP_VERSION}") { - dir("${BASE_DIR}"){ - sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} ADD_LIBUNWIND_DEPENDENCY=${params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile generate-for-package", label: 'generate-for-package' - stash includes: 'src/ext/modules/*.so', name: "generate-for-package-${PHP_VERSION}-${DOCKERFILE}" - } - } - } - } } } } From a49b68522ade2202c71710af42c923e9e67647cd Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Thu, 1 Jun 2023 15:49:42 +0200 Subject: [PATCH 16/50] fixed phpt test stage --- .ci/Jenkinsfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 42c30fbfa..22ccae34f 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -135,15 +135,9 @@ pipeline { } stages { - stage('Build PHP extension') { + stage('Execute phpt tests') { steps { - // paplo - not sure if should be here initWorkspace(context: "PHPT-${PHP_VERSION}") { - // When running in the CI with multiple parallel stages - // the access could be considered as a DDOS attack. - retryWithSleep(retries: 3, seconds: 5, backoff: true) { - sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} ADD_LIBUNWIND_DEPENDENCY=${params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile prepare", label: 'prepare docker image' - } sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} make -f .ci/Makefile run-phpt-tests", label: 'run-phpt-tests' } } From 98b726366d669cf3b4b9732d432bc1f758cf974f Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Thu, 1 Jun 2023 22:40:58 +0200 Subject: [PATCH 17/50] fixed Jenkins pipeline --- .ci/Jenkinsfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 22ccae34f..ccf2555d2 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -103,10 +103,14 @@ pipeline { stages { stage('Build PHP extension') { steps { - // paplo - not sure if should be here initWorkspace(context: "Build-${BUILD_ARCHITECTURE}") { sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} make -f .ci/Makefile build", label: 'build' } + withGithubNotify(context: "Build-${BUILD_ARCHITECTURE}") { + dir("${BASE_DIR}"){ + stash includes: "agent/native/_build/${BUILD_ARCHITECTURE}-release/ext/elastic_apm-*", name: "built-extensions-${BUILD_ARCHITECTURE}" + } + } } } } @@ -138,6 +142,7 @@ pipeline { stage('Execute phpt tests') { steps { initWorkspace(context: "PHPT-${PHP_VERSION}") { + unstash "built-extensions-${BUILD_ARCHITECTURE}" sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} make -f .ci/Makefile run-phpt-tests", label: 'run-phpt-tests' } } @@ -411,10 +416,9 @@ pipeline { */ def packageGeneration(def args = [:]) { def local = args.get('local', false) - args.versions.each { version -> - unstash "generate-for-package-${version}-Dockerfile" - unstash "generate-for-package-${version}-Dockerfile.alpine" - } + unstash "built-extensions-linux-x86-64" + unstash "built-extensions-linuxmusl-x86-64" + if (local) { // VERSION=1.0.0 is needed to override the current version. // current version is >1.0.0, and this is the way we can @@ -424,7 +428,7 @@ def packageGeneration(def args = [:]) { sh script: "mv build/packages build/local", label: 'prepare-local-upgrade-agent' } else { // Archive the so files to be downloaded if possible. - archiveArtifacts(allowEmptyArchive: true, artifacts: 'src/ext/modules/*.so') + archiveArtifacts(allowEmptyArchive: true, artifacts: 'agent/native/_build/*-release/ext/elastic_apm-*') sh script: "make -C packaging package", label: 'package' sh script: "make -C packaging info", label: 'package info' // checksum files are regenerated by the signing component in the internal-ci instance. From c03e668c27566a6977eac7da34e6563268bce8cf Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 2 Jun 2023 11:54:38 +0200 Subject: [PATCH 18/50] fixed workspace initialization --- .ci/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index ccf2555d2..af4ddf866 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -178,12 +178,13 @@ pipeline { expression { return params.INCLUDE_TESTING } } steps { + echo "params.INCLUDE_TESTING: ${params.INCLUDE_TESTING}" echo "params.AGENT_LOG_LEVEL: ${params.AGENT_LOG_LEVEL}" echo "params.AGENT_LOG_LEVEL == null: " + (params.AGENT_LOG_LEVEL == null) echo "params.TESTS_LOG_LEVEL: ${params.TESTS_LOG_LEVEL}" echo "params.TESTS_LOG_LEVEL == null: " + (params.TESTS_LOG_LEVEL == null) echo "addEnvVarsFromParams([]): " + addEnvVarsFromParams([]) - withGithubNotify(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: 'tests') { + initWorkspace(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: 'tests') { withEnv(addEnvVarsFromParams([])) { echo "env.ELASTIC_APM_LOG_LEVEL: ${env.ELASTIC_APM_LOG_LEVEL}" echo "env.TESTS_LOG_LEVEL: ${env.TESTS_LOG_LEVEL}" From 3718d5625e457a20ca9d454f0299675b5fc8ab76 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 2 Jun 2023 12:33:20 +0200 Subject: [PATCH 19/50] reverted image preparation with retries --- .ci/Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index af4ddf866..1503dd118 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -142,6 +142,11 @@ pipeline { stage('Execute phpt tests') { steps { initWorkspace(context: "PHPT-${PHP_VERSION}") { + // When running in the CI with multiple parallel stages + // the access could be considered as a DDOS attack. + retryWithSleep(retries: 3, seconds: 5, backoff: true) { + sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} ADD_LIBUNWIND_DEPENDENCY=${params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile prepare", label: 'prepare docker image' + } unstash "built-extensions-${BUILD_ARCHITECTURE}" sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} make -f .ci/Makefile run-phpt-tests", label: 'run-phpt-tests' } From 98aa3b43abbeb2f02fb12a8ff3158ef51b8b285e Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 2 Jun 2023 13:41:32 +0200 Subject: [PATCH 20/50] debug data --- .ci/Jenkinsfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 1503dd118..b70c91738 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -105,8 +105,6 @@ pipeline { steps { initWorkspace(context: "Build-${BUILD_ARCHITECTURE}") { sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} make -f .ci/Makefile build", label: 'build' - } - withGithubNotify(context: "Build-${BUILD_ARCHITECTURE}") { dir("${BASE_DIR}"){ stash includes: "agent/native/_build/${BUILD_ARCHITECTURE}-release/ext/elastic_apm-*", name: "built-extensions-${BUILD_ARCHITECTURE}" } @@ -140,8 +138,12 @@ pipeline { stages { stage('Execute phpt tests') { + when { + beforeAgent true + expression { return params.INCLUDE_TESTING } + } steps { - initWorkspace(context: "PHPT-${PHP_VERSION}") { + initWorkspace(context: "PHPT-${PHP_VERSION}", tab: "tests") { // When running in the CI with multiple parallel stages // the access could be considered as a DDOS attack. retryWithSleep(retries: 3, seconds: 5, backoff: true) { @@ -189,13 +191,13 @@ pipeline { echo "params.TESTS_LOG_LEVEL: ${params.TESTS_LOG_LEVEL}" echo "params.TESTS_LOG_LEVEL == null: " + (params.TESTS_LOG_LEVEL == null) echo "addEnvVarsFromParams([]): " + addEnvVarsFromParams([]) - initWorkspace(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: 'tests') { + initWorkspace(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: "tests") { withEnv(addEnvVarsFromParams([])) { echo "env.ELASTIC_APM_LOG_LEVEL: ${env.ELASTIC_APM_LOG_LEVEL}" echo "env.TESTS_LOG_LEVEL: ${env.TESTS_LOG_LEVEL}" - dir("${BASE_DIR}"){ - sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile static-check-unit-test", label: 'static-check-unit-test' - } + sh script: pwd + sh script: ls -al + sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile static-check-unit-test", label: 'static-check-unit-test' } } } From ace5094d65901b011ec167c3f198018d5539853c Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 2 Jun 2023 14:07:10 +0200 Subject: [PATCH 21/50] debug data --- .ci/Jenkinsfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index b70c91738..f6d58aa2c 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -105,7 +105,12 @@ pipeline { steps { initWorkspace(context: "Build-${BUILD_ARCHITECTURE}") { sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} make -f .ci/Makefile build", label: 'build' + echo pwd() + } + withGithubNotify(context: "Build-${BUILD_ARCHITECTURE}") { + echo pwd() dir("${BASE_DIR}"){ + echo pwd() stash includes: "agent/native/_build/${BUILD_ARCHITECTURE}-release/ext/elastic_apm-*", name: "built-extensions-${BUILD_ARCHITECTURE}" } } @@ -191,10 +196,13 @@ pipeline { echo "params.TESTS_LOG_LEVEL: ${params.TESTS_LOG_LEVEL}" echo "params.TESTS_LOG_LEVEL == null: " + (params.TESTS_LOG_LEVEL == null) echo "addEnvVarsFromParams([]): " + addEnvVarsFromParams([]) + echo pwd() + initWorkspace(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: "tests") { withEnv(addEnvVarsFromParams([])) { echo "env.ELASTIC_APM_LOG_LEVEL: ${env.ELASTIC_APM_LOG_LEVEL}" echo "env.TESTS_LOG_LEVEL: ${env.TESTS_LOG_LEVEL}" + echo pwd() sh script: pwd sh script: ls -al sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile static-check-unit-test", label: 'static-check-unit-test' From f4b303cc7cd4ed227934ed940eb38d86dce0f8bc Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 2 Jun 2023 14:50:28 +0200 Subject: [PATCH 22/50] debug data --- .ci/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index f6d58aa2c..8943dd0ab 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -199,12 +199,12 @@ pipeline { echo pwd() initWorkspace(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: "tests") { + echo pwd() + withEnv(addEnvVarsFromParams([])) { echo "env.ELASTIC_APM_LOG_LEVEL: ${env.ELASTIC_APM_LOG_LEVEL}" echo "env.TESTS_LOG_LEVEL: ${env.TESTS_LOG_LEVEL}" echo pwd() - sh script: pwd - sh script: ls -al sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile static-check-unit-test", label: 'static-check-unit-test' } } From ffbf230d61025e59dbfe3b3883493bbad1c72ba5 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Mon, 5 Jun 2023 09:46:09 +0200 Subject: [PATCH 23/50] docker image preparation with retries --- .ci/Jenkinsfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 8943dd0ab..5707ca181 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -105,12 +105,9 @@ pipeline { steps { initWorkspace(context: "Build-${BUILD_ARCHITECTURE}") { sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} make -f .ci/Makefile build", label: 'build' - echo pwd() } withGithubNotify(context: "Build-${BUILD_ARCHITECTURE}") { - echo pwd() dir("${BASE_DIR}"){ - echo pwd() stash includes: "agent/native/_build/${BUILD_ARCHITECTURE}-release/ext/elastic_apm-*", name: "built-extensions-${BUILD_ARCHITECTURE}" } } @@ -196,15 +193,16 @@ pipeline { echo "params.TESTS_LOG_LEVEL: ${params.TESTS_LOG_LEVEL}" echo "params.TESTS_LOG_LEVEL == null: " + (params.TESTS_LOG_LEVEL == null) echo "addEnvVarsFromParams([]): " + addEnvVarsFromParams([]) - echo pwd() initWorkspace(context: "Static-Check-Unit-Tests-${PHP_VERSION}", tab: "tests") { - echo pwd() - withEnv(addEnvVarsFromParams([])) { echo "env.ELASTIC_APM_LOG_LEVEL: ${env.ELASTIC_APM_LOG_LEVEL}" echo "env.TESTS_LOG_LEVEL: ${env.TESTS_LOG_LEVEL}" - echo pwd() + + retryWithSleep(retries: 3, seconds: 5, backoff: true) { + sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile prepare", label: 'prepare docker image' + } + sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile static-check-unit-test", label: 'static-check-unit-test' } } @@ -445,6 +443,12 @@ def packageGeneration(def args = [:]) { } else { // Archive the so files to be downloaded if possible. archiveArtifacts(allowEmptyArchive: true, artifacts: 'agent/native/_build/*-release/ext/elastic_apm-*') + + + retryWithSleep(retries: 3, seconds: 5, backoff: true) { + sh script: "make -C packaging build-docker-images", label: 'build docker images' + } + sh script: "make -C packaging package", label: 'package' sh script: "make -C packaging info", label: 'package info' // checksum files are regenerated by the signing component in the internal-ci instance. From bb8417d8e88562381a2ff159685609ad592b4add Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Mon, 5 Jun 2023 12:44:37 +0200 Subject: [PATCH 24/50] increased retry delay time --- .ci/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 5707ca181..b1b3293a5 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -148,7 +148,7 @@ pipeline { initWorkspace(context: "PHPT-${PHP_VERSION}", tab: "tests") { // When running in the CI with multiple parallel stages // the access could be considered as a DDOS attack. - retryWithSleep(retries: 3, seconds: 5, backoff: true) { + retryWithSleep(retries: 3, seconds: 45, backoff: true) { sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} ADD_LIBUNWIND_DEPENDENCY=${params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile prepare", label: 'prepare docker image' } unstash "built-extensions-${BUILD_ARCHITECTURE}" @@ -199,7 +199,7 @@ pipeline { echo "env.ELASTIC_APM_LOG_LEVEL: ${env.ELASTIC_APM_LOG_LEVEL}" echo "env.TESTS_LOG_LEVEL: ${env.TESTS_LOG_LEVEL}" - retryWithSleep(retries: 3, seconds: 5, backoff: true) { + retryWithSleep(retries: 3, seconds: 45, backoff: true) { sh script: "PHP_VERSION=${PHP_VERSION} DOCKERFILE=${DOCKERFILE} make -f .ci/Makefile prepare", label: 'prepare docker image' } @@ -445,7 +445,7 @@ def packageGeneration(def args = [:]) { archiveArtifacts(allowEmptyArchive: true, artifacts: 'agent/native/_build/*-release/ext/elastic_apm-*') - retryWithSleep(retries: 3, seconds: 5, backoff: true) { + retryWithSleep(retries: 3, seconds: 45, backoff: true) { sh script: "make -C packaging build-docker-images", label: 'build docker images' } @@ -480,7 +480,7 @@ def packageWorkspace(def args = [:], Closure body){ unstash (args.shouldUseSignedBinaries ? env.SIGNED_ARTIFACTS : 'package') // When running in the CI sometimes the docker build might fail for // some environmental issues, let's retry - retryWithSleep(retries: 3, seconds: 5, backoff: true) { + retryWithSleep(retries: 3, seconds: 45, backoff: true) { sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging ${args.prepareGoal}", label: "${args.prepareGoal} for ${PHP_VERSION}" } body() From 585ef3c866e6d734af980dec41e45f83b25d80dc Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 6 Jun 2023 10:47:39 +0200 Subject: [PATCH 25/50] try to use prebuilt images for rpm --- .ci/Jenkinsfile | 5 ----- packaging/Makefile | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index b1b3293a5..bdbbb639f 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -444,11 +444,6 @@ def packageGeneration(def args = [:]) { // Archive the so files to be downloaded if possible. archiveArtifacts(allowEmptyArchive: true, artifacts: 'agent/native/_build/*-release/ext/elastic_apm-*') - - retryWithSleep(retries: 3, seconds: 45, backoff: true) { - sh script: "make -C packaging build-docker-images", label: 'build docker images' - } - sh script: "make -C packaging package", label: 'package' sh script: "make -C packaging info", label: 'package info' // checksum files are regenerated by the signing component in the internal-ci instance. diff --git a/packaging/Makefile b/packaging/Makefile index 4bb615df7..6f7b8daa9 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -164,9 +164,9 @@ tar-install: prepare-tar ## Install the tar installer to run some smoke tests @echo "::endgroup::" .PHONY: rpm-install -rpm-install: prepare-rpm ## Install the rpm installer to run some smoke tests +rpm-install: ## Install the rpm installer to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=rpm $(PWD)/.ci/run_docker_with_component_tests.sh prepare-rpm + TYPE=rpm $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-install-in-apache @@ -197,9 +197,9 @@ deb-install-release-github: prepare-deb ## Install the deb installer from a giv @echo "::endgroup::" .PHONY: rpm-install-release-github -rpm-install-release-github: prepare-rpm ## Install the rpm installer from a given release to run some smoke tests +rpm-install-release-github: ## Install the rpm installer from a given release to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=release-github $(PWD)/.ci/run_docker_with_component_tests.sh prepare-rpm + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=release-github $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: tar-install-release-github @@ -239,9 +239,9 @@ deb-lifecycle-testing-in-fpm: prepare-deb-fpm ## Lifecycle testing for the deb @echo "::endgroup::" .PHONY: rpm-lifecycle-testing -rpm-lifecycle-testing: prepare-rpm ## Lifecycle testing for the rpm installer +rpm-lifecycle-testing: ## Lifecycle testing for the rpm installer @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=rpm-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-rpm + TYPE=rpm-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: tar-lifecycle-testing @@ -252,15 +252,15 @@ tar-lifecycle-testing: prepare-tar ## Lifecycle testing for the tar installer .PHONY: rpm-php-upgrade-testing rpm-php-upgrade-testing: PHP_VERSION="7.2" ### Force the PHP version to start with. -rpm-php-upgrade-testing: prepare-rpm ## PHP upgrade, from 7.2 to 7.4, testing for the rpm installer +rpm-php-upgrade-testing: ## PHP upgrade, from 7.2 to 7.4, testing for the rpm installer @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=php-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-rpm + TYPE=php-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-agent-upgrade-testing -rpm-agent-upgrade-testing: prepare-rpm ## Agent upgrade, from 1.0.0 to the current generated one, testing for the rpm installer +rpm-agent-upgrade-testing: ## Agent upgrade, from 1.0.0 to the current generated one, testing for the rpm installer @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-rpm + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-agent-upgrade-testing @@ -270,9 +270,9 @@ deb-agent-upgrade-testing: prepare-deb ## Agent upgrade, from 1.0.0 to the curr @echo "::endgroup::" .PHONY: rpm-agent-upgrade-testing-local -rpm-agent-upgrade-testing-local: prepare-rpm ## Agent upgrade, from 1.0.0 to the current generated one, testing for the rpm installer +rpm-agent-upgrade-testing-local: ## Agent upgrade, from 1.0.0 to the current generated one, testing for the rpm installer @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade-local PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-rpm + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade-local PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-agent-upgrade-testing-local From 0f30630dca1ef27b91818c999ef13cc9158b546e Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 6 Jun 2023 13:46:31 +0200 Subject: [PATCH 26/50] try to use prebuilt images for deb and apk --- .ci/Jenkinsfile | 6 +++--- packaging/Makefile | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index bdbbb639f..b15edaada 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -476,7 +476,9 @@ def packageWorkspace(def args = [:], Closure body){ // When running in the CI sometimes the docker build might fail for // some environmental issues, let's retry retryWithSleep(retries: 3, seconds: 45, backoff: true) { - sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging ${args.prepareGoal}", label: "${args.prepareGoal} for ${PHP_VERSION}" + if (args.prepareGoal != null) { + sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging ${args.prepareGoal}", label: "${args.prepareGoal} for ${PHP_VERSION}" + } } body() } @@ -630,7 +632,6 @@ def buildLabel(def args = [:]) { def lifecycleTesting(def args = [:]) { runTestingCommand( args + [ - prepareGoal: "prepare-${args.linuxPackageType}", testingCommand: "make -C packaging ${args.linuxPackageType}-lifecycle-testing" ] ) @@ -648,7 +649,6 @@ def lifecycleTestingOnProdServerKind(def args = [:]) { def phpUpgradeTesting(def args = [:]) { runTestingCommand( args + [ - prepareGoal: "prepare-${args.linuxPackageType}", testingCommand: "PHP_VERSION=${args.phpVersion} make -C packaging ${args.linuxPackageType}-php-upgrade-testing" ] ) diff --git a/packaging/Makefile b/packaging/Makefile index 6f7b8daa9..c33a1a105 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -147,15 +147,15 @@ prepare-rpm: ## Build the docker image for the rpm smoke tests @echo "::endgroup::" .PHONY: apk-install -apk-install: prepare-apk ## Install the apk installer to run some smoke tests +apk-install: ## Install the apk installer to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - $(PWD)/.ci/run_docker_with_component_tests.sh prepare-apk + $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-apk-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-install -deb-install: prepare-deb ## Install the deb installer to run some smoke tests +deb-install: ## Install the deb installer to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb + TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 .PHONY: tar-install tar-install: prepare-tar ## Install the tar installer to run some smoke tests @@ -185,15 +185,15 @@ deb-install-in-fpm: prepare-deb-fpm ## Install the deb installer to run some sm install: apk-install deb-install rpm-install tar-install ## Install all the distributions .PHONY: apk-install-release-github -apk-install-release-github: prepare-apk ## Install the apk installer from a given release to run some smoke tests +apk-install-release-github: ## Install the apk installer from a given release to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=release-github $(PWD)/.ci/run_docker_with_component_tests.sh prepare-apk + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=release-github $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-apk-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-install-release-github -deb-install-release-github: prepare-deb ## Install the deb installer from a given release to run some smoke tests +deb-install-release-github: ## Install the deb installer from a given release to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=release-github $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=release-github $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-install-release-github @@ -215,15 +215,15 @@ install-release-github: apk-install-release-github deb-install-release-github rp lifecycle-testing: apk-lifecycle-testing deb-lifecycle-testing rpm-lifecycle-testing tar-lifecycle-testing ## Lifecycle testing all the distributions .PHONY: apk-lifecycle-testing -apk-lifecycle-testing: prepare-apk ## Lifecycle testing for the apk installer +apk-lifecycle-testing: ## Lifecycle testing for the apk installer @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=apk-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-apk + TYPE=apk-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-apk-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-lifecycle-testing -deb-lifecycle-testing: prepare-deb ## Lifecycle testing for the deb installer +deb-lifecycle-testing: ## Lifecycle testing for the deb installer @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=deb-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb + TYPE=deb-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-lifecycle-testing-in-apache @@ -264,9 +264,9 @@ rpm-agent-upgrade-testing: ## Agent upgrade, from 1.0.0 to the current generate @echo "::endgroup::" .PHONY: deb-agent-upgrade-testing -deb-agent-upgrade-testing: prepare-deb ## Agent upgrade, from 1.0.0 to the current generated one, testing for the deb installer +deb-agent-upgrade-testing: ## Agent upgrade, from 1.0.0 to the current generated one, testing for the deb installer @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-agent-upgrade-testing-local @@ -276,7 +276,7 @@ rpm-agent-upgrade-testing-local: ## Agent upgrade, from 1.0.0 to the current ge @echo "::endgroup::" .PHONY: deb-agent-upgrade-testing-local -deb-agent-upgrade-testing-local: prepare-deb ## Agent upgrade, from 1.0.0 to the current generated one, testing for the deb installer +deb-agent-upgrade-testing-local: ## Agent upgrade, from 1.0.0 to the current generated one, testing for the deb installer @echo "::group::$@" # Helping to group logs in GitHub actions - VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade-local PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb + VERSION=$(RELEASE_VERSION) GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) TYPE=agent-upgrade-local PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" From f2d01186de22b1a81b6f789a097044faab616e5b Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 6 Jun 2023 16:22:50 +0200 Subject: [PATCH 27/50] try to use prebuilt images for tar, fpm and apache tests --- packaging/Makefile | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/packaging/Makefile b/packaging/Makefile index c33a1a105..31c51d760 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -158,9 +158,9 @@ deb-install: ## Install the deb installer to run some smoke tests TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 .PHONY: tar-install -tar-install: prepare-tar ## Install the tar installer to run some smoke tests +tar-install: ## Install the tar installer to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=tar $(PWD)/.ci/run_docker_with_component_tests.sh prepare-tar + TYPE=tar $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-install @@ -170,15 +170,15 @@ rpm-install: ## Install the rpm installer to run some smoke tests @echo "::endgroup::" .PHONY: deb-install-in-apache -deb-install-in-apache: prepare-deb-apache ## Install the deb installer to run some smoke tests in apache +deb-install-in-apache: ## Install the deb installer to run some smoke tests in apache @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb-apache + TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-install-in-fpm -deb-install-in-fpm: prepare-deb-fpm ## Install the deb installer to run some smoke tests in fpm +deb-install-in-fpm: ## Install the deb installer to run some smoke tests in fpm @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb-fpm + TYPE=deb $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: install @@ -203,9 +203,9 @@ rpm-install-release-github: ## Install the rpm installer from a given release to @echo "::endgroup::" .PHONY: tar-install-release-github -tar-install-release-github: prepare-tar ## Install the tar installer from a given release to run some smoke tests +tar-install-release-github: ## Install the tar installer from a given release to run some smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions - GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) VERSION=$(RELEASE_VERSION) TYPE=release-tar-github $(PWD)/.ci/run_docker_with_component_tests.sh prepare-tar + GITHUB_RELEASES_URL=$(GITHUB_RELEASES_URL) VERSION=$(RELEASE_VERSION) TYPE=release-tar-github $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: install-release-github @@ -227,15 +227,15 @@ deb-lifecycle-testing: ## Lifecycle testing for the deb installer @echo "::endgroup::" .PHONY: deb-lifecycle-testing-in-apache -deb-lifecycle-testing-in-apache: prepare-deb-apache ## Lifecycle testing for the deb installer with apache +deb-lifecycle-testing-in-apache: ## Lifecycle testing for the deb installer with apache @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=deb-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb-apache + TYPE=deb-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: deb-lifecycle-testing-in-fpm -deb-lifecycle-testing-in-fpm: prepare-deb-fpm ## Lifecycle testing for the deb installer with fpm +deb-lifecycle-testing-in-fpm: ## Lifecycle testing for the deb installer with fpm @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=deb-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh prepare-deb-fpm + TYPE=deb-uninstall PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-lifecycle-testing @@ -245,16 +245,18 @@ rpm-lifecycle-testing: ## Lifecycle testing for the rpm installer @echo "::endgroup::" .PHONY: tar-lifecycle-testing -tar-lifecycle-testing: prepare-tar ## Lifecycle testing for the tar installer +tar-lifecycle-testing: ## Lifecycle testing for the tar installer @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=tar-uninstall $(PWD)/.ci/run_docker_with_component_tests.sh prepare-tar + TYPE=tar-uninstall $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-deb-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-php-upgrade-testing -rpm-php-upgrade-testing: PHP_VERSION="7.2" ### Force the PHP version to start with. +### Force the PHP version to start with. +rpm-php-upgrade-testing: PHP_VERSION=7.2 rpm-php-upgrade-testing: ## PHP upgrade, from 7.2 to 7.4, testing for the rpm installer @echo "::group::$@" # Helping to group logs in GitHub actions - TYPE=php-upgrade PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 + echo "'$(PHP_VERSION)'" + TYPE=php-upgrade PHP_VERSION=$(PHP_VERSION) PACKAGE=$(NAME) $(PWD)/.ci/run_docker_with_component_tests.sh elasticobservability/apm-agent-php-dev:packages-test-rpm-php-$(PHP_VERSION)-0.0.1 @echo "::endgroup::" .PHONY: rpm-agent-upgrade-testing From 7e969fc9a33d212f229b07d599588b7d5c8d03d6 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 6 Jun 2023 16:31:43 +0200 Subject: [PATCH 28/50] removed prepare for webserver tests --- .ci/Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index b15edaada..a0664d6e1 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -640,7 +640,6 @@ def lifecycleTesting(def args = [:]) { def lifecycleTestingOnProdServerKind(def args = [:]) { runTestingCommand( args + [ - prepareGoal: "prepare-${args.linuxPackageType}-${args.prodServerKind}", testingCommand: "make -C packaging ${args.linuxPackageType}-lifecycle-testing-in-${args.prodServerKind}", ] ) From 4c9d41eec095f0dad8ea0d245232b2ac1212c78a Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 7 Jun 2023 23:08:26 +0200 Subject: [PATCH 29/50] Linking with libunwind --- agent/native/ext/CMakeLists.txt | 7 ++++++- agent/native/ext/unit_tests/CMakeLists.txt | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/agent/native/ext/CMakeLists.txt b/agent/native/ext/CMakeLists.txt index e9b9c85c9..ad36ca225 100644 --- a/agent/native/ext/CMakeLists.txt +++ b/agent/native/ext/CMakeLists.txt @@ -41,9 +41,14 @@ foreach(_php_version ${_supported_php_versions}) "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}/TSRM" "${CONAN_INCLUDE_DIRS_PHP-HEADERS-${_php_version}}/Zend" "${CONAN_INCLUDE_DIRS_LIBCURL}" + "${CONAN_INCLUDE_DIRS_LIBUNWIND}" + ) - target_link_libraries(${_Target} PRIVATE CONAN_PKG::libcurl) + target_link_libraries(${_Target} + PRIVATE CONAN_PKG::libcurl + PRIVATE CONAN_PKG::libunwind + ) get_php_api_from_release(${_php_version} _ZEND_API_version) diff --git a/agent/native/ext/unit_tests/CMakeLists.txt b/agent/native/ext/unit_tests/CMakeLists.txt index fa98c7536..fbf6ebdd9 100644 --- a/agent/native/ext/unit_tests/CMakeLists.txt +++ b/agent/native/ext/unit_tests/CMakeLists.txt @@ -123,6 +123,9 @@ IF ( NOT WIN32 ) SET( link_with_libraries ${link_with_libraries} m ) ENDIF() +target_include_directories(unit_tests PRIVATE + ${CONAN_INCLUDE_DIRS_LIBUNWIND} ) + target_link_libraries( unit_tests PRIVATE CONAN_PKG::cmocka PRIVATE CONAN_PKG::libunwind Threads::Threads From b3f78ba27df08dded8e05a11494a2610b80a3019 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 9 Jun 2023 13:34:23 +0200 Subject: [PATCH 30/50] Updated development guide and fixed image tag --- DEVELOPMENT.md | 61 ++++- .../building/dockerized/docker-compose.yml | 4 +- packaging/test/docker-compose.yml | 226 ++++++++++++++++++ 3 files changed, 286 insertions(+), 5 deletions(-) create mode 100644 packaging/test/docker-compose.yml diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 1455b3d6f..c8853cf41 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,6 +1,5 @@ # Local development - -## Build/package +## Build and package ### Using the docker approach @@ -35,7 +34,7 @@ make -f .ci/Makefile help _NOTE_: * `PHP_VERSION` can be set to a different PHP version. -* Alpine specific binaries can be generated if using `DOCKERFILE=Dockerfile.alpine` +* For testing of Alpine specific binaries you must run "prepare" task with `DOCKERFILE=Dockerfile.alpine` environment variable set to build proper docker image. To generate the packages then you can use the `packaging/Dockerfile`, see the below commands: @@ -98,3 +97,59 @@ Jenkins build parameters can be used to run build+test CI pipeline with a custom - Go to `Build with Parameters` - Select log level for agent and/or tests' infrastructure - Click `Build` + + +# Updating docker images used for building and testing +## Building and updating docker images used to build the agent extension + +If you want to update images used to build native extension, you need to go into `agent/native/building/dockerized` folder and modify Dockerfile stored in images folder. In this moment, there are two Dockerfiles: +`Dockerfile_musl` for Linux x86_64 with musl libc implementation and `Dockerfile_glibc` for all other x86_64 distros with glibc implementation. +Then you need to increment image version in `docker-compose.yml`. Remember to update Dockerfiles for all architectures, if needed. To build new images, you just need to call: +```bash +docker-compose build +``` +It will build images for all supported architectures. As a result you should get summary like this: +```bash +Successfully tagged elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linux-x86-64-0.0.1 +Successfully tagged elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.1 +``` + +To test freshly built images, you need to udate image version in `build:` task in ```.ci/Makefile``` and run build task described in [Build/package](#build-and-package) +) + +\ +If everything works as you expected, you just need to push new image to dockerhub by calling: +```bash +docker push elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linux-x86-64-0.0.1 +``` + +## Building and updating docker images used to execute tests +If you want to update images used for testing, you need to go into `packaging/test` folder and modify Dockerfiles stored in folders: +|Folder name|Usage| +|-|-| +|alpine|Testing of apk packages| +|centos|Testing of rpm packages| +|ubuntu|Testing of deb packages| +|ubuntu/apache|Tesing of deb packages with Apache/mod_php| +|ubuntu/fpm|Tesing of deb packages with Apache/php-fpm| + +Then you need to increment image version in `docker-compose.yml`.\ +To build new images, you just need to call: +```bash +docker-compose build +``` +It will build and tag images for all test scenarios. As a result you should get summary like this: +```bash +Successfully tagged elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.2-0.0.1 +... +``` + +\ +To test freshly built images, you need to udate images version in ```packaging/Makefile```. Note that one particular image can be specified multiple times inside this file. Please check carefully that you have updated all the places where the image has been used + +\ +If everything works as you expected, you just need to push new image to dockerhub by calling: +```bash +docker push elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.2-0.0.1 +``` +It should be done for all images you modified. diff --git a/agent/native/building/dockerized/docker-compose.yml b/agent/native/building/dockerized/docker-compose.yml index 0e4c9142c..4a210d645 100644 --- a/agent/native/building/dockerized/docker-compose.yml +++ b/agent/native/building/dockerized/docker-compose.yml @@ -4,7 +4,7 @@ services: build: context: . dockerfile: images/Dockerfile_glibc - image: elasticobservability/apm-agent-php-dev/native-build-gcc-12.2.0-linux-x86-64-0.0.1 + image: elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linux-x86-64-0.0.1 volumes: - ../../../../:/source command: sh -c "cd /source/agent/native && cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" @@ -13,7 +13,7 @@ services: build: context: . dockerfile: images/Dockerfile_musl - image: elasticobservability/apm-agent-php-dev/native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.1 + image: elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.1 volumes: - ../../../../:/source command: sh -c "cd /source/agent/native && cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" diff --git a/packaging/test/docker-compose.yml b/packaging/test/docker-compose.yml new file mode 100644 index 000000000..6bddceaef --- /dev/null +++ b/packaging/test/docker-compose.yml @@ -0,0 +1,226 @@ +version: "3" +services: + deb-fpm-php82: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-8.2-0.0.1 + build: + context: ubuntu + dockerfile: fpm/Dockerfile + args: + - PHP_VERSION=8.2 + deb-fpm-php81: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-8.1-0.0.1 + build: + context: ubuntu + dockerfile: fpm/Dockerfile + args: + - PHP_VERSION=8.1 + deb-fpm-php80: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-8.0-0.0.1 + build: + context: ubuntu + dockerfile: fpm/Dockerfile + args: + - PHP_VERSION=8.0 + deb-fpm-php74: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-7.4-0.0.1 + build: + context: ubuntu + dockerfile: fpm/Dockerfile + args: + - PHP_VERSION=7.4 + deb-fpm-php73: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-7.3-0.0.1 + build: + context: ubuntu + dockerfile: fpm/Dockerfile + args: + - PHP_VERSION=7.3 + deb-fpm-php72: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-fpm-php-7.2-0.0.1 + build: + context: ubuntu + dockerfile: fpm/Dockerfile + args: + - PHP_VERSION=7.2 + + + + + deb-apache-php82: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-8.2-0.0.1 + build: + context: ubuntu + dockerfile: apache/Dockerfile + args: + - PHP_VERSION=8.2 + deb-apache-php81: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-8.1-0.0.1 + build: + context: ubuntu + dockerfile: apache/Dockerfile + args: + - PHP_VERSION=8.1 + deb-apache-php80: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-8.0-0.0.1 + build: + context: ubuntu + dockerfile: apache/Dockerfile + args: + - PHP_VERSION=8.0 + deb-apache-php74: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-7.4-0.0.1 + build: + context: ubuntu + dockerfile: apache/Dockerfile + args: + - PHP_VERSION=7.4 + deb-apache-php73: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-7.3-0.0.1 + build: + context: ubuntu + dockerfile: apache/Dockerfile + args: + - PHP_VERSION=7.3 + deb-apache-php72: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-apache-php-7.2-0.0.1 + build: + context: ubuntu + dockerfile: apache/Dockerfile + args: + - PHP_VERSION=7.2 + + + deb-php82: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-php-8.2-0.0.1 + build: + context: ubuntu + dockerfile: Dockerfile + args: + - PHP_VERSION=8.2 + deb-php81: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-php-8.1-0.0.1 + build: + context: ubuntu + dockerfile: Dockerfile + args: + - PHP_VERSION=8.1 + deb-php80: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-php-8.0-0.0.1 + build: + context: ubuntu + dockerfile: Dockerfile + args: + - PHP_VERSION=8.0 + deb-php74: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-php-7.4-0.0.1 + build: + context: ubuntu + dockerfile: Dockerfile + args: + - PHP_VERSION=7.4 + deb-php73: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-php-7.3-0.0.1 + build: + context: ubuntu + dockerfile: Dockerfile + args: + - PHP_VERSION=7.3 + deb-php72: + image: elasticobservability/apm-agent-php-dev:packages-test-deb-php-7.2-0.0.1 + build: + context: ubuntu + dockerfile: Dockerfile + args: + - PHP_VERSION=7.2 + + rpm-php82: + image: elasticobservability/apm-agent-php-dev:packages-test-rpm-php-8.2-0.0.1 + build: + context: centos + dockerfile: Dockerfile + args: + - PHP_VERSION=8.2 + rpm-php81: + image: elasticobservability/apm-agent-php-dev:packages-test-rpm-php-8.1-0.0.1 + build: + context: centos + dockerfile: Dockerfile + args: + - PHP_VERSION=8.1 + rpm-php80: + image: elasticobservability/apm-agent-php-dev:packages-test-rpm-php-8.0-0.0.1 + build: + context: centos + dockerfile: Dockerfile + args: + - PHP_VERSION=8.0 + rpm-php74: + image: elasticobservability/apm-agent-php-dev:packages-test-rpm-php-7.4-0.0.1 + build: + context: centos + dockerfile: Dockerfile + args: + - PHP_VERSION=7.4 + rpm-php73: + image: elasticobservability/apm-agent-php-dev:packages-test-rpm-php-7.3-0.0.1 + build: + context: centos + dockerfile: Dockerfile + args: + - PHP_VERSION=7.3 + rpm-php72: + image: elasticobservability/apm-agent-php-dev:packages-test-rpm-php-7.2-0.0.1 + build: + context: centos + dockerfile: Dockerfile + args: + - PHP_VERSION=7.2 + + apk-php82: + image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-8.2-0.0.1 + build: + context: alpine + dockerfile: Dockerfile + args: + - PHP_VERSION=8.2 + - ADD_LIBUNWIND_DEPENDENCY= + apk-php81: + image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-8.1-0.0.1 + build: + context: alpine + dockerfile: Dockerfile + args: + - PHP_VERSION=8.1 + - ADD_LIBUNWIND_DEPENDENCY= + apk-php80: + image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-8.0-0.0.1 + build: + context: alpine + dockerfile: Dockerfile + args: + - PHP_VERSION=8.0 + - ADD_LIBUNWIND_DEPENDENCY= + apk-php74: + image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.4-0.0.1 + build: + context: alpine + dockerfile: Dockerfile + args: + - PHP_VERSION=7.4 + - ADD_LIBUNWIND_DEPENDENCY= + apk-php73: + image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.3-0.0.1 + build: + context: alpine + dockerfile: Dockerfile + args: + - PHP_VERSION=7.3 + - ADD_LIBUNWIND_DEPENDENCY= + apk-php72: + image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.2-0.0.1 + build: + context: alpine + dockerfile: Dockerfile + args: + - PHP_VERSION=7.2 + - ADD_LIBUNWIND_DEPENDENCY= From 8b53a3132315a74b175762feec6b41375f869fa3 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 9 Jun 2023 14:23:07 +0200 Subject: [PATCH 31/50] Don't link curl statically --- .ci/Makefile | 2 +- agent/native/CMakeLists.txt | 14 +++++--------- .../native/building/dockerized/docker-compose.yml | 4 ++-- .../building/dockerized/images/Dockerfile_glibc | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.ci/Makefile b/.ci/Makefile index 49bce8d71..88607c75e 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -48,7 +48,7 @@ build: -v $(PWD):/source \ -w /source/agent/native \ -e CONAN_USER_HOME=/tmp/conan \ - elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.1 \ + elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.2 \ sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release && cmake --build --preset $(BUILD_ARCHITECTURE)-release && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" @echo "::endgroup::" diff --git a/agent/native/CMakeLists.txt b/agent/native/CMakeLists.txt index a46bea375..f08aaa72f 100644 --- a/agent/native/CMakeLists.txt +++ b/agent/native/CMakeLists.txt @@ -71,9 +71,9 @@ endforeach() # TODO implement multiarray with mapping of library->version set(dependencies - "libcurl/8.0.1" - "cmocka/1.1.5" - "libunwind/1.6.2" + "libcurl/8.0.1@elastic/stable" + "cmocka/1.1.5@elastic/stable" + "libunwind/1.6.2@elastic/stable" ) foreach(_php_version ${_supported_php_versions}) @@ -82,12 +82,8 @@ endforeach() conan_cmake_run(REQUIRES ${dependencies} OPTIONS Pkg/*:shared=False - boost:header_only=True - boost:error_code_header_only=True - libcurl:shared=False - libcurl:with_libssh2=False - libcurl:with_ssl=False - cmocka:shared=False + libcurl:shared=True + libcurl:with_libssh2=True BUILD missing PROFILE ${_CONAN_PROFILE} PROFILE_BUILD ${_CONAN_PROFILE} diff --git a/agent/native/building/dockerized/docker-compose.yml b/agent/native/building/dockerized/docker-compose.yml index 4a210d645..a95f80687 100644 --- a/agent/native/building/dockerized/docker-compose.yml +++ b/agent/native/building/dockerized/docker-compose.yml @@ -4,7 +4,7 @@ services: build: context: . dockerfile: images/Dockerfile_glibc - image: elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linux-x86-64-0.0.1 + image: elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linux-x86-64-0.0.2 volumes: - ../../../../:/source command: sh -c "cd /source/agent/native && cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" @@ -13,7 +13,7 @@ services: build: context: . dockerfile: images/Dockerfile_musl - image: elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.1 + image: elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.2 volumes: - ../../../../:/source command: sh -c "cd /source/agent/native && cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" diff --git a/agent/native/building/dockerized/images/Dockerfile_glibc b/agent/native/building/dockerized/images/Dockerfile_glibc index b62a77ce4..b640bea0d 100644 --- a/agent/native/building/dockerized/images/Dockerfile_glibc +++ b/agent/native/building/dockerized/images/Dockerfile_glibc @@ -88,7 +88,7 @@ ARG USER_NAME=build COPY --from=devtools /opt /opt RUN yum -y update && yum -y install sudo curl wget git make autoconf bzip2 \ - perl-Thread-Queue \ + perl-Thread-Queue perl-IPC-Cmd perl-Digest-SHA \ file \ glibc-devel From 506ef61bd14ccdf9d4c5cee3388f2318352205d0 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 9 Jun 2023 21:41:10 +0200 Subject: [PATCH 32/50] fixed package dependencies --- agent/native/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent/native/CMakeLists.txt b/agent/native/CMakeLists.txt index f08aaa72f..8444ce8a1 100644 --- a/agent/native/CMakeLists.txt +++ b/agent/native/CMakeLists.txt @@ -71,9 +71,9 @@ endforeach() # TODO implement multiarray with mapping of library->version set(dependencies - "libcurl/8.0.1@elastic/stable" - "cmocka/1.1.5@elastic/stable" - "libunwind/1.6.2@elastic/stable" + "libcurl/8.0.1" + "cmocka/1.1.5@" + "libunwind/1.6.2" ) foreach(_php_version ${_supported_php_versions}) From ef4f3514d344712083a81cffb208d8f63045c21c Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Mon, 12 Jun 2023 14:27:04 +0200 Subject: [PATCH 33/50] Fixed component-test step for local development * minor cleanup in docker files --- .ci/Makefile | 1 + .ci/component-test.sh | 30 +++++++++++++++++++++++++----- DEVELOPMENT.md | 2 +- Dockerfile | 25 ------------------------- Dockerfile.alpine | 19 ------------------- 5 files changed, 27 insertions(+), 50 deletions(-) diff --git a/.ci/Makefile b/.ci/Makefile index 88607c75e..11a3c32ae 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -87,6 +87,7 @@ component-test: prepare ## Run component-test @echo "::group::$@" # Helping to group logs in GitHub actions # docker as root to install the extension docker run -t --rm \ + -e BUILD_ARCHITECTURE=$(BUILD_ARCHITECTURE) \ -v $(PWD):/app \ $(IMAGE):${PHP_VERSION}$(SUFFIX) \ sh -c '/app/.ci/component-test.sh' diff --git a/.ci/component-test.sh b/.ci/component-test.sh index fabb3584b..6a11971fa 100755 --- a/.ci/component-test.sh +++ b/.ci/component-test.sh @@ -4,12 +4,32 @@ set -xe -o pipefail # Disable Elastic APM for any process outside the component tests to prevent noise in the logs export ELASTIC_APM_ENABLED=false +APP_FOLDER=/app +PHP_API=$(php -i | grep -i 'PHP API' | sed -e 's#.* =>##g' | awk '{print $1}') +PHP_EXECUTABLE=$(which php) + +echo "BUILD ARCHITECTURE: $BUILD_ARCHITECTURE" + +if [ -z "${BUILD_ARCHITECTURE}" ] +then + echo "\$BUILD_ARCHITECTURE is not specified, assuming linux-x86-64" + BUILD_ARCHITECTURE=linux-x86-64 +fi +echo "BUILD ARCHITECTURE: $BUILD_ARCHITECTURE" + + + +AGENT_EXTENSION_DIR=$APP_FOLDER/agent/native/_build/$BUILD_ARCHITECTURE-release/ext +AGENT_EXTENSION=$AGENT_EXTENSION_DIR/elastic_apm-$PHP_API.so + +mkdir -p $APP_FOLDER/build + + PHP_INI=/usr/local/etc/php/php.ini -make install -echo 'extension=elastic_apm.so' > ${PHP_INI} -echo 'elastic_apm.bootstrap_php_part_file=/app/src/bootstrap_php_part.php' >> ${PHP_INI} +echo "extension=${AGENT_EXTENSION}" > ${PHP_INI} +echo "elastic_apm.bootstrap_php_part_file=${APP_FOLDER}/agent/php/bootstrap_php_part.php" >> ${PHP_INI} php -m -cd /app +cd "${APP_FOLDER}" # Install 3rd party dependencies composer install @@ -28,5 +48,5 @@ fi # Run component tests mkdir -p ./build/ -composer run-script run_component_tests 2>&1 | tee /app/build/run_component_tests_output.txt +composer run-script run_component_tests 2>&1 | tee ${APP_FOLDER}/build/run_component_tests_output.txt diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index c8853cf41..84e44b9ae 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -22,7 +22,7 @@ BUILD_ARCHITECTURE=linux-x86-64 PHP_VERSION=7.2 make -f .ci/Makefile run-phpt-t PHP_VERSION=7.2 make -f .ci/Makefile static-check-unit-test ## To run the component tests -PHP_VERSION=7.2 make -f .ci/Makefile component-test +BUILD_ARCHITECTURE=linux-x86-64 PHP_VERSION=7.2 make -f .ci/Makefile component-test ## To release given the GITHUB_TOKEN and TAG_NAME, it creates a draft release GITHUB_TOKEN=**** TAG_NAME=v1.0.0 make -f .ci/Makefile draft-release diff --git a/Dockerfile b/Dockerfile index bfe68e0e6..e70f3fede 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,16 +3,8 @@ FROM php:${PHP_VERSION}-fpm RUN apt-get -qq update \ && apt-get -qq -y --no-install-recommends install \ - autoconf \ - build-essential \ - curl \ - libcmocka-dev \ - libcurl4-openssl-dev \ - libsqlite3-dev \ procps \ rsyslog \ - unzip \ - wget \ && rm -rf /var/lib/apt/lists/* RUN docker-php-ext-install \ @@ -23,33 +15,16 @@ RUN docker-php-ext-install \ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5-Linux-x86_64.tar.gz -O /tmp/cmake.tar.gz \ - && mkdir /usr/bin/cmake \ - && tar -xpf /tmp/cmake.tar.gz --strip-components=1 -C /usr/bin/cmake \ - && rm /tmp/cmake.tar.gz - -ENV PATH="/usr/bin/cmake/bin:${PATH}" - WORKDIR /app/agent/native/ext ENV REPORT_EXIT_STATUS=1 ENV TEST_PHP_DETAILED=1 ENV NO_INTERACTION=1 ENV TEST_PHP_JUNIT=/app/build/junit.xml -ENV CMOCKA_MESSAGE_OUTPUT=XML -ENV CMOCKA_XML_FILE=/app/build/${PHP_VERSION}-%g-unit-tests-junit.xml - -# C call stack capture should be supported on non-Alpine by default -ENV ELASTIC_APM_ASSUME_CAN_CAPTURE_C_STACK_TRACE=true # Disable agent for auxiliary PHP processes to reduce noise in logs ENV ELASTIC_APM_ENABLED=false -CMD phpize \ - && CFLAGS="-std=gnu99" ./configure --enable-elastic_apm \ - && make clean \ - && make - # Create a link to extensions directory to make it easier accessible (paths are different between php releases) RUN ln -s `find /usr/local/lib/php/extensions/ -name opcache.so | head -n1 | xargs dirname` /tmp/extensions diff --git a/Dockerfile.alpine b/Dockerfile.alpine index a0910f494..4aa7d9f84 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -3,19 +3,10 @@ FROM php:${PHP_VERSION}-fpm-alpine RUN apk update \ && apk add \ - autoconf \ bash \ - build-base \ - cmake \ - cmocka-dev \ - curl \ - curl-dev \ - git \ logrotate \ procps \ rsyslog \ - sqlite-dev \ - unzip \ util-linux ARG ADD_LIBUNWIND_DEPENDENCY=false @@ -38,20 +29,10 @@ ENV REPORT_EXIT_STATUS=1 ENV TEST_PHP_DETAILED=1 ENV NO_INTERACTION=1 ENV TEST_PHP_JUNIT=/app/build/junit.xml -ENV CMOCKA_MESSAGE_OUTPUT=XML -ENV CMOCKA_XML_FILE=/app/build/alpine-${PHP_VERSION}-%g-unit-tests-junit.xml # Disable agent for auxiliary PHP processes to reduce noise in logs ENV ELASTIC_APM_ENABLED=false -CMD export CFLAGS="-std=gnu99 ${CFLAGS}" ; \ - if [[ "${ADD_LIBUNWIND_DEPENDENCY}" = "true" ]] ; then export LDFLAGS="-lunwind ${LDFLAGS}" ; fi ; \ - echo "CFLAGS: ${CFLAGS}, ADD_LIBUNWIND_DEPENDENCY: ${ADD_LIBUNWIND_DEPENDENCY}, LDFLAGS: ${LDFLAGS}" ; \ - phpize \ - && ./configure --enable-elastic_apm \ - && make clean \ - && make - # Create a link to extensions directory to make it easier accessible (paths are different between php releases) RUN ln -s `find /usr/local/lib/php/extensions/ -name opcache.so | head -n1 | xargs dirname` /tmp/extensions From 83aaaccf69b1a84d885753713cea3fb039368e7c Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Mon, 12 Jun 2023 14:52:42 +0200 Subject: [PATCH 34/50] reverted back some utils - not sure if they're needed --- Dockerfile | 3 +++ Dockerfile.alpine | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e70f3fede..39f706b53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,9 @@ RUN apt-get -qq update \ && apt-get -qq -y --no-install-recommends install \ procps \ rsyslog \ + curl \ + unzip \ + wget \ && rm -rf /var/lib/apt/lists/* RUN docker-php-ext-install \ diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 4aa7d9f84..92d4e972d 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -7,7 +7,10 @@ RUN apk update \ logrotate \ procps \ rsyslog \ - util-linux + util-linux \ + curl \ + git \ + unzip ARG ADD_LIBUNWIND_DEPENDENCY=false RUN echo "ADD_LIBUNWIND_DEPENDENCY: ${ADD_LIBUNWIND_DEPENDENCY}" From 7e2aba1a20d121d87a8fb7567300d6e8d33ab8de Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 27 Jun 2023 11:44:26 +0200 Subject: [PATCH 35/50] updated development guide with local development isntructions --- DEVELOPMENT.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 84e44b9ae..16396643c 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -31,6 +31,24 @@ GITHUB_TOKEN=**** TAG_NAME=v1.0.0 make -f .ci/Makefile draft-release make -f .ci/Makefile help ``` +### Local development with direct calls to cmake inside docker container +\ +If you want to make local development easier, you can call build directly via docker commands.\ +All you need to do is mount the path with the sources to the `/source` directory inside the container.\ +\ +To further speed up build, it is a good idea to mount the local conan cache so that it uses a folder outside the container. The location is arbitrary, but should preferably point outside the source folder. This is optional, if you omit it, conan will place the cache inside the container in the `/home/build/.conan` folder. +\ +Make sure to always use the latest version of the image you are using for the build. You can find the current version inside the `.ci/Makefile` in `build:` section + +```bash +# this will build agent for linux-x86-64 +docker run -v "/path/to/your/apm-agent-php:/source" -v "/path/to/your/conan:/home/build/.conan:rw" -w /source/agent/native elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linux-x86-64-0.0.2 sh -c "cmake --preset linux-x86-64-release && cmake --build --preset linux-x86-64-release" +# this will build agent for linuxmusl-x86-64 +docker run -v "/path/to/your/apm-agent-php:/source" -v "/path/to/your/conan:/home/build/.conan:rw" -w /source/agent/native elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-linuxmusl-x86-64-0.0.2 sh -c "cmake --preset linuxmusl-x86-64-release && cmake --build --preset linuxmusl-x86-64-release" + +``` + + _NOTE_: * `PHP_VERSION` can be set to a different PHP version. From d4847c84ca61e9b6c3a8d6d1053848435b00dd1f Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Tue, 27 Jun 2023 11:46:13 +0200 Subject: [PATCH 36/50] updated development guide with local development instructions --- DEVELOPMENT.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 16396643c..93a0f4022 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -31,6 +31,12 @@ GITHUB_TOKEN=**** TAG_NAME=v1.0.0 make -f .ci/Makefile draft-release make -f .ci/Makefile help ``` + +_NOTE_: + +* `PHP_VERSION` can be set to a different PHP version. +* For testing of Alpine specific binaries you must run "prepare" task with `DOCKERFILE=Dockerfile.alpine` environment variable set to build proper docker image. + ### Local development with direct calls to cmake inside docker container \ If you want to make local development easier, you can call build directly via docker commands.\ @@ -48,12 +54,6 @@ docker run -v "/path/to/your/apm-agent-php:/source" -v "/path/to/your/conan:/ho ``` - -_NOTE_: - -* `PHP_VERSION` can be set to a different PHP version. -* For testing of Alpine specific binaries you must run "prepare" task with `DOCKERFILE=Dockerfile.alpine` environment variable set to build proper docker image. - To generate the packages then you can use the `packaging/Dockerfile`, see the below commands: | :warning: :construction: **WARNING: The packaging stage is still in development!** | From 0392a856b5c8e4aa950cd2995e20a900102b180a Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 28 Jun 2023 09:02:54 +0200 Subject: [PATCH 37/50] removed commented out code --- .ci/static-check-unit-test.sh | 60 ----------------------------------- 1 file changed, 60 deletions(-) diff --git a/.ci/static-check-unit-test.sh b/.ci/static-check-unit-test.sh index aabba19bd..d2c485f69 100755 --- a/.ci/static-check-unit-test.sh +++ b/.ci/static-check-unit-test.sh @@ -27,66 +27,6 @@ trap onScriptExit EXIT ensureSyslogIsRunning -## This make runs PHPT -# Disable agent for auxiliary PHP processes to reduce noise in logs - -# export ELASTIC_APM_ENABLED=false -# for phptFile in ./tests/*.phpt; do -# msg="Running tests in \`${phptFile}' ..." -# echo "${msg}" -# this_script_name="$( basename "${BASH_SOURCE[0]}" )" -# logger -t "${this_script_name}" "${msg}" -# # Disable exit-on-error -# set +e -# make test TESTS="--show-all ${phptFile}" -# exitCode=$? - -# if [ ${exitCode} -ne 0 ] ; then -# echo "Tests in \`${phptFile}' failed" -# phptFileName="${phptFile%.phpt}" -# cat "${phptFileName}.log" -# cat "${phptFileName}.out" -# exit 1 -# fi - -# # Re-enable exit-on-error -# set -e -# done - -# native unit tests will be triggered just after build -# Disable exit-on-error -#set +e -## Run cmocka tests -#function buildAndRunUnitTests () { -# pushd /app/src/ext/unit_tests -# for buildType in Debug Release -# do -# cmake -DCMAKE_BUILD_TYPE=${buildType} . -# make -# ./unit_tests -# unitTestsExitCode=$? -# if [ ${unitTestsExitCode} -ne 0 ] ; then -# popd -# return ${unitTestsExitCode} -# fi -# done -# popd -#} -#buildAndRunUnitTests -## Save errorlevel to be reported later on -# ret=$? - -# TODO pawel - makes no sense to me here, should be located after last call to composer -# ## Manipulate JUnit report without multiple testsuites entries. -# for file in "${BUILD_FOLDER}"/*-unit-tests-junit.xml; do -# sed -i.bck ':begin;$!N;s#\n##;tbegin;P;D' "${file}" -# done - -# ## Return the error if any -# if [ $ret -ne 0 ] ; then -# exit 1 -# fi - # Re-enable exit-on-error set -e From 828acb2e3c64fcf9aecc32f7745f73abb055fde1 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Wed, 28 Jun 2023 11:29:24 +0200 Subject: [PATCH 38/50] ignoring native build folder from git --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 2ba19e6cd..118068d19 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ z_local* # Temporary files _TEMP/ + +# Native build folder +agent/native/_build/ From ae3ab70e3845285db63bc5d7b7a53cdec089b7c2 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 14:06:21 +0300 Subject: [PATCH 39/50] Added MAP_CONAN_HOME_TO_DOCKER_HOST env var --- .ci/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.ci/Makefile b/.ci/Makefile index 11a3c32ae..6965dc27c 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -20,6 +20,11 @@ ifeq ($(DOCKERFILE), Dockerfile.alpine) ADD_LIBUNWIND_DEPENDENCY_BUILD_ARG_OPT:=--build-arg ADD_LIBUNWIND_DEPENDENCY=${ADD_LIBUNWIND_DEPENDENCY} endif +MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:= +ifdef MAP_CONAN_HOME_TO_DOCKER_HOST + MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:=-v "${MAP_CONAN_HOME_TO_DOCKER_HOST}:/home/build/.conan" +endif + CURRENT_UID := $(shell id -u) CURRENT_GID := $(shell id -g) CURRENT_USER_HOME := $(shell echo ~) @@ -46,8 +51,8 @@ build: docker run --rm -t \ -u $(CURRENT_UID):$(CURRENT_GID) \ -v $(PWD):/source \ + ${MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG} \ -w /source/agent/native \ - -e CONAN_USER_HOME=/tmp/conan \ elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.2 \ sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release && cmake --build --preset $(BUILD_ARCHITECTURE)-release && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" @echo "::endgroup::" From b03e2196673330b2f1c9861dbae2f5e6a6a33c70 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 14:16:35 +0300 Subject: [PATCH 40/50] [TEMP] Dummy failure in .phpt test --- agent/native/ext/elastic_apm.c | 10 ++++++++++ .../tests/config_boolean_0_using_env_var_is_false.phpt | 2 ++ 2 files changed, 12 insertions(+) diff --git a/agent/native/ext/elastic_apm.c b/agent/native/ext/elastic_apm.c index 2a8483e4a..bf8f681a1 100644 --- a/agent/native/ext/elastic_apm.c +++ b/agent/native/ext/elastic_apm.c @@ -668,6 +668,16 @@ PHP_FUNCTION( elastic_apm_ast_instrumentation_direct_call ) } /* }}} */ +ZEND_BEGIN_ARG_INFO_EX( elastic_apm_get_version_arginfo, /* _unused */ 0, /* return_reference: */ 0, /* required_num_args: */ 0 ) +ZEND_END_ARG_INFO() +/* {{{ elastic_apm_get_version(): string + */ +PHP_FUNCTION( elastic_apm_get_version ) +{ + RETURN_STRING( PHP_ELASTIC_APM_VERSION ); +} +/* }}} */ + /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO(elastic_apm_no_paramters_arginfo, 0) diff --git a/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt b/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt index 30dd7ec60..817c392d8 100644 --- a/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt +++ b/agent/native/ext/tests/config_boolean_0_using_env_var_is_false.phpt @@ -14,6 +14,8 @@ elasticApmAssertSame("getenv('ELASTIC_APM_ENABLED')", getenv('ELASTIC_APM_ENABLE elasticApmAssertSame('elastic_apm_is_enabled()', elastic_apm_is_enabled(), false); +elasticApmAssertSame('elastic_apm_get_version()', elastic_apm_get_version(), 'x' . \Elastic\Apm\ElasticApm::VERSION); + echo 'Test completed' ?> --EXPECT-- From e40412ad8fff7245c76a0989633917250ac393dc Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 14:59:49 +0300 Subject: [PATCH 41/50] Fixed to be used with CONAN_USER_HOME env var --- .ci/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/Makefile b/.ci/Makefile index 6965dc27c..4a3ffc015 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -22,7 +22,7 @@ endif MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:= ifdef MAP_CONAN_HOME_TO_DOCKER_HOST - MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:=-v "${MAP_CONAN_HOME_TO_DOCKER_HOST}:/home/build/.conan" + MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:=-v "${MAP_CONAN_HOME_TO_DOCKER_HOST}:/conan_user_home" endif CURRENT_UID := $(shell id -u) @@ -53,6 +53,7 @@ build: -v $(PWD):/source \ ${MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG} \ -w /source/agent/native \ + -e CONAN_USER_HOME=/conan_user_home \ elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.2 \ sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release && cmake --build --preset $(BUILD_ARCHITECTURE)-release && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" @echo "::endgroup::" From a223e1650b3d503e36515c0fcc3c454404f88d95 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 15:02:30 +0300 Subject: [PATCH 42/50] Update agent/native/CMakeLists.txt --- agent/native/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/native/CMakeLists.txt b/agent/native/CMakeLists.txt index 8444ce8a1..bb5f1a316 100644 --- a/agent/native/CMakeLists.txt +++ b/agent/native/CMakeLists.txt @@ -31,7 +31,7 @@ if(EXISTS /etc/alpine-release) endif() if ((NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR (NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")) - message(FATAL_ERROR "System or architecure not supported") + message(FATAL_ERROR "System or architecture not supported") endif() include(elastic_set_default_build_options) From c2cd83518bf4e0b482c4006bc50674beb617c2b2 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Thu, 29 Jun 2023 14:25:50 +0200 Subject: [PATCH 43/50] removed deprecated libunwind dependency settings --- .ci/Jenkinsfile | 4 +--- .ci/Makefile | 3 --- Dockerfile.alpine | 6 ------ agent/native/ext/unit_tests/CMakeLists.txt | 4 +--- packaging/Makefile | 2 +- packaging/test/alpine/Dockerfile | 3 --- packaging/test/docker-compose.yml | 6 ------ 7 files changed, 3 insertions(+), 25 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index a0664d6e1..bbb2ea93d 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -31,7 +31,6 @@ pipeline { choice(name: 'AGENT_LOG_LEVEL', choices: LOG_LEVELS, description: "Agent's log level") choice(name: 'TESTS_LOG_LEVEL', choices: LOG_LEVELS, description: "Tests' log level") booleanParam(name: 'INCLUDE_TESTING', defaultValue: true, description: 'Should the testing stages be included?') - booleanParam(name: 'ADD_LIBUNWIND_DEPENDENCY', defaultValue: false, description: 'Should Alpine (.apk) build have dependency on libunwind (to be able to log C call stack on crash)?') } stages { stage('Initializing'){ @@ -149,7 +148,7 @@ pipeline { // When running in the CI with multiple parallel stages // the access could be considered as a DDOS attack. retryWithSleep(retries: 3, seconds: 45, backoff: true) { - sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} ADD_LIBUNWIND_DEPENDENCY=${params.ADD_LIBUNWIND_DEPENDENCY} make -f .ci/Makefile prepare", label: 'prepare docker image' + sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} make -f .ci/Makefile prepare", label: 'prepare docker image' } unstash "built-extensions-${BUILD_ARCHITECTURE}" sh script: "BUILD_ARCHITECTURE=${BUILD_ARCHITECTURE} PHP_VERSION=${PHP_VERSION} make -f .ci/Makefile run-phpt-tests", label: 'run-phpt-tests' @@ -604,7 +603,6 @@ def addEnvVarsFromParams(def withEnvList) { if (params.TESTS_LOG_LEVEL != null && !params.TESTS_LOG_LEVEL.equals(LOG_LEVEL_NOT_SET)) { withEnvList.add('ELASTIC_APM_PHP_TESTS_LOG_LEVEL=' + params.TESTS_LOG_LEVEL) } - withEnvList.add('ADD_LIBUNWIND_DEPENDENCY=' + params.ADD_LIBUNWIND_DEPENDENCY) return withEnvList } diff --git a/.ci/Makefile b/.ci/Makefile index 4a3ffc015..e7ea2b495 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -13,11 +13,9 @@ PHP_VERSION ?= 7.2 DOCKERFILE ?= Dockerfile LOOPS ?= 50 SUFFIX := -ADD_LIBUNWIND_DEPENDENCY_BUILD_ARG_OPT:= ifeq ($(DOCKERFILE), Dockerfile.alpine) ## This is only required to tag the docker images used for building/testing this project SUFFIX := -alpine - ADD_LIBUNWIND_DEPENDENCY_BUILD_ARG_OPT:=--build-arg ADD_LIBUNWIND_DEPENDENCY=${ADD_LIBUNWIND_DEPENDENCY} endif MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:= @@ -39,7 +37,6 @@ prepare: ## Build docker image for building and testing the project @echo "::group::$@" # Helping to group logs in GitHub actions docker build \ --build-arg PHP_VERSION=${PHP_VERSION} \ - ${ADD_LIBUNWIND_DEPENDENCY_BUILD_ARG_OPT} \ --tag $(IMAGE):${PHP_VERSION}$(SUFFIX) \ -f ${DOCKERFILE} . @echo "::endgroup::" diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 460fc8056..5235c2da8 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -12,12 +12,6 @@ RUN apk update \ git \ unzip -ARG ADD_LIBUNWIND_DEPENDENCY=false -RUN echo "ADD_LIBUNWIND_DEPENDENCY: ${ADD_LIBUNWIND_DEPENDENCY}" -ENV ADD_LIBUNWIND_DEPENDENCY=${ADD_LIBUNWIND_DEPENDENCY} -RUN if [[ "${ADD_LIBUNWIND_DEPENDENCY}" = "true" ]] ; then apk add libunwind-dev ; fi -ENV ELASTIC_APM_ASSUME_CAN_CAPTURE_C_STACK_TRACE=${ADD_LIBUNWIND_DEPENDENCY} - RUN docker-php-ext-install \ mysqli \ pcntl \ diff --git a/agent/native/ext/unit_tests/CMakeLists.txt b/agent/native/ext/unit_tests/CMakeLists.txt index bbd194d21..829e51155 100644 --- a/agent/native/ext/unit_tests/CMakeLists.txt +++ b/agent/native/ext/unit_tests/CMakeLists.txt @@ -81,9 +81,7 @@ IF ( $ENV{CLION_IDE} ) ADD_COMPILE_DEFINITIONS( ELASTIC_APM_UNDER_IDE ) ENDIF() -IF ( "$ENV{ELASTIC_APM_ASSUME_CAN_CAPTURE_C_STACK_TRACE}" STREQUAL "true" ) - ADD_COMPILE_DEFINITIONS( ELASTIC_APM_ASSUME_CAN_CAPTURE_C_STACK_TRACE ) -ENDIF() +ADD_COMPILE_DEFINITIONS( ELASTIC_APM_ASSUME_CAN_CAPTURE_C_STACK_TRACE ) IF ( WIN32 ) ADD_COMPILE_DEFINITIONS( PHP_WIN32 ) diff --git a/packaging/Makefile b/packaging/Makefile index 31c51d760..481a9c47a 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -102,7 +102,7 @@ tar-info: ## Show the tar package metadata prepare-apk: ## Build the docker image for the apk smoke tests @echo "::group::$@" # Helping to group logs in GitHub actions cd $(PWD)/packaging/test/alpine ;\ - docker build --build-arg PHP_VERSION=$(PHP_VERSION) --build-arg ADD_LIBUNWIND_DEPENDENCY=${ADD_LIBUNWIND_DEPENDENCY} -t $@ . || exit 1 ;\ + docker build --build-arg PHP_VERSION=$(PHP_VERSION) -t $@ . || exit 1 ;\ cd - @echo "::endgroup::" diff --git a/packaging/test/alpine/Dockerfile b/packaging/test/alpine/Dockerfile index 071b2497d..c7163048c 100644 --- a/packaging/test/alpine/Dockerfile +++ b/packaging/test/alpine/Dockerfile @@ -14,9 +14,6 @@ RUN apk update \ unzip \ wget -ARG ADD_LIBUNWIND_DEPENDENCY=false -RUN if [[ "${ADD_LIBUNWIND_DEPENDENCY}" = "true" ]] ; then apk add libunwind; fi - RUN docker-php-ext-install \ mysqli \ pcntl \ diff --git a/packaging/test/docker-compose.yml b/packaging/test/docker-compose.yml index 6bddceaef..4af448e02 100644 --- a/packaging/test/docker-compose.yml +++ b/packaging/test/docker-compose.yml @@ -183,7 +183,6 @@ services: dockerfile: Dockerfile args: - PHP_VERSION=8.2 - - ADD_LIBUNWIND_DEPENDENCY= apk-php81: image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-8.1-0.0.1 build: @@ -191,7 +190,6 @@ services: dockerfile: Dockerfile args: - PHP_VERSION=8.1 - - ADD_LIBUNWIND_DEPENDENCY= apk-php80: image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-8.0-0.0.1 build: @@ -199,7 +197,6 @@ services: dockerfile: Dockerfile args: - PHP_VERSION=8.0 - - ADD_LIBUNWIND_DEPENDENCY= apk-php74: image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.4-0.0.1 build: @@ -207,7 +204,6 @@ services: dockerfile: Dockerfile args: - PHP_VERSION=7.4 - - ADD_LIBUNWIND_DEPENDENCY= apk-php73: image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.3-0.0.1 build: @@ -215,7 +211,6 @@ services: dockerfile: Dockerfile args: - PHP_VERSION=7.3 - - ADD_LIBUNWIND_DEPENDENCY= apk-php72: image: elasticobservability/apm-agent-php-dev:packages-test-apk-php-7.2-0.0.1 build: @@ -223,4 +218,3 @@ services: dockerfile: Dockerfile args: - PHP_VERSION=7.2 - - ADD_LIBUNWIND_DEPENDENCY= From 1f0ae4afbd37b70cb2e06a8470c17f41f294eb53 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 20:32:55 +0300 Subject: [PATCH 44/50] Fixed conan_user_home location --- .ci/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.ci/Makefile b/.ci/Makefile index 4a3ffc015..0cfc94a10 100644 --- a/.ci/Makefile +++ b/.ci/Makefile @@ -20,9 +20,10 @@ ifeq ($(DOCKERFILE), Dockerfile.alpine) ADD_LIBUNWIND_DEPENDENCY_BUILD_ARG_OPT:=--build-arg ADD_LIBUNWIND_DEPENDENCY=${ADD_LIBUNWIND_DEPENDENCY} endif +CONAN_USER_HOME:=/tmp/conan_user_home MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:= ifdef MAP_CONAN_HOME_TO_DOCKER_HOST - MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:=-v "${MAP_CONAN_HOME_TO_DOCKER_HOST}:/conan_user_home" + MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG:=-v "${MAP_CONAN_HOME_TO_DOCKER_HOST}:$(CONAN_USER_HOME)" endif CURRENT_UID := $(shell id -u) @@ -53,9 +54,11 @@ build: -v $(PWD):/source \ ${MAP_CONAN_HOME_TO_DOCKER_HOST_CMD_LINE_ARG} \ -w /source/agent/native \ - -e CONAN_USER_HOME=/conan_user_home \ + -e CONAN_USER_HOME=$(CONAN_USER_HOME) \ elasticobservability/apm-agent-php-dev:native-build-gcc-12.2.0-$(BUILD_ARCHITECTURE)-0.0.2 \ - sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release && cmake --build --preset $(BUILD_ARCHITECTURE)-release && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" + sh -c "cmake --preset $(BUILD_ARCHITECTURE)-release \ + && cmake --build --preset $(BUILD_ARCHITECTURE)-release \ + && /source/agent/native/_build/$(BUILD_ARCHITECTURE)-release/ext/unit_tests/unit_tests" @echo "::endgroup::" .PHONY: static-check-unit-test From 6d9ab180a85b0c7d5ae910d7c913c841512c3414 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 21:22:35 +0300 Subject: [PATCH 45/50] Removed redundant dependencies between stages in .github\workflows\test.yml --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bdf00ec32..236c19663 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,7 +79,7 @@ jobs: - name: phpt-unit-tests run: make -f .ci/Makefile run-phpt-tests - test: + static-checks-unit-tests: name: static-checks-unit-tests runs-on: ubuntu-latest timeout-minutes: 30 @@ -122,8 +122,6 @@ jobs: runs-on: ubuntu-latest needs: - build - - test - - phpt-tests steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 @@ -159,7 +157,6 @@ jobs: needs: - build-packages - generate-test-packages-matrix - - test runs-on: ubuntu-latest strategy: max-parallel: 20 From 9a307163e29703d35a123df8984dd631e84c6e7e Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Thu, 29 Jun 2023 21:22:35 +0300 Subject: [PATCH 46/50] Removed redundant dependencies between stages in .github\workflows\test.yml --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bdf00ec32..236c19663 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,7 +79,7 @@ jobs: - name: phpt-unit-tests run: make -f .ci/Makefile run-phpt-tests - test: + static-checks-unit-tests: name: static-checks-unit-tests runs-on: ubuntu-latest timeout-minutes: 30 @@ -122,8 +122,6 @@ jobs: runs-on: ubuntu-latest needs: - build - - test - - phpt-tests steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 @@ -159,7 +157,6 @@ jobs: needs: - build-packages - generate-test-packages-matrix - - test runs-on: ubuntu-latest strategy: max-parallel: 20 From 991164b66661c8c7ca0903cc6c786b5a73aedcd0 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Fri, 30 Jun 2023 08:16:32 +0300 Subject: [PATCH 47/50] Make test-packages depend on static-checks-unit-tests and phpt-tests --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 236c19663..e3b060645 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -157,6 +157,8 @@ jobs: needs: - build-packages - generate-test-packages-matrix + - static-checks-unit-tests + - phpt-tests runs-on: ubuntu-latest strategy: max-parallel: 20 From c7dc4391e65208844816411bbcfcab822afc1d16 Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Fri, 30 Jun 2023 08:18:50 +0300 Subject: [PATCH 48/50] Make build-packages depend on static-checks-unit-tests and phpt-tests --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3b060645..643f29e57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,6 +122,8 @@ jobs: runs-on: ubuntu-latest needs: - build + - static-checks-unit-tests + - phpt-tests steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 @@ -157,8 +159,6 @@ jobs: needs: - build-packages - generate-test-packages-matrix - - static-checks-unit-tests - - phpt-tests runs-on: ubuntu-latest strategy: max-parallel: 20 From 361d14f5a420bea65728e708c7f7e8a2dd430fde Mon Sep 17 00:00:00 2001 From: Sergey Kleyman Date: Fri, 30 Jun 2023 08:23:06 +0300 Subject: [PATCH 49/50] Make build-packages depend on static-checks-unit-tests and phpt-tests --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 236c19663..643f29e57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,6 +122,8 @@ jobs: runs-on: ubuntu-latest needs: - build + - static-checks-unit-tests + - phpt-tests steps: - uses: actions/checkout@v3 - uses: actions/download-artifact@v3 From 4b7510a39e79ce27aadb11d5716404acc138aeb5 Mon Sep 17 00:00:00 2001 From: Pawel Filipczak Date: Fri, 30 Jun 2023 13:03:12 +0200 Subject: [PATCH 50/50] added pkgconf to local dependencies becuase of unstable original source host --- agent/native/CMakeLists.txt | 15 ++ .../building/cmake/elastic_conan_export.cmake | 11 ++ .../dependencies/pkgconf/conandata.yml | 8 + .../dependencies/pkgconf/conanfile.py | 152 ++++++++++++++++++ ...PATH-allow-colon+semicolon-separator.patch | 11 ++ 5 files changed, 197 insertions(+) create mode 100644 agent/native/building/dependencies/pkgconf/conandata.yml create mode 100644 agent/native/building/dependencies/pkgconf/conanfile.py create mode 100644 agent/native/building/dependencies/pkgconf/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch diff --git a/agent/native/CMakeLists.txt b/agent/native/CMakeLists.txt index bb5f1a316..a6cb90e4a 100644 --- a/agent/native/CMakeLists.txt +++ b/agent/native/CMakeLists.txt @@ -60,6 +60,19 @@ endfunction() message(STATUS "Creating dependencies from local directories") + +# build pkgconf from local reciepe because default one rely on unstable sources host, we're fetching from github tag +elastic_conan_create( + PATH ${CMAKE_SOURCE_DIR}/building/dependencies/pkgconf + REFERENCE pkgconf/1.9.3@elastic/local + PROFILE ${_CONAN_PROFILE} + ) + +elastic_conan_alias( + REFERENCE pkgconf/1.9.3 + TARGET pkgconf/1.9.3@elastic/local +) + foreach(_php_version ${_supported_php_versions}) elastic_conan_create( PATH ${CMAKE_SOURCE_DIR}/building/dependencies/php${_php_version} @@ -68,6 +81,8 @@ foreach(_php_version ${_supported_php_versions}) ) endforeach() + + # TODO implement multiarray with mapping of library->version set(dependencies diff --git a/agent/native/building/cmake/elastic_conan_export.cmake b/agent/native/building/cmake/elastic_conan_export.cmake index ad07f2d33..6b052a3d2 100644 --- a/agent/native/building/cmake/elastic_conan_export.cmake +++ b/agent/native/building/cmake/elastic_conan_export.cmake @@ -30,3 +30,14 @@ function(elastic_conan_create) COMMAND_ERROR_IS_FATAL ANY ) endfunction() + + +function(elastic_conan_alias) + set(oneValueArgs PATH REFERENCE TARGET) + cmake_parse_arguments(_elastic_conan_alias "" "${oneValueArgs}" "" ${ARGN} ) + + message(STATUS "${CONAN_CMD} alias ${_elastic_conan_alias_REFERENCE} ${_elastic_conan_alias_TARGET}") + execute_process(COMMAND ${CONAN_CMD} alias ${_elastic_conan_alias_REFERENCE} ${_elastic_conan_alias_TARGET} + COMMAND_ERROR_IS_FATAL ANY + ) +endfunction() diff --git a/agent/native/building/dependencies/pkgconf/conandata.yml b/agent/native/building/dependencies/pkgconf/conandata.yml new file mode 100644 index 000000000..5a2974ff2 --- /dev/null +++ b/agent/native/building/dependencies/pkgconf/conandata.yml @@ -0,0 +1,8 @@ +version: "1.9.3" +patches: + 1.9.3: + - patch_file: patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch +sources: + 1.9.3: + sha256: e8b637c0dd8ae1decbcc95b24b64795cba81a8e3064fddb4424cacef411e59f9 + url: https://github.com/pkgconf/pkgconf/archive/refs/tags/pkgconf-1.9.3.tar.gz diff --git a/agent/native/building/dependencies/pkgconf/conanfile.py b/agent/native/building/dependencies/pkgconf/conanfile.py new file mode 100644 index 000000000..7edfbe65c --- /dev/null +++ b/agent/native/building/dependencies/pkgconf/conanfile.py @@ -0,0 +1,152 @@ +import os + +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc, unix_path_package_info_legacy +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + + +required_conan_version = ">=1.57.0" + + +class PkgConfConan(ConanFile): + name = "pkgconf" + url = "https://github.com/conan-io/conan-center-index" + topics = ("build", "configuration") + homepage = "https://git.sr.ht/~kaniini/pkgconf" + license = "ISC" + description = "package compiler and linker metadata toolkit" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_lib": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_lib": False, + } + + def init(self): + self.version = self.conan_data["version"] # version of the package + + def layout(self): + basic_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if not self.options.enable_lib: + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") + elif self.options.shared: + self.options.rm_safe("fPIC") + + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def build_requirements(self): + self.tool_requires("meson/1.0.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def _patch_sources(self): + apply_conandata_patches(self) + + if not self.options.get_safe("shared", False): + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "'-DLIBPKGCONF_EXPORT'", + "'-DPKGCONFIG_IS_STATIC'") + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "project('pkgconf', 'c',", + "project('pkgconf', 'c',\ndefault_options : ['c_std=gnu99'],") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = MesonToolchain(self) + tc.project_options["tests"] = False + if not self.options.enable_lib: + tc.project_options["default_library"] = "static" + tc.generate() + + def build(self): + self._patch_sources() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + + meson = Meson(self) + meson.install() + + if is_msvc(self): + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if self.options.enable_lib and not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libpkgconf.a"), + os.path.join(self.package_folder, "lib", "pkgconf.lib"),) + + if not self.options.enable_lib: + rmdir(self, os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "include")) + + + rmdir(self, os.path.join(self.package_folder, "share", "man")) + rename(self, os.path.join(self.package_folder, "share", "aclocal"), + os.path.join(self.package_folder, "bin", "aclocal")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_id(self): + if not self.info.options.enable_lib: + del self.info.settings.compiler + + def package_info(self): + if self.options.enable_lib: + self.cpp_info.set_property("pkg_config_name", "libpkgconf") + if Version(self.version) >= "1.7.4": + self.cpp_info.includedirs.append(os.path.join("include", "pkgconf")) + self.cpp_info.libs = ["pkgconf"] + if not self.options.shared: + self.cpp_info.defines = ["PKGCONFIG_IS_STATIC"] + else: + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + + bindir = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH env var: {}".format(bindir)) + self.env_info.PATH.append(bindir) + + exesuffix = ".exe" if self.settings.os == "Windows" else "" + pkg_config = os.path.join(bindir, "pkgconf" + exesuffix).replace("\\", "/") + self.output.info("Setting PKG_CONFIG env var: {}".format(pkg_config)) + self.buildenv_info.define_path("PKG_CONFIG", pkg_config) + + pkgconf_aclocal = os.path.join(self.package_folder, "bin", "aclocal") + self.buildenv_info.prepend_path("ACLOCAL_PATH", pkgconf_aclocal) + # TODO: evaluate if `ACLOCAL_PATH` is enough and we can stop using `AUTOMAKE_CONAN_INCLUDES` + self.buildenv_info.prepend_path("AUTOMAKE_CONAN_INCLUDES", pkgconf_aclocal) + + # TODO: remove in conanv2 + automake_extra_includes = unix_path_package_info_legacy(self, pkgconf_aclocal.replace("\\", "/")) + self.output.info("Appending AUTOMAKE_CONAN_INCLUDES env var: {}".format(automake_extra_includes)) + self.env_info.PKG_CONFIG = pkg_config + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(automake_extra_includes) + + # TODO: to remove in conan v2 once pkg_config generator removed + if self.options.enable_lib: + self.cpp_info.names["pkg_config"] = "libpkgconf" diff --git a/agent/native/building/dependencies/pkgconf/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch b/agent/native/building/dependencies/pkgconf/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch new file mode 100644 index 000000000..8c6738a23 --- /dev/null +++ b/agent/native/building/dependencies/pkgconf/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch @@ -0,0 +1,11 @@ +--- libpkgconf/path.c ++++ libpkgconf/path.c +@@ -138,7 +138,7 @@ + return 0; + + iter = workbuf = strdup(text); +- while ((p = strtok(iter, PKG_CONFIG_PATH_SEP_S)) != NULL) ++ while ((p = strtok(iter, ":;")) != NULL) + { + pkgconf_path_add(p, dirlist, filter); +