Files
chromebrew/packages/libpng.rb
Satadru Pramanik, DO, MPH, MEng 035bf8fb82 GCC 13 library rebuilds (especially packages with jbigkit deps) (#8303)
* update graphene

* update libpng

* rebuild zlibpkg

* rebuild giflib

* libjpeg update

* libtiff rebuild

* libwebp rebuild

* update libwebp deps

* update minizip version

* update ghostscript

* rebuild gettext

* gstreamer update

* libpng: add libtool file

* rebuild liburcu
2023-05-26 00:00:22 -05:00

104 lines
3.6 KiB
Ruby

require 'package'
class Libpng < Package
description 'libpng is the official PNG reference library.'
homepage 'http://libpng.org/pub/png/libpng.html'
version '1.6.39'
license 'libpng2'
compatibility 'all'
source_url 'https://git.code.sf.net/p/libpng/code.git'
git_hashtag "v#{version}"
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libpng/1.6.39_armv7l/libpng-1.6.39-chromeos-armv7l.tar.zst',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libpng/1.6.39_armv7l/libpng-1.6.39-chromeos-armv7l.tar.zst',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libpng/1.6.39_i686/libpng-1.6.39-chromeos-i686.tar.zst',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libpng/1.6.39_x86_64/libpng-1.6.39-chromeos-x86_64.tar.zst'
})
binary_sha256({
aarch64: '54bea8afba78bd2388704137d49b5151a9d0f8dcaafacff02436ec510e2ae627',
armv7l: '54bea8afba78bd2388704137d49b5151a9d0f8dcaafacff02436ec510e2ae627',
i686: 'd4516093258bc90eecb4cc4bfd16cd5540a6e056806df37b43695b8b9137982a',
x86_64: '6f7c139fc86ec24c0dce766b43a940441a0ab4b29f685f1110adcf03bad5d5d9'
})
depends_on 'zlibpkg'
depends_on 'glibc' # R
def self.build
system "cmake \
-B builddir -G Ninja \
#{CREW_CMAKE_OPTIONS.gsub('-mfpu=vfpv3-d16', '-mfpu=neon-fp16')} \
-DPNG_STATIC=OFF \
-Wno-dev"
system "#{CREW_NINJA} -C builddir"
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} #{CREW_NINJA} -C builddir install"
# Imagemagick wants a libtool file.
@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
@dlname = @libnames.grep(/.so/).first if @dlname.nil?
@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
def self.postinstall
return unless File.exist?("#{CREW_PREFIX}/bin/gdk-pixbuf-query-loaders")
system 'gdk-pixbuf-query-loaders',
'--update-cache'
end
end