-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add libwebp * Update add_build_file.patch * Update source.json
- Loading branch information
1 parent
159a8fa
commit cd62ba0
Showing
6 changed files
with
313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""libwebp build dependencies.""" | ||
|
||
module( | ||
name = "libwebp", | ||
version = "1.3.2", | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep(name = "platforms", version = "0.0.8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,254 @@ | ||
--- BUILD.bazel | ||
+++ BUILD.bazel | ||
@@ -0,0 +1,251 @@ | ||
+# Copied from https://skia.googlesource.com/skia/+/refs/heads/main/bazel/external/libwebp/BUILD.bazel | ||
+# The copied code is available under the following BSD-style license (see | ||
+# https://skia.googlesource.com/skia/+/refs/heads/main/LICENSE): | ||
+# | ||
+# Copyright (c) 2011 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 the copyright holder 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. | ||
+ | ||
+# This file will be copied into //third_party/externals/libwebp via the new_local_repository | ||
+# rule in WORKSPACE.bazel, so all files should be relative to that path. | ||
+# We define this here because the emscripten toolchain calls the cpu wasm, whereas the | ||
+# bazelbuild/platforms call it wasm32. https://github.com/emscripten-core/emsdk/issues/919 | ||
+config_setting( | ||
+ name = "cpu_wasm", | ||
+ values = { | ||
+ "cpu": "wasm", | ||
+ }, | ||
+) | ||
+ | ||
+WEBP_SRCS = [ | ||
+ "sharpyuv/sharpyuv.c", | ||
+ "sharpyuv/sharpyuv.h", | ||
+ "sharpyuv/sharpyuv_cpu.c", | ||
+ "sharpyuv/sharpyuv_cpu.h", | ||
+ "sharpyuv/sharpyuv_csp.c", | ||
+ "sharpyuv/sharpyuv_csp.h", | ||
+ "sharpyuv/sharpyuv_dsp.c", | ||
+ "sharpyuv/sharpyuv_dsp.h", | ||
+ "sharpyuv/sharpyuv_gamma.c", | ||
+ "sharpyuv/sharpyuv_gamma.h", | ||
+ "sharpyuv/sharpyuv_neon.c", | ||
+ "sharpyuv/sharpyuv_sse2.c", | ||
+ "src/dec/alpha_dec.c", | ||
+ "src/dec/alphai_dec.h", | ||
+ "src/dec/buffer_dec.c", | ||
+ "src/dec/common_dec.h", | ||
+ "src/dec/frame_dec.c", | ||
+ "src/dec/idec_dec.c", | ||
+ "src/dec/io_dec.c", | ||
+ "src/dec/quant_dec.c", | ||
+ "src/dec/tree_dec.c", | ||
+ "src/dec/vp8_dec.c", | ||
+ "src/dec/vp8_dec.h", | ||
+ "src/dec/vp8i_dec.h", | ||
+ "src/dec/vp8l_dec.c", | ||
+ "src/dec/vp8li_dec.h", | ||
+ "src/dec/webp_dec.c", | ||
+ "src/dec/webpi_dec.h", | ||
+ "src/demux/anim_decode.c", | ||
+ "src/demux/demux.c", | ||
+ "src/dsp/alpha_processing.c", | ||
+ "src/dsp/alpha_processing_mips_dsp_r2.c", | ||
+ "src/dsp/alpha_processing_neon.c", | ||
+ "src/dsp/alpha_processing_sse2.c", | ||
+ "src/dsp/common_sse2.h", | ||
+ "src/dsp/common_sse41.h", | ||
+ "src/dsp/cost.c", | ||
+ "src/dsp/cost_mips32.c", | ||
+ "src/dsp/cost_mips_dsp_r2.c", | ||
+ "src/dsp/cost_neon.c", | ||
+ "src/dsp/cost_sse2.c", | ||
+ "src/dsp/cpu.c", | ||
+ "src/dsp/cpu.h", | ||
+ "src/dsp/dec.c", | ||
+ "src/dsp/dec_clip_tables.c", | ||
+ "src/dsp/dec_mips32.c", | ||
+ "src/dsp/dec_mips_dsp_r2.c", | ||
+ "src/dsp/dec_msa.c", | ||
+ "src/dsp/dec_neon.c", | ||
+ "src/dsp/dec_sse2.c", | ||
+ "src/dsp/dsp.h", | ||
+ "src/dsp/enc.c", | ||
+ "src/dsp/enc_mips32.c", | ||
+ "src/dsp/enc_mips_dsp_r2.c", | ||
+ "src/dsp/enc_msa.c", | ||
+ "src/dsp/enc_neon.c", | ||
+ "src/dsp/enc_sse2.c", | ||
+ "src/dsp/filters.c", | ||
+ "src/dsp/filters_mips_dsp_r2.c", | ||
+ "src/dsp/filters_msa.c", | ||
+ "src/dsp/filters_neon.c", | ||
+ "src/dsp/filters_sse2.c", | ||
+ "src/dsp/lossless.c", | ||
+ "src/dsp/lossless.h", | ||
+ "src/dsp/lossless_common.h", | ||
+ "src/dsp/lossless_enc.c", | ||
+ "src/dsp/lossless_enc_mips32.c", | ||
+ "src/dsp/lossless_enc_mips_dsp_r2.c", | ||
+ "src/dsp/lossless_enc_msa.c", | ||
+ "src/dsp/lossless_enc_neon.c", | ||
+ "src/dsp/lossless_enc_sse2.c", | ||
+ "src/dsp/lossless_mips_dsp_r2.c", | ||
+ "src/dsp/lossless_msa.c", | ||
+ "src/dsp/lossless_neon.c", | ||
+ "src/dsp/lossless_sse2.c", | ||
+ "src/dsp/mips_macro.h", | ||
+ "src/dsp/msa_macro.h", | ||
+ "src/dsp/neon.h", | ||
+ "src/dsp/quant.h", | ||
+ "src/dsp/rescaler.c", | ||
+ "src/dsp/rescaler_mips32.c", | ||
+ "src/dsp/rescaler_mips_dsp_r2.c", | ||
+ "src/dsp/rescaler_msa.c", | ||
+ "src/dsp/rescaler_neon.c", | ||
+ "src/dsp/rescaler_sse2.c", | ||
+ "src/dsp/ssim.c", | ||
+ "src/dsp/ssim_sse2.c", | ||
+ "src/dsp/upsampling.c", | ||
+ "src/dsp/upsampling_mips_dsp_r2.c", | ||
+ "src/dsp/upsampling_msa.c", | ||
+ "src/dsp/upsampling_neon.c", | ||
+ "src/dsp/upsampling_sse2.c", | ||
+ "src/dsp/yuv.c", | ||
+ "src/dsp/yuv.h", | ||
+ "src/dsp/yuv_mips32.c", | ||
+ "src/dsp/yuv_mips_dsp_r2.c", | ||
+ "src/dsp/yuv_neon.c", | ||
+ "src/dsp/yuv_sse2.c", | ||
+ "src/enc/alpha_enc.c", | ||
+ "src/enc/analysis_enc.c", | ||
+ "src/enc/backward_references_cost_enc.c", | ||
+ "src/enc/backward_references_enc.c", | ||
+ "src/enc/backward_references_enc.h", | ||
+ "src/enc/config_enc.c", | ||
+ "src/enc/cost_enc.c", | ||
+ "src/enc/cost_enc.h", | ||
+ "src/enc/filter_enc.c", | ||
+ "src/enc/frame_enc.c", | ||
+ "src/enc/histogram_enc.c", | ||
+ "src/enc/histogram_enc.h", | ||
+ "src/enc/iterator_enc.c", | ||
+ "src/enc/near_lossless_enc.c", | ||
+ "src/enc/picture_csp_enc.c", | ||
+ "src/enc/picture_enc.c", | ||
+ "src/enc/picture_psnr_enc.c", | ||
+ "src/enc/picture_rescale_enc.c", | ||
+ "src/enc/picture_tools_enc.c", | ||
+ "src/enc/predictor_enc.c", | ||
+ "src/enc/quant_enc.c", | ||
+ "src/enc/syntax_enc.c", | ||
+ "src/enc/token_enc.c", | ||
+ "src/enc/tree_enc.c", | ||
+ "src/enc/vp8i_enc.h", | ||
+ "src/enc/vp8l_enc.c", | ||
+ "src/enc/vp8li_enc.h", | ||
+ "src/enc/webp_enc.c", | ||
+ "src/mux/anim_encode.c", | ||
+ "src/mux/animi.h", | ||
+ "src/mux/muxedit.c", | ||
+ "src/mux/muxi.h", | ||
+ "src/mux/muxinternal.c", | ||
+ "src/mux/muxread.c", | ||
+ "src/utils/bit_reader_inl_utils.h", | ||
+ "src/utils/bit_reader_utils.c", | ||
+ "src/utils/bit_reader_utils.h", | ||
+ "src/utils/bit_writer_utils.c", | ||
+ "src/utils/bit_writer_utils.h", | ||
+ "src/utils/color_cache_utils.c", | ||
+ "src/utils/color_cache_utils.h", | ||
+ "src/utils/endian_inl_utils.h", | ||
+ "src/utils/filters_utils.c", | ||
+ "src/utils/filters_utils.h", | ||
+ "src/utils/huffman_encode_utils.c", | ||
+ "src/utils/huffman_encode_utils.h", | ||
+ "src/utils/huffman_utils.c", | ||
+ "src/utils/huffman_utils.h", | ||
+ "src/utils/quant_levels_dec_utils.c", | ||
+ "src/utils/quant_levels_dec_utils.h", | ||
+ "src/utils/quant_levels_utils.c", | ||
+ "src/utils/quant_levels_utils.h", | ||
+ "src/utils/random_utils.c", | ||
+ "src/utils/random_utils.h", | ||
+ "src/utils/rescaler_utils.c", | ||
+ "src/utils/rescaler_utils.h", | ||
+ "src/utils/thread_utils.c", | ||
+ "src/utils/thread_utils.h", | ||
+ "src/utils/utils.c", | ||
+ "src/utils/utils.h", | ||
+] + select({ | ||
+ "@platforms//cpu:x86_64": [ | ||
+ "src/dsp/alpha_processing_sse41.c", | ||
+ "src/dsp/dec_sse41.c", | ||
+ "src/dsp/enc_sse41.c", | ||
+ "src/dsp/lossless_enc_sse41.c", | ||
+ "src/dsp/lossless_sse41.c", | ||
+ "src/dsp/upsampling_sse41.c", | ||
+ "src/dsp/yuv_sse41.c", | ||
+ ], | ||
+ ":cpu_wasm": [], # not sure why wasm doesn't use default | ||
+ "//conditions:default": [], | ||
+}) | ||
+ | ||
+WEBP_COPTS = select({ | ||
+ "@platforms//os:windows": [], | ||
+ "//conditions:default": ["-Wno-unused-but-set-variable"], | ||
+}) + select({ | ||
+ "@platforms//cpu:x86_64": ["-msse4.1"], | ||
+ ":cpu_wasm": [], # not sure why wasm doesn't use default | ||
+ "//conditions:default": [], | ||
+}) | ||
+ | ||
+WEBP_DEFINES = [ | ||
+ # TODO(scroggo): swizzle ourself in SkWebpCodec instead of requiring this non-standard libwebp. | ||
+ "WEBP_SWAP_16BIT_CSP", | ||
+] | ||
+ | ||
+cc_library( | ||
+ name = "webp", | ||
+ srcs = WEBP_SRCS, | ||
+ hdrs = [ | ||
+ "src/webp/decode.h", | ||
+ "src/webp/demux.h", | ||
+ "src/webp/encode.h", | ||
+ "src/webp/format_constants.h", | ||
+ "src/webp/mux.h", | ||
+ "src/webp/mux_types.h", | ||
+ "src/webp/types.h", | ||
+ ], | ||
+ copts = WEBP_COPTS, | ||
+ includes = ["src"], | ||
+ local_defines = WEBP_DEFINES, | ||
+ textual_hdrs = ["src/dsp/cpu.c"], | ||
+ visibility = ["//visibility:public"], | ||
+) | ||
+ | ||
+alias( | ||
+ name = "libwebp", | ||
+ actual = ":webp", | ||
+ visibility = ["//visibility:public"], | ||
+) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- MODULE.bazel | ||
+++ MODULE.bazel | ||
@@ -0,0 +1,9 @@ | ||
+"""libwebp build dependencies.""" | ||
+ | ||
+module( | ||
+ name = "libwebp", | ||
+ version = "1.3.2", | ||
+ compatibility_level = 1, | ||
+) | ||
+ | ||
+bazel_dep(name = "platforms", version = "0.0.8") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
matrix: | ||
platform: | ||
- ubuntu2004 | ||
- macos | ||
- windows | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
build_targets: | ||
- '@libwebp//:libwebp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"integrity": "sha256-wsL1IfpGjjxZSatpjC2kEPXc4cXpn1rZ5w4OhEa4ZQU=", | ||
"patch_strip": 0, | ||
"patches": { | ||
"add_build_file.patch": "sha256-3HLHhRR77AbDAt1hkJfITaztgFpt9++a8PM0hQIN6Ho=", | ||
"module_dot_bazel.patch": "sha256-Ipy8mhkGtRK8MluHkRmFTkrB/fTO8Bd5h53jO7OWqEs=" | ||
}, | ||
"strip_prefix": "libwebp-1.3.2", | ||
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"homepage": "https://github.com/webmproject/libwebp", | ||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"github": "Vertexwahn", | ||
"name": "Julian Amann" | ||
} | ||
], | ||
"repository": [ | ||
"github:webmproject/libwebp" | ||
], | ||
"versions": [ | ||
"1.3.2" | ||
], | ||
"yanked_versions": {} | ||
} |