mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 15:37:56 -05:00
* update gnulib_git and babl * icu4c => 73.2 * update boost * rebuild source_highlight * update mold * rebuild cppunit * update libgpgerror * update taglib * update libgcrypt * rebuild librevenge * update gnupg, rebuild yajl, grive * update exempi, rebuild libvisio * update poppler * rebuild eigen libcdr * update gegl * swig rebuild * update tcpflow, ledger * update gdb, rebuild libtorrent * update gimp * rebuild inkscape * rebuild binutils with gdb fallback * gimp rebuild
121 lines
4.3 KiB
Ruby
121 lines
4.3 KiB
Ruby
# Adapted in part from Arch Linux binutils PKGBUILD at:
|
|
# https://gitlab.archlinux.org/archlinux/packaging/packages/binutils/-/blob/main/PKGBUILD
|
|
require 'package'
|
|
|
|
class Binutils < Package
|
|
description 'The GNU Binutils are a collection of binary tools.'
|
|
homepage 'https://www.gnu.org/software/binutils/'
|
|
@_ver = '2.40'
|
|
version "#{@_ver}-1"
|
|
license 'GPL-3+'
|
|
compatibility 'all'
|
|
source_url "https://ftpmirror.gnu.org/binutils/binutils-#{@_ver}.tar.bz2"
|
|
source_sha256 'f8298eb153a4b37d112e945aa5cb2850040bcf26a3ea65b5a715c83afe05e48a'
|
|
|
|
binary_url({
|
|
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/binutils/2.40-1_armv7l/binutils-2.40-1-chromeos-armv7l.tar.zst',
|
|
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/binutils/2.40-1_armv7l/binutils-2.40-1-chromeos-armv7l.tar.zst',
|
|
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/binutils/2.40-1_i686/binutils-2.40-1-chromeos-i686.tar.zst',
|
|
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/binutils/2.40-1_x86_64/binutils-2.40-1-chromeos-x86_64.tar.zst'
|
|
})
|
|
binary_sha256({
|
|
aarch64: 'e5cfc098a644342ce15eef1d2bc42f19db6bcb34e585dac96111c0e9423702f2',
|
|
armv7l: 'e5cfc098a644342ce15eef1d2bc42f19db6bcb34e585dac96111c0e9423702f2',
|
|
i686: 'c13f1e2cf9e9aa0237293e65fa1c20c0b512a60ea20fc038ba233293c07e113e',
|
|
x86_64: '7871d7b2e70c54cbf5a4e351aa31bd0394fd1b5de864525cf360fd1512f925d6'
|
|
})
|
|
|
|
depends_on 'elfutils' # R
|
|
depends_on 'flex' # R
|
|
depends_on 'gcc_lib' # R
|
|
depends_on 'glibc' # R
|
|
depends_on 'zlibpkg' # R
|
|
depends_on 'zstd' # R
|
|
|
|
def self.prebuild
|
|
FileUtils.rm_f "#{CREW_LIB_PREFIX}/libiberty.a"
|
|
end
|
|
|
|
def self.patch
|
|
system 'filefix'
|
|
system "sed -i 's,scriptdir = $(tooldir)/lib,scriptdir = $(tooldir)/#{ARCH_LIB},g' ld/Makefile.am"
|
|
Dir.chdir 'ld' do
|
|
system 'aclocal && automake'
|
|
end
|
|
system "sed -i '/^development=/s/true/false/' bfd/development.sh"
|
|
end
|
|
|
|
def self.build
|
|
# gprofng is broken on i686 in binutils 2.40
|
|
# https://sourceware.org/bugzilla/show_bug.cgi?id=30006
|
|
@gprofng = ARCH == 'i686' ? '--disable-gprofng' : ''
|
|
Dir.mkdir 'build'
|
|
Dir.chdir 'build' do
|
|
system "../configure #{CREW_OPTIONS} \
|
|
--disable-gdb \
|
|
--disable-gdbserver \
|
|
--disable-bootstrap \
|
|
--disable-maintainer-mode \
|
|
#{@gprofng} \
|
|
--enable-64-bit-bfd \
|
|
--enable-colored-disassembly \
|
|
--enable-gold=default \
|
|
--enable-install-libiberty \
|
|
--enable-ld \
|
|
--enable-lto \
|
|
--enable-plugins \
|
|
--enable-relro \
|
|
--enable-shared \
|
|
--enable-threads \
|
|
--enable-vtable-verify \
|
|
--with-bugurl=https://github.com/chromebrew/chromebrew/issues/new \
|
|
--with-lib-path=#{CREW_LIB_PREFIX} \
|
|
--with-pic \
|
|
--with-pkgversion=Chromebrew \
|
|
--with-system-zlib"
|
|
system 'make configure-host'
|
|
system "make tooldir=#{CREW_PREFIX} || make -j 1"
|
|
end
|
|
end
|
|
|
|
def self.check
|
|
Dir.chdir 'build' do
|
|
system 'make -O CFLAGS_FOR_TARGET="-O2 -g" \
|
|
CXXFLAGS="-O2 -no-pie -fno-PIC" \
|
|
CFLAGS="-O2 -no-pie" \
|
|
LDFLAGS="" \
|
|
check || true'
|
|
end
|
|
end
|
|
|
|
def self.install
|
|
Dir.chdir 'build' do
|
|
system 'make', "DESTDIR=#{CREW_DEST_DIR}", "prefix=#{CREW_PREFIX}",
|
|
"tooldir=#{CREW_PREFIX}", 'install'
|
|
# install PIC version of libiberty
|
|
FileUtils.install 'libiberty/pic/libiberty.a', "#{CREW_DEST_LIB_PREFIX}/", mode: 0o644
|
|
|
|
# No shared linking to these files outside binutils
|
|
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libbfd.so"
|
|
FileUtils.rm_f "#{CREW_DEST_LIB_PREFIX}/libopcodes.so"
|
|
File.write "#{CREW_DEST_LIB_PREFIX}/libbfd.so", <<~LIB_BFD_EOF
|
|
/* GNU ld script */
|
|
|
|
INPUT( #{CREW_LIB_PREFIX}/libbfd.a -lsframe -liberty -lz -lzstd -ldl )
|
|
LIB_BFD_EOF
|
|
|
|
File.write "#{CREW_DEST_LIB_PREFIX}/libopcodes.so", <<~LIB_OPCODES_EOF
|
|
/* GNU ld script */
|
|
|
|
INPUT( #{CREW_LIB_PREFIX}/libopcodes.a -lbfd )
|
|
LIB_OPCODES_EOF
|
|
# Needed for gdb.
|
|
@oldlibs = %w[bfd opcodes]
|
|
@oldlibs.each do |oldlib|
|
|
FileUtils.ln_sf "#{CREW_LIB_PREFIX}/lib#{oldlib}-#{@_ver}.so",
|
|
"#{CREW_DEST_LIB_PREFIX}/lib#{oldlib}-2.39.50.so"
|
|
end
|
|
end
|
|
end
|
|
end
|