Remove cmake from the build process

While I'm here change the name of the module to ngx_otel_module.
This commit is contained in:
Sergey A. Osokin 2024-12-02 16:24:01 -05:00
parent 1d25954274
commit 3a655dfa8a
6 changed files with 323 additions and 211 deletions

View file

@ -1,10 +1,45 @@
cat << END >> $NGX_MAKEFILE
if [ ! "`which protoc 2>/dev/null`" ]; then
echo "Need to install protoc."
exit 2
else
PROTOC=`which protoc`
fi
modules: ngx_otel_module
if [ ! "`which grpc_cpp_plugin 2>/dev/null`" ]; then
echo "Need to install grpc tools."
exit 2
else
GRPC_CPP=`which grpc_cpp_plugin`
fi
ngx_otel_module:
\$(MAKE) -C $NGX_OBJS/otel
mkdir -p objs
.PHONY: ngx_otel_module
if [ -z $NGX_OTEL_PROTO_DIR ]; then
echo "Need to set \$NGX_OTEL_PROTO_DIR variable."
exit 2
fi
END
if [ ! -d $NGX_OTEL_PROTO_DIR ]; then
echo "\$NGX_OTEL_PROTO_DIR is set to unavailable directory."
exit 2
fi
find $NGX_OTEL_PROTO_DIR/opentelemetry/proto -type f -name '*.proto' | \
xargs $PROTOC \
--proto_path $NGX_OTEL_PROTO_DIR \
--cpp_out=objs \
--grpc_out=objs \
--plugin=protoc-gen-grpc=$GRPC_CPP
find objs -name '*.pb.cc' | \
xargs sed -i.bak -e "/ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(/,/);/d"
for src_file in $OTEL_NGX_SRCS; do
obj_file="$NGX_OBJS/addon/src/`basename $src_file .cpp`.o"
echo "$obj_file : CFLAGS += $CXXFLAGS -Wno-missing-field-initializers -Wno-conditional-uninitialized -fPIC -fvisibility=hidden -DHAVE_ABSEIL -Dngx_otel_module_EXPORTS" >> $NGX_MAKEFILE
done
for src_file in $OTEL_NGX_SRCS; do
obj_file="$NGX_OBJS/addon/v1/`basename $src_file .cc`.o"
echo "$obj_file : CFLAGS += $CXXFLAGS -Wno-missing-field-initializers -Wno-conditional-uninitialized -fPIC -fvisibility=hidden -DHAVE_ABSEIL -Dngx_otel_module_EXPORTS" >> $NGX_MAKEFILE
done