summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/mozjpeg/README71
-rw-r--r--graphics/mozjpeg/mozjpeg.SlackBuild133
-rw-r--r--graphics/mozjpeg/mozjpeg.info6
-rw-r--r--graphics/mozjpeg/mozjpeg.sh8
4 files changed, 114 insertions, 104 deletions
diff --git a/graphics/mozjpeg/README b/graphics/mozjpeg/README
index 00b151318f..a8d968a844 100644
--- a/graphics/mozjpeg/README
+++ b/graphics/mozjpeg/README
@@ -1,41 +1,60 @@
mozjpeg (Mozilla JPEG Encoder Project)
-mozjpeg is a fork of libjpeg-turbo from Mozilla Research. Its goal is to
-reduce the size of JPEG files without reducing quality or compatibility
-with the vast majority of the world's deployed decoders. The idea is to
-reduce transfer times for JPEGs on the Web, thus reducing page load times.
-
-mozjpeg is not intended to be a general JPEG library replacement. It makes
-tradeoffs that are intended to benefit Web use cases and focuses solely
-on improving encoding. It is best used as part of a Web encoding workflow.
-
-In essence, libjpeg-turbo (as shipped with Slackware) is optimized for
-speed of encoding/decoding, while mozjpeg is optimized for encoding
-smaller file sizes (at the expense of speed). mozjpeg will not interfere
-with Slackware's libjpeg-turbo package, as it installs to /opt/mozjpeg/.
+mozjpeg is a fork of libjpeg-turbo from Mozilla Research. Its
+goal is to reduce the size of JPEG files without reducing quality
+or compatibility with the vast majority of the world's deployed
+decoders. The idea is to reduce transfer times for JPEGs on the Web,
+thus reducing page load times.
+
+mozjpeg is not intended to be a general JPEG library replacement. It
+makes tradeoffs that are intended to benefit Web use cases and
+focuses solely on improving encoding. It is best used as part of a Web
+encoding workflow.
+
+In essence, libjpeg-turbo (as shipped with Slackware) is optimized
+for speed of encoding/decoding, while mozjpeg is optimized for
+encoding smaller file sizes (at the expense of speed). mozjpeg will
+not interfere with Slackware's libjpeg-turbo package, as it installs
+to /opt/mozjpeg/.
mozjpeg supports multiple versions of the libjpeg API. By default,
version 6b is built. If you need compatibility with libjpeg 7 or 8,
set API=7 or API=8 in the script's environment.
-Optionally, mozjpeg can be built with Java wrapper support for
-turbojpeg. To do this, install one of: jdk, openjdk, openjdk8, or
-openjdk6. Then run this script with JAVA=yes in the environment.
+Usage
+-----
+To run the binaries, either call them by their full paths, e.g:
-To run the binaries, it's probably easiest to add this to ~/.bash_profile:
+$ /opt/mozjpeg/bin/cjpeg
-export PATH=/opt/mozjpeg/bin:$PATH
-export MANPATH=/opt/mozjpeg/man:$MANPATH
+...or else:
-To compile & link with the mozjpeg libraries, use -I/opt/mozjpeg/include
-and -L/opt/mozjpeg/lib (or lib64). You might also want -static, or
-else -Wl,-rpath,/opt/mozjpeg/lib (or lib64). Starting with version 3.2,
-there's also pkg-config support for mozjpeg. In ~/.bash_profile:
+$ source /etc/profile.d/mozjpeg.sh
-export PKG_CONFIG_PATH=/opt/mozjpeg/lib64/pkgconfig:$PKG_CONFIG_PATH
+...to temporarily make mozjpeg the default, in the current shell.
+Running e.g. "cjpeg" will now run the mozjpeg one. If you wanted to
+do this permanently for all users (not recommended), you could:
-(chage lib64 to lib, for 32-bit Slackware)
+# chmod +x /etc/profile.d/mozjpeg.sh
-If you built with JAVA=yes, the java library will be installed
+...then log out and back in. The profile script isn't executable by
+default, to avoid surprises.
+
+Development
+-----------
+To compile & link with the mozjpeg libraries, use -I/opt/mozjpeg/include
+and -L/opt/mozjpeg/lib (or lib64). You might also want -static, or
+else -Wl,-rpath,/opt/mozjpeg/lib (or lib64). Starting with version 3.2,
+there's also pkg-config support for mozjpeg. If you source the profile
+script, software that uses pkg-config should find and link with the
+mozjpeg libraries automatically.
+
+Java Support
+------------
+Optionally, mozjpeg can be built with Java wrapper support
+for turbojpeg. To do this, install one of: jdk, openjdk8,
+openjdk7, or openjdk6 (or possibly one of the zulu-openjdk*
+or adoptopenjdk* packages; untested). Then run this script with
+JAVA=yes in the environment. The Java library will be installed
as /opt/mozjpeg/classes/turbojpeg.jar, and the docs will be in
/usr/doc/mozjpeg-$VERSION/javadoc.
diff --git a/graphics/mozjpeg/mozjpeg.SlackBuild b/graphics/mozjpeg/mozjpeg.SlackBuild
index c752946864..ecf3732720 100644
--- a/graphics/mozjpeg/mozjpeg.SlackBuild
+++ b/graphics/mozjpeg/mozjpeg.SlackBuild
@@ -25,6 +25,18 @@
# with this program (most likely, a file named COPYING). If not, see
# <http://www.gnu.org/licenses/>.
+# 20210310 bkw: update for v4.0.3.
+# - upstream switched from autoconf to cmake, so this script can't
+# build older versions any more.
+# - cmake chokes when trying to build static libs, apparently because
+# we don't have a static libpng.a. So no more static libs in this
+# package until further notice. If you actually care about this,
+# remind me to look into it again.
+# - get rid of man pages, they're identical to the ones from libjpeg-turbo.
+# - add profile script.
+# - add -Wl,-rpath to .pc files.
+# - install HTML docs in /usr/doc.
+
# 20180101 bkw: Update for v3.3.1. Script still works with 3.1 and 3.2,
# if you can think of a use for them.
@@ -45,7 +57,7 @@
# - BUILD=2
PRGNAM=mozjpeg
-VERSION=${VERSION:-3.3.1}
+VERSION=${VERSION:-4.0.3}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -85,19 +97,18 @@ rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
-find -L . \
- \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
- -o -perm 511 \) -exec chmod 755 {} \; -o \
- \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
- -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-
-# JAVA=yes only tested with openjdk and openjdk6. We source the profile.d
-# script here in case someone's *just* installed jdk|openjdk, so they
-# won't have to log out & back in to get this built. This mostly helps
-# out sbopkg users.
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+ARGS=""
+
+# JAVA=yes only tested with openjdk8. We source the profile.d script
+# here in case someone's *just* installed jdk|openjdk, so they won't
+# have to log out & back in to get this built. This mostly helps out
+# sbopkg users.
JAVA="${JAVA:-no}"
if [ "$JAVA" = "yes" ]; then
- EXTRAOPTS="--with-java "
+ ARGS+="-DWITH_JAVA=TRUE "
# Find a JDK. Presumably a sane admin will only have one of these
# profile scripts executable, even if he's installed all of them.
@@ -105,84 +116,56 @@ if [ "$JAVA" = "yes" ]; then
# sure it actually matters that much ("write once, run anywhere" should
# mean a .jar built with openjdk will run with Oracle's jdk, right? But
# there's JNI (native code) involved...)
- for i in jdk openjdk8 openjdk openjdk6; do
+ for i in jdk openjdk8 openjdk7 openjdk6; do
if [ -x /etc/profile.d/$i.sh ]; then
source /etc/profile.d/$i.sh
break
fi
done
-
- # Whichever jdk we decided to use, use its JAVA_HOME. Unfortunately
- # mozjpeg ignores the *standard* JAVA_HOME env var, so we persuade
- # it thus:
- sed -i "s,/usr/java,$JAVA_HOME,g" configure.ac
fi
-autoreconf -fiv
-
-# Maybe TODO: really, there should be a way to build multiple API versions,
-# with file paths that don't clash: /opt/mozjpeg/jpeg$API/(bin|lib|include).
-# However, I'd be inventing my own directory layout for this (upstream
-# doesn't support it), which is kinda outside the scope of what a SlackBuild
-# should do. If you *really* need this feature, email me and convince me to
-# implement it (it's a lot of error-prone work, not going to do it unless
-# someone actually needs it).
API="${API:-6b}"
-case "$API" in
- 6b) ;; # do nothing, this is the default
- 7|8) EXTRAOPTS="$EXTRAOPTS --with-jpeg$API" ;;
- *) echo "Invalid API version, supported versions are 6b 7 8" 1>&2
- exit 1
- ;;
-esac
-
-# 20170310 bkw: This stuff needs documenting, or I'll forget why
-# I did it this way.
-
-# Leaving off all the --prefix and related options below, since the
-# default prefix is already /opt/mozjpeg... though starting with 3.2,
-# the man pages and docs are in $PREFIX/share/(man|doc), so use
-# --mandir and --docdir. Also, to make 3.2 match the 3.1 package, need
-# --datarootdir=$PREFIX to make the java classes go to $PREFIX/classes.
-
-# Ryan's version of this script had --disable-static, but I'm leaving
-# that off, because sometimes static libs are easier to deal with when
-# you're linking with libraries outside the system /usr/lib(64) dir.
-
-# The LDFLAGS gibberish below is to force the binaries in /opt/mozjpeg/bin
-# to use the libraries in /opt/mozjpeg/lib(64), otherwise they use the
-# system libjpeg in /usr/lib(64) which partly defeats the purpose of
-# having optimized jpeg libs...
-
-
-LDFLAGS="-Wl,-rpath,/opt/$PRGNAM/lib$LIBDIRSUFFIX" \
-CFLAGS="$SLKCFLAGS" \
-CXXFLAGS="$SLKCFLAGS" \
-./configure \
- $EXTRAOPTS \
- --datarootdir=/opt/$PRGNAM \
- --mandir=/opt/$PRGNAM/man \
- --docdir=/opt/$PRGNAM/doc \
- --build=$ARCH-slackware-linux
-
-# the java stuff chokes without -j1, everything else is OK.
-if [ "$JAVA" = "yes" ]; then
- make -j1 -C java
-fi
-
-make # V=1
-make install-strip DESTDIR=$PKG
-gzip $PKG/opt/$PRGNAM/man/man?/*.?
-
-# docs are installed in /opt already (except the license)
+[ "$API" = "7" ] && ARGS+="-DWITH_JPEG7=TRUE "
+[ "$API" = "8" ] && ARGS+="-DWITH_JPEG8=TRUE "
+
+mkdir -p build
+cd build
+ CFLAGS="$SLKCFLAGS" \
+ CXXFLAGS="$SLKCFLAGS" \
+ cmake \
+ $ARGS \
+ -DENABLE_STATIC=FALSE \
+ -DPNG_LIBRARY_DEBUG=/usr/lib$LIBDIRSUFFIX/libpng.so \
+ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
+ -DCMAKE_INSTALL_PREFIX=/opt/$PRGNAM \
+ -DCMAKE_BUILD_TYPE=Release ..
+ make
+ make install/strip DESTDIR=$PKG
+cd ..
+
+# Slackware has these man pages already.
+rm -rf $PKG/opt/$PRGNAM/man
+
+# most of the docs are installed in /opt already, but not all.
mkdir -p $PKG/usr/doc
mv $PKG/opt/$PRGNAM/doc $PKG/usr/doc/$PRGNAM-$VERSION
+rm -f CMakeLists.txt BUILDING.* jconfig.txt # do not want
+cp -a *.txt *.md tjexample.c doc/html $PKG/usr/doc/$PRGNAM-$VERSION
ln -s ../../../usr/doc/$PRGNAM-$VERSION $PKG/opt/$PRGNAM/doc
-cp -a LICENSE.* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
[ "$JAVA" = "yes" ] && cp -a java/doc $PKG/usr/doc/$PRGNAM-$VERSION/javadoc
+# 20210312 bkw: profile script is new with v4.0.x. It's installed without +x
+# permission (see README).
+mkdir -p $PKG/etc/profile.d
+sed "s,@,$LIBDIRSUFFIX," $CWD/${PRGNAM}.sh > $PKG/etc/profile.d/${PRGNAM}.sh
+
+# 20210312 bkw: help pkg-config out a bit.
+sed -i '/^Libs:/s|$| -lm -Wl,-rpath,${libdir}|' \
+ $PKG/opt/$PRGNAM/lib$LIBDIRSUFFIX/pkgconfig/*.pc
+
mkdir -p $PKG/install
sed -e "s,@API@,$API," -e "s,@JAVA@,$JAVA," \
$CWD/slack-desc > \
diff --git a/graphics/mozjpeg/mozjpeg.info b/graphics/mozjpeg/mozjpeg.info
index fe1d1c78b8..b799b1deda 100644
--- a/graphics/mozjpeg/mozjpeg.info
+++ b/graphics/mozjpeg/mozjpeg.info
@@ -1,8 +1,8 @@
PRGNAM="mozjpeg"
-VERSION="3.3.1"
+VERSION="4.0.3"
HOMEPAGE="https://github.com/mozilla/mozjpeg"
-DOWNLOAD="https://github.com/mozilla/mozjpeg/archive/v3.3.1/mozjpeg-3.3.1.tar.gz"
-MD5SUM="63bc152b325666465ae86dc046786118"
+DOWNLOAD="https://github.com/mozilla/mozjpeg/archive/v4.0.3/mozjpeg-4.0.3.tar.gz"
+MD5SUM="c6910ca8f0ee82a8c0243dc5b7217aba"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/graphics/mozjpeg/mozjpeg.sh b/graphics/mozjpeg/mozjpeg.sh
new file mode 100644
index 0000000000..fc784ee53a
--- /dev/null
+++ b/graphics/mozjpeg/mozjpeg.sh
@@ -0,0 +1,8 @@
+# mozjpeg.sh: part of the SBo mozjpeg build, by B. Watson
+# <yalhcru@gmail.com>. Source this file in your shell, to run
+# mozjpeg's binaries by default, and to compile software with
+# mozjpeg's libraries. Not installed +x by default to avoid
+# conflicting with Slackware's libjpeg-turbo package.
+
+export PATH=/opt/mozjpeg/bin:$PATH
+export PKG_CONFIG_PATH=/opt/mozjpeg/lib@/pkgconfig:$PKG_CONFIG_PATH