mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
175 lines
6.3 KiB
Ruby
175 lines
6.3 KiB
Ruby
require 'package'
|
|
|
|
class Harfbuzz < Package
|
|
description 'HarfBuzz is an OpenType text shaping engine.'
|
|
homepage 'https://www.freedesktop.org/wiki/Software/HarfBuzz/'
|
|
@_ver = '5.3.1'
|
|
version @_ver
|
|
license 'Old-MIT, ISC and icu'
|
|
compatibility 'all'
|
|
source_url 'https://github.com/harfbuzz/harfbuzz.git'
|
|
git_hashtag @_ver
|
|
|
|
binary_url({
|
|
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/harfbuzz/5.3.1_armv7l/harfbuzz-5.3.1-chromeos-armv7l.tar.zst',
|
|
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/harfbuzz/5.3.1_armv7l/harfbuzz-5.3.1-chromeos-armv7l.tar.zst',
|
|
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/harfbuzz/5.3.1_i686/harfbuzz-5.3.1-chromeos-i686.tar.zst',
|
|
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/harfbuzz/5.3.1_x86_64/harfbuzz-5.3.1-chromeos-x86_64.tar.zst'
|
|
})
|
|
binary_sha256({
|
|
aarch64: '43473d97214e99b955d0455db5dd21ac8fdb1bb417f6ce6d57b364190b84277c',
|
|
armv7l: '43473d97214e99b955d0455db5dd21ac8fdb1bb417f6ce6d57b364190b84277c',
|
|
i686: '15f91dd2f6d29fa908f90331d746c1014b3b62d1e4f20cf9b4cb906092bf5f8f',
|
|
x86_64: 'a7260181dd0fcda38651c87607f3c42f3aca199da2fec7939cc4ebf200d446c6'
|
|
})
|
|
|
|
# provides freetype (sans harfbuzz), ragel, and a non-x11 cairo stub
|
|
depends_on 'brotli'
|
|
depends_on 'bz2'
|
|
depends_on 'chafa'
|
|
depends_on 'gcc'
|
|
depends_on 'glib'
|
|
depends_on 'gobject_introspection' => :build
|
|
# depends_on 'fontconfig' # This pulls in freetype.
|
|
depends_on 'graphite'
|
|
depends_on 'icu4c'
|
|
depends_on 'libffi'
|
|
depends_on 'libpng'
|
|
depends_on 'pixman' # Needed for cairo subproject
|
|
depends_on 'pcre'
|
|
depends_on 'zlibpkg'
|
|
depends_on 'expat' # R
|
|
# depends_on 'freetype' # R harfbuzz provides this.
|
|
depends_on 'glibc' # R
|
|
depends_on 'libx11' # R
|
|
depends_on 'libxcb' # R
|
|
depends_on 'libxext' # R
|
|
depends_on 'libxrender' # R
|
|
depends_on 'lzo' # R
|
|
|
|
no_env_options
|
|
conflicts_ok
|
|
|
|
def self.patch
|
|
# Update to new versions of freetype as they come out.
|
|
system "sed -i 's,revision=VER-2-11-0,revision=VER-2-12-1,g' subprojects/freetype2.wrap"
|
|
system "sed -i 's,revision=c90faeb7492b1b778d18a796afe5c2e4b32a6356,revision=521a3a7bdb9299d511dcb1e4f243670141e53847,g' subprojects/cairo.wrap"
|
|
end
|
|
|
|
def self.build
|
|
system "meson setup #{CREW_MESON_OPTIONS} \
|
|
--wrap-mode=default \
|
|
--default-library=both \
|
|
-Dbenchmark=disabled \
|
|
-Dcairo=enabled \
|
|
-Ddocs=disabled \
|
|
-Dfreetype=enabled \
|
|
-Dgraphite2=enabled \
|
|
-Dintrospection=enabled \
|
|
-Dragel_subproject=true \
|
|
-Dtests=disabled \
|
|
builddir"
|
|
system 'meson configure builddir'
|
|
system 'mold -run ninja -C builddir'
|
|
end
|
|
|
|
def self.install
|
|
system "DESTDIR=#{CREW_DEST_DIR} ninja install -C builddir"
|
|
# 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*"]
|
|
# Create libtool file. Needed by handbrake build
|
|
return if File.file?("#{CREW_DEST_LIB_PREFIX}/#{@libname}.la")
|
|
|
|
@libname = name.to_s.start_with?('lib') ? name.downcase : "lib#{name.downcase}"
|
|
@libnames = Dir["#{CREW_DEST_LIB_PREFIX}/#{@libname}.so*"]
|
|
@libnames = Dir["#{CREW_DEST_LIB_PREFIX}/#{@libname}-*.so*"] if @libnames.empty?
|
|
@libnames.each do |s|
|
|
s.gsub!("#{CREW_DEST_LIB_PREFIX}/", '')
|
|
end
|
|
@dlname = @libnames.grep(/.so./).first
|
|
@libname = @dlname.gsub(/.so.\d+/, '')
|
|
@longest_libname = @libnames.max_by(&:length)
|
|
@libvars = @longest_libname.rpartition('.so.')[2].split('.')
|
|
|
|
@libtool_file = <<~LIBTOOLEOF
|
|
# #{@libname}.la - a libtool library file
|
|
# Generated by libtool (GNU libtool) (hacked up by Chromebrew)
|
|
#
|
|
# Please DO NOT delete this file!
|
|
# It is necessary for linking the library.
|
|
|
|
# The name that we can dlopen(3).
|
|
dlname='#{@dlname}'
|
|
|
|
# Names of this library.
|
|
library_names='#{@libnames.reverse.join(' ')}'
|
|
|
|
# The name of the static archive.
|
|
old_library='#{@libname}.a'
|
|
|
|
# Linker flags that cannot go in dependency_libs.
|
|
inherited_linker_flags=''
|
|
|
|
# Libraries that this one depends upon.
|
|
dependency_libs=''
|
|
|
|
# Names of additional weak libraries provided by this library
|
|
weak_library_names=''
|
|
|
|
# Version information for #{name}.
|
|
current=#{@libvars[0]}
|
|
age=#{@libvars[1]}
|
|
revision=#{@libvars[2]}
|
|
|
|
# Is this an already installed library?
|
|
installed=yes
|
|
|
|
# Should we warn about portability when linking against -modules?
|
|
shouldnotlink=no
|
|
|
|
# Files to dlopen/dlpreopen
|
|
dlopen=''
|
|
dlpreopen=''
|
|
|
|
# Directory that this library needs to be installed in:
|
|
libdir='#{CREW_LIB_PREFIX}'
|
|
LIBTOOLEOF
|
|
File.write("#{CREW_DEST_LIB_PREFIX}/#{@libname}.la", @libtool_file)
|
|
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
|
|
# This should become a function.
|
|
# check for conflicts with other installed files
|
|
@override_allowed = %w[fontconfig cairo]
|
|
puts 'Checking for conflicts with files from installed packages...'
|
|
conflicts = []
|
|
conflictscmd = `grep --exclude #{CREW_META_PATH}#{name}.filelist -Fxf #{CREW_META_PATH}#{name}.filelist #{CREW_META_PATH}*.filelist`
|
|
conflicts << conflictscmd.gsub(/(\.filelist|#{CREW_META_PATH})/, '').split("\n")
|
|
conflicts.reject!(&:empty?)
|
|
unless conflicts.empty?
|
|
if conflicts_ok?
|
|
puts 'Warning: There is a conflict with the same file in another package.'.orange
|
|
else
|
|
puts 'Error: There is a conflict with the same file in another package.'.lightred
|
|
@_errors = 1
|
|
end
|
|
conflicts.each do |conflict|
|
|
conflict.each do |thisconflict|
|
|
singleconflict = thisconflict.split(':', -1)
|
|
system "sed -i '\\?^#{singleconflict[1]}?d' #{CREW_META_PATH}/#{singleconflict[0]}.filelist" if @override_allowed.include?(singleconflict[0])
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|