diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e0ece8e49..ada00a48d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3636,7 +3636,6 @@ if(SHELLCHECK_EXECUTABLE) packaging/macosx/osx-app.sh.in packaging/macosx/osx-dmg.sh.in packaging/source/git-export-release.sh.in - tools/compress-pngs.sh tools/debian-setup.sh tools/fuzz-test.sh tools/gen-bugnote diff --git a/docbook/CMakeLists.txt b/docbook/CMakeLists.txt index 264b964595..76234fd150 100644 --- a/docbook/CMakeLists.txt +++ b/docbook/CMakeLists.txt @@ -78,7 +78,7 @@ set(WSUG_FILES ${COMMON_FILES} ) -# Note: Images should be minimized using tools/compress-pngs.sh. +# Note: Images should be minimized using tools/compress-pngs.py. set(WSUG_GRAPHICS wsug_graphics/related-ack.png wsug_graphics/related-current.png diff --git a/tools/alpine-setup.sh b/tools/alpine-setup.sh index a43d0540f6..11712fbb71 100755 --- a/tools/alpine-setup.sh +++ b/tools/alpine-setup.sh @@ -77,6 +77,13 @@ ADDITIONAL_LIST=" brotli-dev \ " +# Uncomment to add PNG compression utilities used by compress-pngs: +# ADDITIONAL_LIST="$ADDITIONAL_LIST \ +# advancecomp \ +# optipng \ +# oxipng \ +# pngcrush" + # Adds package $2 to list variable $1 if the package is found. # If $3 is given, then this version requirement must be satisfied. add_package() { diff --git a/tools/bsd-setup.sh b/tools/bsd-setup.sh index 72a99e05a2..220ec6d6cf 100755 --- a/tools/bsd-setup.sh +++ b/tools/bsd-setup.sh @@ -58,6 +58,12 @@ ADDITIONAL_LIST="\ lua52 \ " +# Uncomment to add PNG compression utilities used by compress-pngs: +# ADDITIONAL_LIST="$ADDITIONAL_LIST \ +# advancecomp \ +# optipng \ +# pngcrush" + # Guess which package manager we will use PM=`which pkgin 2> /dev/null || which pkg 2> /dev/null || which pkg_add 2> /dev/null` diff --git a/tools/compress-pngs.py b/tools/compress-pngs.py new file mode 100755 index 0000000000..3b715d3589 --- /dev/null +++ b/tools/compress-pngs.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python3 +# +# Compress PNGs +# +# By Gerald Combs -# Copyright 2013 Gerald Combs -# -# SPDX-License-Identifier: GPL-2.0-or-later -# - -while getopts h OPTCHAR -do - case $OPTCHAR in - h|?) - echo "Usage: compress-pngs.sh file1.png [file2.png] ..." 1>&1 - exit 0 - ;; - esac -done - -# Other utilities: -# PNGOUT (http://advsys.net/ken/utils.htm). Closed source. -# pngquant (https://pngquant.org/). Lossy. - -JOBS=8 -PNG_FILES=$(printf "%q " "$@") -export PNG_FILES -( - cat <<"FIN" - -all: $(PNG_FILES) - -$(PNG_FILES): FORCE - @echo Compressing $@ - @hash oxipng 2>/dev/null && oxipng --opt 4 --strip safe "$@" - @hash optipng 2>/dev/null && optipng -o3 -quiet "$@" - @hash advpng 2>/dev/null && advpng --recompress --shrink-insane "$@" - @hash advdef 2>/dev/null && advdef --recompress --shrink-insane "$@" - @hash pngcrush 2>/dev/null && pngcrush -q -ow -brute -reduce -noforce "$@" pngout.$$$$.png - -FORCE: -FIN - -) | make -j $JOBS -f - diff --git a/tools/debian-setup.sh b/tools/debian-setup.sh index f810ab9bb3..656c0e4808 100755 --- a/tools/debian-setup.sh +++ b/tools/debian-setup.sh @@ -89,6 +89,12 @@ ADDITIONAL_LIST="libnl-3-dev \ xsltproc \ libspeexdsp-dev" +# Uncomment to add PNG compression utilities used by compress-pngs: +# ADDITIONAL_LIST="$ADDITIONAL_LIST \ +# advancecomp \ +# optipng \ +# pngcrush" + DEBDEPS_LIST="debhelper \ dh-python \ docbook-xml \ diff --git a/tools/macos-setup-brew.sh b/tools/macos-setup-brew.sh index 001177ddb2..5b084f37a9 100755 --- a/tools/macos-setup-brew.sh +++ b/tools/macos-setup-brew.sh @@ -19,6 +19,9 @@ brew install sparkle opus c-ares glib libgcrypt gnutls lua@5.1 cmake python nght # Uncomment to enable automatic updates using Sparkle # brew cask install sparkle +# Uncomment to add PNG compression utilities used by compress-pngs: +# brew install advancecomp optipng oxipng pngcrush + brew doctor exit 0 diff --git a/tools/rpm-setup.sh b/tools/rpm-setup.sh index e2ecaf306f..ce88eef0b1 100755 --- a/tools/rpm-setup.sh +++ b/tools/rpm-setup.sh @@ -56,7 +56,7 @@ BASIC_LIST="cmake \ glib2-devel \ libpcap-devel \ zlib-devel \ - libgcrypt-devel" + libgcrypt-devel" ADDITIONAL_LIST="libcap-devel \ libssh-devel \ @@ -69,6 +69,13 @@ ADDITIONAL_LIST="libcap-devel \ spandsp-devel \ systemd-devel" +# Uncomment to add PNG compression utilities used by compress-pngs: +# ADDITIONAL_LIST="$ADDITIONAL_LIST \ +# advancecomp \ +# optipng \ +# oxipng \ +# pngcrush" + RPMDEPS_LIST="rpm-build" # Guess which package manager we will use