deflate-ruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CLAUDE.md +138 -0
- data/LICENSE.txt +21 -0
- data/README.md +117 -0
- data/ext/deflate_ruby/deflate_ruby.c +301 -0
- data/ext/deflate_ruby/extconf.rb +34 -0
- data/ext/deflate_ruby/libdeflate/CMakeLists.txt +270 -0
- data/ext/deflate_ruby/libdeflate/COPYING +22 -0
- data/ext/deflate_ruby/libdeflate/NEWS.md +494 -0
- data/ext/deflate_ruby/libdeflate/README.md +228 -0
- data/ext/deflate_ruby/libdeflate/common_defs.h +747 -0
- data/ext/deflate_ruby/libdeflate/lib/adler32.c +162 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/adler32_impl.h +358 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/cpu_features.c +230 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/cpu_features.h +214 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/crc32_impl.h +600 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/crc32_pmull_helpers.h +156 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/crc32_pmull_wide.h +226 -0
- data/ext/deflate_ruby/libdeflate/lib/arm/matchfinder_impl.h +78 -0
- data/ext/deflate_ruby/libdeflate/lib/bt_matchfinder.h +342 -0
- data/ext/deflate_ruby/libdeflate/lib/cpu_features_common.h +93 -0
- data/ext/deflate_ruby/libdeflate/lib/crc32.c +262 -0
- data/ext/deflate_ruby/libdeflate/lib/crc32_multipliers.h +377 -0
- data/ext/deflate_ruby/libdeflate/lib/crc32_tables.h +587 -0
- data/ext/deflate_ruby/libdeflate/lib/decompress_template.h +777 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_compress.c +4129 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_compress.h +15 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_constants.h +56 -0
- data/ext/deflate_ruby/libdeflate/lib/deflate_decompress.c +1208 -0
- data/ext/deflate_ruby/libdeflate/lib/gzip_compress.c +90 -0
- data/ext/deflate_ruby/libdeflate/lib/gzip_constants.h +45 -0
- data/ext/deflate_ruby/libdeflate/lib/gzip_decompress.c +144 -0
- data/ext/deflate_ruby/libdeflate/lib/hc_matchfinder.h +401 -0
- data/ext/deflate_ruby/libdeflate/lib/ht_matchfinder.h +234 -0
- data/ext/deflate_ruby/libdeflate/lib/lib_common.h +106 -0
- data/ext/deflate_ruby/libdeflate/lib/matchfinder_common.h +224 -0
- data/ext/deflate_ruby/libdeflate/lib/riscv/matchfinder_impl.h +97 -0
- data/ext/deflate_ruby/libdeflate/lib/utils.c +141 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/adler32_impl.h +134 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/adler32_template.h +518 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/cpu_features.c +183 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/cpu_features.h +169 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/crc32_impl.h +160 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/crc32_pclmul_template.h +495 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/decompress_impl.h +57 -0
- data/ext/deflate_ruby/libdeflate/lib/x86/matchfinder_impl.h +122 -0
- data/ext/deflate_ruby/libdeflate/lib/zlib_compress.c +82 -0
- data/ext/deflate_ruby/libdeflate/lib/zlib_constants.h +21 -0
- data/ext/deflate_ruby/libdeflate/lib/zlib_decompress.c +104 -0
- data/ext/deflate_ruby/libdeflate/libdeflate-config.cmake.in +3 -0
- data/ext/deflate_ruby/libdeflate/libdeflate.h +411 -0
- data/ext/deflate_ruby/libdeflate/libdeflate.pc.in +18 -0
- data/ext/deflate_ruby/libdeflate/programs/CMakeLists.txt +105 -0
- data/ext/deflate_ruby/libdeflate/programs/benchmark.c +696 -0
- data/ext/deflate_ruby/libdeflate/programs/checksum.c +218 -0
- data/ext/deflate_ruby/libdeflate/programs/config.h.in +19 -0
- data/ext/deflate_ruby/libdeflate/programs/gzip.c +688 -0
- data/ext/deflate_ruby/libdeflate/programs/prog_util.c +521 -0
- data/ext/deflate_ruby/libdeflate/programs/prog_util.h +225 -0
- data/ext/deflate_ruby/libdeflate/programs/test_checksums.c +200 -0
- data/ext/deflate_ruby/libdeflate/programs/test_custom_malloc.c +155 -0
- data/ext/deflate_ruby/libdeflate/programs/test_incomplete_codes.c +385 -0
- data/ext/deflate_ruby/libdeflate/programs/test_invalid_streams.c +130 -0
- data/ext/deflate_ruby/libdeflate/programs/test_litrunlen_overflow.c +72 -0
- data/ext/deflate_ruby/libdeflate/programs/test_overread.c +95 -0
- data/ext/deflate_ruby/libdeflate/programs/test_slow_decompression.c +472 -0
- data/ext/deflate_ruby/libdeflate/programs/test_trailing_bytes.c +151 -0
- data/ext/deflate_ruby/libdeflate/programs/test_util.c +237 -0
- data/ext/deflate_ruby/libdeflate/programs/test_util.h +61 -0
- data/ext/deflate_ruby/libdeflate/programs/tgetopt.c +118 -0
- data/ext/deflate_ruby/libdeflate/scripts/android_build.sh +118 -0
- data/ext/deflate_ruby/libdeflate/scripts/android_tests.sh +69 -0
- data/ext/deflate_ruby/libdeflate/scripts/benchmark.sh +10 -0
- data/ext/deflate_ruby/libdeflate/scripts/checksum.sh +10 -0
- data/ext/deflate_ruby/libdeflate/scripts/checksum_benchmarks.sh +253 -0
- data/ext/deflate_ruby/libdeflate/scripts/cmake-helper.sh +17 -0
- data/ext/deflate_ruby/libdeflate/scripts/deflate_benchmarks.sh +119 -0
- data/ext/deflate_ruby/libdeflate/scripts/exec_tests.sh +38 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen-release-archives.sh +37 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_bitreverse_tab.py +19 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_crc32_multipliers.c +199 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_crc32_tables.c +105 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_default_litlen_costs.py +44 -0
- data/ext/deflate_ruby/libdeflate/scripts/gen_offset_slot_map.py +29 -0
- data/ext/deflate_ruby/libdeflate/scripts/gzip_tests.sh +523 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_compress/corpus/0 +0 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_compress/fuzz.c +95 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_decompress/corpus/0 +3 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/deflate_decompress/fuzz.c +62 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/fuzz.sh +108 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/gzip_decompress/corpus/0 +0 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/gzip_decompress/fuzz.c +19 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/zlib_decompress/corpus/0 +3 -0
- data/ext/deflate_ruby/libdeflate/scripts/libFuzzer/zlib_decompress/fuzz.c +19 -0
- data/ext/deflate_ruby/libdeflate/scripts/run_tests.sh +416 -0
- data/ext/deflate_ruby/libdeflate/scripts/toolchain-i686-w64-mingw32.cmake +8 -0
- data/ext/deflate_ruby/libdeflate/scripts/toolchain-x86_64-w64-mingw32.cmake +8 -0
- data/lib/deflate_ruby/version.rb +5 -0
- data/lib/deflate_ruby.rb +71 -0
- metadata +191 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.7)
|
|
2
|
+
|
|
3
|
+
# Default to a release build.
|
|
4
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
5
|
+
message(STATUS "No build type selected; defaulting to Release")
|
|
6
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE)
|
|
7
|
+
endif()
|
|
8
|
+
|
|
9
|
+
# With MSVC, don't automatically append /W3 to the compiler flags.
|
|
10
|
+
# This makes it possible for the user to select /W4.
|
|
11
|
+
if(POLICY CMP0092)
|
|
12
|
+
cmake_policy(SET CMP0092 NEW)
|
|
13
|
+
endif()
|
|
14
|
+
|
|
15
|
+
# Extract the version string from libdeflate.h so that it doesn't have to be
|
|
16
|
+
# duplicated here.
|
|
17
|
+
set(VERSION_REGEX "#define LIBDEFLATE_VERSION_STRING[ \t]+\"([0-9\\.]+)\"")
|
|
18
|
+
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/libdeflate.h VERSION_STRING REGEX ${VERSION_REGEX})
|
|
19
|
+
string(REGEX REPLACE ${VERSION_REGEX} "\\1" VERSION_STRING "${VERSION_STRING}")
|
|
20
|
+
|
|
21
|
+
# Declare the project.
|
|
22
|
+
project(libdeflate
|
|
23
|
+
LANGUAGES C
|
|
24
|
+
VERSION ${VERSION_STRING})
|
|
25
|
+
|
|
26
|
+
# Include the CMake modules required by the top-level directory.
|
|
27
|
+
include(CMakePackageConfigHelpers)
|
|
28
|
+
include(CheckCCompilerFlag)
|
|
29
|
+
include(GNUInstallDirs)
|
|
30
|
+
|
|
31
|
+
# Declare the options, which can be overridden via 'cmake -DOPTION=VALUE'.
|
|
32
|
+
option(LIBDEFLATE_BUILD_STATIC_LIB "Build the static library" ON)
|
|
33
|
+
option(LIBDEFLATE_BUILD_SHARED_LIB "Build the shared library" ON)
|
|
34
|
+
option(LIBDEFLATE_COMPRESSION_SUPPORT "Support compression" ON)
|
|
35
|
+
option(LIBDEFLATE_DECOMPRESSION_SUPPORT "Support decompression" ON)
|
|
36
|
+
option(LIBDEFLATE_ZLIB_SUPPORT "Support the zlib format" ON)
|
|
37
|
+
option(LIBDEFLATE_GZIP_SUPPORT "Support the gzip format" ON)
|
|
38
|
+
option(LIBDEFLATE_FREESTANDING
|
|
39
|
+
"Build a freestanding library, i.e. a library that doesn't link to any
|
|
40
|
+
libc functions like malloc(), free(), and memcpy(). Library users will
|
|
41
|
+
need to provide a custom memory allocator." OFF)
|
|
42
|
+
option(LIBDEFLATE_BUILD_GZIP "Build the libdeflate-gzip program" ON)
|
|
43
|
+
option(LIBDEFLATE_BUILD_TESTS "Build the test programs" OFF)
|
|
44
|
+
option(LIBDEFLATE_USE_SHARED_LIB
|
|
45
|
+
"Link the libdeflate-gzip and test programs to the shared library instead
|
|
46
|
+
of the static library" OFF)
|
|
47
|
+
|
|
48
|
+
if(LIBDEFLATE_BUILD_TESTS)
|
|
49
|
+
enable_testing()
|
|
50
|
+
endif()
|
|
51
|
+
|
|
52
|
+
# The gzip program can't be built if any library feature it needs is disabled.
|
|
53
|
+
if(NOT LIBDEFLATE_COMPRESSION_SUPPORT OR NOT LIBDEFLATE_DECOMPRESSION_SUPPORT
|
|
54
|
+
OR NOT LIBDEFLATE_GZIP_SUPPORT)
|
|
55
|
+
set(LIBDEFLATE_BUILD_GZIP OFF)
|
|
56
|
+
endif()
|
|
57
|
+
|
|
58
|
+
# If the static library isn't being built, we have to link to the shared one.
|
|
59
|
+
if(NOT LIBDEFLATE_BUILD_STATIC_LIB)
|
|
60
|
+
set(LIBDEFLATE_USE_SHARED_LIB ON)
|
|
61
|
+
endif()
|
|
62
|
+
|
|
63
|
+
# Set common C compiler flags for all targets (the library and the programs).
|
|
64
|
+
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
|
|
65
|
+
set(CMAKE_C_STANDARD 99)
|
|
66
|
+
if(NOT MSVC)
|
|
67
|
+
check_c_compiler_flag(-Wdeclaration-after-statement HAVE_WDECLARATION_AFTER_STATEMENT)
|
|
68
|
+
check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH)
|
|
69
|
+
check_c_compiler_flag(-Wmissing-field-initializers HAVE_WMISSING_FIELD_INITIALIZERS)
|
|
70
|
+
check_c_compiler_flag(-Wmissing-prototypes HAVE_WMISSING_PROTOTYPES)
|
|
71
|
+
check_c_compiler_flag(-Wpedantic HAVE_WPEDANTIC)
|
|
72
|
+
check_c_compiler_flag(-Wshadow HAVE_WSHADOW)
|
|
73
|
+
check_c_compiler_flag(-Wstrict-prototypes HAVE_WSTRICT_PROTOTYPES)
|
|
74
|
+
check_c_compiler_flag(-Wundef HAVE_WUNDEF)
|
|
75
|
+
check_c_compiler_flag(-Wvla HAVE_WVLA)
|
|
76
|
+
add_compile_options(
|
|
77
|
+
-Wall
|
|
78
|
+
$<$<BOOL:${HAVE_WDECLARATION_AFTER_STATEMENT}>:-Wdeclaration-after-statement>
|
|
79
|
+
$<$<BOOL:${HAVE_WIMPLICIT_FALLTHROUGH}>:-Wimplicit-fallthrough>
|
|
80
|
+
$<$<BOOL:${HAVE_WMISSING_FIELD_INITIALIZERS}>:-Wmissing-field-initializers>
|
|
81
|
+
$<$<BOOL:${HAVE_WMISSING_PROTOTYPES}>:-Wmissing-prototypes>
|
|
82
|
+
$<$<BOOL:${HAVE_WPEDANTIC}>:-Wpedantic>
|
|
83
|
+
$<$<BOOL:${HAVE_WSHADOW}>:-Wshadow>
|
|
84
|
+
$<$<BOOL:${HAVE_WSTRICT_PROTOTYPES}>:-Wstrict-prototypes>
|
|
85
|
+
$<$<BOOL:${HAVE_WUNDEF}>:-Wundef>
|
|
86
|
+
$<$<BOOL:${HAVE_WVLA}>:-Wvla>
|
|
87
|
+
)
|
|
88
|
+
endif()
|
|
89
|
+
if(LIBDEFLATE_FREESTANDING)
|
|
90
|
+
add_definitions(-DFREESTANDING)
|
|
91
|
+
endif()
|
|
92
|
+
|
|
93
|
+
# Determine the list of source files and the list of compiler options that will
|
|
94
|
+
# be used for both the static library and the shared library.
|
|
95
|
+
|
|
96
|
+
set(LIB_SOURCES
|
|
97
|
+
common_defs.h
|
|
98
|
+
libdeflate.h
|
|
99
|
+
lib/arm/cpu_features.c
|
|
100
|
+
lib/arm/cpu_features.h
|
|
101
|
+
lib/cpu_features_common.h
|
|
102
|
+
lib/deflate_constants.h
|
|
103
|
+
lib/lib_common.h
|
|
104
|
+
lib/utils.c
|
|
105
|
+
lib/x86/cpu_features.c
|
|
106
|
+
lib/x86/cpu_features.h
|
|
107
|
+
)
|
|
108
|
+
if(LIBDEFLATE_COMPRESSION_SUPPORT)
|
|
109
|
+
list(APPEND LIB_SOURCES
|
|
110
|
+
lib/arm/matchfinder_impl.h
|
|
111
|
+
lib/bt_matchfinder.h
|
|
112
|
+
lib/deflate_compress.c
|
|
113
|
+
lib/deflate_compress.h
|
|
114
|
+
lib/hc_matchfinder.h
|
|
115
|
+
lib/ht_matchfinder.h
|
|
116
|
+
lib/matchfinder_common.h
|
|
117
|
+
lib/riscv/matchfinder_impl.h
|
|
118
|
+
lib/x86/matchfinder_impl.h
|
|
119
|
+
)
|
|
120
|
+
endif()
|
|
121
|
+
if(LIBDEFLATE_DECOMPRESSION_SUPPORT)
|
|
122
|
+
list(APPEND LIB_SOURCES
|
|
123
|
+
lib/decompress_template.h
|
|
124
|
+
lib/deflate_decompress.c
|
|
125
|
+
lib/x86/decompress_impl.h
|
|
126
|
+
)
|
|
127
|
+
endif()
|
|
128
|
+
if(LIBDEFLATE_ZLIB_SUPPORT)
|
|
129
|
+
list(APPEND LIB_SOURCES
|
|
130
|
+
lib/adler32.c
|
|
131
|
+
lib/arm/adler32_impl.h
|
|
132
|
+
lib/x86/adler32_impl.h
|
|
133
|
+
lib/x86/adler32_template.h
|
|
134
|
+
lib/zlib_constants.h
|
|
135
|
+
)
|
|
136
|
+
if(LIBDEFLATE_COMPRESSION_SUPPORT)
|
|
137
|
+
list(APPEND LIB_SOURCES lib/zlib_compress.c)
|
|
138
|
+
endif()
|
|
139
|
+
if(LIBDEFLATE_DECOMPRESSION_SUPPORT)
|
|
140
|
+
list(APPEND LIB_SOURCES lib/zlib_decompress.c)
|
|
141
|
+
endif()
|
|
142
|
+
endif()
|
|
143
|
+
if(LIBDEFLATE_GZIP_SUPPORT)
|
|
144
|
+
list(APPEND LIB_SOURCES
|
|
145
|
+
lib/arm/crc32_impl.h
|
|
146
|
+
lib/arm/crc32_pmull_helpers.h
|
|
147
|
+
lib/arm/crc32_pmull_wide.h
|
|
148
|
+
lib/crc32.c
|
|
149
|
+
lib/crc32_multipliers.h
|
|
150
|
+
lib/crc32_tables.h
|
|
151
|
+
lib/gzip_constants.h
|
|
152
|
+
lib/x86/crc32_impl.h
|
|
153
|
+
lib/x86/crc32_pclmul_template.h
|
|
154
|
+
)
|
|
155
|
+
if(LIBDEFLATE_COMPRESSION_SUPPORT)
|
|
156
|
+
list(APPEND LIB_SOURCES lib/gzip_compress.c)
|
|
157
|
+
endif()
|
|
158
|
+
if(LIBDEFLATE_DECOMPRESSION_SUPPORT)
|
|
159
|
+
list(APPEND LIB_SOURCES lib/gzip_decompress.c)
|
|
160
|
+
endif()
|
|
161
|
+
endif()
|
|
162
|
+
|
|
163
|
+
if(LIBDEFLATE_FREESTANDING)
|
|
164
|
+
list(APPEND LIB_COMPILE_OPTIONS -ffreestanding -nostdlib)
|
|
165
|
+
list(APPEND LIB_LINK_LIBRARIES -ffreestanding -nostdlib)
|
|
166
|
+
endif()
|
|
167
|
+
|
|
168
|
+
set(LIB_INCLUDE_DIRS
|
|
169
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
170
|
+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>)
|
|
171
|
+
|
|
172
|
+
# Build the static library.
|
|
173
|
+
if(LIBDEFLATE_BUILD_STATIC_LIB)
|
|
174
|
+
add_library(libdeflate_static STATIC ${LIB_SOURCES})
|
|
175
|
+
|
|
176
|
+
# This alias allows third-party usage of the library with CMake to work the
|
|
177
|
+
# same way with add_subdirectory() as with other ways.
|
|
178
|
+
add_library(libdeflate::libdeflate_static ALIAS libdeflate_static)
|
|
179
|
+
|
|
180
|
+
if(WIN32 AND NOT MINGW)
|
|
181
|
+
set(STATIC_LIB_NAME deflatestatic)
|
|
182
|
+
else()
|
|
183
|
+
set(STATIC_LIB_NAME deflate)
|
|
184
|
+
endif()
|
|
185
|
+
set_target_properties(libdeflate_static PROPERTIES
|
|
186
|
+
OUTPUT_NAME ${STATIC_LIB_NAME}
|
|
187
|
+
PUBLIC_HEADER libdeflate.h)
|
|
188
|
+
target_include_directories(libdeflate_static PUBLIC ${LIB_INCLUDE_DIRS})
|
|
189
|
+
target_compile_definitions(libdeflate_static PRIVATE ${LIB_COMPILE_DEFINITIONS})
|
|
190
|
+
target_compile_options(libdeflate_static PRIVATE ${LIB_COMPILE_OPTIONS})
|
|
191
|
+
list(APPEND LIB_TARGETS libdeflate_static)
|
|
192
|
+
endif()
|
|
193
|
+
|
|
194
|
+
# Build the shared library.
|
|
195
|
+
if(LIBDEFLATE_BUILD_SHARED_LIB)
|
|
196
|
+
add_library(libdeflate_shared SHARED ${LIB_SOURCES})
|
|
197
|
+
|
|
198
|
+
# This alias allows third-party usage of the library with CMake to work the
|
|
199
|
+
# same way with add_subdirectory() as with other ways.
|
|
200
|
+
add_library(libdeflate::libdeflate_shared ALIAS libdeflate_shared)
|
|
201
|
+
|
|
202
|
+
set_target_properties(libdeflate_shared PROPERTIES
|
|
203
|
+
OUTPUT_NAME deflate
|
|
204
|
+
PUBLIC_HEADER libdeflate.h
|
|
205
|
+
C_VISIBILITY_PRESET hidden
|
|
206
|
+
SOVERSION 0)
|
|
207
|
+
target_include_directories(libdeflate_shared PUBLIC ${LIB_INCLUDE_DIRS})
|
|
208
|
+
target_compile_definitions(libdeflate_shared PUBLIC LIBDEFLATE_DLL)
|
|
209
|
+
target_compile_definitions(libdeflate_shared PRIVATE ${LIB_COMPILE_DEFINITIONS})
|
|
210
|
+
target_compile_options(libdeflate_shared PRIVATE ${LIB_COMPILE_OPTIONS})
|
|
211
|
+
target_link_libraries(libdeflate_shared PRIVATE ${LIB_LINK_LIBRARIES})
|
|
212
|
+
list(APPEND LIB_TARGETS libdeflate_shared)
|
|
213
|
+
endif()
|
|
214
|
+
|
|
215
|
+
# Install the static and/or shared library.
|
|
216
|
+
install(TARGETS ${LIB_TARGETS}
|
|
217
|
+
EXPORT libdeflate_exported_targets
|
|
218
|
+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
219
|
+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
220
|
+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
221
|
+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
222
|
+
|
|
223
|
+
# Generate and install the pkg-config file. (Don't confuse this with the CMake
|
|
224
|
+
# package config file, which is CMake-specific.) Take care to define the
|
|
225
|
+
# include and lib directories in terms of the ${prefix} and ${exec_prefix}
|
|
226
|
+
# pkg-config variables when possible, since some pkg-config users expect to be
|
|
227
|
+
# able to override these variables to relocate packages.
|
|
228
|
+
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
229
|
+
set(CMAKE_PKGCONFIG_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
230
|
+
else()
|
|
231
|
+
set(CMAKE_PKGCONFIG_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
|
232
|
+
endif()
|
|
233
|
+
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
|
|
234
|
+
set(CMAKE_PKGCONFIG_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
|
|
235
|
+
else()
|
|
236
|
+
set(CMAKE_PKGCONFIG_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
|
|
237
|
+
endif()
|
|
238
|
+
configure_file(libdeflate.pc.in libdeflate.pc @ONLY)
|
|
239
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdeflate.pc
|
|
240
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
241
|
+
|
|
242
|
+
# Generate a "libdeflate-targets.cmake" file in the build tree that can be
|
|
243
|
+
# included by outside projects to import targets from the build tree.
|
|
244
|
+
export(EXPORT libdeflate_exported_targets
|
|
245
|
+
NAMESPACE libdeflate::
|
|
246
|
+
FILE libdeflate-targets.cmake)
|
|
247
|
+
|
|
248
|
+
# Generate and install a separate "libdeflate-targets.cmake" file that can be
|
|
249
|
+
# included by outside projects to import targets from the installation tree.
|
|
250
|
+
install(EXPORT libdeflate_exported_targets
|
|
251
|
+
NAMESPACE libdeflate::
|
|
252
|
+
FILE libdeflate-targets.cmake
|
|
253
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libdeflate)
|
|
254
|
+
|
|
255
|
+
# Generate and install the CMake package version and config files.
|
|
256
|
+
write_basic_package_version_file(libdeflate-config-version.cmake
|
|
257
|
+
VERSION ${PROJECT_VERSION}
|
|
258
|
+
COMPATIBILITY AnyNewerVersion)
|
|
259
|
+
configure_package_config_file(
|
|
260
|
+
${CMAKE_CURRENT_SOURCE_DIR}/libdeflate-config.cmake.in
|
|
261
|
+
libdeflate-config.cmake
|
|
262
|
+
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libdeflate)
|
|
263
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libdeflate-config.cmake
|
|
264
|
+
${CMAKE_CURRENT_BINARY_DIR}/libdeflate-config-version.cmake
|
|
265
|
+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libdeflate)
|
|
266
|
+
|
|
267
|
+
# Build the programs subdirectory if needed.
|
|
268
|
+
if(LIBDEFLATE_BUILD_GZIP OR LIBDEFLATE_BUILD_TESTS)
|
|
269
|
+
add_subdirectory(programs)
|
|
270
|
+
endif()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright 2016 Eric Biggers
|
|
2
|
+
Copyright 2024 Google LLC
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person
|
|
5
|
+
obtaining a copy of this software and associated documentation files
|
|
6
|
+
(the "Software"), to deal in the Software without restriction,
|
|
7
|
+
including without limitation the rights to use, copy, modify, merge,
|
|
8
|
+
publish, distribute, sublicense, and/or sell copies of the Software,
|
|
9
|
+
and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
19
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
20
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
21
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|