Files
chromebrew/packages/glib.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

105 lines
3.3 KiB
Ruby

require 'package'
class Glib < Package
description 'GLib provides the core application building blocks for libraries and applications written in C.'
homepage 'https://developer.gnome.org/glib'
version '2.78.0'
license 'LGPL-2.1'
compatibility 'all'
source_url 'https://gitlab.gnome.org/GNOME/glib.git'
git_hashtag version
binary_compression 'tar.zst'
binary_sha256({
aarch64: '829516ace17d57ad58ac5d5e617235e243a6fb8927505a77a967df9a90f91405',
armv7l: '829516ace17d57ad58ac5d5e617235e243a6fb8927505a77a967df9a90f91405',
i686: '5945326740ddddfb751c7bd7740d2964f993b1dbc30c054cef35d4033082ac4a',
x86_64: '0af84b414507e0ce9178845035944c054deaa8e9304f05a1e3bdb2f66dfe0bf7'
})
depends_on 'elfutils' # R
depends_on 'libffi' # R
depends_on 'pcre' # R
depends_on 'py3_pygments' => :build
depends_on 'shared_mime_info' # L
depends_on 'util_linux' # R
depends_on 'zlibpkg' # R
depends_on 'pcre2' # R
depends_on 'gcc_lib' # R
no_strip if %w[aarch64 armv7l].include? ARCH
def self.build
system "mold -run meson setup #{CREW_MESON_OPTIONS.gsub('strip=true', 'strip=false')} \
-Dselinux=disabled \
-Dsysprof=disabled \
-Dman=false \
-Dtests=false \
builddir"
system 'meson configure --no-pager builddir'
system "mold -run #{CREW_NINJA} -C builddir"
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} #{CREW_NINJA} -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