mirror of
https://github.com/ZoeyVid/NPMplus.git
synced 2026-03-02 22:49:24 +00:00
179 lines
6.1 KiB
Diff
179 lines
6.1 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index ecdcb61..250e5ca 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -1,4 +1,4 @@
|
|
-cmake_minimum_required(VERSION 2.8.4)
|
|
+cmake_minimum_required(VERSION 3.5.0)
|
|
project(ngen)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wno-terminate")
|
|
@@ -17,5 +17,5 @@ include_directories(core/include/attachments)
|
|
|
|
add_subdirectory(core)
|
|
add_subdirectory(attachments)
|
|
-add_subdirectory(docker)
|
|
-add_subdirectory(nodes)
|
|
+#add_subdirectory(docker)
|
|
+#add_subdirectory(nodes)
|
|
diff --git a/attachments/CMakeLists.txt b/attachments/CMakeLists.txt
|
|
index 7862ae9..f4b3ba9 100644
|
|
--- a/attachments/CMakeLists.txt
|
|
+++ b/attachments/CMakeLists.txt
|
|
@@ -1,4 +1,4 @@
|
|
-add_subdirectory(nano_attachment)
|
|
+#add_subdirectory(nano_attachment)
|
|
if ("${ATTACHMENT_TYPE}" STREQUAL "envoy")
|
|
add_subdirectory(envoy)
|
|
elseif("${ATTACHMENT_TYPE}" STREQUAL "kong")
|
|
diff --git a/attachments/nginx/ngx_module/CMakeLists.txt b/attachments/nginx/ngx_module/CMakeLists.txt
|
|
index 8c8ae92..e8f700a 100644
|
|
--- a/attachments/nginx/ngx_module/CMakeLists.txt
|
|
+++ b/attachments/nginx/ngx_module/CMakeLists.txt
|
|
@@ -1,32 +1,3 @@
|
|
-MACRO(CREATE_INCLUDE_LIST result)
|
|
- file(READ ${CMAKE_INSTALL_PREFIX}/nginx-src/include_paths.mk relative_includes)
|
|
- STRING(REGEX REPLACE "\n" ";" relative_includes "${relative_includes}")
|
|
- set(inclist "")
|
|
- FOREACH(include ${relative_includes})
|
|
- if(NOT include MATCHES "^/")
|
|
- set(inclist ${inclist} "${CMAKE_INSTALL_PREFIX}/nginx-src/${include}")
|
|
- else()
|
|
- set(inclist ${inclist} "${include}")
|
|
- endif()
|
|
- ENDFOREACH()
|
|
- set(${result} ${inclist})
|
|
-ENDMACRO()
|
|
-
|
|
-MACRO(READ_COMPILE_FLAGS result)
|
|
- file(READ ${CMAKE_INSTALL_PREFIX}/nginx-src/cc_flags.mk CC_FLAGS)
|
|
- string(REGEX REPLACE "\n" "" CC_FLAGS "${CC_FLAGS}")
|
|
- set(flag_list "")
|
|
- FOREACH(flag ${CC_FLAGS})
|
|
- if (flag MATCHES "-fstack-clash-protection" OR flag MATCHES "-fcf-protection" OR flag MATCHES "-Wno-cast-function-type")
|
|
- continue()
|
|
- endif()
|
|
-
|
|
- set(flag_list ${flag_list} "${flag}")
|
|
- ENDFOREACH()
|
|
- separate_arguments(flag_list)
|
|
- set(${result} ${flag_list})
|
|
-ENDMACRO()
|
|
-
|
|
add_library(
|
|
ngx_module
|
|
SHARED
|
|
@@ -39,8 +10,13 @@ add_dependencies(ngx_module osrc_shmem_ipc osrc_nginx_attachment_util osrc_compr
|
|
|
|
target_link_libraries(ngx_module osrc_shmem_ipc osrc_nginx_attachment_util osrc_compression_utils)
|
|
|
|
-CREATE_INCLUDE_LIST(NGX_INCLUDES)
|
|
-READ_COMPILE_FLAGS(CC_FLAG_LIST)
|
|
+file(GLOB_RECURSE NGINX_DIRS LIST_DIRECTORIES true "/src/nginx/*")
|
|
+set(NGX_INCLUDES "/src/nginx")
|
|
+foreach(dir ${NGINX_DIRS})
|
|
+ if(IS_DIRECTORY ${dir})
|
|
+ list(APPEND NGX_INCLUDES ${dir})
|
|
+ endif()
|
|
+endforeach()
|
|
|
|
target_include_directories(ngx_module PRIVATE ${NGX_INCLUDES})
|
|
target_compile_options(ngx_module PRIVATE ${CC_FLAG_LIST})
|
|
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
|
|
index 8285065..19cdc99 100644
|
|
--- a/core/CMakeLists.txt
|
|
+++ b/core/CMakeLists.txt
|
|
@@ -1,4 +1,4 @@
|
|
add_subdirectory(shmem_ipc)
|
|
-add_subdirectory(shmem_ipc_2)
|
|
+#add_subdirectory(shmem_ipc_2)
|
|
add_subdirectory(compression)
|
|
add_subdirectory(attachments)
|
|
diff --git a/core/compression/compression_utils.cc b/core/compression/compression_utils.cc
|
|
index c7e8922..f0f5930 100644
|
|
--- a/core/compression/compression_utils.cc
|
|
+++ b/core/compression/compression_utils.cc
|
|
@@ -21,7 +21,7 @@
|
|
#include <tuple>
|
|
#include <strings.h>
|
|
#include <string.h>
|
|
-#include <zlib.h>
|
|
+#include <zlib-ng.h>
|
|
#include <brotli/encode.h>
|
|
#include <brotli/decode.h>
|
|
|
|
@@ -115,7 +115,7 @@ struct CompressionStream
|
|
br_encoder_state(nullptr),
|
|
br_decoder_state(nullptr)
|
|
{
|
|
- bzero(&stream, sizeof(z_stream));
|
|
+ bzero(&stream, sizeof(zng_stream));
|
|
}
|
|
|
|
~CompressionStream() { fini(); }
|
|
@@ -144,7 +144,7 @@ struct CompressionStream
|
|
|
|
auto old_total_out = stream.total_out;
|
|
|
|
- auto inflate_res = inflate(&stream, zlib_no_flush);
|
|
+ auto inflate_res = zng_inflate(&stream, zlib_no_flush);
|
|
|
|
if (inflate_res != Z_OK && inflate_res != Z_STREAM_END) {
|
|
fini();
|
|
@@ -181,7 +181,7 @@ struct CompressionStream
|
|
stream.next_in = data;
|
|
|
|
vector<unsigned char> work_space;
|
|
- work_space.reserve(deflateBound(&stream, stream.avail_in));
|
|
+ work_space.reserve(zng_deflateBound(&stream, stream.avail_in));
|
|
basic_string<unsigned char> res;
|
|
int retries = 0;
|
|
|
|
@@ -191,7 +191,7 @@ struct CompressionStream
|
|
|
|
auto old_total_out = stream.total_out;
|
|
|
|
- int deflate_res = deflate(&stream, is_last_chunk ? zlib_finish_flush : zlib_sync_flush);
|
|
+ int deflate_res = zng_deflate(&stream, is_last_chunk ? zlib_finish_flush : zlib_sync_flush);
|
|
|
|
if (deflate_res != Z_OK && deflate_res != Z_STREAM_END) {
|
|
fini();
|
|
@@ -221,7 +221,7 @@ private:
|
|
{
|
|
if (state != TYPE::UNINITIALIZED) return;
|
|
|
|
- auto init_status = inflateInit2(&stream, default_num_window_bits + 32);
|
|
+ auto init_status = zng_inflateInit2(&stream, default_num_window_bits + 32);
|
|
if (init_status != zlib_ok_return_value) {
|
|
throw runtime_error(
|
|
"Failed to initialize decompression stream. Error: " + getZlibError(init_status)
|
|
@@ -258,7 +258,7 @@ private:
|
|
}
|
|
}
|
|
|
|
- int init_status = deflateInit2(
|
|
+ int init_status = zng_deflateInit2(
|
|
&stream,
|
|
default_compression_level,
|
|
default_compression_method,
|
|
@@ -464,8 +464,8 @@ private:
|
|
{
|
|
int end_stream_res = zlib_ok_return_value;
|
|
|
|
- if (state == TYPE::DECOMPRESS) end_stream_res = inflateEnd(&stream);
|
|
- if (state == TYPE::COMPRESS) end_stream_res = deflateEnd(&stream);
|
|
+ if (state == TYPE::DECOMPRESS) end_stream_res = zng_inflateEnd(&stream);
|
|
+ if (state == TYPE::COMPRESS) end_stream_res = zng_deflateEnd(&stream);
|
|
|
|
if (br_encoder_state) {
|
|
BrotliEncoderDestroyInstance(br_encoder_state);
|
|
@@ -503,7 +503,7 @@ private:
|
|
}
|
|
}
|
|
|
|
- z_stream stream;
|
|
+ zng_stream stream;
|
|
enum class TYPE {
|
|
UNINITIALIZED,
|
|
COMPRESS,
|