Update libpng, fontconfig and harfbuzz packages (#7180)

This commit is contained in:
Ed Reel
2022-07-05 21:11:54 -05:00
committed by GitHub
parent 5500271cc8
commit 3681c78057
3 changed files with 80 additions and 89 deletions

View File

@@ -2,90 +2,46 @@ require 'package'
class Fontconfig < Package
description 'Fontconfig is a library for configuring and customizing font access.'
homepage 'https://www.freedesktop.org/software/fontconfig/front.html'
@_ver = '2.14.0'
version "#{@_ver}-1"
homepage 'https://www.freedesktop.org/wiki/Software/fontconfig/'
version '2.14.0'
license 'MIT'
compatibility 'all'
source_url 'https://gitlab.freedesktop.org/fontconfig/fontconfig.git'
git_hashtag @_ver
source_url 'https://gitlab.freedesktop.org/fontconfig/fontconfig/-/archive/2.14.0/fontconfig-2.14.0.tar.bz2'
source_sha256 'e89a0c6868771b88de27bd20cd98f1056a3083666a1cf7c85d26ac5c67cc25a8'
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0-1_armv7l/fontconfig-2.14.0-1-chromeos-armv7l.tar.zst',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0-1_armv7l/fontconfig-2.14.0-1-chromeos-armv7l.tar.zst',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0-1_i686/fontconfig-2.14.0-1-chromeos-i686.tar.zst',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0-1_x86_64/fontconfig-2.14.0-1-chromeos-x86_64.tar.zst'
binary_url ({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0_armv7l/fontconfig-2.14.0-chromeos-armv7l.tar.zst',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0_armv7l/fontconfig-2.14.0-chromeos-armv7l.tar.zst',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0_i686/fontconfig-2.14.0-chromeos-i686.tar.zst',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/fontconfig/2.14.0_x86_64/fontconfig-2.14.0-chromeos-x86_64.tar.zst',
})
binary_sha256({
aarch64: 'e84766cac7cbb4416041e49c9d668ee8b52a1689737f652be6b6eb5c17b652e3',
armv7l: 'e84766cac7cbb4416041e49c9d668ee8b52a1689737f652be6b6eb5c17b652e3',
i686: '4012be43038438529efd2ba423ce1a561c012d37fdc8c33bd03b6b702a5d86ad',
x86_64: 'b2a370a40b5fd70213555c598663be865ed67f263fa9bcaa9c910f5394c87200'
binary_sha256 ({
aarch64: '99c5724f5a53e7ba476b4fb5dfbec97632608fc28afb39a26f0ea394b6b8ca86',
armv7l: '99c5724f5a53e7ba476b4fb5dfbec97632608fc28afb39a26f0ea394b6b8ca86',
i686: 'fce56b685e312d9754c3376c6ff8ed83f7cc99154da5f6a913d2d76c9b8736c2',
x86_64: 'ea6e16d4505be56cbb9ed5a0b971e1df7f34c8ddd9e6c160cda62c8f30ca6af2',
})
depends_on 'gperf'
depends_on 'expat'
depends_on 'jsonc'
depends_on 'gperf'
depends_on 'freetype'
depends_on 'libpng'
depends_on 'util_linux'
depends_on 'graphite'
no_fhs
# Remove fontconfig before rebuilding this package.
def self.build
# Fix build failure from font directories not being writable.
@install_cache = <<~INSTALLCACHE_HEREDOC
#!/usr/bin/env python3
import sys
sys.exit()
INSTALLCACHE_HEREDOC
File.write('install-cache', @install_cache, perm: 0o666)
system "meson #{CREW_MESON_OPTIONS} \
--localstatedir=#{CREW_PREFIX}/cache \
--default-library=both \
-Ddoc=disabled \
-Dfreetype2:harfbuzz=disabled \
-Dfreetype2:default_library=both \
builddir"
system 'meson configure builddir'
system 'ninja -C builddir'
system "./autogen.sh #{CREW_OPTIONS} --localstatedir=#{CREW_PREFIX}/cache"
system 'make'
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} ninja -C builddir install"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/fonts/conf.d"
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/cache/fontconfig"
@fonts_conf = <<~FONTCONF_HEREDOC
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<description>Load local customization file</description>
<!-- Font directory list -->
<dir>/usr/local/share/fonts</dir>
<dir>~/.fonts</dir>
<!-- Font cache directory list -->
<cachedir>#{CREW_PREFIX}/cache/fontconfig</cachedir>
<cachedir>~/.fontconfig</cachedir>
</fontconfig>
FONTCONF_HEREDOC
File.write("#{CREW_DEST_PREFIX}/etc/fonts/conf.d/52-chromebrew.conf", @fonts_conf, perm: 0o666)
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/env.d/"
@env = <<~EOF
# Fontconfig configuration
export FONTCONFIG_PATH=#{CREW_PREFIX}/etc/fonts
EOF
File.write("#{CREW_DEST_PREFIX}/etc/env.d/fontconfig", @env)
end
def self.preinstall
@device = JSON.parse(File.read("#{CREW_CONFIG_PATH}device.json"), symbolize_names: true)
if @device[:installed_packages].any? { |elem| elem[:name] == 'freetype' }
system "sed -i '/freetype2/d;/libfreetype/d' filelist"
system "sed -i '/freetype2/d;/libfreetype/d' dlist"
end
end
def self.postinstall
system "FONTCONFIG_PATH=#{CREW_PREFIX}/etc/fonts fc-cache -fv || true"
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
# The following are included the libpng package.
FileUtils.rm Dir["#{CREW_DEST_LIB_PREFIX}/libpng*"]
FileUtils.rm Dir["#{CREW_DEST_PREFIX}/include/libpng16/png*"]
FileUtils.rm Dir["#{CREW_DEST_LIB_PREFIX}/pkgconfig/libpng*"]
end
end