mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
101 lines
3.0 KiB
Ruby
101 lines
3.0 KiB
Ruby
require 'package'
|
|
|
|
class Expat < Package
|
|
description 'James Clark\'s Expat XML parser library in C.'
|
|
homepage 'https://github.com/libexpat/libexpat'
|
|
version '2.6.0'
|
|
license 'MIT'
|
|
compatibility 'all'
|
|
source_url 'https://github.com/libexpat/libexpat.git'
|
|
git_hashtag "R_#{version.gsub('.', '_')}"
|
|
binary_compression 'tar.zst'
|
|
|
|
binary_sha256({
|
|
aarch64: '0e2b6d7dbb58b6820446701b89bfad4c0a46651974d6901b0a02a0e724744bfe',
|
|
armv7l: '0e2b6d7dbb58b6820446701b89bfad4c0a46651974d6901b0a02a0e724744bfe',
|
|
i686: 'bec09a1a1c7a1e178c6e8859a49a4ba5b5376127971fbcf927751eb1b526249c',
|
|
x86_64: 'c5ad0543f0c6d1499243b3eba4459f328e639eb93167082d7e59c6d254aefde6'
|
|
})
|
|
|
|
depends_on 'glibc' # R
|
|
|
|
def self.build
|
|
Dir.chdir('expat') do
|
|
system "mold -run cmake -B builddir #{CREW_CMAKE_OPTIONS} \
|
|
-DEXPAT_BUILD_EXAMPLES=OFF \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-Wno-dev \
|
|
-G Ninja"
|
|
system "mold -run #{CREW_NINJA} -C builddir"
|
|
end
|
|
end
|
|
|
|
def self.check
|
|
Dir.chdir('expat') do
|
|
system "mold -run #{CREW_NINJA} -C builddir test"
|
|
end
|
|
end
|
|
|
|
def self.install
|
|
Dir.chdir('expat') do
|
|
system "DESTDIR=#{CREW_DEST_DIR} #{CREW_NINJA} -C builddir install"
|
|
end
|
|
|
|
# Imagemagick7 wants a libtool file from expat.
|
|
@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
|