diff options
author | B. Watson <yalhcru@gmail.com> | 2020-06-18 06:59:07 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-06-20 07:59:30 +0700 |
commit | 07e0e2010388855125316407b57cf60b715f4a93 (patch) | |
tree | f2bf65533c4771c02bc48168eaf8679fb4eed0f3 | |
parent | db8b297acc76d6512fc5c24c5aead07a7a6995cd (diff) |
system/ft2demos: Added (freetype demos and tools)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/ft2demos/README | 26 | ||||
-rw-r--r-- | system/ft2demos/ft2demos.SlackBuild | 158 | ||||
-rw-r--r-- | system/ft2demos/ft2demos.info | 16 | ||||
-rw-r--r-- | system/ft2demos/slack-desc | 19 |
4 files changed, 219 insertions, 0 deletions
diff --git a/system/ft2demos/README b/system/ft2demos/README new file mode 100644 index 000000000000..048f6be97116 --- /dev/null +++ b/system/ft2demos/README @@ -0,0 +1,26 @@ +ft2demos (freetype demos and tools) + +Set of demo programs and tools for freetype. Can be useful for testing +and debugging problems with fonts (or with freetype itself). Includes +these tools: + +ftbench - benchmark some common FreeType paths +ftchkwd - test fixed font width +ftdiff - compare font hinting modes +ftdump - simple font dumper +ftgamma - screen gamma calibration helper +ftgrid - simple glyph grid viewer +ftlint - simple font tester +ftmemchk - simple memory tester (tests FreeType's memory allocator) +ftmulti - multiple masters font viewer +ftpatchk - tests whether patented hinting is necessary +ftstring - string viewer (displays text in specified font) +fttimer - simple performance timer +ftvalid - font layout table validator +ftview - simple glyph viewer +ttdebug - a TrueType bytecode debugger + +Most of the commands have man pages. Also most of the commands show +usage info if you run them with --help (or with no arguments). + +This package is known as "freetype2-demos" on Arch and Debian systems. diff --git a/system/ft2demos/ft2demos.SlackBuild b/system/ft2demos/ft2demos.SlackBuild new file mode 100644 index 000000000000..6f4c2805c946 --- /dev/null +++ b/system/ft2demos/ft2demos.SlackBuild @@ -0,0 +1,158 @@ +#!/bin/sh + +# Slackware build script for ft2demos + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# This thing requires first building (but not installing) freetype2, +# hence all the downloads. + +# This script is heavily based on Pat Volkerding's freetype.SlackBuild: +# https://slackware.uk/slackware/slackware-14.2/patches/source/freetype/ +# ...and Arch Linux's freetype2-demos PKGBUILD: +# https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/freetype2 + +# Note to self: keep VERSION in sync with Pat's patches/freetype. + +PRGNAM=ft2demos +VERSION=${VERSION:-2.6.3} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +LIBNAM=freetype + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-build +mkdir -p $PRGNAM-build +cd $PRGNAM-build +tar xvf $CWD/$LIBNAM-$VERSION.tar.xz +tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +chown -R root:root . +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# Build process wants this symlink. +ln -s $LIBNAM-$VERSION ${LIBNAM}2 + +### First, build FreeType, since ft2demos needs the whole source tree. +cd $LIBNAM-$VERSION + +# Apply Pat's patches +zcat $CWD/freetype.illadvisederror.diff.gz | patch -p1 +zcat $CWD/freetype.CVE-2017-8287.diff.gz | patch -p1 + +# Enable the validators needed by the ftvalid command. Part 1 of a +# DIRTY_HACK to make ftvalid work. +sed -i '/^# *AUX_MODULES.*valid/s|^# *||' modules.cfg + +# Use Pat's build command (but no make install!) +CFLAGS="$SLKCFLAGS" \ + make setup \ + CFG="--prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --build=$ARCH-slackware-linux" +make + +### Now, build ft2demos. These will end up dynamically linked to the +# system libfreetype.so after package installation, *except* for +# ftvalid, which won't work with Slackware's libfreetype.so, so it +# gets statically linked with the libfreetype.a we just built. See +# DIRTY_HACK, parts 1 and 2. +cd $TMP/$PRGNAM-build/$PRGNAM-$VERSION + +# Build the extra executables +sed -i '/^ *# *EXES/s|# *||' Makefile + +# Don't try to build ftvalid yet. If we do, the resulting binary is +# useless, complains that none of its validation methods are compiled in, +# and suggests rebuilding FreeType. +sed -i '/EXES *+= *ftvalid/d' Makefile + +# Don't include RPATH in binaries (borrowed from Arch) +sed -i '/X11_LIB:%=-R%/d' graph/x11/rules.mk + +# Don't have to specify CFLAGS here, it'll pick them up from the freetype +# build we just did. +make + +# DIRTY_HACK, part 2. Get the link command libtool generated for ftvalid, +# and replace freetype.so with freetype.a (the static lib). This is me +# working around libtool's "helpful" automation. Die, libtool! +echo "=== Prepare for dirty hack, put on your goggles now" +make EXES=ftvalid | tee make.out + +echo "=== ftvalid.build.cmd:" +grep '^libtool: link:' make.out | \ + cut -d: -f3- | \ + sed 's|/usr/lib[^/]*/libfreetype.so||' | \ + sed 's|\([^ *]\.libs/libfreetype.\)so|\1a|' | \ + tee ftvalid.build.cmd + +# Now run the abomination we've created. If it fails, don't let set -e +# kill the whole script (we'll just make a package without ftvalid). +sh ./ftvalid.build.cmd || echo "!!! Attempt to build ftvalid failed" + +# The semi-static ftvalid is big, but still under 1MB. Also, if you +# run ldd on it, you'll see libfreetype.so is required... this is because +# of a circular dependency with harfbuzz. It doesn't seem to cause a +# problem for ftvalid. +echo "=== Stand down from dirty hack alert, you may now remove your goggles" + +# There is no 'make install', this bit was borrowed from Arch. +mkdir -p $PKG/usr/bin +for i in bin/{f,t}t*; do + libtool --mode=install install $i $PKG/usr/bin +done +strip $PKG/usr/bin/* + +# For whatever reason, the Arch and Debian packages don't install the +# man pages. +mkdir -p $PKG/usr/man/man1 +for i in src/*.1; do + gzip -9c < $i > $PKG/usr/man/man1/$( basename $i).gz +done + +# The README is build instructions, don't bother. Instead, include our +# own README which at least lists the tools and their short descriptions. +# The ChangeLog goes back to 2000, don't need the whole damn thing. +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +head -n1000 ChangeLog > $PKG/usr/doc/$PRGNAM-$VERSION/ChangeLog +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README_SBo.txt +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/ft2demos/ft2demos.info b/system/ft2demos/ft2demos.info new file mode 100644 index 000000000000..50c3bc2ea58d --- /dev/null +++ b/system/ft2demos/ft2demos.info @@ -0,0 +1,16 @@ +PRGNAM="ft2demos" +VERSION="2.6.3" +HOMEPAGE="http://www.freetype.org" +DOWNLOAD="https://download-mirror.savannah.gnu.org/releases/freetype/ft2demos-2.6.3.tar.bz2 \ + https://slackware.uk/slackware/slackware-14.2/patches/source/freetype/freetype-2.6.3.tar.xz \ + https://slackware.uk/slackware/slackware-14.2/patches/source/freetype/freetype.CVE-2017-8287.diff.gz \ + https://slackware.uk/slackware/slackware-14.2/patches/source/freetype/freetype.illadvisederror.diff.gz" +MD5SUM="f7c6102f29834a80456264fe4edd81d1 \ + c806890db47d8ad8887253a926377e33 \ + eea2e24cf46314d716d0668f5fdbbf08 \ + 419295091bb684f531c3ba9614fea3a0" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/system/ft2demos/slack-desc b/system/ft2demos/slack-desc new file mode 100644 index 000000000000..22f4cbc5e388 --- /dev/null +++ b/system/ft2demos/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +ft2demos: ft2demos (freetype demos and tools) +ft2demos: +ft2demos: Set of demo programs and tools for freetype. Can be useful for testing +ft2demos: and debugging problems with fonts (or with freetype itself). Includes +ft2demos: these tools: +ft2demos: +ft2demos: ftbench ftchkwd ftdiff ftdump ftgamma ftgrid ftlint ftmemchk +ft2demos: ftmulti ftpatchk ftstring fttimer ftvalid ftview ttdebug +ft2demos: +ft2demos: +ft2demos: |