contrib/upx/system-deps.patch
2022-10-30 08:59:54 +00:00

72 lines
2.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22db99a..abf8f65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,21 +70,18 @@ endif()
# targets and compilation flags
#***********************************************************************
-file(GLOB ucl_SOURCES "vendor/ucl/src/*.c")
-list(SORT ucl_SOURCES)
-add_library(upx_vendor_ucl STATIC ${ucl_SOURCES})
-set_property(TARGET upx_vendor_ucl PROPERTY C_STANDARD 11)
-
file(GLOB zlib_SOURCES "vendor/zlib/*.c")
list(SORT zlib_SOURCES)
add_library(upx_vendor_zlib STATIC ${zlib_SOURCES})
set_property(TARGET upx_vendor_zlib PROPERTY C_STANDARD 11)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(upx_vendor_ucl REQUIRED ucl IMPORTED_TARGET GLOBAL)
file(GLOB upx_SOURCES "src/*.cpp" "src/util/*.cpp")
list(SORT upx_SOURCES)
add_executable(upx ${upx_SOURCES})
set_property(TARGET upx PROPERTY CXX_STANDARD 14)
-target_link_libraries(upx upx_vendor_ucl upx_vendor_zlib)
+target_link_libraries(upx ucl upx_vendor_zlib)
if(UPX_CONFIG_DISABLE_WERROR)
set(warn_Werror "")
@@ -118,25 +115,8 @@ else()
add_definitions(-fno-tree-vectorize)
endif()
-set(t upx_vendor_ucl)
-target_include_directories(${t} PRIVATE vendor/ucl/include vendor/ucl)
-if(MSVC)
- target_compile_options(${t} PRIVATE -J -W4 ${warn_WX})
-else()
- target_compile_options(${t} PRIVATE -Wall -Wextra -Wvla ${warn_Werror})
-endif()
-
-set(t upx_vendor_zlib)
-if(MSVC)
- target_compile_options(${t} PRIVATE -DHAVE_STDARG_H -DHAVE_VSNPRINTF -J -W3 ${warn_WX})
-else()
- target_compile_options(${t} PRIVATE -DHAVE_STDARG_H -DHAVE_UNISTD_H -DHAVE_VSNPRINTF)
- # clang-15: -Wno-strict-prototypes is needed to silence the new -Wdeprecated-non-prototype warning
- target_compile_options(${t} PRIVATE -Wall -Wextra -Wvla -Wno-strict-prototypes ${warn_Werror})
-endif()
-
set(t upx)
-target_include_directories(${t} PRIVATE vendor)
+target_include_directories(${t} PRIVATE upx_vendor_ucl_INCLUDE_DIRS vendor)
target_compile_definitions(${t} PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
if(GITREV_SHORT)
target_compile_definitions(${t} PRIVATE UPX_VERSION_GITREV="${GITREV_SHORT}${GITREV_PLUS}")
diff --git a/src/conf.h b/src/conf.h
index e50b250..449161d 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -161,8 +161,8 @@ typedef unsigned char upx_byte;
#define WITH_ZLIB 1
#if (WITH_UCL)
# define ucl_compress_config_t REAL_ucl_compress_config_t
-# include <ucl/include/ucl/uclconf.h>
-# include <ucl/include/ucl/ucl.h>
+# include <ucl/uclconf.h>
+# include <ucl/ucl.h>
# undef ucl_compress_config_t
# undef ucl_compress_config_p
#endif