Skip to content

Instantly share code, notes, and snippets.

@glitsj16

glitsj16/README

Created Sep 24, 2017
Embed
What would you like to do?
freetype2-fix for waterfox-bin
This is a temporary fix for people who use waterfox-bin from the AUR.
After freetype2 from official repo got upgraded to 2.8.1-1, firefox font
rendering got broken [ see https://bugs.archlinux.org/task/55663].
Luckily, this got fixed in Arch Linux firefox 55.0.3-3.
Those who use waterfox-bin from AUR are currently still left
with broken font rendering, as upstream tagged the relevant bugs
as '55 wontfix'.
So what to do if you're hit by this bug?
One option is to wait it out untill waterfox-bin 56.x hits the AUR.
Another option is to downgrade freetype2 to version 2.8-2. Although
that will work, it has the side-effect that pacman will offer an upgrade
on each -Syu. The PKGBUILD here offers a third option, fixes the
freetype2 issue while keeping pacman happy. It does this by manipulating
pkgver/pkgrel values and is obviously a crude hack.
IT SHOULD BE REPLACED BY THE PROPER FREETYPE2 FROM OFFICIAL
ARCH LINUX REPOS AS SOON AS WATERFOX 56 IS RELEASED.
@glitsj16

This comment has been minimized.

Copy link
Owner Author

@glitsj16 glitsj16 commented Sep 24, 2017

Needed files:

0001-Enable-table-validation-modules.patch
0002-Enable-subpixel-rendering.patch
0003-Enable-infinality-subpixel-hinting.patch
0004-Enable-long-PCF-family-names.patch
0005-freetype-2.5.2-more-demos.patch
freetype2.install
freetype2.sh

The PKGBUILD:

pkgbase=freetype2
pkgname=('freetype2' 'freetype2-demos')
pkgver=2.8.1
_pkgver=2.8
pkgrel=1
_pkgrel=2
pkgdesc="Font rasterization library"
arch=(i686 x86_64)
license=('GPL')
url="https://www.freetype.org/"
# adding harfbuzz for improved OpenType features auto-hinting
# introduces a cycle dep to harfbuzz depending on freetype wanted by upstream
depends=('zlib' 'bzip2' 'sh' 'libpng' 'harfbuzz')
makedepends=('libx11')
source=(https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${_pkgver}.tar.bz2{,.sig}
    0001-Enable-table-validation-modules.patch
    0002-Enable-subpixel-rendering.patch
    0003-Enable-infinality-subpixel-hinting.patch
    0004-Enable-long-PCF-family-names.patch
    0005-freetype-2.5.2-more-demos.patch
    freetype2.install
    freetype2.sh)
sha1sums=('42c6b1f733fe13a3eba135f5025b22cb68450f91'
          'SKIP'
          'adcaec92eba6b539482c77ee669b313e1825c6e6'
          '0b36ec198c713337e0e75e95aca148e3c305d604'
          '9ff85c71a5cfab685aab17fcd8394e70e1330814'
          '98a8f244e156f586a79c1e41df20c9c67e7ceae3'
          '72cfecbe738085eec475e012617661ad0cc9b76f'
          '84b83a5fa2edaf44fbe3311a00b74bf98d8b7c25'
          'bc6df1661c4c33e20f5ce30c2da8ad3c2083665f')
validpgpkeys=('58E0C111E39F5408C5D3EC76C1A60EACE707FDA5')

prepare() {
    # Rename source dir to allow building the demos
    mv freetype-${_pkgver} freetype2
    mv ft2demos-${_pkgver} freetype2-demos

    cd freetype2
    patch -Np1 -i ../0001-Enable-table-validation-modules.patch
    patch -Np1 -i ../0002-Enable-subpixel-rendering.patch
    patch -Np1 -i ../0003-Enable-infinality-subpixel-hinting.patch
    patch -Np1 -i ../0004-Enable-long-PCF-family-names.patch

    cd ../freetype2-demos
    # enable more demos
    patch -Np1 -i ../0005-freetype-2.5.2-more-demos.patch

    # Suppress RPATH
    sed -i '/X11_LIB:%=-R%/d' graph/x11/rules.mk
}

build() {
    cd freetype2
    ./configure --prefix=/usr --disable-static
    make

    # Build demos
    cd ../freetype2-demos
    make
}

check() {
    cd freetype2
    make -k check
}

package_freetype2() {
    provides=('libfreetype.so')
    install=freetype2.install
    backup=('etc/profile.d/freetype2.sh')

    cd freetype2
    make DESTDIR="${pkgdir}" install
    install -Dm644 ../freetype2.sh "${pkgdir}/etc/profile.d/freetype2.sh"
}

package_freetype2-demos() {
    pkgdesc="Freetype tools and demos"
    depends=('freetype2' 'libx11')

    cd freetype2-demos
    install -d "${pkgdir}/usr/bin"
    for _i in bin/{f,t}t*; do
        libtool --mode=install install $_i "${pkgdir}/usr/bin"
    done
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.