Linux HOWTOs

About | Home | Search


HOWTO: freetype
Description: A free and portable TrueType font rendering engine
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# FreeType 2.9.1
# ==============
# Older releases of Slackware included freetype in xfree86/xfree86-devel
# and x11/x11-devel packages
#
# The rest include it in a separate freetype package:
# Slackware 13.37: 2.4.4
# Slackware 14.0: 2.4.10
# Slackware 14.1: 2.5.0.1
# Slackware 14.2: 2.6.3

# FreeType's 2.x library is libfreetype.  FreeType 1.x's library is libttf.

# Slackware's X package(s) used to come with a copy of freetype2 that was in
# /usr/X11R6/lib.  This howto used to install it into /usr/local/lib, and
# since /usr/local/lib (usually) comes before /usr/X11R6/lib in
# /etc/ld.so.conf all was well even if one had both installed.  Recent
# versions put it into the /usr prefix.  Whatever you do, make sure you
# don't have multiple versions all over the place or you may have some crazy
# conflicts.

# If you want to uninstall FreeType2, or want to clean up files from an
# old version before installing a new one, skip down to the bottom for
# instructions.

# You may want to open /var/adm/packages/* files in a text editor that refer
# to the files that are being removed to remove those lines.  Use grep
# because you'll find it in *elflibs*, older Slackwares will have it in
# xfree86 packages, recent ones before 11.0 will have it in x11 packages.
# Here's an example line from Slackware 10.2's aaa_elflibs package file
# that you'll want to remove if you actually care enough to bother:
# usr/lib/libfreetype.so.6.3.7

# As of 2.2.x, 'make install' no longer installs the
# /usr/include/freetype2/freetype/internal headers.  Patches are
# available for software that still uses those headers here:
# http://www.freetype.org/freetype2/patches/rogue-patches.html

# Prerequisites:
# pkg-config
# zlib
# bzip2's libbz2
# libpng

# If you have trouble getting FreeType from SourceForge, try getting it
# from Savannah:
# https://download.savannah.gnu.org/releases/freetype/

# Get it
cd
test -f installed/freetype-2.9.1.tar.bz2 &&
 mv installed/freetype-2.9.1.tar.bz2 .
test ! -f freetype-2.9.1.tar.bz2 &&
 wget https://downloads.sf.net/freetype/freetype-2.9.1.tar.bz2

# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "db8d87ea720ea9d5edc5388fc7a0497bb11ba9fe972245e0f7f4c7e8b1e1e8\
4d  freetype-2.9.1.tar.bz2" | sha256sum -c

# Verify tarball w/ gpg:
( gpg --list-keys E707FDA5 > /dev/null 2>&1 || gpg --recv-keys E707FDA5 ) &&
 wget -nc https://downloads.sf.net/freetype/freetype-2.9.1.tar.bz2.sig &&
  gpg --verify freetype-2.9.1.tar.bz2.sig && rm freetype-2.9.1.tar.bz2.sig

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "freetype-*" -exec rm -r {} \;
tar xjvf ~/freetype-2.9.1.tar.bz2
cd freetype-2.9.1
test $UID = 0 && chown -R root:root .

# 'make' failed for me with an error about missing windows.h and
# this took care of it:
# http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=3b6e65f7bf674601b9419d02ce0aa633e2e882fb

# Read ./README and docs/INSTALL.UNIX

# If you're upgrading, read docs/CHANGES, and if you want detailed change
# info, read ./ChangeLog

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
 ./configure --prefix=/usr --libdir=/usr/lib64 --mandir=/usr/man

# Configure the build for anything else
test $(uname -m) != 'x86_64' && ./configure --prefix=/usr --mandir=/usr/man

# I don't know if I forgot to make note of it here before, or if it
# didn't happen then, but I had an error about a missing windows.h
# referred to by src/base/ftver.rc  The description in there is
# FreeType VERSIONINFO resource for Windows DLLs
# ...which obviously does not apply to me.  I ran 'make -i' (ignore
# errors) and it completed.  Hmmmm.

# Build it
make

# Become root to install it
su

# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg freetype

# Install it
make install
ldconfig

# If you installed this over an older version, look here for old files.
# Generally if you ran 'make install' and it's date is not today, then
# you don't need it any more.
# /usr/include/freetype2
# /usr/lib/libfreetype.*

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/freetype-*.tar.*
mv freetype-2.9.1.tar.bz2 installed/


# If you ever want to uninstall FreeType, this should do it:
cd
su
test -d src/libfreetype-* && ( cd src/libfreetype-* ; make uninstall )
for prefix in /usr /usr/local /usr/X11R6; do
  test -d ${prefix}/include/freetype2 && rm -r ${prefix}/include/freetype2
  rm -f ${prefix}/bin/freetype-config ${prefix}/include/ft2build.h \
   ${prefix}/lib/libfreetype.* ${prefix}/lib/pkgconfig/freetype2.pc \
   ${prefix}/share/aclocal/freetype2.m4
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "libfreetype-*" -exec rm -r {} \;
rm -f ~/installed/libfreetype-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>