diff --git a/deps/zlib/.cmake-format.yaml b/deps/zlib/.cmake-format.yaml new file mode 100644 index 000000000..9c554da15 --- /dev/null +++ b/deps/zlib/.cmake-format.yaml @@ -0,0 +1,245 @@ +_help_parse: Options affecting listfile parsing +parse: + _help_additional_commands: + - Specify structure for custom cmake functions + additional_commands: + foo: + flags: + - BAR + - BAZ + kwargs: + HEADERS: '*' + SOURCES: '*' + DEPENDS: '*' + _help_override_spec: + - Override configurations per-command where available + override_spec: {} + _help_vartags: + - Specify variable tags. + vartags: [] + _help_proptags: + - Specify property tags. + proptags: [] +_help_format: Options affecting formatting. +format: + _help_disable: + - Disable formatting entirely, making cmake-format a no-op + disable: false + _help_line_width: + - How wide to allow formatted cmake files + line_width: 80 + _help_tab_size: + - How many spaces to tab for indent + tab_size: 4 + _help_use_tabchars: + - If true, lines are indented using tab characters (utf-8 + - 0x09) instead of space characters (utf-8 0x20). + - In cases where the layout would require a fractional tab + - character, the behavior of the fractional indentation is + - governed by + use_tabchars: false + _help_fractional_tab_policy: + - If is True, then the value of this variable + - indicates how fractional indentions are handled during + - whitespace replacement. If set to 'use-space', fractional + - indentation is left as spaces (utf-8 0x20). If set to + - '`round-up` fractional indentation is replaced with a single' + - tab character (utf-8 0x09) effectively shifting the column + - to the next tabstop + fractional_tab_policy: use-space + _help_max_subgroups_hwrap: + - If an argument group contains more than this many sub-groups + - (parg or kwarg groups) then force it to a vertical layout. + max_subgroups_hwrap: 2 + _help_max_pargs_hwrap: + - If a positional argument group contains more than this many + - arguments, then force it to a vertical layout. + max_pargs_hwrap: 6 + _help_max_rows_cmdline: + - If a cmdline positional group consumes more than this many + - lines without nesting, then invalidate the layout (and nest) + max_rows_cmdline: 2 + _help_separate_ctrl_name_with_space: + - If true, separate flow control names from their parentheses + - with a space + separate_ctrl_name_with_space: false + _help_separate_fn_name_with_space: + - If true, separate function names from parentheses with a + - space + separate_fn_name_with_space: false + _help_dangle_parens: + - If a statement is wrapped to more than one line, than dangle + - the closing parenthesis on its own line. + dangle_parens: false + _help_dangle_align: + - If the trailing parenthesis must be 'dangled' on its on + - 'line, then align it to this reference: `prefix`: the start' + - 'of the statement, `prefix-indent`: the start of the' + - 'statement, plus one indentation level, `child`: align to' + - the column of the arguments + dangle_align: prefix + _help_min_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is smaller than this amount, then force reject + - nested layouts. + min_prefix_chars: 4 + _help_max_prefix_chars: + - If the statement spelling length (including space and + - parenthesis) is larger than the tab width by more than this + - amount, then force reject un-nested layouts. + max_prefix_chars: 10 + _help_max_lines_hwrap: + - If a candidate layout is wrapped horizontally but it exceeds + - this many lines, then reject the layout. + max_lines_hwrap: 2 + _help_line_ending: + - What style line endings to use in the output. + line_ending: unix + _help_command_case: + - Format command names consistently as 'lower' or 'upper' case + command_case: canonical + _help_keyword_case: + - Format keywords consistently as 'lower' or 'upper' case + keyword_case: unchanged + _help_always_wrap: + - A list of command names which should always be wrapped + always_wrap: [] + _help_enable_sort: + - If true, the argument lists which are known to be sortable + - will be sorted lexicographicall + enable_sort: true + _help_autosort: + - If true, the parsers may infer whether or not an argument + - list is sortable (without annotation). + autosort: false + _help_require_valid_layout: + - By default, if cmake-format cannot successfully fit + - everything into the desired linewidth it will apply the + - last, most aggressive attempt that it made. If this flag is + - True, however, cmake-format will print error, exit with non- + - zero status code, and write-out nothing + require_valid_layout: false + _help_layout_passes: + - A dictionary mapping layout nodes to a list of wrap + - decisions. See the documentation for more information. + layout_passes: {} +_help_markup: Options affecting comment reflow and formatting. +markup: + _help_bullet_char: + - What character to use for bulleted lists + bullet_char: '*' + _help_enum_char: + - What character to use as punctuation after numerals in an + - enumerated list + enum_char: . + _help_first_comment_is_literal: + - If comment markup is enabled, don't reflow the first comment + - block in each listfile. Use this to preserve formatting of + - your copyright/license statements. + first_comment_is_literal: false + _help_literal_comment_pattern: + - If comment markup is enabled, don't reflow any comment block + - which matches this (regex) pattern. Default is `None` + - (disabled). + literal_comment_pattern: null + _help_fence_pattern: + - Regular expression to match preformat fences in comments + - default= ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$ + _help_ruler_pattern: + - Regular expression to match rulers in comments default= + - '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``' + ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$ + _help_explicit_trailing_pattern: + - If a comment line matches starts with this pattern then it + - is explicitly a trailing comment for the preceding argument. + - Default is '#<' + explicit_trailing_pattern: '#<' + _help_hashruler_min_length: + - If a comment line starts with at least this many consecutive + - hash characters, then don't lstrip() them off. This allows + - for lazy hash rulers where the first hash char is not + - separated by space + hashruler_min_length: 10 + _help_canonicalize_hashrulers: + - If true, then insert a space between the first hash char and + - remaining hash chars in a hash ruler, and normalize its + - length to fill the column + canonicalize_hashrulers: true + _help_enable_markup: + - enable comment markup parsing and reflow + enable_markup: true +_help_lint: Options affecting the linter +lint: + _help_disabled_codes: + - a list of lint codes to disable + disabled_codes: [] + _help_function_pattern: + - regular expression pattern describing valid function names + function_pattern: '[0-9a-z_]+' + _help_macro_pattern: + - regular expression pattern describing valid macro names + macro_pattern: '[0-9A-Z_]+' + _help_global_var_pattern: + - regular expression pattern describing valid names for + - variables with global (cache) scope + global_var_pattern: '[A-Z][0-9A-Z_]+' + _help_internal_var_pattern: + - regular expression pattern describing valid names for + - variables with global scope (but internal semantic) + internal_var_pattern: _[A-Z][0-9A-Z_]+ + _help_local_var_pattern: + - regular expression pattern describing valid names for + - variables with local scope + local_var_pattern: '[a-z][a-z0-9_]+' + _help_private_var_pattern: + - regular expression pattern describing valid names for + - privatedirectory variables + private_var_pattern: _[0-9a-z_]+ + _help_public_var_pattern: + - regular expression pattern describing valid names for public + - directory variables + public_var_pattern: '[A-Z][0-9A-Z_]+' + _help_argument_var_pattern: + - regular expression pattern describing valid names for + - function/macro arguments and loop variables. + argument_var_pattern: '[a-z][a-z0-9_]+' + _help_keyword_pattern: + - regular expression pattern describing valid names for + - keywords used in functions or macros + keyword_pattern: '[A-Z][0-9A-Z_]+' + _help_max_conditionals_custom_parser: + - In the heuristic for C0201, how many conditionals to match + - within a loop in before considering the loop a parser. + max_conditionals_custom_parser: 2 + _help_min_statement_spacing: + - Require at least this many newlines between statements + min_statement_spacing: 1 + _help_max_statement_spacing: + - Require no more than this many newlines between statements + max_statement_spacing: 2 + max_returns: 6 + max_branches: 12 + max_arguments: 5 + max_localvars: 15 + max_statements: 50 +_help_encode: Options affecting file encoding +encode: + _help_emit_byteorder_mark: + - If true, emit the unicode byte-order mark (BOM) at the start + - of the file + emit_byteorder_mark: false + _help_input_encoding: + - Specify the encoding of the input file. Defaults to utf-8 + input_encoding: utf-8 + _help_output_encoding: + - Specify the encoding of the output file. Defaults to utf-8. + - Note that cmake only claims to support utf-8 so be careful + - when using anything else + output_encoding: utf-8 +_help_misc: Miscellaneous configurations options. +misc: + _help_per_command: + - A dictionary containing any per-command configuration + - overrides. Currently only `command_case` is supported. + per_command: {} diff --git a/deps/zlib/.github/workflows/c-std.yml b/deps/zlib/.github/workflows/c-std.yml new file mode 100644 index 000000000..a99cdb569 --- /dev/null +++ b/deps/zlib/.github/workflows/c-std.yml @@ -0,0 +1,230 @@ +name: C Standard + +# Compile with as many C standards as possible. +# The worflow is setup to fail on any compilation warnings. + +on: + workflow_dispatch: + push: + pull_request: + +jobs: + + main: + name: ${{ matrix.os.name }} ${{ matrix.compiler }} ${{ matrix.arch.name }} ${{ matrix.std.name }} ${{ matrix.builder }} + runs-on: ${{ matrix.os.value }} + strategy: + fail-fast: false + matrix: + os: + - name: Linux + value: ubuntu-latest + + - name: MacOS + value: macos-latest + + - name: Windows + value: windows-latest + cmake-opt: -G Ninja + + compiler: + - gcc + - clang + + arch: + - name: 64-bit + tag: amd64 + compiler-opt: -m64 + cmake-opt: -A x64 + + - name: 32-bit + tag: i386 + compiler-opt: -m32 + cmake-opt: -A Win32 + + + builder: + - configure + - cmake + + std: + - name: c89 + value: c89 + + - name: gnu89 + value: gnu89 + + - name: c94 + value: iso9899:199409 + + - name: c99 + value: c99 + + - name: gnu99 + value: gnu99 + + - name: c11 + value: c11 + + - name: gnu11 + value: gnu11 + + - name: c17 + value: c17 + + - name: gnu17 + value: gnu17 + + - name: c2x + value: c2x + + - name: gnu2x + value: gnu2x + + exclude: + # Don't run 32-bit on MacOS + - { os: { name: MacOS }, + arch: { tag: i386 } } + + # Don't run configure on Windows + - { os: { name: Windows }, + builder: configure } + + # Don't run gcc 32-bit on Windows + - { os: { name: Windows }, + arch: { tag: i386 } } + + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + with: + show-progress: 'false' + + - name: Install packages (Linux) + if: runner.os == 'Linux' && matrix.arch.tag == 'i386' + run: | + sudo apt-get update + sudo apt install gcc-multilib libc6-dev-i386-cross + + - name: Install packages (Windows) + if: runner.os == 'Windows' + run: | + choco install --no-progress ninja + + - name: Generate project files (configure) + if: matrix.builder == 'configure' + run: | + ./configure + env: + CC: ${{ matrix.compiler }} + CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra + + - name: Compile source code (configure) + if: matrix.builder == 'configure' + run: make -j2 + + - name: Run test cases (configure) + if: matrix.builder == 'configure' + run: | + make test + make cover + + - name: Generate project files (cmake) + if: matrix.builder == 'cmake' + run: | + cmake -S . -B ./build1 -D CMAKE_BUILD_TYPE=Release ${{ matrix.os.cmake-opt }} -DZLIB_BUILD_TESTING=OFF + env: + CC: ${{ matrix.compiler }} + CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra + + - name: Generate project files with tests (cmake) + if: matrix.builder == 'cmake' + run: | + cmake -S . -B ./build2 -D CMAKE_BUILD_TYPE=Release ${{ matrix.os.cmake-opt }} -DZLIB_BUILD_MINIZIP=ON -DMINIZIP_ENABLE_BZIP2=OFF + env: + CC: ${{ matrix.compiler }} + CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Wall -Wextra + + - name: Compile source code (cmake) + if: matrix.builder == 'cmake' + run: cmake --build ./build1 --config Release + + - name: Compile source code with tests (cmake) + if: matrix.builder == 'cmake' + run: cmake --build ./build2 --config Release + + - name: Run test cases (cmake) + if: matrix.builder == 'cmake' + run: ctest ./build2 -C Release --output-on-failure --max-width 120 + + + msvc: + name: ${{ matrix.os.name }} ${{ matrix.compiler }} ${{ matrix.arch.name }} ${{ matrix.std.name }} ${{ matrix.builder }} + runs-on: ${{ matrix.os.value }} + strategy: + fail-fast: false + matrix: + os: + - name: Windows + value: windows-latest + + compiler: + - cl + + arch: + - name: 32-bit + value: -A Win32 + + - name: 64-bit + value: -A x64 + + builder: + - cmake + + std: + - name: default + value: "" + + - name: C11 + value: /std:c11 + + - name: C17 + value: /std:c17 + + # not available on the runner yet + # - name: C20 + # value: /std:c20 + + - name: latest + value: /std:clatest + + steps: + + - name: Checkout repository + uses: actions/checkout@v4 + with: + show-progress: 'false' + + - name: Generate project files (cmake) + run: | + cmake -S . -B ./build1 ${{ matrix.arch.value }} -D CMAKE_BUILD_TYPE=Release -DZLIB_BUILD_TESTING=OFF + env: + CC: ${{ matrix.compiler }} + CFLAGS: /WX ${{ matrix.std.value }} + + - name: Generate project files with tests (cmake) + run: | + cmake -S . -B ./build2 ${{ matrix.arch.value }} -D CMAKE_BUILD_TYPE=Release -DZLIB_BUILD_MINIZIP=ON -DMINIZIP_ENABLE_BZIP2=OFF + env: + CC: ${{ matrix.compiler }} + CFLAGS: ${{ matrix.std.value }} + + - name: Compile source code (cmake) + run: cmake --build ./build1 --config Release -v + + - name: Compile source code with tests(cmake) + run: cmake --build ./build2 --config Release -v + + - name: Run test cases (cmake) + run: ctest ./build2 -C Release --output-on-failure --max-width 120 diff --git a/deps/zlib/.github/workflows/cmake.yml b/deps/zlib/.github/workflows/cmake.yml new file mode 100644 index 000000000..25a3b8124 --- /dev/null +++ b/deps/zlib/.github/workflows/cmake.yml @@ -0,0 +1,112 @@ +name: CMake +on: [push, pull_request] +jobs: + ci-cmake: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Ubuntu GCC + os: ubuntu-latest + compiler: gcc + cflags: -Wall -Wextra + pkgtgt: package package_source + cmake-args: -DMINIZIP_ENABLE_BZIP2=ON + + - name: Ubuntu GCC -O3 + os: ubuntu-latest + compiler: gcc + cflags: -O3 -Wall -Wextra + pkgtgt: package package_source + cmake-args: -DMINIZIP_ENABLE_BZIP2=ON + + - name: Ubuntu Clang + os: ubuntu-latest + compiler: clang + cflags: -Wall -Wextra + pkgtgt: package package_source + cmake-args: -DMINIZIP_ENABLE_BZIP2=ON + + - name: Ubuntu Clang Debug + os: ubuntu-latest + compiler: clang + cflags: -Wall -Wextra + build-config: Debug + pkgtgt: package package_source + cmake-args: -DMINIZIP_ENABLE_BZIP2=ON + + - name: Windows MSVC Win32 + os: windows-latest + compiler: cl + cflags: /W3 + cmake-args: -A Win32 + pkgtgt: PACKAGE + + - name: Windows MSVC Win64 + os: windows-latest + compiler: cl + cflags: /W3 + cmake-args: -A x64 -DMINIZIP_ENABLE_BZIP2=OFF + pkgtgt: PACKAGE + + - name: Windows GCC + os: windows-latest + compiler: gcc + cflags: -Wall -Wextra + cmake-args: -G Ninja -DMINIZIP_ENABLE_BZIP2=OFF + pkgtgt: package + + - name: macOS Clang + os: macos-latest + compiler: clang + cflags: -Wall -Wextra + pkgtgt: package + cmake-args: -DMINIZIP_ENABLE_BZIP2=ON + + - name: macOS GCC + os: macos-latest + compiler: gcc-12 + cflags: -Wall -Wextra + pkgtgt: package + cmake-args: -DMINIZIP_ENABLE_BZIP2=ON + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install packages (Windows) + if: runner.os == 'Windows' + run: | + choco install --no-progress ninja + + - name: Install packages (Linux) + if: runner.os == 'Linux' + run: | + sudo apt install libbz2-dev + - name: Generate project files + run: cmake -S . -B ../build ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DZLIB_BUILD_MINIZIP=ON + env: + CC: ${{ matrix.compiler }} + CFLAGS: ${{ matrix.cflags }} + + - name: Compile source code + run: cmake --build ../build --config ${{ matrix.build-config || 'Release' }} + + - name: Run test cases + run: ctest -C Release --output-on-failure --max-width 120 + working-directory: ../build + + - name: create packages + run: cmake --build ../build --config ${{ matrix.build-config || 'Release' }} -t ${{ matrix.pkgtgt }} + + - name: Upload build errors + uses: actions/upload-artifact@v4 + if: failure() + with: + name: ${{ matrix.name }} (cmake) + path: | + ../build/CMakeFiles/CMakeOutput.log + ../build/CMakeFiles/CMakeError.log + retention-days: 7 diff --git a/deps/zlib/.github/workflows/configure.yml b/deps/zlib/.github/workflows/configure.yml new file mode 100644 index 000000000..f19272c72 --- /dev/null +++ b/deps/zlib/.github/workflows/configure.yml @@ -0,0 +1,136 @@ +name: Configure +on: [push, pull_request] +jobs: + ci-configure: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: Ubuntu GCC + os: ubuntu-latest + compiler: gcc + configure-args: --warn + + # Test out of source builds + - name: Ubuntu GCC OSB + os: ubuntu-latest + compiler: gcc + configure-args: --warn + build-dir: ../build + src-dir: ../zlib + + - name: Ubuntu GCC ARM SF + os: ubuntu-latest + compiler: arm-linux-gnueabi-gcc + configure-args: --warn + chost: arm-linux-gnueabi + packages: qemu-system qemu-user gcc-arm-linux-gnueabi libc-dev-armel-cross + qemu-run: qemu-arm -L /usr/arm-linux-gnueabi + + - name: Ubuntu GCC ARM HF + os: ubuntu-latest + compiler: arm-linux-gnueabihf-gcc + configure-args: --warn + chost: arm-linux-gnueabihf + packages: qemu-system qemu-user gcc-arm-linux-gnueabihf libc-dev-armhf-cross + qemu-run: qemu-arm -L /usr/arm-linux-gnueabihf + + - name: Ubuntu GCC AARCH64 + os: ubuntu-latest + compiler: aarch64-linux-gnu-gcc + configure-args: --warn + chost: aarch64-linux-gnu + packages: qemu-system qemu-user gcc-aarch64-linux-gnu libc-dev-arm64-cross + qemu-run: qemu-aarch64 -L /usr/aarch64-linux-gnu + + - name: Ubuntu GCC PPC + os: ubuntu-latest + compiler: powerpc-linux-gnu-gcc + configure-args: --warn --static + chost: powerpc-linux-gnu + packages: qemu-system qemu-user gcc-powerpc-linux-gnu libc-dev-powerpc-cross + qemu-run: qemu-ppc -L /usr/powerpc-linux-gnu + cflags: -static + ldflags: -static + + - name: Ubuntu GCC PPC64 + os: ubuntu-latest + compiler: powerpc64-linux-gnu-gcc + configure-args: --warn --static + chost: powerpc-linux-gnu + packages: qemu-system qemu-user gcc-powerpc64-linux-gnu libc-dev-ppc64-cross + qemu-run: qemu-ppc64 -L /usr/powerpc64-linux-gnu + cflags: -static + ldflags: -static + + - name: Ubuntu GCC PPC64LE + os: ubuntu-latest + compiler: powerpc64le-linux-gnu-gcc + configure-args: --warn + chost: powerpc64le-linux-gnu + packages: qemu-system qemu-user gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross + qemu-run: qemu-ppc64le -L /usr/powerpc64le-linux-gnu + + - name: Ubuntu GCC S390X + os: ubuntu-latest + compiler: s390x-linux-gnu-gcc + configure-args: --warn --static + chost: s390x-linux-gnu + packages: qemu-system qemu-user gcc-s390x-linux-gnu libc-dev-s390x-cross + qemu-run: qemu-s390x -L /usr/s390x-linux-gnu + cflags: -static + ldflags: -static + + - name: macOS GCC + os: macos-latest + compiler: gcc-12 + configure-args: --warn + + - name: macOS Clang + os: macos-latest + compiler: clang + configure-args: --warn + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install packages (Ubuntu) + if: runner.os == 'Linux' && matrix.packages + run: | + sudo apt-get update + sudo apt-get install -y ${{ matrix.packages }} + + - name: Generate project files + run: | + [ -d ${{ matrix.build-dir || '.' }} ] || mkdir ${{ matrix.build-dir || '.' }} + cd ${{ matrix.build-dir || '.' }} + ${{ matrix.src-dir || '.' }}/configure ${{ matrix.configure-args }} + env: + CC: ${{ matrix.compiler }} + CFLAGS: ${{ matrix.cflags }} + LDFLAGS: ${{ matrix.ldflags }} + CHOST: ${{ matrix.chost }} + + - name: Compile source code + run: make -j2 + working-directory: ${{ matrix.build-dir }} + + - name: Run test cases + run: | + make test + make cover + working-directory: ${{ matrix.build-dir }} + env: + QEMU_RUN: ${{ matrix.qemu-run }} + + - name: Upload build errors + uses: actions/upload-artifact@v4 + if: failure() + with: + name: ${{ matrix.name }} (configure) + path: | + ${{ matrix.build-dir || '.' }}/configure.log + retention-days: 7 diff --git a/deps/zlib/.github/workflows/fuzz.yml b/deps/zlib/.github/workflows/fuzz.yml new file mode 100644 index 000000000..ddca83c37 --- /dev/null +++ b/deps/zlib/.github/workflows/fuzz.yml @@ -0,0 +1,25 @@ +name: OSS-Fuzz +on: [pull_request] +jobs: + Fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'zlib' + dry-run: false + + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'zlib' + fuzz-seconds: 300 + dry-run: false + + - name: Upload Crash + uses: actions/upload-artifact@v4 + if: failure() + with: + name: artifacts + path: ./out/artifacts diff --git a/deps/zlib/.github/workflows/msys-cygwin.yml b/deps/zlib/.github/workflows/msys-cygwin.yml new file mode 100644 index 000000000..e76be9f0d --- /dev/null +++ b/deps/zlib/.github/workflows/msys-cygwin.yml @@ -0,0 +1,77 @@ +name: mingw/cygwin + +on: [push, pull_request] + +jobs: + MSys: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + sys: [mingw32, mingw64, ucrt64, clang64] + name: MSys - ${{ matrix.sys }} + defaults: + run: + shell: msys2 {0} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup MSYS2 + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.sys }} + update: true + install: >- + make + pacboy: >- + toolchain:p + cmake:p + - name: Configure + run: | + cmake -G"Unix Makefiles" \ + -S . \ + -B build \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DMINIZIP_ENABLE_BZIP2=ON + - name: Build + run: cmake --build build --config Release + - name: Run tests + run: ctest --output-on-failure --test-dir build -C Release + + cygwin: + strategy: + fail-fast: false + runs-on: windows-latest + defaults: + run: + shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}' + name: Cygwin + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup cygwin + uses: cygwin/cygwin-install-action@master + with: + packages: >- + cmake + cygwin-devel + gcc-core + gcc-g++ + ninja + - name: Configure + run: | + cmake /cygdrive/d/a/zlib/zlib \ + -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DZLIB_BUILD_MINIZIP=ON \ + -DMINIZIP_ENABLE_BZIP2=OFF \ + -G Ninja + - name: Build + run: cmake --build build --config Release -v -j1 + - name: Run tests + run: ctest --output-on-failure --test-dir build -C Release diff --git a/deps/zlib/.gitignore b/deps/zlib/.gitignore new file mode 100644 index 000000000..8d069ed38 --- /dev/null +++ b/deps/zlib/.gitignore @@ -0,0 +1,51 @@ +*.diff +*.patch +*.orig +*.rej + +*~ +*.a +*.lo +*.o +*.dylib + +*.gcda +*.gcno +*.gcov + +/zconf.h +/Makefile +/example +/example64 +/examplesh +**/libz.so* +/minigzip +/minigzip64 +/minigzipsh +/zlib.pc +/configure.log +/build + +.DS_Store +.vs +*.user +*.nupkg +contrib/vstudio/vc143/x86 +contrib/vstudio/vc143/x64 +contrib/vstudio/vc143/arm +contrib/vstudio/vc143/arm64 +contrib/nuget/bin +contrib/nuget/obj +*.included + +# Bazel directories +/bazel-* +/bazel-bin +/bazel-genfiles +/bazel-out +/bazel-testlogs +user.bazelrc + +# MODULE.bazel.lock is ignored for now as per this recommendation: +# https://github.com/bazelbuild/bazel/issues/20369 +MODULE.bazel.lock diff --git a/deps/zlib/BUILD.bazel b/deps/zlib/BUILD.bazel new file mode 100644 index 000000000..9a294f2f2 --- /dev/null +++ b/deps/zlib/BUILD.bazel @@ -0,0 +1,134 @@ +# Copied from https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/zlib/1.3.1.bcr.4/patches +# Adapted from https://github.com/protocolbuffers/protobuf/blob/master/third_party/zlib.BUILD + +# Copyright 2008 Google Inc. 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. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# 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. +# +# Code generated by the Protocol Buffer compiler is owned by the owner +# of the input file used when generating it. This code is not +# standalone and requires a support library to be linked with it. This +# support library is itself covered by the above license. + +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@rules_license//rules:license.bzl", "license") + +package( + default_applicable_licenses = [":license"], +) + +license( + name = "license", + license_kinds = ["@rules_license//licenses/spdx:Zlib"], + license_text = "LICENSE", +) + +exports_files([ + "LICENSE", +]) + +_ZLIB_HEADERS = [ + "crc32.h", + "deflate.h", + "gzguts.h", + "inffast.h", + "inffixed.h", + "inflate.h", + "inftrees.h", + "trees.h", + "zconf.h", + "zlib.h", + "zutil.h", +] + +_ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS] + +# In order to limit the damage from the `includes` propagation +# via `:zlib`, copy the public headers to a subdirectory and +# expose those. +genrule( + name = "copy_public_headers", + srcs = _ZLIB_HEADERS, + outs = _ZLIB_PREFIXED_HEADERS, + cmd_bash = "cp $(SRCS) $(@D)/zlib/include/", + cmd_bat = " && ".join( + ["@copy /Y \"$(location %s)\" \"$(@D)\\zlib\\include\\\" >NUL" % + s for s in _ZLIB_HEADERS], + ), +) + +config_setting( + name = "mingw_gcc_compiler", + flag_values = { + "@bazel_tools//tools/cpp:compiler": "mingw-gcc", + }, + visibility = [":__subpackages__"], +) + +cc_library( + name = "z", + srcs = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "gzclose.c", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + # Include the un-prefixed headers in srcs to work + # around the fact that zlib isn't consistent in its + # choice of <> or "" delimiter when including itself. + ] + _ZLIB_HEADERS, + hdrs = _ZLIB_PREFIXED_HEADERS, + copts = select({ + ":mingw_gcc_compiler": [ + "-fpermissive", + ], + "@platforms//os:windows": [], + "//conditions:default": [ + "-Wno-deprecated-non-prototype", + "-Wno-unused-variable", + "-Wno-implicit-function-declaration", + ], + }), + includes = ["zlib/include/"], + visibility = ["//visibility:public"], +) + +alias( + name = "zlib", + actual = ":z", + visibility = ["//visibility:public"], +) diff --git a/deps/zlib/CMakeLists.txt b/deps/zlib/CMakeLists.txt index 0fe939df6..aa7359121 100644 --- a/deps/zlib/CMakeLists.txt +++ b/deps/zlib/CMakeLists.txt @@ -1,99 +1,131 @@ -cmake_minimum_required(VERSION 2.4.4) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +cmake_minimum_required(VERSION 3.12...3.31) -project(zlib C) +project( + zlib + LANGUAGES C + VERSION 1.4.1.1 + HOMEPAGE_URL "https://zlib.net/" + DESCRIPTION "a general-purpose lossless data-compression library") -set(VERSION "1.2.11") +# ============================================================================ +# CPack +# ============================================================================ +set(CPACK_PACKAGE_VENDOR "zlib-Project") +set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README) +set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE) +set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README) -option(ASM686 "Enable building i686 assembly implementation") -option(AMD64 "Enable building amd64 assembly implementation") +# ============================================================================ +# configuration +# ============================================================================ -set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") +option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON) +option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON) +option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON) +option(ZLIB_BUILD_MINIZIP "Enable building libminizip contrib library" OFF) +option(ZLIB_INSTALL "Enable installation of zlib" ON) +option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in" + OFF) +mark_as_advanced(ZLIB_PREFIX) -include(CheckTypeSize) +if(WIN32) + option(ZLIB_INSTALL_COMPAT_DLL "Install a copy as zlib1.dll" ON) +endif(WIN32) + +get_property(IS_MULTI GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + +if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI) + message(STATUS "No CMAKE_BUILD_TYPE set -- using Release") + set(CMAKE_BUILD_TYPE Release) +endif(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI) + +include(CheckCSourceCompiles) include(CheckFunctionExists) include(CheckIncludeFile) -include(CheckCSourceCompiles) -enable_testing() +include(CMakePackageConfigHelpers) +include(CheckTypeSize) +include(CPack) +include(GNUInstallDirs) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) +set(CPACK_INCLUDED TRUE) + +if(NOT ZLIB_CONF_WRITTEN) + set(Z_PREFIX ${ZLIB_PREFIX}) + set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein) + file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT LIMIT 245) + file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT}) + file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n") + file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n") + file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n") + file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT OFFSET 244) + set(FIRST_ITEM TRUE) + + foreach(item IN LISTS ZCONF_CONTENT) + if(FIRST_ITEM) + string(APPEND OUT_CONTENT ${item}) + set(FIRST_ITEM FALSE) + else(FIRST_ITEM) + string(APPEND OUT_CONTENT "\;" ${item}) + endif(FIRST_ITEM) + endforeach(item IN LISTS ${ZCONF_CONTENT}) + + file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT}) + set(ZLIB_CONF_WRITTEN + TRUE + CACHE BOOL "zconf.h.cmakein was created") + mark_as_advanced(ZLIB_CONF_WRITTEN) +endif(NOT ZLIB_CONF_WRITTEN) # # Check to see if we have large file support # set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -# We add these other definitions here because CheckTypeSize.cmake -# in CMake 2.4.x does not automatically do so and we want -# compatibility with CMake 2.4.x. -if(HAVE_SYS_TYPES_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -endif() -if(HAVE_STDINT_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -endif() -if(HAVE_STDDEF_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -endif() check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable +unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable # # Check for fseeko # check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() + +# +# Check for stdarg.h +# +check_include_file(stdarg.h HAVE_STDARG_H) # # Check for unistd.h # -check_include_file(unistd.h Z_HAVE_UNISTD_H) +check_include_file(unistd.h HAVE_UNISTD_H) +# +# Check visibility attribute is supported +# if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -endif() + set(CMAKE_REQUIRED_FLAGS "-WX") +else(MSVC) + set(CMAKE_REQUIRED_FLAGS "-WError") +endif(MSVC) -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") - message(STATUS "to 'zconf.h.included' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) - endif() -endif() +check_c_source_compiles( + " + #include + static void f(void) __attribute__ ((visibility(\"hidden\"))); + int main(void) {return 0;} + " + HAVE___ATTR__VIS_HIDDEN) -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) +unset(CMAKE_COMPILE_FLAGS) +set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) +configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY) +configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h) - -#============================================================================ +# ============================================================================ # zlib -#============================================================================ +# ============================================================================ + +set(ZLIB_PUBLIC_HDRS ${zlib_BINARY_DIR}/zconf.h zlib.h) -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h - zlib.h -) set(ZLIB_PRIVATE_HDRS crc32.h deflate.h @@ -103,8 +135,8 @@ set(ZLIB_PRIVATE_HDRS inflate.h inftrees.h trees.h - zutil.h -) + zutil.h) + set(ZLIB_SRCS adler32.c compress.c @@ -120,130 +152,179 @@ set(ZLIB_SRCS inffast.c trees.c uncompr.c - zutil.c -) + zutil.c) -if(NOT MINGW) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -endif() +if(WIN32) + set(zlib_static_suffix "s") + set(CMAKE_DEBUG_POSTFIX "d") +endif(WIN32) -if(CMAKE_COMPILER_IS_GNUCC) - if(ASM686) - set(ZLIB_ASMS contrib/asm686/match.S) - elseif (AMD64) - set(ZLIB_ASMS contrib/amd64/amd64-match.S) - endif () +if(ZLIB_BUILD_SHARED) + add_library( + zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS} + $<$,$>:win32/zlib1.rc>) + add_library(ZLIB::ZLIB ALIAS zlib) + target_include_directories( + zlib + PUBLIC $ + $ + $) + target_compile_definitions( + zlib + PRIVATE ZLIB_BUILD + $<$:NO_FSEEKO> + $<$:HAVE_HIDDEN> + $<$:_CRT_SECURE_NO_DEPRECATE> + $<$:_CRT_NONSTDC_NO_DEPRECATE> + PUBLIC $<$:_LARGEFILE64_SOURCE=1>) + set(INSTALL_VERSION ${zlib_VERSION}) - if(ZLIB_ASMS) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() -endif() + if(NOT CYGWIN) + set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR} + VERSION ${INSTALL_VERSION}) + endif(NOT CYGWIN) -if(MSVC) - if(ASM686) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx86/inffas32.asm - contrib/masmx86/match686.asm - ) - elseif (AMD64) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx64/gvmat64.asm - contrib/masmx64/inffasx64.asm - ) - endif() + set_target_properties( + zlib + PROPERTIES DEFINE_SYMBOL ZLIB_DLL + EXPORT_NAME ZLIB + OUTPUT_NAME z) + if(UNIX + AND NOT APPLE + AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)) + # On unix-like platforms the library is almost always called libz + set_target_properties( + zlib + PROPERTIES LINK_FLAGS + "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"") + endif( + UNIX + AND NOT APPLE + AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX)) +endif(ZLIB_BUILD_SHARED) - if(ZLIB_ASMS) - add_definitions(-DASMV -DASMINF) - endif() -endif() +if(ZLIB_BUILD_STATIC) + add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} + ${ZLIB_PRIVATE_HDRS}) + add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic) + target_include_directories( + zlibstatic + PUBLIC $ + $ + $) + target_compile_definitions( + zlibstatic + PRIVATE ZLIB_BUILD + $<$:NO_FSEEKO> + $<$:HAVE_HIDDEN> + $<$:_CRT_SECURE_NO_DEPRECATE> + $<$:_CRT_NONSTDC_NO_DEPRECATE> + PUBLIC $<$:_LARGEFILE64_SOURCE=1>) + set_target_properties( + zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME + z${zlib_static_suffix}) +endif(ZLIB_BUILD_STATIC) -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) +if(ZLIB_INSTALL) + if(ZLIB_BUILD_SHARED) + install( + TARGETS zlib + COMPONENT Runtime + EXPORT zlibSharedExport + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install( + EXPORT zlibSharedExport + FILE ZLIB-shared.cmake + NAMESPACE ZLIB:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) + if(ZLIB_INSTALL_COMPAT_DLL) + install( + FILES $ + COMPONENT Runtime + RENAME zlib1.dll + DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif(ZLIB_INSTALL_COMPAT_DLL) -if(MINGW) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) - endif() + if(MSVC) + install( + FILES $ + COMPONENT Runtime + DESTINATION ${CMAKE_INSTALL_BINDIR} + CONFIGURATIONS Debug OR RelWithDebInfo + OPTIONAL) + endif(MSVC) + endif(ZLIB_BUILD_SHARED) - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} - -D GCC_WINDRES - -I ${CMAKE_CURRENT_SOURCE_DIR} - -I ${CMAKE_CURRENT_BINARY_DIR} - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -endif(MINGW) + if(ZLIB_BUILD_STATIC) + install( + TARGETS zlibstatic + COMPONENT Development + EXPORT zlibStaticExport + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install( + EXPORT zlibStaticExport + FILE ZLIB-static.cmake + NAMESPACE ZLIB:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -set_target_properties(zlib PROPERTIES SOVERSION 1) + if(ZLIB_INSTALL_COMPAT_DLL AND MINGW) + install( + FILES $ + COMPONENT Development + RENAME libz.dll.a + DESTINATION "${CMAKE_INSTALL_LIBDIR}") + endif(ZLIB_INSTALL_COMPAT_DLL AND MINGW) + endif(ZLIB_BUILD_STATIC) -if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # This has no effect with MSVC, on that platform the version info for - # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) -endif() + configure_package_config_file( + ${zlib_SOURCE_DIR}/zlibConfig.cmake.in + ${zlib_BINARY_DIR}/ZLIBConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) -if(UNIX) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") - endif() -elseif(BUILD_SHARED_LIBS AND WIN32) - # Creates zlib1.dll when building shared library version - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") -endif() + write_basic_package_version_file( + "${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake" + VERSION "${zlib_VERSION}" + COMPATIBILITY AnyNewerVersion) -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - install(TARGETS zlib zlibstatic - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -endif() -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3") -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") -endif() + install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake + ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib) + install( + FILES ${ZLIB_PUBLIC_HDRS} + COMPONENT Development + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + install( + FILES zlib.3 + COMPONENT Docs + DESTINATION "${CMAKE_INSTALL_MANDIR}/man3") + install( + FILES LICENSE + doc/algorithm.txt + doc/crc-doc.1.0.pdf + doc/rfc1950.txt + doc/rfc1951.txt + doc/rfc1952.txt + doc/txtvsbin.txt + COMPONENT Docs + DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib") + install( + FILES ${ZLIB_PC} + COMPONENT Development + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") +endif(ZLIB_INSTALL) -#============================================================================ -# Example binaries -#============================================================================ +# ============================================================================ +# Tests +# ============================================================================ +if(ZLIB_BUILD_TESTING) + enable_testing() + add_subdirectory(test) +endif(ZLIB_BUILD_TESTING) -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) - -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) - -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -endif() +if(ZLIB_BUILD_MINIZIP) + add_subdirectory(contrib/minizip/) +endif(ZLIB_BUILD_MINIZIP) diff --git a/deps/zlib/ChangeLog b/deps/zlib/ChangeLog index 30199a65a..1f83ab05c 100644 --- a/deps/zlib/ChangeLog +++ b/deps/zlib/ChangeLog @@ -1,6 +1,112 @@ ChangeLog file for zlib +Changes in 1.3.1.1 (xx Jan 2024) +- + +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + +Changes in 1.3 (18 Aug 2023) +- Remove K&R function definitions and zlib2ansi +- Fix bug in deflateBound() for level 0 and memLevel 9 +- Fix bug when gzungetc() is used immediately after gzopen() +- Fix bug when using gzflush() with a very small buffer +- Fix crash when gzsetparams() attempted for transparent write +- Fix test/example.c to work with FORCE_STORED +- Rewrite of zran in examples (see zran.c version history) +- Fix minizip to allow it to open an empty zip file +- Fix reading disk number start on zip64 files in minizip +- Fix logic error in minizip argument processing +- Add minizip testing to Makefile +- Read multiple bytes instead of byte-by-byte in minizip unzip.c +- Add memory sanitizer to configure (--memory) +- Various portability improvements +- Various documentation improvements +- Various spelling and typo corrections + +Changes in 1.2.13 (13 Oct 2022) +- Fix configure issue that discarded provided CC definition +- Correct incorrect inputs provided to the CRC functions +- Repair prototypes and exporting of new CRC functions +- Fix inflateBack to detect invalid input with distances too far +- Have infback() deliver all of the available output up to any error +- Fix a bug when getting a gzip header extra field with inflate() +- Fix bug in block type selection when Z_FIXED used +- Tighten deflateBound bounds +- Remove deleted assembler code references +- Various portability and appearance improvements + +Changes in 1.2.12 (27 Mar 2022) +- Cygwin does not have _wopen(), so do not create gzopen_w() there +- Permit a deflateParams() parameter change as soon as possible +- Limit hash table inserts after switch from stored deflate +- Fix bug when window full in deflate_stored() +- Fix CLEAR_HASH macro to be usable as a single statement +- Avoid a conversion error in gzseek when off_t type too small +- Have Makefile return non-zero error code on test failure +- Avoid some conversion warnings in gzread.c and gzwrite.c +- Update use of errno for newer Windows CE versions +- Small speedup to inflate [psumbera] +- Return an error if the gzputs string length can't fit in an int +- Add address checking in clang to -w option of configure +- Don't compute check value for raw inflate if asked to validate +- Handle case where inflateSync used when header never processed +- Avoid the use of ptrdiff_t +- Avoid an undefined behavior of memcpy() in gzappend() +- Avoid undefined behaviors of memcpy() in gz*printf() +- Avoid an undefined behavior of memcpy() in _tr_stored_block() +- Make the names in functions declarations identical to definitions +- Remove old assembler code in which bugs have manifested +- Fix deflateEnd() to not report an error at start of raw deflate +- Add legal disclaimer to README +- Emphasize the need to continue decompressing gzip members +- Correct the initialization requirements for deflateInit2() +- Fix a bug that can crash deflate on some input when using Z_FIXED +- Assure that the number of bits for deflatePrime() is valid +- Use a structure to make globals in enough.c evident +- Use a macro for the printf format of big_t in enough.c +- Clean up code style in enough.c, update version +- Use inline function instead of macro for index in enough.c +- Clarify that prefix codes are counted in enough.c +- Show all the codes for the maximum tables size in enough.c +- Add gznorm.c example, which normalizes gzip files +- Fix the zran.c example to work on a multiple-member gzip file +- Add tables for crc32_combine(), to speed it up by a factor of 200 +- Add crc32_combine_gen() and crc32_combine_op() for fast combines +- Speed up software CRC-32 computation by a factor of 1.5 to 3 +- Use atomic test and set, if available, for dynamic CRC tables +- Don't bother computing check value after successful inflateSync() +- Correct comment in crc32.c +- Add use of the ARMv8 crc32 instructions when requested +- Use ARM crc32 instructions if the ARM architecture has them +- Explicitly note that the 32-bit check values are 32 bits +- Avoid adding empty gzip member after gzflush with Z_FINISH +- Fix memory leak on error in gzlog.c +- Fix error in comment on the polynomial representation of a byte +- Clarify gz* function interfaces, referring to parameter names +- Change macro name in inflate.c to avoid collision in VxWorks +- Correct typo in blast.c +- Improve portability of contrib/minizip +- Fix indentation in minizip's zip.c +- Replace black/white with allow/block. (theresa-m) +- minizip warning fix if MAXU32 already defined. (gvollant) +- Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner) +- Clean up minizip to reduce warnings for testing +- Add fallthrough comments for gcc +- Eliminate use of ULL constants +- Separate out address sanitizing from warnings in configure +- Remove destructive aspects of make distclean +- Check for cc masquerading as gcc or clang in configure +- Fix crc32.c to compile local functions only if used + Changes in 1.2.11 (15 Jan 2017) - Fix deflate stored bug when pulling last block from window - Permit immediate deflateParams changes before any deflate input @@ -96,7 +202,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Fix types in contrib/minizip to match result of get_crc_table() - Simplify contrib/vstudio/vc10 with 'd' suffix - Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Support i686 and amd64 assembler builds in CMakeLists.txt - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Add vc11 and vc12 build files to contrib/vstudio - Add gzvprintf() as an undocumented function in zlib @@ -296,14 +402,14 @@ Changes in 1.2.5.1 (10 Sep 2011) - Use u4 type for crc_table to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy +- Improve inflateSync() documentation to note indeterminacy - Add deflatePending() function to return the amount of pending output - Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Add a check in configure for stdarg.h, use for gzprintf() - Check that pointers fit in ints when gzprint() compiled old style - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] +- Add debug records in assembler code [Londer] - Update RFC references to use http://tools.ietf.org/html/... [Li] - Add --archs option, use of libtool to configure for Mac OS X [Borstel] @@ -511,7 +617,7 @@ Changes in 1.2.3.5 (8 Jan 2010) - Don't use _vsnprintf on later versions of MSVC [Lowman] - Add CMake build script and input file [Lowman] - Update contrib/minizip to 1.1 [Svensson, Vollant] -- Moved nintendods directory from contrib to . +- Moved nintendods directory from contrib to root - Replace gzio.c with a new set of routines with the same functionality - Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above - Update contrib/minizip to 1.1b @@ -685,7 +791,7 @@ Changes in 1.2.2.4 (11 July 2005) - Be more strict on incomplete code sets in inflate_table() and increase ENOUGH and MAXD -- this repairs a possible security vulnerability for invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. + discovering the vulnerability and providing test cases - Add ia64 support to configure for HP-UX [Smith] - Add error return to gzread() for format or i/o error [Levin] - Use malloc.h for OS/2 [Necasek] @@ -721,7 +827,7 @@ Changes in 1.2.2.2 (30 December 2004) - Add Z_FIXED strategy option to deflateInit2() to force fixed trees - Add updated make_vms.com [Coghlan], update README - Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html - Add FAQ entry and comments in deflate.c on uninitialized memory access - Add Solaris 9 make options in configure [Gilbert] - Allow strerror() usage in gzio.c for STDC @@ -792,7 +898,7 @@ Changes in 1.2.1.1 (9 January 2004) - Fix a big fat bug in inftrees.c that prevented decoding valid dynamic blocks with only literals and no distance codes -- Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. +- Add a note to puff.c on no distance codes case Changes in 1.2.1 (17 November 2003) - Remove a tab in contrib/gzappend/gzappend.c @@ -970,7 +1076,7 @@ Changes in 1.2.0.1 (17 March 2003) - Include additional header file on VMS for off_t typedef - Try to use _vsnprintf where it supplants vsprintf [Vollant] - Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to +- Enhance comments in zlib.h on what happens if gzprintf() tries to write more than 4095 bytes before compression - Remove unused state from inflateBackEnd() - Remove exit(0) from minigzip.c, example.c @@ -1036,14 +1142,14 @@ Changes in 1.2.0 (9 March 2003) - Add contrib/puff/ simple inflate for deflate format description Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. +- ZFREE was repeated on same allocation on some error conditions This creates a security problem described in http://www.zlib.org/advisory-2002-03-11.txt - Returned incorrect error (Z_MEM_ERROR) on some invalid data - Avoid accesses before window for invalid distances with inflate window - less than 32K. + less than 32K - force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). + of 256 bytes. (A complete fix will be available in 1.1.5) Changes in 1.1.3 (9 July 1998) - fix "an inflate input buffer bug that shows up on rare but persistent @@ -1117,7 +1223,7 @@ Changes in 1.1.1 (27 Feb 98) - remove block truncation heuristic which had very marginal effect for zlib (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. + matches in deflate_slow - added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) Changes in 1.1.0 (24 Feb 98) @@ -1148,7 +1254,7 @@ Changes in 1.0.9 (17 Feb 1998) - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) + the declaration of FAR (Gilles Vollant) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - read_buf buf parameter of type Bytef* instead of charf* - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) @@ -1162,7 +1268,7 @@ Changes in 1.0.8 (27 Jan 1998) - include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) - use constant arrays for the static trees in trees.c instead of computing them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". + trees.h, compile with GEN_TREES_H and run "make test" - check return code of example in "make test" and display result - pass minigzip command line options to file_compress - simplifying code of inflateSync to avoid gcc 2.8 bug @@ -1201,12 +1307,12 @@ Changes in 1.0.6 (19 Jan 1998) - add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) - Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. + Andy Buckler for finding this one) +- In minigzip, pass transparently also the first byte for .Z files - return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() - check Z_FINISH in inflate (thanks to Marc Schluper) - Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. +- make static libraries by default in configure, add --shared option - move MSDOS or Windows specific files to directory msdos - suppress the notion of partial flush to simplify the interface (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) @@ -1218,7 +1324,7 @@ Changes in 1.0.6 (19 Jan 1998) - added Makefile.nt (thanks to Stephen Williams) - added the unsupported "contrib" directory: contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). + 386 asm code replacing longest_match() contrib/iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions contrib/iostream2/ by Tyge Løvset @@ -1226,7 +1332,7 @@ Changes in 1.0.6 (19 Jan 1998) contrib/untgz/ by "Pedro A. Aranda Guti\irrez" A very simple tar.gz file extractor using zlib contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. + How to use compress(), uncompress() and the gz* functions from VB - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression level) in minigzip (thanks to Tom Lane) @@ -1235,8 +1341,8 @@ Changes in 1.0.6 (19 Jan 1998) - add undocumented function inflateSyncPoint() (hack for Paul Mackerras) - add undocumented function zError to convert error code to string (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code +- Use default memcpy for Symantec MSDOS compiler - Add EXPORT keyword for check_func (needed for Windows DLL) - add current directory to LD_LIBRARY_PATH for "make test" - create also a link for libz.so.1 @@ -1249,7 +1355,7 @@ Changes in 1.0.6 (19 Jan 1998) - allow compilation with ANSI keywords only enabled for TurboC in large model - avoid "versionString"[0] (Borland bug) - add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch) - allow compilation with CC - defined STDC for OS/2 (David Charlap) - limit external names to 8 chars for MVS (Thomas Lund) @@ -1259,7 +1365,7 @@ Changes in 1.0.6 (19 Jan 1998) - use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) - added makelcc.bat for lcc-win32 (Tom St Denis) - in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion - check for unistd.h in configure (for off_t) - remove useless check parameter in inflate_blocks_free - avoid useless assignment of s->check to itself in inflate_blocks_new @@ -1280,7 +1386,7 @@ Changes in 1.0.5 (3 Jan 98) Changes in 1.0.4 (24 Jul 96) - In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. + on to attempt decompressing extra garbage data. This affected minigzip too - zlibVersion and gzerror return const char* (needed for DLL) - port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) - use z_error only for DEBUG (avoid problem with DLLs) @@ -1310,7 +1416,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] - fix array overlay in deflate.c which sometimes caused bad compressed data - fix inflate bug with empty stored block - fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generate bad compressed data. +- fix deflateParams() which could generate bad compressed data - Bytef is define'd instead of typedef'ed (work around Borland bug) - added an INDEX file - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), @@ -1331,7 +1437,7 @@ Changes in 0.99 (27 Jan 96) - allow preset dictionary shared between compressor and decompressor - allow compression level 0 (no compression) - add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. + and compression strategy - test large buffers and deflateParams in example.c - add optional "configure" to build zlib as a shared library - suppress Makefile.qnx, use configure instead @@ -1370,33 +1476,33 @@ Changes in 0.99 (27 Jan 96) - fix typo in Make_vms.com (f$trnlnm -> f$getsyi) - in fcalloc, normalize pointer if size > 65520 bytes - don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc. - use Z_BINARY instead of BINARY - document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. +- allow "a" as mode in gzopen - fix error checking in gzread - allow skipping .gz extra-field on pipes - added reference to Perl interface in README - put the crc table in FAR data (I dislike more and more the medium model :) - added get_crc_table -- added a dimension to all arrays (Borland C can't count). +- added a dimension to all arrays (Borland C can't count) - workaround Borland C bug in declaration of inflate_codes_new & inflate_fast - guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- Watcom C pretends to be Microsoft C small model even in 32 bit mode - don't use unsized arrays to avoid silly warnings by Visual C++: warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). + (what's wrong with far data in far model?) - define enum out of inflate_blocks_state to allow compilation with C++ Changes in 0.95 (16 Aug 95) - fix MSDOS small and medium model (now easier to adapt to any compiler) - inlined send_bits - fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). + not completely flushed in rare occasions) - default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). + (it's now sufficient to set MAX_WBITS in zconf.h) - voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). + typedefs and because voidnp was not near in large model) Changes in 0.94 (13 Aug 95) - support MSDOS medium model @@ -1405,12 +1511,12 @@ Changes in 0.94 (13 Aug 95) - added support for VMS - allow a compression level in gzopen() - gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. +- For deflate with flush, flush even if no more input is provided - rename libgz.a as libz.a - avoid complex expression in infcodes.c triggering Turbo C bug - work around a problem with gcc on Alpha (in INSERT_STRING) - don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. +- allow renaming of Byte, uInt, etc... with #define - avoid warning about (unused) pointer before start of array in deflate.c - avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c - avoid reserved word 'new' in trees.c @@ -1429,7 +1535,7 @@ Changes in 0.92 (3 May 95) - no memcpy on Pyramid - suppressed inftest.c - optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. +- optimized inflate on stored blocks - untabify all sources to simplify patches Changes in 0.91 (2 May 95) @@ -1447,7 +1553,7 @@ Changes in 0.9 (1 May 95) - let again gzread copy uncompressed data unchanged (was working in 0.71) - deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented - added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. +- moved MAX_WBITS to zconf.h because users might want to change that - document explicitly that zalloc(64K) on MSDOS must return a normalized pointer (zero offset) - added Makefiles for Microsoft C, Turbo C, Borland C++ @@ -1456,7 +1562,7 @@ Changes in 0.9 (1 May 95) Changes in 0.8 (29 April 95) - added fast inflate (inffast.c) - deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. + is incompatible with previous versions of zlib which returned Z_OK - work around a TurboC compiler bug (bad code for b << 0, see infutil.h) (actually that was not a compiler bug, see 0.81 above) - gzread no longer reads one extra byte in certain cases @@ -1466,50 +1572,50 @@ Changes in 0.8 (29 April 95) Changes in 0.71 (14 April 95) - Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. + TurboC large model Changes in 0.7 (14 April 95) -- Added full inflate support. +- Added full inflate support - Simplified the crc32() interface. The pre- and post-conditioning (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. + incompatible with previous versions; see zlib.h for the new usage Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. +- workaround for a bug in TurboC. example and minigzip now work on MSDOS Changes in 0.6 (11 April 95) - added minigzip.c - added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. +- added transparent reading of non-gziped files in gzread - fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose) - don't allocate big arrays in the stack (for MSDOS) - fix some MSDOS compilation problems Changes in 0.5: - do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. + not yet Z_FULL_FLUSH - support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. +- added opaque object for zalloc and zfree - added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. +- added a variable zlib_version for consistency checking +- renamed the 'filter' parameter of deflateInit2 as 'strategy' + Added Z_FILTERED and Z_HUFFMAN_ONLY constants Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. +- avoid "zip" everywhere, use zlib instead of ziplib - suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. + if compression method == 8 - added adler32 and crc32 - renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. +- added the method parameter for deflateInit2 - added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting +- simplified considerably deflateInit and inflateInit by not supporting user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. + and inflateInit2 Changes in 0.3: - prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. +- use Z_FINISH instead of deflateEnd to finish compression - added Z_HUFFMAN_ONLY - added gzerror() diff --git a/deps/zlib/FAQ b/deps/zlib/FAQ index 99b7cf92e..f72cac63c 100644 --- a/deps/zlib/FAQ +++ b/deps/zlib/FAQ @@ -4,7 +4,7 @@ If your question is not there, please check the zlib home page http://zlib.net/ which may have more recent information. -The lastest zlib FAQ is at http://zlib.net/zlib_faq.html +The latest zlib FAQ is at http://zlib.net/zlib_faq.html 1. Is zlib Y2K-compliant? @@ -14,13 +14,12 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? See - * http://marknelson.us/1997/01/01/zlib-engine/ + * https://marknelson.us/posts/1997/01/01/zlib-engine.html * win32/DLL_FAQ.txt in the zlib distribution 4. compress() returns Z_BUF_ERROR. diff --git a/deps/zlib/LICENSE b/deps/zlib/LICENSE new file mode 100644 index 000000000..b517acd57 --- /dev/null +++ b/deps/zlib/LICENSE @@ -0,0 +1,22 @@ +Copyright notice: + + (C) 1995-2024 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu diff --git a/deps/zlib/MODULE.bazel b/deps/zlib/MODULE.bazel new file mode 100644 index 000000000..cb4c13ef3 --- /dev/null +++ b/deps/zlib/MODULE.bazel @@ -0,0 +1,9 @@ +module( + name = "zlib", + version = "0.0.0", + compatibility_level = 1, +) + +bazel_dep(name = "platforms", version = "0.0.10") +bazel_dep(name = "rules_cc", version = "0.0.16") +bazel_dep(name = "rules_license", version = "1.0.0") diff --git a/deps/zlib/Makefile.in b/deps/zlib/Makefile.in index 5a77949ff..7010b25c5 100644 --- a/deps/zlib/Makefile.in +++ b/deps/zlib/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -7,16 +7,14 @@ # Normally configure builds both a static and a shared library. # If you want to build just a static library, use: ./configure --static -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: # make install # To install in $HOME instead of /usr/local, use: # make install prefix=$HOME CC=cc +GCOV=GCOV +LLVM_GCOV_FLAG=LLMV_GCOV_FLAG CFLAGS=-O #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 @@ -26,13 +24,13 @@ CFLAGS=-O SFLAGS=-O LDFLAGS= -TEST_LDFLAGS=-L. libz.a +TEST_LIBS=-L. libz.a LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.11 +SHAREDLIBV=libz.so.1.3.1.1 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -87,12 +85,12 @@ test: all teststatic testshared teststatic: static @TMPST=tmpst_$$; \ - if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ + if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \ echo ' *** zlib test OK ***'; \ else \ echo ' *** zlib test FAILED ***'; false; \ - fi; \ - rm -f $$TMPST + fi + @rm -f tmpst_$$ testshared: shared @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ @@ -100,32 +98,36 @@ testshared: shared DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ TMPSH=tmpsh_$$; \ - if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ + if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \ echo ' *** zlib shared test OK ***'; \ else \ echo ' *** zlib shared test FAILED ***'; false; \ - fi; \ - rm -f $$TMPSH + fi + @rm -f tmpsh_$$ test64: all64 @TMP64=tmp64_$$; \ - if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ + if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \ echo ' *** zlib 64-bit test OK ***'; \ else \ echo ' *** zlib 64-bit test FAILED ***'; false; \ - fi; \ - rm -f $$TMP64 + fi + @rm -f tmp64_$$ infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c + $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c infcover: infcover.o libz.a - $(CC) $(CFLAGS) -o $@ infcover.o libz.a + $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a cover: infcover +ifdef $(GCOV) rm -f *.gcda - ./infcover - gcov inf*.c + ${QEMU_RUN} ./infcover + ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda +else + @echo 'cover disabled as no suitable gcov was found' +endif libz.a: $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) @@ -180,7 +182,7 @@ inftrees.o: $(SRCDIR)inftrees.c trees.o: $(SRCDIR)trees.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c -zutil.o: $(SRCDIR)zutil.c +zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c compress.o: $(SRCDIR)compress.c @@ -242,7 +244,7 @@ trees.lo: $(SRCDIR)trees.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c -@mv objs/trees.o $@ -zutil.lo: $(SRCDIR)zutil.c +zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h -@mkdir objs 2>/dev/null || test -d objs $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c -@mv objs/zutil.o $@ @@ -286,22 +288,22 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a -@rmdir objs example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS) minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS) examplesh$(EXE): example.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) + $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) example64$(EXE): example64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS) minigzip64$(EXE): minigzip64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS) install-libs: $(LIBS) -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi @@ -353,18 +355,25 @@ docs: zlib.3.pdf zlib.3.pdf: $(SRCDIR)zlib.3 groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@ -zconf.h.cmakein: $(SRCDIR)zconf.h.in - -@ TEMPFILE=zconfh_$$; \ - echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ - sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ - touch -r $(SRCDIR)zconf.h.in $@ &&\ - rm $$TEMPFILE +# zconf.h.cmakein: $(SRCDIR)zconf.h.in +# -@ TEMPFILE=zconfh_$$; \ +# echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ +# sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ +# touch -r $(SRCDIR)zconf.h.in $@ &&\ +# rm $$TEMPFILE +# zconf: $(SRCDIR)zconf.h.in cp -p $(SRCDIR)zconf.h.in zconf.h +minizip-test: static + cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } + +minizip-clean: + cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; } + mostlyclean: clean -clean: +clean: minizip-clean rm -f *.o *.lo *~ \ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ example64$(EXE) minigzip64$(EXE) \ @@ -376,20 +385,19 @@ clean: rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov maintainer-clean: distclean -distclean: clean zconf zconf.h.cmakein docs +distclean: clean zconf # zconf.h.cmakein rm -f Makefile zlib.pc configure.log -@rm -f .DS_Store @if [ -f Makefile.in ]; then \ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \ touch -r $(SRCDIR)Makefile.in Makefile ; fi - @if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi - @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi tags: etags $(SRCDIR)*.[ch] -adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h @@ -399,7 +407,8 @@ inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h -adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h +zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h diff --git a/deps/zlib/README b/deps/zlib/README index 51106de47..75da52058 100644 --- a/deps/zlib/README +++ b/deps/zlib/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.11 is a general purpose data compression library. All the code is +zlib 1.3.1.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at -http://marknelson.us/1997/01/01/zlib-engine/ . +https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.2.11 are documented in the file ChangeLog. +The changes made in version 1.3.1.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . -zlib is available in Java using the java.util.zip package, documented at -http://java.sun.com/developer/technicalArticles/Programming/compression/ . +zlib is available in Java using the java.util.zip package. Follow the API +Documentation link at: https://docs.oracle.com/search/?q=java.util.zip . -A Perl interface to zlib written by Paul Marquess is available -at CPAN (Comprehensive Perl Archive Network) sites, including -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . +A Perl interface to zlib and bzip2 written by Paul Marquess +can be found at https://github.com/pmqs/IO-Compress . A Python interface to zlib written by A.M. Kuchling is available in Python 1.5 and later versions, see @@ -64,14 +63,12 @@ Notes for some targets: - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works when compiled with cc. -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is +- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is necessary to get gzprintf working correctly. This is done by configure. - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with other compilers. Use "make test" to check your compiler. -- gzdopen is not supported on RISCOS or BEOS. - - For PalmOs, see http://palmzlib.sourceforge.net/ @@ -84,7 +81,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2017 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,7 +105,10 @@ Copyright notice: If you use the zlib library in a product, we would appreciate *not* receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. +Gailly and Mark Adler; it does not include third-party code. We make all +contributions to and distributions of this project solely in our personal +capacity, and are not conveying any rights to any intellectual property of +any third parties. If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read diff --git a/deps/zlib/README-cmake.md b/deps/zlib/README-cmake.md new file mode 100644 index 000000000..7258f9cad --- /dev/null +++ b/deps/zlib/README-cmake.md @@ -0,0 +1,83 @@ +# For building with cmake at least version 3.12 (minizip 3.12) is needed + +In most cases the usual + + cmake -S . -B build -D CMAKE_BUILD_TYPE=Release + +will create everything you need, however if you want something off default you can adjust several options fit your needs. +Every option is list below (excluding the cmake-standard options), they can be set via cmake-gui or on cmdline with + + -D