From 3857d9600c9488c6255ab32d39151ebb08a2f19b Mon Sep 17 00:00:00 2001 From: Ryan Parman Date: Tue, 22 Oct 2019 10:43:13 -0700 Subject: [PATCH] Initial commit. --- Formula/webp-full.rb | 37 ++++++++++++++++++++++++ Makefile | 68 ++++++++++++++++++++++++++++++++++++++++++++ README.sh | 37 ++++++++++++++++++++++++ azure-pipelines.yml | 15 ++++++++++ 4 files changed, 157 insertions(+) create mode 100644 Formula/webp-full.rb create mode 100644 Makefile create mode 100755 README.sh create mode 100644 azure-pipelines.yml diff --git a/Formula/webp-full.rb b/Formula/webp-full.rb new file mode 100644 index 0000000..bcea28c --- /dev/null +++ b/Formula/webp-full.rb @@ -0,0 +1,37 @@ +class WebpFull < Formula + desc "Image format providing lossless and lossy compression for web images" + homepage "https://developers.google.com/speed/webp/" + url "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.3.tar.gz" + sha256 "e20a07865c8697bba00aebccc6f54912d6bc333bb4d604e6b07491c1a226b34f" + + bottle do + cellar :any + sha256 "6bce8ee7b2b0cb615ea73deed3de3f345bcec05720222bd23882d4d8b7424fb6" => :catalina + sha256 "347c02d4de7afe9e5e73391d293a19f89d40957fafd757656011dea270227838" => :mojave + sha256 "c21dfa59400041f1e1976c3b9721bf10c7df35bf1514f3182d6911db3fb85ebf" => :high_sierra + sha256 "dd8d1b68c16db0a5861f4be748456fa745dca31e22a708a6eb4f6374b03debbe" => :sierra + end + + head do + url "https://chromium.googlesource.com/webm/libwebp.git" + depends_on "autoconf" => :build + depends_on "automake" => :build + depends_on "libtool" => :build + end + + depends_on "jpeg" + depends_on "libpng" + depends_on "libtiff" + + def install + system "./autogen.sh" if build.head? + system "./configure", "--prefix=#{prefix}", "--enable-everything" + system "make", "install" + end + + test do + system bin/"cwebp", test_fixtures("test.png"), "-o", "webp_test.png" + system bin/"dwebp", "webp_test.png", "-o", "webp_test.webp" + assert_predicate testpath/"webp_test.webp", :exist? + end +end diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..49439f9 --- /dev/null +++ b/Makefile @@ -0,0 +1,68 @@ +# coreutils/findutils versions +# https://ryanparman.com/posts/2019/using-gnu-command-line-tools-in-macos-instead-of-freebsd-tools/ +AWK=/usr/local/opt/gawk/libexec/gnubin/awk +GREP=/usr/local/opt/grep/libexec/gnubin/grep +NPROC=/usr/local/opt/coreutils/libexec/gnubin/nproc +SED=/usr/local/opt/gnu-sed/libexec/gnubin/sed +SORT=/usr/local/opt/coreutils/libexec/gnubin/sort +TEE=/usr/local/opt/coreutils/libexec/gnubin/tee +UNIQ=/usr/local/opt/coreutils/libexec/gnubin/uniq +XARGS=/usr/local/opt/findutils/libexec/gnubin/xargs + +#------------------------------------------------------------------------------- + +all: + @cat Makefile | $(GREP) "^[a-z]" | $(SED) 's/://' | $(AWK) '{print $$1}' + +.PHONY: clean +clean: + rm -Rf ./docs/* + +#------------------------------------------------------------------------------- + +.PHONY: config +config: + ffmpeg -hide_banner -buildconf | $(GREP) --color=never "^ --" | $(AWK) '{print $$1}' | $(UNIQ) | $(TEE) docs/buildconf.txt + +.PHONY: muxers +muxers: + ffmpeg -hide_banner -muxers | $(GREP) --color=never "^ E " | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(TEE) docs/muxers.txt + +.PHONY: demuxers +demuxers: + ffmpeg -hide_banner -demuxers | $(GREP) --color=never "^ D " | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(TEE) docs/demuxers.txt + +.PHONY: codecs-decode +codecs-decode: + ffmpeg -hide_banner -codecs | $(GREP) --color=never "^ D" | $(GREP) --color=never -v "=" | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/codecs-decode.txt + +.PHONY: codecs-encode +codecs-encode: + ffmpeg -hide_banner -codecs | $(GREP) --color=never "^ .E" | $(GREP) --color=never -v "=" | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/codecs-encode.txt + +.PHONY: decoders +decoders: + ffmpeg -hide_banner -decoders | $(GREP) --color=never -E "^ (V|A|S)" | $(GREP) --color=never -v "=" | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/decoders.txt + +.PHONY: encoders +encoders: + ffmpeg -hide_banner -encoders | $(GREP) --color=never -E "^ (V|A|S)" | $(GREP) --color=never -v "=" | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/encoders.txt + +.PHONY: bsfs +bsfs: + ffmpeg -hide_banner -bsfs | $(GREP) --color=never -v "Bitstream filters:" | $(AWK) '{print $$1}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/bsfs.txt + +.PHONY: pix +pix: + ffmpeg -hide_banner -pix_fmts | $(GREP) --color=never -E "^(I|\.)" | $(GREP) --color=never -v "=" | $(AWK) '{print $$2}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/pix_fmts.txt + +.PHONY: hwaccels +hwaccels: + ffmpeg -hide_banner -hwaccels| $(GREP) --color=never -v "Hardware acceleration methods:" | $(AWK) '{print $$1}' | $(XARGS) -I% bash -c 'echo "\`%\`"' _ % | $(UNIQ) | $(SORT) | $(TEE) docs/hwaccels.txt + +.PHONY: readme +readme: + ./README.sh + +.PHONY: docs +docs: bsfs codecs-decode codecs-encode config decoders demuxers encoders hwaccels muxers pix readme diff --git a/README.sh b/README.sh new file mode 100755 index 0000000..ad6bbf9 --- /dev/null +++ b/README.sh @@ -0,0 +1,37 @@ +#! /usr/bin/env bash + +cat << EOF > "README.md" +# homebrew-webp + +A complete build of [libwebp](https://developers.google.com/speed/webp/docs/using), including all CLI tools. + +## Installation + +\`brew install skyzyx/webp/webp-full\` + +Or \`brew tap skyzyx/webp\` and then \`brew install webp-full\`. + +Or install via URL (which will not receive updates): + +\`\`\`bash +brew install https://raw.githubusercontent.com/skyzyx/homebrew-webp/master/Formula/webp-full.rb +\`\`\` + +## Support + +Includes the following binaries: + +| Binary | Description | +| ------ | ----------- | +| \`cwebp\` | Compress an image file to a WebP file. | +| \`dwebp\` | Decompress a WebP file to a PNG, PAM, PPM, or PGM image file. | +| \`gif2webp\` | Convert a GIF image to WebP (including animated ones). | +| \`img2webp\` | Create animated WebP file from a sequence of input images. | +| \`vwebp\` | Decompress a WebP file and display it in a window using OpenGL. | +| \`webpinfo\` | Print out the chunk level structure of WebP files along with basic integrity checks. | +| \`webpmux\` | Create animated WebP files from non-animated WebP images, extract frames from animated WebP images, and manage XMP/EXIF metadata and ICC profile. | + +## Documentation + +\`brew help\`, \`man brew\` or check [Homebrew's documentation](https://docs.brew.sh). +EOF diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..f7ac644 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,15 @@ +jobs: +- job: macOS + pool: + vmImage: macOS-10.14 + steps: + - bash: | + set -e + sudo xcode-select --switch /Applications/Xcode_10.2.app/Contents/Developer + brew update + HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/skyzyx/homebrew-ffmpeg" + mkdir -p "$HOMEBREW_TAP_DIR" + rm -rf "$HOMEBREW_TAP_DIR" + ln -s "$PWD" "$HOMEBREW_TAP_DIR" + brew test-bot + displayName: Run brew test-bot