|
| 1 | +-- compat.libwebp — the WebP image codec, encode + decode, built from upstream |
| 2 | +-- source rather than linked against a host libwebp. |
| 3 | +-- |
| 4 | +-- Shape A (C-source compat): a consumer writes `#include <webp/encode.h>` / |
| 5 | +-- `<webp/decode.h>` and links one lib. |
| 6 | +-- |
| 7 | +-- WHAT IS IN THE LIB. dec + enc + dsp + utils + sharpyuv, as five directory |
| 8 | +-- globs. sharpyuv is inside the SAME archive rather than a package of its own |
| 9 | +-- because the encoder's picture_csp_enc.c calls into it directly — upstream's |
| 10 | +-- CMake builds it as a separate target only to reuse it elsewhere, and there is |
| 11 | +-- nothing else here to reuse it. |
| 12 | +-- |
| 13 | +-- WHAT IS NOT. `src/demux` and `src/mux` (animation and metadata containers: |
| 14 | +-- WebPDemux* / WebPMux*) are separate upstream libraries with their own public |
| 15 | +-- headers; they belong in a feature, and nothing asks for them yet. |
| 16 | +-- `examples/`, `extras/`, `imageio/` and `swig/` are tools and bindings. |
| 17 | +-- |
| 18 | +-- SIMD. Every `src/dsp/*_sse2.c`, `*_sse41.c`, `*_neon.c`, `*_mips*.c`, `*_msa.c` |
| 19 | +-- variant is compiled unconditionally and gates ITSELF: src/dsp/cpu.h keys off |
| 20 | +-- the compiler's own `__SSE2__` / `__SSE4_1__` / `__aarch64__` built-ins, so a |
| 21 | +-- variant that does not match the target compiles to an empty translation unit |
| 22 | +-- and the runtime CPU probe falls back to scalar. That is why the glob is safe |
| 23 | +-- and why there are no per-file flags here. |
| 24 | +-- |
| 25 | +-- SSE4.1 needs `-msse4.1` per file to actually be emitted, which this package |
| 26 | +-- does not add: it would make the artifact require an SSE4.1 CPU. x86-64's |
| 27 | +-- baseline SSE2 and aarch64's baseline NEON are both on without any flag. |
| 28 | +-- |
| 29 | +-- INCLUDE ROOTS, both of them. The library's own sources include flat from the |
| 30 | +-- archive root (`#include "src/dsp/dsp.h"`, `"sharpyuv/sharpyuv.h"`), while |
| 31 | +-- consumers include `<webp/decode.h>` — which lives at `src/webp/decode.h`. Both |
| 32 | +-- roots therefore travel to dependents. |
| 33 | +package = { |
| 34 | + spec = "1", |
| 35 | + namespace = "compat", |
| 36 | + name = "libwebp", |
| 37 | + description = "WebP image codec: encode + decode + sharpyuv, built from upstream sources", |
| 38 | + licenses = {"BSD-3-Clause"}, |
| 39 | + repo = "https://github.com/webmproject/libwebp", |
| 40 | + type = "package", |
| 41 | + |
| 42 | + xpm = { |
| 43 | + linux = { |
| 44 | + ["1.5.0"] = { |
| 45 | + url = { |
| 46 | + GLOBAL = "https://github.com/webmproject/libwebp/archive/refs/tags/v1.5.0.tar.gz", |
| 47 | + CN = "https://gitcode.com/mcpp-res/libwebp/releases/download/1.5.0/libwebp-1.5.0.tar.gz", |
| 48 | + }, |
| 49 | + sha256 = "668c9aba45565e24c27e17f7aaf7060a399f7f31dba6c97a044e1feacb930f37", |
| 50 | + }, |
| 51 | + }, |
| 52 | + macosx = { |
| 53 | + ["1.5.0"] = { |
| 54 | + url = { |
| 55 | + GLOBAL = "https://github.com/webmproject/libwebp/archive/refs/tags/v1.5.0.tar.gz", |
| 56 | + CN = "https://gitcode.com/mcpp-res/libwebp/releases/download/1.5.0/libwebp-1.5.0.tar.gz", |
| 57 | + }, |
| 58 | + sha256 = "668c9aba45565e24c27e17f7aaf7060a399f7f31dba6c97a044e1feacb930f37", |
| 59 | + }, |
| 60 | + }, |
| 61 | + windows = { |
| 62 | + ["1.5.0"] = { |
| 63 | + url = { |
| 64 | + GLOBAL = "https://github.com/webmproject/libwebp/archive/refs/tags/v1.5.0.tar.gz", |
| 65 | + CN = "https://gitcode.com/mcpp-res/libwebp/releases/download/1.5.0/libwebp-1.5.0.tar.gz", |
| 66 | + }, |
| 67 | + sha256 = "668c9aba45565e24c27e17f7aaf7060a399f7f31dba6c97a044e1feacb930f37", |
| 68 | + }, |
| 69 | + }, |
| 70 | + }, |
| 71 | + |
| 72 | + mcpp = { |
| 73 | + language = "c++23", |
| 74 | + import_std = false, |
| 75 | + c_standard = "c11", |
| 76 | + include_dirs = { "*", "*/src" }, |
| 77 | + -- 117 translation units, as five directory globs. Each directory holds |
| 78 | + -- only library code; the tools live in examples/ extras/ imageio/ swig/ |
| 79 | + -- and the container libraries in src/demux src/mux, none of which are |
| 80 | + -- matched here. |
| 81 | + sources = { |
| 82 | + "*/src/dec/*.c", |
| 83 | + "*/src/enc/*.c", |
| 84 | + "*/src/dsp/*.c", |
| 85 | + "*/src/utils/*.c", |
| 86 | + "*/sharpyuv/*.c", |
| 87 | + }, |
| 88 | + targets = { ["webp"] = { kind = "lib" } }, |
| 89 | + deps = { }, |
| 90 | + |
| 91 | + -- libm for the dsp math, pthread for utils/thread_utils.c's worker pool. |
| 92 | + -- Both are sysroot components, not third-party host libraries. Windows |
| 93 | + -- needs neither: the CRT carries the math and thread_utils uses the Win32 |
| 94 | + -- thread API directly. |
| 95 | + linux = { ldflags = { "-lpthread", "-lm" } }, |
| 96 | + macosx = { ldflags = { "-lpthread", "-lm" } }, |
| 97 | + }, |
| 98 | +} |
0 commit comments