From 6217b9d57185ccb564d6ed03106d8bcd4a8bcb66 Mon Sep 17 00:00:00 2001 From: Vertexwahn Date: Fri, 16 Feb 2024 22:37:53 +0100 Subject: [PATCH] Add zlib 1.3.1 (#1497) * Add zlib 1.3.1 * Fix strip_prefix --- modules/zlib/1.3.1/MODULE.bazel | 8 ++ .../zlib/1.3.1/patches/add_build_file.patch | 108 ++++++++++++++++++ .../zlib/1.3.1/patches/module_dot_bazel.patch | 11 ++ modules/zlib/1.3.1/presubmit.yml | 15 +++ modules/zlib/1.3.1/source.json | 10 ++ modules/zlib/metadata.json | 3 +- 6 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 modules/zlib/1.3.1/MODULE.bazel create mode 100644 modules/zlib/1.3.1/patches/add_build_file.patch create mode 100644 modules/zlib/1.3.1/patches/module_dot_bazel.patch create mode 100644 modules/zlib/1.3.1/presubmit.yml create mode 100644 modules/zlib/1.3.1/source.json diff --git a/modules/zlib/1.3.1/MODULE.bazel b/modules/zlib/1.3.1/MODULE.bazel new file mode 100644 index 00000000000..a73798637ee --- /dev/null +++ b/modules/zlib/1.3.1/MODULE.bazel @@ -0,0 +1,8 @@ +module( + name = "zlib", + version = "1.3.1", + compatibility_level = 1, +) + +bazel_dep(name = "platforms", version = "0.0.7") +bazel_dep(name = "rules_cc", version = "0.0.8") diff --git a/modules/zlib/1.3.1/patches/add_build_file.patch b/modules/zlib/1.3.1/patches/add_build_file.patch new file mode 100644 index 00000000000..e7be6535418 --- /dev/null +++ b/modules/zlib/1.3.1/patches/add_build_file.patch @@ -0,0 +1,108 @@ +--- /dev/null ++++ BUILD.bazel +@@ -0,0 +1,105 @@ ++# Copied 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") ++ ++licenses(["notice"]) # BSD/MIT-like license (for zlib) ++ ++#exports_files(["zlib.BUILD"]) # uncommented - not needed/working here ++ ++_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], ++ ), ++) ++ ++cc_library( ++ name = "zlib", ++ 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({ ++ "@platforms//os:windows": [], ++ "//conditions:default": [ ++ "-Wno-deprecated-non-prototype", ++ "-Wno-unused-variable", ++ "-Wno-implicit-function-declaration", ++ ], ++ }), ++ includes = ["zlib/include/"], ++ visibility = ["//visibility:public"], ++) diff --git a/modules/zlib/1.3.1/patches/module_dot_bazel.patch b/modules/zlib/1.3.1/patches/module_dot_bazel.patch new file mode 100644 index 00000000000..d7ead3344d7 --- /dev/null +++ b/modules/zlib/1.3.1/patches/module_dot_bazel.patch @@ -0,0 +1,11 @@ +--- MODULE.bazel ++++ MODULE.bazel +@@ -0,0 +1,8 @@ ++module( ++ name = "zlib", ++ version = "1.3.1", ++ compatibility_level = 1, ++) ++ ++bazel_dep(name = "platforms", version = "0.0.7") ++bazel_dep(name = "rules_cc", version = "0.0.8") diff --git a/modules/zlib/1.3.1/presubmit.yml b/modules/zlib/1.3.1/presubmit.yml new file mode 100644 index 00000000000..c4a0c3c0a7b --- /dev/null +++ b/modules/zlib/1.3.1/presubmit.yml @@ -0,0 +1,15 @@ +matrix: + platform: + - centos7 + - debian10 + - ubuntu2004 + - macos + - windows + bazel: [6.x, 7.x] +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - '@zlib//:zlib' diff --git a/modules/zlib/1.3.1/source.json b/modules/zlib/1.3.1/source.json new file mode 100644 index 00000000000..33994418307 --- /dev/null +++ b/modules/zlib/1.3.1/source.json @@ -0,0 +1,10 @@ +{ + "integrity": "sha256-mpOyt9/ax3zrpaVYpYDnRmfdb+3kWFuR7vtg8Dty3yM=", + "patch_strip": 0, + "patches": { + "add_build_file.patch": "sha256-Ei+FYaaOo7A3jTKunMEodTI0Uw5NXQyZEcboMC8JskY=", + "module_dot_bazel.patch": "sha256-IFCFES6KY2jaryT+Kq2NemDn7hgdZYH0kZC1esA4cyE=" + }, + "strip_prefix": "zlib-1.3.1", + "url": "https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz" +} diff --git a/modules/zlib/metadata.json b/modules/zlib/metadata.json index 2a85370da57..afd3f308bca 100644 --- a/modules/zlib/metadata.json +++ b/modules/zlib/metadata.json @@ -14,7 +14,8 @@ "1.2.12", "1.2.13", "1.2.13.bcr.1", - "1.3" + "1.3", + "1.3.1" ], "yanked_versions": { "1.2.11": "CVE-2018-25032 (https://github.com/advisories/GHSA-jc36-42cf-vqwj)",