Files
chromebrew/packages/freetype.rb
Maximilian Downey Twiss f6dc1d8d4e Derive binary_url in package.rb (#7082)
* Add binary_compression value to each package

* Remove binary_url values and arrays

* Handle packages with empty binary_sha256 arrays (either missing binaries or not compiled by us)
2024-01-25 11:03:31 -05:00

103 lines
3.2 KiB
Ruby

require 'package'
# build order: harfbuzz => freetype => fontconfig => cairo => pango
class Freetype < Package
description 'FreeType is a freely available software library to render fonts.'
homepage 'https://www.freetype.org/'
version '2.13.1' # Update freetype in harfbuzz when updating freetype
license 'FTL or GPL-2+'
compatibility 'x86_64 aarch64 armv7l'
source_url 'https://gitlab.freedesktop.org/freetype/freetype.git'
git_hashtag "VER-#{version.tr('.', '-')}"
binary_compression 'tar.zst'
binary_sha256({
aarch64: '32d644934a6727c0ea8a0e8e13ed70de49e9c0337651818566dbd91d4cd52fd7',
armv7l: '32d644934a6727c0ea8a0e8e13ed70de49e9c0337651818566dbd91d4cd52fd7',
x86_64: '7f137b4b0bdcf332afe470d32c2cfb8b1a3464ed66cc9d7d1a20fe925ddca1f8'
})
depends_on 'brotli' # R
depends_on 'bzip2' # R
depends_on 'expat' => :build
depends_on 'gcc_lib' # R
depends_on 'glib' => :build
depends_on 'glibc' # R
depends_on 'graphite' => :build
depends_on 'harfbuzz' # R
depends_on 'libpng' # R
depends_on 'pcre' => :build
depends_on 'py3_docwriter' => :build
depends_on 'zlibpkg' # R
def self.build
system "meson setup #{CREW_MESON_OPTIONS} \
-Dharfbuzz=enabled \
builddir"
system 'meson configure --no-pager builddir'
system 'samu -C builddir'
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} samu -C builddir install"
# 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) (Created 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[1]}
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
end