├── .github ├── FUNDING.yml └── workflows │ └── package.yml ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── banner.png ├── build.sh ├── fastlane └── Fastfile └── templates └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: timoliver 2 | custom: https://tim.dev/paypal 3 | -------------------------------------------------------------------------------- /.github/workflows/package.yml: -------------------------------------------------------------------------------- 1 | # Clones and builds static frameworks of WebP for Apple's platforms, and releases them on GitHub. 2 | 3 | name: Release New WebP Build 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the main branch 7 | on: 8 | workflow_dispatch: 9 | inputs: 10 | version: 11 | description: 'WebP Version Tag' 12 | required: true 13 | default: 'v1.2.0' 14 | 15 | jobs: 16 | build: 17 | # Run on the latest version of macOS supported 18 | runs-on: macos-latest 19 | 20 | steps: 21 | # Check out the repo with our CI bot's credentials 22 | - name: Check out WebP-Cococa 23 | uses: actions/checkout@v2 24 | 25 | # Configure git credentials 26 | - name: Configure git credentials 27 | uses: fregante/setup-git-token@v1 28 | with: 29 | name: XD-CI 30 | email: ${{ secrets.CI_EMAIL }} 31 | token: ${{ secrets.API_TOKEN }} 32 | 33 | # Install the GNU tools to build from the command line 34 | - name: Install CL Tools 35 | run: brew install autoconf automake libtool 36 | 37 | # Execute fastlane 38 | - name: Run Fastlane 39 | run: bundle install && bundle exec fastlane package tag:${{ github.event.inputs.version }} --verbose 40 | env: 41 | API_TOKEN: ${{ secrets.API_TOKEN }} 42 | 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "fastlane" 4 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.5) 5 | rexml 6 | addressable (2.8.0) 7 | public_suffix (>= 2.0.2, < 5.0) 8 | artifactory (3.0.15) 9 | atomos (0.1.3) 10 | aws-eventstream (1.2.0) 11 | aws-partitions (1.543.0) 12 | aws-sdk-core (3.125.0) 13 | aws-eventstream (~> 1, >= 1.0.2) 14 | aws-partitions (~> 1, >= 1.525.0) 15 | aws-sigv4 (~> 1.1) 16 | jmespath (~> 1.0) 17 | aws-sdk-kms (1.53.0) 18 | aws-sdk-core (~> 3, >= 3.125.0) 19 | aws-sigv4 (~> 1.1) 20 | aws-sdk-s3 (1.110.0) 21 | aws-sdk-core (~> 3, >= 3.125.0) 22 | aws-sdk-kms (~> 1) 23 | aws-sigv4 (~> 1.4) 24 | aws-sigv4 (1.4.0) 25 | aws-eventstream (~> 1, >= 1.0.2) 26 | babosa (1.0.4) 27 | claide (1.0.3) 28 | colored (1.2) 29 | colored2 (3.1.2) 30 | commander (4.6.0) 31 | highline (~> 2.0.0) 32 | declarative (0.0.20) 33 | digest-crc (0.6.4) 34 | rake (>= 12.0.0, < 14.0.0) 35 | domain_name (0.5.20190701) 36 | unf (>= 0.0.5, < 1.0.0) 37 | dotenv (2.7.6) 38 | emoji_regex (3.2.3) 39 | excon (0.89.0) 40 | faraday (1.8.0) 41 | faraday-em_http (~> 1.0) 42 | faraday-em_synchrony (~> 1.0) 43 | faraday-excon (~> 1.1) 44 | faraday-httpclient (~> 1.0.1) 45 | faraday-net_http (~> 1.0) 46 | faraday-net_http_persistent (~> 1.1) 47 | faraday-patron (~> 1.0) 48 | faraday-rack (~> 1.0) 49 | multipart-post (>= 1.2, < 3) 50 | ruby2_keywords (>= 0.0.4) 51 | faraday-cookie_jar (0.0.7) 52 | faraday (>= 0.8.0) 53 | http-cookie (~> 1.0.0) 54 | faraday-em_http (1.0.0) 55 | faraday-em_synchrony (1.0.0) 56 | faraday-excon (1.1.0) 57 | faraday-httpclient (1.0.1) 58 | faraday-net_http (1.0.1) 59 | faraday-net_http_persistent (1.2.0) 60 | faraday-patron (1.0.0) 61 | faraday-rack (1.0.0) 62 | faraday_middleware (1.2.0) 63 | faraday (~> 1.0) 64 | fastimage (2.2.6) 65 | fastlane (2.199.0) 66 | CFPropertyList (>= 2.3, < 4.0.0) 67 | addressable (>= 2.8, < 3.0.0) 68 | artifactory (~> 3.0) 69 | aws-sdk-s3 (~> 1.0) 70 | babosa (>= 1.0.3, < 2.0.0) 71 | bundler (>= 1.12.0, < 3.0.0) 72 | colored 73 | commander (~> 4.6) 74 | dotenv (>= 2.1.1, < 3.0.0) 75 | emoji_regex (>= 0.1, < 4.0) 76 | excon (>= 0.71.0, < 1.0.0) 77 | faraday (~> 1.0) 78 | faraday-cookie_jar (~> 0.0.6) 79 | faraday_middleware (~> 1.0) 80 | fastimage (>= 2.1.0, < 3.0.0) 81 | gh_inspector (>= 1.1.2, < 2.0.0) 82 | google-apis-androidpublisher_v3 (~> 0.3) 83 | google-apis-playcustomapp_v1 (~> 0.1) 84 | google-cloud-storage (~> 1.31) 85 | highline (~> 2.0) 86 | json (< 3.0.0) 87 | jwt (>= 2.1.0, < 3) 88 | mini_magick (>= 4.9.4, < 5.0.0) 89 | multipart-post (~> 2.0.0) 90 | naturally (~> 2.2) 91 | optparse (~> 0.1.1) 92 | plist (>= 3.1.0, < 4.0.0) 93 | rubyzip (>= 2.0.0, < 3.0.0) 94 | security (= 0.1.3) 95 | simctl (~> 1.6.3) 96 | terminal-notifier (>= 2.0.0, < 3.0.0) 97 | terminal-table (>= 1.4.5, < 2.0.0) 98 | tty-screen (>= 0.6.3, < 1.0.0) 99 | tty-spinner (>= 0.8.0, < 1.0.0) 100 | word_wrap (~> 1.0.0) 101 | xcodeproj (>= 1.13.0, < 2.0.0) 102 | xcpretty (~> 0.3.0) 103 | xcpretty-travis-formatter (>= 0.0.3) 104 | gh_inspector (1.1.3) 105 | google-apis-androidpublisher_v3 (0.14.0) 106 | google-apis-core (>= 0.4, < 2.a) 107 | google-apis-core (0.4.1) 108 | addressable (~> 2.5, >= 2.5.1) 109 | googleauth (>= 0.16.2, < 2.a) 110 | httpclient (>= 2.8.1, < 3.a) 111 | mini_mime (~> 1.0) 112 | representable (~> 3.0) 113 | retriable (>= 2.0, < 4.a) 114 | rexml 115 | webrick 116 | google-apis-iamcredentials_v1 (0.9.0) 117 | google-apis-core (>= 0.4, < 2.a) 118 | google-apis-playcustomapp_v1 (0.6.0) 119 | google-apis-core (>= 0.4, < 2.a) 120 | google-apis-storage_v1 (0.10.0) 121 | google-apis-core (>= 0.4, < 2.a) 122 | google-cloud-core (1.6.0) 123 | google-cloud-env (~> 1.0) 124 | google-cloud-errors (~> 1.0) 125 | google-cloud-env (1.5.0) 126 | faraday (>= 0.17.3, < 2.0) 127 | google-cloud-errors (1.2.0) 128 | google-cloud-storage (1.35.0) 129 | addressable (~> 2.8) 130 | digest-crc (~> 0.4) 131 | google-apis-iamcredentials_v1 (~> 0.1) 132 | google-apis-storage_v1 (~> 0.1) 133 | google-cloud-core (~> 1.6) 134 | googleauth (>= 0.16.2, < 2.a) 135 | mini_mime (~> 1.0) 136 | googleauth (1.1.0) 137 | faraday (>= 0.17.3, < 2.0) 138 | jwt (>= 1.4, < 3.0) 139 | memoist (~> 0.16) 140 | multi_json (~> 1.11) 141 | os (>= 0.9, < 2.0) 142 | signet (>= 0.16, < 2.a) 143 | highline (2.0.3) 144 | http-cookie (1.0.4) 145 | domain_name (~> 0.5) 146 | httpclient (2.8.3) 147 | jmespath (1.4.0) 148 | json (2.6.1) 149 | jwt (2.3.0) 150 | memoist (0.16.2) 151 | mini_magick (4.11.0) 152 | mini_mime (1.1.2) 153 | multi_json (1.15.0) 154 | multipart-post (2.0.0) 155 | nanaimo (0.3.0) 156 | naturally (2.2.1) 157 | optparse (0.1.1) 158 | os (1.1.4) 159 | plist (3.6.0) 160 | public_suffix (4.0.6) 161 | rake (13.0.6) 162 | representable (3.1.1) 163 | declarative (< 0.1.0) 164 | trailblazer-option (>= 0.1.1, < 0.2.0) 165 | uber (< 0.2.0) 166 | retriable (3.1.2) 167 | rexml (3.2.5) 168 | rouge (2.0.7) 169 | ruby2_keywords (0.0.5) 170 | rubyzip (2.3.2) 171 | security (0.1.3) 172 | signet (0.16.0) 173 | addressable (~> 2.8) 174 | faraday (>= 0.17.3, < 2.0) 175 | jwt (>= 1.5, < 3.0) 176 | multi_json (~> 1.10) 177 | simctl (1.6.8) 178 | CFPropertyList 179 | naturally 180 | terminal-notifier (2.0.0) 181 | terminal-table (1.8.0) 182 | unicode-display_width (~> 1.1, >= 1.1.1) 183 | trailblazer-option (0.1.2) 184 | tty-cursor (0.7.1) 185 | tty-screen (0.8.1) 186 | tty-spinner (0.9.3) 187 | tty-cursor (~> 0.7) 188 | uber (0.1.0) 189 | unf (0.1.4) 190 | unf_ext 191 | unf_ext (0.0.8) 192 | unicode-display_width (1.8.0) 193 | webrick (1.7.0) 194 | word_wrap (1.0.0) 195 | xcodeproj (1.21.0) 196 | CFPropertyList (>= 2.3.3, < 4.0) 197 | atomos (~> 0.1.3) 198 | claide (>= 1.0.2, < 2.0) 199 | colored2 (~> 3.1) 200 | nanaimo (~> 0.3.0) 201 | rexml (~> 3.2.4) 202 | xcpretty (0.3.0) 203 | rouge (~> 2.0.7) 204 | xcpretty-travis-formatter (1.0.1) 205 | xcpretty (~> 0.2, >= 0.0.7) 206 | 207 | PLATFORMS 208 | ruby 209 | 210 | DEPENDENCIES 211 | fastlane 212 | 213 | BUNDLED WITH 214 | 2.3.3 215 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, Tim Oliver 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | WebP-Cocoa Banner 3 |

4 | 5 | [WebP](https://developers.google.com/speed/webp) is a modern image file format that provides amazing lossy and lossless compression fidelity. WebP is developed by Google who very kindly publishes the underlying library, [`libwepb` as open source software](https://chromium.googlesource.com/webm/libwebp/). 6 | 7 | Google provides precompiled binaries of WebP for both iOS and macOS on [WebP's download page](https://developers.google.com/speed/webp/download). However, at the time of writing, their build pipeline has not yet been updated to support the more modern features of Apple's platforms, such as Swift module support, or architectural slices for Mac Catalyst. 8 | 9 | Using Google's original iOS build script as a base, this repository uses GitHub Actions to automatically build and release precompiled WebP binaries for all of Apple's platforms. This includes support for watchOS and tvOS as well as support for Mac Catalyst via Apple's new `xcframework` format. 10 | 11 | There are 4 separate frameworks available for each platform: 12 | 13 | * **WebP**: Enables both encoding and decoding of WebP image files. 14 | * **WebPDecoder**: Enables just the decoding of WebP image files. 15 | * **WebPMux**: Enables manipulation of WebP container image features like color profile, metadata, animation. 16 | * **WebPDemux**: Enables extraction of image and extended format data from WebP files. 17 | 18 | # Installation Instructions 19 | 20 | 1. Download and extract the package for your platform and capabilities of choice. 21 | 2. Drag the `framework` folder into your Xcode project. 22 | 3. When prompted, make sure *Copy items if needed* is checked before proceeding. 23 | 24 | # Download Frameworks 25 | 26 | For fast access, the binaries are bundled up and provided in a variety of different ZIP archive combinations. Simply click any of the links below to begin downloading. 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | 56 | 85 | 86 | 87 | 88 | 89 | 95 | 124 | 125 | 126 | 127 | 128 | 134 | 163 | 164 | 165 | 166 | 167 | 175 | 204 | 205 |
31 | Download All Frameworks for All Platforms (ZIP) 32 |
PlatformVersionsSlicesDownload Packages
iOS
iPadOS
43 | iOS 9.0 and up.
44 | iPadOS 13.0 and up.
45 | Mac Catalyst 13.0 and up. 46 |
48 |
    49 |
  • arm64
  • 50 |
  • armv7
  • 51 |
  • armv7s
  • 52 |
  • x86_64
  • 53 |
  • i386
  • 54 |
55 |
57 | 84 |
macOSOS X 10.9 and up. 90 |
    91 |
  • x86_64
  • 92 |
  • arm64
  • 93 |
94 |
96 | 123 |
tvOStvOS 9.0 and up. 129 |
    130 |
  • arm64
  • 131 |
  • x86_64
  • 132 |
133 |
135 | 162 |
watchOSwatchOS 2.0 and up. 168 |
    169 |
  • arm64_32
  • 170 |
  • armv7k
  • 171 |
  • i386
  • 172 |
  • x86_64
  • 173 |
174 |
176 | 203 |
206 | 207 | # Dependency Managers 208 | 209 | If you would prefer to integrate `libwebp` via a dependency manager, the [`libwebp-Xcode`](https://github.com/SDWebImage/libwebp-Xcode) project managed by [SDWebImage](https://github.com/SDWebImage) already provides amazing support for all of the major dependency managers. 210 | 211 | For convenience, the configuration settings for using `libwebp-Xcode`'s packages are as follows: 212 | 213 | ### CocoaPods 214 | ```ruby 215 | pod 'libwebp' 216 | ``` 217 | 218 | ### Carthage 219 | ``` 220 | github "SDWebImage/libwebp-Xcode" 221 | ``` 222 | 223 | ### Swift Package Manager (SPM) 224 | ```swift 225 | let package = Package( 226 | dependencies: [ 227 | .package(url: "https://github.com/SDWebImage/libwebp-Xcode", from: "1.1.0") 228 | ], 229 | // ... 230 | ) 231 | ``` 232 | 233 | # Credits 234 | 235 | Repository created and maintained by [Tim Oliver](http://twitter.com/TimOliverAU). WebP logo artwork by [Simo99](https://commons.wikimedia.org/wiki/User:Simo99) used under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/). WebP is developed by [Google](http://about.google). 236 | 237 | # License 238 | 239 | All code in this repository is under the BSD-3-Clause License. Please see the [LICENSE](LICENSE) file for more information. 240 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TimOliver/WebP-Cocoa/d67f7283c3b0514a54533faaabcdaa79d730d71f/banner.png -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # BSD 3-Clause License 4 | # 5 | # Copyright (c) 2019-2020, Google, Tim Oliver 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are met: 10 | # 11 | # 1. Redistributions of source code must retain the above copyright notice, this 12 | # list of conditions and the following disclaimer. 13 | # 14 | # 2. Redistributions in binary form must reproduce the above copyright notice, 15 | # this list of conditions and the following disclaimer in the documentation 16 | # and/or other materials provided with the distribution. 17 | # 18 | # 3. Neither the name of the copyright holder nor the names of its 19 | # contributors may be used to endorse or promote products derived from 20 | # this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 26 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | set -e 34 | 35 | # Perform all operations in a sub-directory 36 | mkdir -p build 37 | cd build 38 | 39 | # Global Valuess 40 | readonly WEBP_GIT_URL="https://chromium.googlesource.com/webm/libwebp" 41 | readonly WEBP_SRC_DIR="libwebp" 42 | readonly TOPDIR=$(pwd) 43 | 44 | # Read the tag from ENV, or default to a manually specified one 45 | TAG_VERSION="v1.2.2" 46 | if [[ ! -z ${WEBP_TAG_VERSION} ]]; then 47 | TAG_VERSION=${WEBP_TAG_VERSION} 48 | fi 49 | 50 | # Extract Xcode version. 51 | readonly XCODE=$(xcodebuild -version | grep Xcode | cut -d " " -f2) 52 | if [[ -z "${XCODE}" ]]; then 53 | echo "Xcode not available" 54 | exit 1 55 | fi 56 | 57 | # Global Static 58 | readonly DEVELOPER=$(xcode-select --print-path) 59 | readonly PLATFORMSROOT="${DEVELOPER}/Platforms" 60 | readonly OLDPATH=${PATH} 61 | readonly EXTRA_CFLAGS="-fembed-bitcode" 62 | readonly LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo) 63 | 64 | usage() { 65 | cat <> ${TARGETDIR}/Headers/module.modulemap 338 | module WebP [system] { 339 | header "encode.h" 340 | header "types.h" 341 | export * 342 | 343 | module Decoder { 344 | header "decode.h" 345 | header "types.h" 346 | export * 347 | } 348 | } 349 | EOT 350 | LIBRARIES='' 351 | for LIBRARY in ${LIBLIST}; do 352 | LIBRARIES+="-library ${LIBRARY} -headers ${TARGETDIR}/Headers " 353 | done 354 | echo ${LIBRARIES} 355 | cp -a ${SRCDIR}/src/webp/{decode,encode,types}.h ${TARGETDIR}/Headers 356 | xcodebuild -create-xcframework ${LIBRARIES} \ 357 | -output ${TARGETDIR}/WebP.xcframework 358 | rm -rf ${TARGETDIR}/Headers 359 | 360 | # Make WebPDecoder.xcframework 361 | echo "DECLIBLIST = ${DECLIBLIST}" 362 | rm -rf ${TARGETDIR}/WebPDecoder.xcframework 363 | mkdir -p ${TARGETDIR}/Headers 364 | cat <> ${TARGETDIR}/Headers/module.modulemap 365 | module WebPDecoder [system] { 366 | header "decode.h" 367 | header "types.h" 368 | export * 369 | } 370 | EOT 371 | LIBRARIES='' 372 | for LIBRARY in ${DECLIBLIST}; do 373 | LIBRARIES+="-library ${LIBRARY} -headers ${TARGETDIR}/Headers " 374 | done 375 | cp -a ${SRCDIR}/src/webp/{decode,types}.h ${TARGETDIR}/Headers 376 | xcodebuild -create-xcframework ${LIBRARIES} \ 377 | -output ${TARGETDIR}/WebPDecoder.xcframework 378 | rm -rf ${TARGETDIR}/Headers 379 | 380 | # Make WebPMux.xcframework 381 | echo "MUXLIBLIST = ${MUXLIBLIST}" 382 | rm -rf ${TARGETDIR}/WebPMux.xcframework 383 | mkdir -p ${TARGETDIR}/Headers 384 | cat <> ${TARGETDIR}/Headers/module.modulemap 385 | module WebPMux [system] { 386 | header "mux.h" 387 | header "mux_types.h" 388 | header "types.h" 389 | export * 390 | } 391 | EOT 392 | LIBRARIES='' 393 | for LIBRARY in ${MUXLIBLIST}; do 394 | LIBRARIES+="-library ${LIBRARY} -headers ${TARGETDIR}/Headers " 395 | done 396 | cp -a ${SRCDIR}/src/webp/{types,mux,mux_types}.h ${TARGETDIR}/Headers 397 | xcodebuild -create-xcframework ${LIBRARIES} \ 398 | -output ${TARGETDIR}/WebPMux.xcframework 399 | rm -rf ${TARGETDIR}/Headers 400 | 401 | # Make WebPDemux.xcframework 402 | echo "DEMUXLIBLIST = ${DEMUXLIBLIST}" 403 | rm -rf ${TARGETDIR}/WebPDemux.xcframework 404 | mkdir -p ${TARGETDIR}/Headers 405 | cat <> ${TARGETDIR}/Headers/module.modulemap 406 | module WebPDemux [system] { 407 | header "decode.h" 408 | header "mux_types.h" 409 | header "types.h" 410 | header "demux.h" 411 | export * 412 | } 413 | EOT 414 | LIBRARIES='' 415 | for LIBRARY in ${DEMUXLIBLIST}; do 416 | LIBRARIES+="-library ${LIBRARY} -headers ${TARGETDIR}/Headers " 417 | done 418 | cp -a ${SRCDIR}/src/webp/{decode,types,mux_types,demux}.h ${TARGETDIR}/Headers 419 | xcodebuild -create-xcframework ${LIBRARIES} \ 420 | -output ${TARGETDIR}/WebPDemux.xcframework 421 | rm -rf ${TARGETDIR}/Headers 422 | } 423 | 424 | package_framework_platform() { 425 | FRAMEWORK_NAME=$1 426 | DESTINATION_NAME=$2 427 | 428 | # Check there is a valid build folder 429 | if [[ ! -d ${FRAMEWORK_NAME} ]]; then 430 | return 431 | fi 432 | 433 | # Define the build folder name and delete if already there 434 | ZIP_FILENAME="libwebp-${TAG_VERSION}-framework-${DESTINATION_NAME}" 435 | if [[ -d ${ZIP_FILENAME} ]]; then 436 | rm -rf ${ZIP_FILENAME} 437 | fi 438 | 439 | # Make a directory with that name and copy the framework folder in there 440 | mkdir -p ${ZIP_FILENAME} 441 | rsync -av --exclude=".*" ${FRAMEWORK_NAME}/. ${ZIP_FILENAME} 442 | 443 | # Generate the ZIP file 444 | if [[ -d "${ZIP_FILENAME}.zip" ]]; then 445 | rm -rf "${ZIP_FILENAME}.zip" 446 | fi 447 | zip -r "${ZIP_FILENAME}.zip" ${ZIP_FILENAME} 448 | 449 | # Delete the folder copy 450 | rm -rf ${ZIP_FILENAME} 451 | } 452 | 453 | package_all_frameworks() { 454 | PLATFORMS="iOS tvOS watchOS macOS" 455 | ZIP_FILENAME="libwebp-${TAG_VERSION}-framework" 456 | 457 | # Override ZIP name if supplied 458 | if [[ ! -z $1 ]]; then 459 | ZIP_FILENAME=$1 460 | fi 461 | 462 | # If supplied, put the frameworks in this directory 463 | ZIP_DIRECTORY=${ZIP_FILENAME} 464 | if [[ ! -z $2 ]]; then 465 | ZIP_DIRECTORY=$2/ 466 | fi 467 | 468 | # Make a directory to copy all of the frameworks into 469 | mkdir -p ${ZIP_DIRECTORY} 470 | 471 | # Copy all framework folders 472 | for PLATFORM in ${PLATFORMS}; do 473 | if [[ ! -d ${PLATFORM} ]]; then 474 | continue 475 | fi 476 | 477 | rsync -av --exclude=".*" ${PLATFORM} ${ZIP_DIRECTORY} 478 | done 479 | 480 | # Generate the ZIP file 481 | if [[ -d "${ZIP_FILENAME}.zip" ]]; then 482 | rm -rf "${ZIP_FILENAME}.zip" 483 | fi 484 | zip -r "${ZIP_FILENAME}.zip" ${ZIP_DIRECTORY} 485 | 486 | # Delete the folder copy 487 | rm -rf ${ZIP_FILENAME} 488 | } 489 | 490 | package_carthage() { 491 | PLATFORMS="iOS tvOS watchOS macOS" 492 | FRAMEWORKS="WebP WebPDecoder WebPDemux WebPMux" 493 | 494 | # Make a new folder for Carthage 495 | rm -rf Carthage 496 | mkdir -p Carthage 497 | 498 | # Loop through each framework name to collect all of the libraries 499 | for FRAMEWORK in ${FRAMEWORKS}; do 500 | PATHS='' 501 | # Loop through each platform and aggregate the libraries 502 | for PLATFORM in ${PLATFORMS}; do 503 | if [[ ! -d ${PLATFORM} ]]; then 504 | continue 505 | fi 506 | 507 | for BINARY in ${PLATFORM}/${FRAMEWORK}.xcframework/**/*.a; do 508 | PATHS+="-library ${BINARY} " 509 | done 510 | done 511 | 512 | xcodebuild -create-xcframework ${PATHS} -output Carthage/${FRAMEWORK}.xcframework 513 | done 514 | 515 | # Zip up the Carthage folder 516 | zip -r "Carthage.zip" Carthage 517 | } 518 | 519 | package_each_framework() { 520 | PLATFORM_NAME=$1 521 | ZIP_PLATFORM=$2 522 | FRAMEWORK_NAME=$3 523 | ZIP_FRAMEWORK=$4 524 | 525 | ZIP_FILENAME="libwebp-${TAG_VERSION}-framework-${ZIP_PLATFORM}-${ZIP_FRAMEWORK}" 526 | FRAMEWORK_PATH="${PLATFORM_NAME}/${FRAMEWORK_NAME}" 527 | 528 | # Exit out if there's no matching framework to ZIP 529 | if [[ ! -d ${FRAMEWORK_PATH} ]]; then 530 | return 531 | fi 532 | 533 | # Make a directory to copy all of the frameworks into 534 | mkdir -p ${ZIP_FILENAME} 535 | 536 | # Copy the framework to the folder 537 | rsync -av --exclude=".*" ${FRAMEWORK_PATH} ${ZIP_FILENAME} 538 | 539 | # Generate the ZIP file 540 | if [[ -d "${ZIP_FILENAME}.zip" ]]; then 541 | rm -rf "${ZIP_FILENAME}.zip" 542 | fi 543 | zip -r "${ZIP_FILENAME}.zip" ${ZIP_FILENAME} 544 | 545 | # Delete the folder copy 546 | rm -rf ${ZIP_FILENAME} 547 | } 548 | 549 | # Commands 550 | COMMAND="$1" 551 | case "$COMMAND" in 552 | 553 | "all") 554 | clone_repo 555 | build_ios 556 | build_tvos 557 | build_macos 558 | build_watchos 559 | exit 0 560 | ;; 561 | 562 | "ios") 563 | clone_repo 564 | build_ios 565 | exit 0 566 | ;; 567 | 568 | "tvos") 569 | clone_repo 570 | build_tvos 571 | exit 0 572 | ;; 573 | 574 | "macos") 575 | clone_repo 576 | build_macos 577 | exit 0 578 | ;; 579 | 580 | "watchos") 581 | clone_repo 582 | build_watchos 583 | exit 0 584 | ;; 585 | 586 | "package-carthage") 587 | package_carthage 588 | exit 0;; 589 | 590 | "package-platform") 591 | package_framework_platform "iOS" "ios" 592 | package_framework_platform "tvOS" "tvos" 593 | package_framework_platform "watchOS" "watchos" 594 | package_framework_platform "macOS" "macos" 595 | exit 0;; 596 | 597 | "package-each") 598 | package_each_framework "iOS" "ios" "WebP.xcframework" "webp" 599 | package_each_framework "iOS" "ios" "WebPDecoder.xcframework" "webpdecoder" 600 | package_each_framework "iOS" "ios" "WebPDemux.xcframework" "webpdemux" 601 | package_each_framework "iOS" "ios" "WebPMux.xcframework" "webpmux" 602 | package_each_framework "tvOS" "tvos" "WebP.xcframework" "webp" 603 | package_each_framework "tvOS" "tvos" "WebPDecoder.xcframework" "webpdecoder" 604 | package_each_framework "tvOS" "tvos" "WebPDemux.xcframework" "webpdemux" 605 | package_each_framework "tvOS" "tvos" "WebPMux.xcframework" "webpmux" 606 | package_each_framework "macOS" "macos" "WebP.xcframework" "webp" 607 | package_each_framework "macOS" "macos" "WebPDecoder.xcframework" "webpdecoder" 608 | package_each_framework "macOS" "macos" "WebPDemux.xcframework" "webpdemux" 609 | package_each_framework "macOS" "macos" "WebPMux.xcframework" "webpmux" 610 | package_each_framework "watchOS" "watchos" "WebP.xcframework" "webp" 611 | package_each_framework "watchOS" "watchos" "WebPDecoder.xcframework" "webpdecoder" 612 | package_each_framework "watchOS" "watchos" "WebPDemux.xcframework" "webpdemux" 613 | package_each_framework "watchOS" "watchos" "WebPMux.xcframework" "webpmux" 614 | exit 0;; 615 | 616 | "package-all") 617 | package_all_frameworks 618 | exit 0; 619 | esac 620 | 621 | # Print usage instructions if no arguments were set 622 | if [ "$#" -eq 0 -o "$#" -gt 3 ]; then 623 | usage 624 | exit 1 625 | fi 626 | -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | desc "Build, package and upload all of the WebP framework binaries" 2 | lane :package do |options| 3 | tag = options[:tag] 4 | 5 | # Get the tag for the version we want to build 6 | if tag 7 | ENV["WEBP_TAG_VERSION"] = tag 8 | else 9 | UI.user_error!("No tag specified. Please specify a libwebp repo tag to target.") 10 | end 11 | 12 | # Verify we haven't shipped this tag before 13 | if git_tag_exists(tag: tag) 14 | UI.user_error!("Tag #{tag} already exists! Please use a different one.") 15 | end 16 | 17 | # Build the binaries 18 | UI.message "Building binaries..." 19 | sh "cd .. && sh build.sh all" 20 | UI.success "... done!" 21 | 22 | # Package up the main bundle 23 | UI.message "Building main package" 24 | sh "cd .. && sh build.sh package-all" 25 | UI.success "...done!" 26 | 27 | # Package up a Carthage variant 28 | UI.message "Building Carthage package" 29 | sh "cd .. && sh build.sh package-carthage" 30 | UI.success "...done!" 31 | 32 | # Package up all of the platform frameworks 33 | UI.message "Building platform packages" 34 | sh "cd .. && sh build.sh package-platform" 35 | UI.success "...done!" 36 | 37 | # Package up all of the separate frameworks 38 | UI.message "Building all separate packages" 39 | sh "cd .. && sh build.sh package-each" 40 | UI.success "...done!" 41 | 42 | # Get all of the files we created 43 | files = Dir["../build/*.zip"].map { |path| File.expand_path(path) } 44 | 45 | # Update the README with the links to the new version 46 | readme_text = File.read("../templates/README.md") 47 | readme_text = readme_text.gsub("{tag_version}", tag) 48 | File.write("../README.md", readme_text) 49 | 50 | # Commit the new README to GitHub 51 | begin 52 | git_pull 53 | git_add(path: "README.md") 54 | git_commit(path: "README.md", message: "Created Release " + tag) 55 | push_to_git_remote 56 | rescue => ex 57 | UI.error(ex) 58 | end 59 | 60 | # Cut a new release on GitHub Releases 61 | UI.message "Uploading to GitHub Releases" 62 | set_github_release( 63 | repository_name: "TimOliver/WebP-Cocoa", 64 | api_token: ENV["API_TOKEN"], 65 | name: tag, 66 | tag_name: tag, 67 | description: "", 68 | commitish: "main", 69 | upload_assets: files 70 | ) 71 | UI.success "...done!" 72 | 73 | end 74 | -------------------------------------------------------------------------------- /templates/README.md: -------------------------------------------------------------------------------- 1 |

2 | WebP-Cocoa Banner 3 |

4 | 5 | [WebP](https://developers.google.com/speed/webp) is a modern image file format that provides amazing lossy and lossless compression fidelity. WebP is developed by Google who very kindly publishes the underlying library, [`libwepb` as open source software](https://chromium.googlesource.com/webm/libwebp/). 6 | 7 | Google provides precompiled binaries of WebP for both iOS and macOS on [WebP's download page](https://developers.google.com/speed/webp/download). However, at the time of writing, their build pipeline has not yet been updated to support the more modern features of Apple's platforms, such as Swift module support, or architectural slices for Mac Catalyst. 8 | 9 | Using Google's original iOS build script as a base, this repository uses GitHub Actions to automatically build and release precompiled WebP binaries for all of Apple's platforms. This includes support for watchOS and tvOS as well as support for Mac Catalyst via Apple's new `xcframework` format. 10 | 11 | There are 4 separate frameworks available for each platform: 12 | 13 | * **WebP**: Enables both encoding and decoding of WebP image files. 14 | * **WebPDecoder**: Enables just the decoding of WebP image files. 15 | * **WebPMux**: Enables manipulation of WebP container image features like color profile, metadata, animation. 16 | * **WebPDemux**: Enables extraction of image and extended format data from WebP files. 17 | 18 | # Installation Instructions 19 | 20 | 1. Download and extract the package for your platform and capabilities of choice. 21 | 2. Drag the `framework` folder into your Xcode project. 22 | 3. When prompted, make sure *Copy items if needed* is checked before proceeding. 23 | 24 | # Download Frameworks 25 | 26 | For fast access, the binaries are bundled up and provided in a variety of different ZIP archive combinations. Simply click any of the links below to begin downloading. 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | 56 | 85 | 86 | 87 | 88 | 89 | 95 | 124 | 125 | 126 | 127 | 128 | 134 | 163 | 164 | 165 | 166 | 167 | 175 | 204 | 205 |
31 | Download All Frameworks for All Platforms (ZIP) 32 |
PlatformVersionsSlicesDownload Packages
iOS
iPadOS
43 | iOS 9.0 and up.
44 | iPadOS 13.0 and up.
45 | Mac Catalyst 13.0 and up. 46 |
48 |
    49 |
  • arm64
  • 50 |
  • armv7
  • 51 |
  • armv7s
  • 52 |
  • x86_64
  • 53 |
  • i386
  • 54 |
55 |
57 | 84 |
macOSOS X 10.9 and up. 90 |
    91 |
  • x86_64
  • 92 |
  • arm64
  • 93 |
94 |
96 | 123 |
tvOStvOS 9.0 and up. 129 |
    130 |
  • arm64
  • 131 |
  • x86_64
  • 132 |
133 |
135 | 162 |
watchOSwatchOS 2.0 and up. 168 |
    169 |
  • arm64_32
  • 170 |
  • armv7k
  • 171 |
  • i386
  • 172 |
  • x86_64
  • 173 |
174 |
176 | 203 |
206 | 207 | # Dependency Managers 208 | 209 | If you would prefer to integrate `libwebp` via a dependency manager, the [`libwebp-Xcode`](https://github.com/SDWebImage/libwebp-Xcode) project managed by [SDWebImage](https://github.com/SDWebImage) already provides amazing support for all of the major dependency managers. 210 | 211 | For convenience, the configuration settings for using `libwebp-Xcode`'s packages are as follows: 212 | 213 | ### CocoaPods 214 | ```ruby 215 | pod 'libwebp' 216 | ``` 217 | 218 | ### Carthage 219 | ``` 220 | github "SDWebImage/libwebp-Xcode" 221 | ``` 222 | 223 | ### Swift Package Manager (SPM) 224 | ```swift 225 | let package = Package( 226 | dependencies: [ 227 | .package(url: "https://github.com/SDWebImage/libwebp-Xcode", from: "1.1.0") 228 | ], 229 | // ... 230 | ) 231 | ``` 232 | 233 | # Credits 234 | 235 | Repository created and maintained by [Tim Oliver](http://twitter.com/TimOliverAU). WebP logo artwork by [Simo99](https://commons.wikimedia.org/wiki/User:Simo99) used under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/). WebP is developed by [Google](http://about.google). 236 | 237 | # License 238 | 239 | All code in this repository is under the BSD-3-Clause License. Please see the [LICENSE](LICENSE) file for more information. 240 | --------------------------------------------------------------------------------