Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: remove vendor subdir #1012

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

- name: Provision agent's build dependencies
if: ${{ matrix.language == 'c-cpp' }}
run: |
sudo apt-get update
sudo apt-get install -y libprotobuf-c-dev protobuf-c-compiler

- name: Build
run: |
make ${{ matrix.language == 'go' && 'daemon' || 'agent' }}
Expand Down
33 changes: 12 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ bin/:
#

.PHONY: axiom
axiom: vendor
axiom: protobuf-c
$(MAKE) -C axiom

#
Expand All @@ -238,15 +238,15 @@ axiom: vendor
# TESTARGS =

.PHONY: axiom-tests
axiom-tests: vendor
axiom-tests: protobuf-c
$(MAKE) -C axiom tests

.PHONY: axiom-check axiom-run-tests
axiom-check axiom-run-tests: vendor axiom/tests/cross_agent_tests
axiom-check axiom-run-tests: protobuf-c axiom/tests/cross_agent_tests
$(MAKE) -C axiom run_tests

.PHONY: axiom-valgrind
axiom-valgrind: vendor axiom/tests/cross_agent_tests
axiom-valgrind: protobuf-c axiom/tests/cross_agent_tests
$(MAKE) -C axiom valgrind

.PHONY: tests
Expand Down Expand Up @@ -279,9 +279,7 @@ axiom-clean:
daemon-protobuf: daemon/internal/newrelic/infinite_tracing/com_newrelic_trace_v1/v1.pb.go

daemon/internal/newrelic/infinite_tracing/com_newrelic_trace_v1/v1.pb.go: protocol/infinite_tracing/v1.proto
$(MAKE) vendor # Only build vendor stuff if v1.proto has changed. Otherwise
# this rule will be triggered every time the daemon is built.
$(VENDOR_PREFIX)/bin/protoc \
protoc \
-I=./protocol/infinite_tracing \
--go_out="paths=source_relative,plugins=grpc:daemon/internal/newrelic/infinite_tracing/com_newrelic_trace_v1" \
protocol/infinite_tracing/v1.proto
Expand Down Expand Up @@ -403,7 +401,7 @@ coverage:
#

.PHONY: clean
clean: agent-clean axiom-clean daemon-clean package-clean coverage-clean vendor-clean
clean: agent-clean axiom-clean daemon-clean package-clean coverage-clean
rm -rf releases
rm -f agent/newrelic.map agent/LicenseData/license_errors.txt

Expand Down Expand Up @@ -441,21 +439,14 @@ lasp-test-all:
$(MAKE) lasp-test SUITE_LASP=suite-random-3

#
# Vendored libraries
# Check for protobuf-c (HAVE_PROTOBUF_C):
# - axiom build needs protoc-c (protobuf-c-compiler)
# - agent build needs protobuf-c static library (protobuf-c-devel)
#
export GIT

.PHONY: vendor vendor-clean
.PHONY: protobuf-c
protobuf-c:
ifeq (0,$(HAVE_PROTOBUF_C))
vendor:
$(MAKE) -C vendor all

vendor-clean:
$(MAKE) -C vendor clean
else
vendor: ;

vendor-clean: ;
$(error Build dependency 'protobuf-c' not found.)
endif

#
Expand Down
41 changes: 41 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ by e-mailing [[email protected]](mailto:[email protected]).
* [PCRE](#pcre)
* [PHP](#php)
* [Portable OpenSSH](#portable-openssh)
* [protobuf-c](#protobuf-c)
* [TSRM](#tsrm)
* [Symfony](#symfony)

Expand Down Expand Up @@ -895,6 +896,46 @@ under
*/
```

## protobuf-c

This product includes [protobuf-c]https://github.com/protobuf-c/protobuf-c) ([v1.3.3](https://github.com/protobuf-c/protobuf-c/tree/v1.3.3)),
distributed under the [protobuf-c license](https://github.com/protobuf-c/protobuf-c/blob/v1.3.3/LICENSE):

```
Copyright (c) 2008-2016, Dave Benson and the protobuf-c authors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The code generated by the protoc-gen-c code generator and by the
protoc-c compiler is owned by the owner of the input files used when
generating it. This code is not standalone and requires a support
library to be linked with it. This support library is covered by the
above license.
```

## TSRM

This product includes source derived from
Expand Down
8 changes: 7 additions & 1 deletion axiom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ nr_config.h: configure Makefile
#
# Build the 8T protobuf code.
#
v1.pb-c.c: v1.proto
v1.pb-c.c: v1.proto protobuf-c
$(PROTOBUF_C_PREFIX)/bin/protoc-c --c_out=. $<

#
Expand All @@ -205,6 +205,12 @@ v1.pb-c.c: v1.proto
v1.pb-c.o: v1.pb-c.c
$(CC) $(AXIOM_CPPFLAGS) $(CPPFLAGS) $(AXIOM_CFLAGS) $(PCRE_CFLAGS) $(VENDOR_CFLAGS) $(CFLAGS) -MMD -MP -Wno-cast-qual -c $< -o $@

.PHONY: protobuf-c
protobuf-c:
ifeq (0,$(HAVE_PROTOBUF_C))
$(error Build dependency 'protobuf-c' not found.)
endif

#
# Track the flags passed to the compiler to force a rebuild when they change.
# This ensures a rebuild occurs when the version number or commit are updated.
Expand Down
11 changes: 5 additions & 6 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ Currently, the PHP agent has only been developed and compiled on Linux systems.

#### Operating Systems
- Fully supported for building from source
- Ubuntu 16.04+
- CentOS/RHEL 7+
- Supported in binary form only (may require experimentation to build)
- FreeBSD
- Debian/Ubuntu LTS
- Alpine Linux
- AWS Linux 2
- Any Linux with Kernel >=2.6.26 and `glibc` >=2.5 (or `musl libc` >= 1.1)
- CentOS/RHEL 7+

#### Build system dependencies
- `build-essential` on Debian systems, `"Development Tools"` group on RHEL systems, equivalent packages on other supported systems for `make`, `cmake`, `gcc`, etc.
- `valgrind` is extensively in the test suite
- `protoc-c` (protobuf-c-compiler) is needed to build the agent

#### Go

Expand All @@ -42,6 +39,7 @@ Install the [latest version of Go](https://golang.org/dl/). Typically it's insta
- `libxslt`
- `openssl`
- `pcre`
- `protobuf-c` (`libprotobuf-c-dev` on Debian systems, `protobuf-c-devel` on RHEL systems)
- `zlib`

#### Application development headers
Expand All @@ -54,6 +52,7 @@ _(most operating systems package these with `-dev` or `-devel` suffixes)_
- `php`
- `postgresql`
- `sqlite`
- `protobuf-c` (`libprotobuf-c-dev` on Debian systems, `protobuf-c-devel` on RHEL systems)


### PHP
Expand Down
6 changes: 6 additions & 0 deletions files/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libmcrypt-dev \
libonig-dev \
libpcre3 libpcre3-dev \
# 8T protobuf code in axiom depends on libprotobuf-c library
libprotobuf-c-dev \
libreadline-dev \
libssl-dev \
libsqlite3-dev \
Expand All @@ -52,6 +54,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
locales \
locales-all \
netcat-openbsd \
# needed to generate 8T protobuf code in daemon
protobuf-compiler \
# needed to generate 8T protobuf code in axiom
protobuf-c-compiler \
python3-yaml \
${PHP_USER_SPECIFIED_PACKAGES} \
zlib1g-dev
Expand Down
4 changes: 0 additions & 4 deletions make/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ ifneq ($(findstring environment,$(origin PROTOBUF_C_PREFIX)), )
ifeq ($(HAVE_PROTOBUF_C), 0)
$(error User provided 'protobuf-c' installation is not valid!)
endif
else
ifeq ($(HAVE_PROTOBUF_C), 0)
$(info 'protobuf-c' installation not found, falling back to building from vendor subdir.)
endif
endif


Expand Down
11 changes: 1 addition & 10 deletions make/vendor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,8 @@
# It is recommended to use the VENDOR_... variables.
#

# We need to find where the project's vendored dependencies live for these
# variables.
ifeq (0,$(HAVE_PROTOBUF_C))
PROTOBUF_C_PREFIX := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))../vendor)/local
endif

#
# protobuf-c
#
# Note that this does not require protobuf, which is a build time dependency
# only.
# protobuf-c: 8T protobuf code from axiom needs protobuf-c library
#
PROTOBUF_C_CFLAGS := -I$(PROTOBUF_C_PREFIX)/include
PROTOBUF_C_LDFLAGS := -L$(PROTOBUF_C_PREFIX)/lib
Expand Down
1 change: 0 additions & 1 deletion trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ scan:
scanners:
- vuln
- misconfig
skip-dirs: vendor

severities:
- CRITICAL
Expand Down
3 changes: 0 additions & 3 deletions vendor/.gitignore

This file was deleted.

57 changes: 0 additions & 57 deletions vendor/Makefile

This file was deleted.

63 changes: 0 additions & 63 deletions vendor/README.md

This file was deleted.

Loading