mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-05-01 03:00:26 -04:00
* glibc: Several improvements Signed-off-by: SupeChicken666 <me@supechicken666.dev> * Unset LD_PRELOAD before build Signed-off-by: SupeChicken666 <me@supechicken666.dev> * Adjust make to avoid segfaults. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * build changes Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add built packages for linux/386 to glibc_update * Add built packages for linux/amd64 to glibc_update * Add built packages for linux/arm/v7 to glibc_update * add armv7l binaries Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Make lib64 aarch64 changes clearer. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust crew_profile_base to remove LD_LIBRARY_PATH Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust LD_LIBRARY_PATH setting again. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle arm multiarch. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer LD_LIBRARY_PATH Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove core. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update install.sh to working version. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add crew_preload package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update preload logic... Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update hashes, add crew_preload to CREW_ESSENTIAL_PACKAGES. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove preload install sections from install.sh now that there is a separate crew_preload package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add build instructions reference to crew_preload package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Bring over more from the old install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Fix install on older systems. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Let CREW_ESSENTIAL_PACKAGES work on older syatems. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Move down setting of repo variables to after initial system checks exit. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use right ldconfig. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove sudo from ldconfig call. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust locale generation. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * cleanup Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add condition for crew_preload. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove duplicate hashes. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle some install errors. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update ncurses, readline, bash Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add update of sudo_rs Signed-off-by: Satadru Pramanik <satadru@gmail.com> * ruby updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * llvm => 20.1.6 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rust rebuilds to work on older container glibcs... Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Remove instance variable. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add libxcrypt to core. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use our versions of core apps where possible, since they will likely be newer than system binaries. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Universalize fixup to work with pre_glibc_standalone branch. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rename function to better describe what it does. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild filecmd and update edit. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * package updates/rebuilds Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates and rebuilds Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update unit tests. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * fixup Signed-off-by: Satadru Pramanik <satadru@gmail.com> * gettext rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add upx and patchelf to essential packages, to avoid unit test failure. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates & rebuilds Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Install adjustment. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Install adjustment. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Break out curl dependencies in install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust install.sh for arm. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle remove during upgrade of special packages. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust to notice empty CREW_ESSENTIAL_PACKAGES during remove. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add libxcrypt to CREW_ESSENTIAL_PACKAGES Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust CREW_STANDALONE_UPGRADE_ORDER Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Lint ruby package as per new rubocop. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Simplify getrealdeps.rb Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Ruby rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add usage of docker tmpfs to workflows. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update python3 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild ruby Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild zlib Signed-off-by: Satadru Pramanik <satadru@gmail.com> * install testing Signed-off-by: Satadru Pramanik <satadru@gmail.com> * curl rebuild with older glibc Signed-off-by: Satadru Pramanik <satadru@gmail.com> * cleanup Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust packages to reduce subshells during install. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Handle ELOOP exception. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add gcc15 rebuild. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild binutils without gcc version. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * update cmake Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add date stamp to installer.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update libxml2 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * shared_mime_info rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Many updates rebuilt on a lower glibc Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * sync up from pre_glibc_standalone Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Merge pre_glibc_standalone and master versions of glibc.rb. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Sync back deprecated glibc packages from pre_glibc_standalone. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint packages/rust.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Add versioning to installer error message. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * perl => 5.40.2 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add more variable setting to install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Reverse logic in glibc.rb Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust curl_wrapper logic in install.sh Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Allow glibc package to pass rubocop. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Gate new glibc behind CREW_PRE_GLIBC_STANDALONE env variable. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update lib/const.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update mold Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * debug Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild uchardet Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Python Tweaks. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Python Tweaks Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Arm install adjustment Signed-off-by: Satadru Pramanik <satadru@gmail.com> * xzutils rebuild Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust installer to detect i686 in container. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add message to source bashrc to end of install. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Fix Updater workflow Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild lz4, adjust meson buildsystem to handle alternate location for meson files. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild zlib Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild xzutils Signed-off-by: Satadru Pramanik <satadru@gmail.com> * rebuild libyaml Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuilds of acl and attr for i686 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update automake and add no_filefix to autotools buildsystem. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Rebuild acl, attr, and revert from gettext 0.25, which is broken when using autopoint on x86_64 and armv7l. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * adjust core for i686 Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjustments for i686 installs. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Add ruby_prism to ruby_rubocop_ast package. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * updates Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust messages Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update compatibility of uutils_coreutils. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Adjust install for both M136 hatch and M136 strongbad. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Use Concurrent Ruby for upx and patchelf. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Switch installer to using static zstd. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * Update packages/zstd_static.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Make final crew update in install more robust. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * install adjustments. Signed-off-by: Satadru Pramanik <satadru@gmail.com> * lint Signed-off-by: Satadru Pramanik <satadru@gmail.com> --------- Signed-off-by: SupeChicken666 <me@supechicken666.dev> Signed-off-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: SupeChicken666 <me@supechicken666.dev> Co-authored-by: Satadru Pramanik <satadru@gmail.com> Co-authored-by: satmandu <satmandu@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ed Reel <edreel@gmail.com>
344 lines
13 KiB
Ruby
344 lines
13 KiB
Ruby
require 'English'
|
||
require 'package'
|
||
|
||
class Gcc_build < Package
|
||
description 'The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, and Go.'
|
||
homepage 'https://www.gnu.org/software/gcc/'
|
||
version '15.1.0-69eb171'
|
||
license 'GPL-3, LGPL-3, libgcc, FDL-1.2'
|
||
compatibility 'all'
|
||
source_url 'https://github.com/gcc-mirror/gcc.git'
|
||
git_hashtag '69eb1716b884f6213aef30194390d7741af97c80'
|
||
# git_hashtag "releases/gcc-#{version.split('-').first}"
|
||
binary_compression 'tar.zst'
|
||
|
||
binary_sha256({
|
||
aarch64: 'b777260eb6f5b4e7983e7afd766aa21068d66d1645ffc0aac0c3f96b07102710',
|
||
armv7l: 'b777260eb6f5b4e7983e7afd766aa21068d66d1645ffc0aac0c3f96b07102710',
|
||
i686: 'f5acefa8008778a12b0e81b1ed952c1985653743306c50676a77fc2f16a23bae',
|
||
x86_64: '43b84c2811c9e7e6ce1465fa76554cc24e452fa7e31d9709b86a1a6e39a7366c'
|
||
})
|
||
|
||
depends_on 'binutils' => :build
|
||
depends_on 'dejagnu' => :build # for test
|
||
depends_on 'glibc' # R
|
||
depends_on 'gmp' # R
|
||
depends_on 'isl' # R
|
||
depends_on 'libssp' # L
|
||
depends_on 'mpc' # R
|
||
depends_on 'mpfr' # R
|
||
depends_on 'rust' => :build
|
||
depends_on 'zlib' # R
|
||
depends_on 'zstd' # R
|
||
|
||
conflicts_ok
|
||
|
||
@gcc_version = version.split('-')[0].partition('.')[0]
|
||
|
||
@glibc_flags = ''
|
||
@cflags = @cxxflags = "-fPIC -pipe #{@glibc_flags}"
|
||
@languages = 'c,c++,jit,objc,fortran,go,rust'
|
||
case ARCH
|
||
when 'armv7l', 'aarch64'
|
||
@archflags = '--with-arch=armv7-a+fp --with-float=hard --with-tune=cortex-a15 --with-fpu=vfpv3-d16'
|
||
when 'x86_64'
|
||
@archflags = '--with-arch-64=x86-64'
|
||
when 'i686'
|
||
@archflags = '--with-arch-32=i686'
|
||
end
|
||
@ldflags = @glibc_flags
|
||
@path = "#{CREW_PREFIX}/share/cargo/bin:" + ENV.fetch('PATH', nil)
|
||
|
||
def self.patch
|
||
system 'filefix'
|
||
|
||
# This fixes a PATH_MAX undefined error which breaks libsanitizer
|
||
# "libsanitizer/asan/asan_linux.cpp:217:21: error: ‘PATH_MAX’ was not declared in this scope"
|
||
# This is defined in https://chromium.googlesource.com/chromiumos/third_party/kernel/+/refs/heads/chromeos-5.4/include/uapi/linux/limits.h
|
||
# and is defined as per suggested method here: https://github.com/ZefengWang/cross-tool-chain-build
|
||
# The following is due to sed not passing newlines right.
|
||
return unless system 'grep -q 4096 libsanitizer/asan/asan_linux.cpp', exception: false
|
||
|
||
system "sed -i '77a #endif' libsanitizer/asan/asan_linux.cpp"
|
||
system "sed -i '77a #define PATH_MAX 4096' libsanitizer/asan/asan_linux.cpp"
|
||
system "sed -i '77a #ifndef PATH_MAX' libsanitizer/asan/asan_linux.cpp"
|
||
end
|
||
|
||
def self.prebuild
|
||
@C99 = <<~EOF
|
||
#!/usr/bin/env sh
|
||
fl="-std=c99"
|
||
for opt; do
|
||
case "$opt" in
|
||
-std=c99|-std=iso9899:1999) fl="";;
|
||
-std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2
|
||
exit 1;;
|
||
esac
|
||
done
|
||
exec gcc $fl ${1+"$@"}
|
||
EOF
|
||
|
||
@C89 = <<~EOF
|
||
#!/usr/bin/env sh
|
||
fl="-std=c89"
|
||
for opt; do
|
||
case "$opt" in
|
||
-ansi|-std=c89|-std=iso9899:1990) fl="";;
|
||
-std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2
|
||
exit 1;;
|
||
esac
|
||
done
|
||
exec gcc $fl ${1+"$@"}
|
||
EOF
|
||
end
|
||
|
||
def self.build
|
||
@gcc_global_opts = <<~OPT.chomp
|
||
--build=#{CREW_TARGET} \
|
||
--host=#{CREW_TARGET} \
|
||
--target=#{CREW_TARGET} \
|
||
--disable-bootstrap \
|
||
--disable-install-libiberty \
|
||
--disable-libmpx \
|
||
--disable-libssp \
|
||
--disable-multilib \
|
||
--disable-werror \
|
||
--enable-cet=auto \
|
||
--enable-checking=release \
|
||
--enable-clocale=gnu \
|
||
--enable-default-pie \
|
||
--enable-default-ssp \
|
||
--enable-gnu-indirect-function \
|
||
--enable-gnu-unique-object \
|
||
--enable-host-shared \
|
||
--enable-link-serialization=1 \
|
||
--enable-linker-plugin-configure-flags='--host=#{CREW_TARGET} --target=#{CREW_TARGET}' \
|
||
--enable-plugin \
|
||
--enable-shared \
|
||
--enable-symvers \
|
||
--enable-static \
|
||
--enable-threads=posix \
|
||
--with-gcc-major-version-only \
|
||
--with-gmp \
|
||
--with-isl \
|
||
--with-mpc \
|
||
--with-mpfr \
|
||
--with-newlib \
|
||
--with-pic \
|
||
--with-system-libunwind \
|
||
--with-system-zlib \
|
||
--with-system-zstd \
|
||
--with-stage1-ldflags='#{@glibc_flags}' \
|
||
--with-boot-ldflags='#{@glibc_flags}'
|
||
OPT
|
||
puts 'Building with:'.lightblue
|
||
puts @gcc_global_opts.lightblue
|
||
# Install prereqs using the standard gcc method so they can be
|
||
# linked statically.
|
||
# system './contrib/download_prerequisites'
|
||
|
||
FileUtils.mkdir_p 'objdir/gcc/.deps'
|
||
|
||
Dir.chdir('objdir') do
|
||
build_env =
|
||
{
|
||
build_configargs: @gcc_global_opts,
|
||
AR: 'gcc-ar',
|
||
CFLAGS: @cflags,
|
||
CXXFLAGS: @cxxflags,
|
||
LDFLAGS: @ldflags,
|
||
LIBRARY_PATH: CREW_LIB_PREFIX,
|
||
LD: 'ld',
|
||
NM: 'gcc-nm',
|
||
PATH: @path,
|
||
RANLIB: 'gcc-ranlib'
|
||
}.transform_keys(&:to_s)
|
||
|
||
system build_env, "../configure #{CREW_CONFIGURE_OPTIONS} \
|
||
#{@gcc_global_opts} \
|
||
#{@archflags} \
|
||
--with-native-system-header-dir=#{CREW_PREFIX}/include \
|
||
--enable-languages=#{@languages} \
|
||
--program-suffix=-#{@gcc_version}"
|
||
# Concurrent build sometimes breaks.
|
||
system 'make'
|
||
system 'make -j1' if $CHILD_STATUS.exitstatus != 0
|
||
end
|
||
end
|
||
|
||
# preserve for check, skip check for current version
|
||
def self.check
|
||
# Dir.chdir('objdir') do
|
||
# system "make -k check -j#{CREW_NPROC} || true"
|
||
# system '../contrib/test_summary'
|
||
# end
|
||
end
|
||
|
||
def self.install
|
||
gcc_arch = `objdir/gcc/xgcc -dumpmachine`.chomp
|
||
gcc_dir = "gcc/#{gcc_arch}/#{@gcc_version}"
|
||
gcc_libdir = "#{CREW_DEST_LIB_PREFIX}/#{gcc_dir}"
|
||
|
||
Dir.chdir('objdir') do
|
||
# gcc-libs install
|
||
system "make -C #{CREW_TARGET}/libgcc DESTDIR=#{CREW_DEST_DIR} install-shared"
|
||
|
||
@gcc_libs = %w[libatomic libgfortran libgo libgomp libitm
|
||
libquadmath libsanitizer/asan libsanitizer/lsan libsanitizer/ubsan
|
||
libsanitizer/tsan libstdc++-v3/src libvtv]
|
||
@gcc_libs.each do |lib|
|
||
system "make -C #{CREW_TARGET}/#{lib} \
|
||
DESTDIR=#{CREW_DEST_DIR} install-toolexeclibLTLIBRARIES", exception: false
|
||
end
|
||
|
||
system "make -C #{CREW_TARGET}/libobjc DESTDIR=#{CREW_DEST_DIR} install-libs", exception: false
|
||
system "make -C #{CREW_TARGET}/libstdc++-v3/po DESTDIR=#{CREW_DEST_DIR} install", exception: false
|
||
system "make -C #{CREW_TARGET}/libphobos DESTDIR=#{CREW_DEST_DIR} install", exception: false
|
||
|
||
# gcc_libs_info
|
||
%w[libgomp libitm libquadmath].each do |lib|
|
||
system "make -C #{CREW_TARGET}/#{lib} DESTDIR=#{CREW_DEST_DIR} install-info", exception: false
|
||
end
|
||
|
||
system "make DESTDIR=#{CREW_DEST_DIR} install-strip"
|
||
|
||
# gcc-non-lib install
|
||
system "make -C gcc DESTDIR=#{CREW_DEST_DIR} install-driver install-cpp install-gcc-ar \
|
||
c++.install-common install-headers install-plugin install-lto-wrapper"
|
||
|
||
%w[gcov gcov-tool].each do |gcov_bin|
|
||
FileUtils.install "gcc/#{gcov_bin}", "#{CREW_DEST_PREFIX}/bin/#{gcov_bin}-#{@gcc_version}", mode: 0o755
|
||
end
|
||
|
||
FileUtils.mkdir_p gcc_libdir
|
||
|
||
%w[cc1 cc1plus collect2 lto1].each do |lib|
|
||
FileUtils.install "gcc/#{lib}", "#{gcc_libdir}/", mode: 0o755
|
||
end
|
||
|
||
system "make -C #{CREW_TARGET}/libgcc DESTDIR=#{CREW_DEST_DIR} install"
|
||
|
||
%w[src include libsupc++ python].each do |lib|
|
||
system "make -C #{CREW_TARGET}/libstdc++-v3/#{lib} DESTDIR=#{CREW_DEST_DIR} install"
|
||
end
|
||
|
||
system "make DESTDIR=#{CREW_DEST_DIR} install-libcc1"
|
||
|
||
# http://www.linuxfromscratch.org/lfs/view/development/chapter06/gcc.html#contents-gcc
|
||
# move a misplaced file
|
||
# The installation stage puts some files used by gdb under the /usr/local/lib(64) directory.
|
||
# This generates spurious error messages when performing ldconfig. This command moves the files to another location.
|
||
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/gdb/auto-load/usr/lib"
|
||
FileUtils.mv Dir["#{CREW_DEST_LIB_PREFIX}/*gdb.py"], "#{CREW_DEST_PREFIX}/share/gdb/auto-load/usr/lib/"
|
||
|
||
system "make DESTDIR=#{CREW_DEST_DIR} install-fixincludes"
|
||
system "make -C gcc DESTDIR=#{CREW_DEST_DIR} install-mkheaders"
|
||
|
||
system "make -C lto-plugin DESTDIR=#{CREW_DEST_DIR} install"
|
||
|
||
system "make -C #{CREW_TARGET}/libgomp DESTDIR=#{CREW_DEST_DIR} install-nodist_libsubincludeHEADERS",
|
||
exception: false
|
||
system "make -C #{CREW_TARGET}/libgomp DESTDIR=#{CREW_DEST_DIR} install-nodist_toolexeclibHEADERS",
|
||
exception: false
|
||
system "make -C #{CREW_TARGET}/libitm DESTDIR=#{CREW_DEST_DIR} install-nodist_toolexeclibHEADERS",
|
||
exception: false
|
||
system "make -C #{CREW_TARGET}/libquadmath DESTDIR=#{CREW_DEST_DIR} install-nodist_libsubincludeHEADERS",
|
||
exception: false
|
||
system "make -C #{CREW_TARGET}/libsanitizer DESTDIR=#{CREW_DEST_DIR} install-nodist_sanincludeHEADERS",
|
||
exception: false
|
||
system "make -C #{CREW_TARGET}/libsanitizer DESTDIR=#{CREW_DEST_DIR} install-nodist_toolexeclibHEADERS",
|
||
exception: false
|
||
system "make -C #{CREW_TARGET}/libsanitizer/asan DESTDIR=#{CREW_DEST_DIR} install-nodist_toolexeclibHEADERS", exception: false
|
||
# This failed on i686
|
||
system "make -C #{CREW_TARGET}/libsanitizer/tsan DESTDIR=#{CREW_DEST_DIR} install-nodist_toolexeclibHEADERS", exception: false
|
||
# This might fail on i686
|
||
system "make -C #{CREW_TARGET}/libsanitizer/lsan DESTDIR=#{CREW_DEST_DIR} install-nodist_toolexeclibHEADERS", exception: false
|
||
|
||
# libiberty is installed from binutils
|
||
# system "env LD_LIBRARY_PATH=#{CREW_LIB_PREFIX} \
|
||
# LIBRARY_PATH=#{CREW_LIB_PREFIX} PATH=#{@path} \
|
||
# make -C libiberty DESTDIR=#{CREW_DEST_DIR} install"
|
||
# install -m644 libiberty/pic/libiberty.a "#{CREW_DEST_PREFIX}/lib"
|
||
|
||
system "make -C gcc DESTDIR=#{CREW_DEST_DIR} install-man install-info"
|
||
|
||
system "make -C libcpp DESTDIR=#{CREW_DEST_DIR} install"
|
||
system "make -C gcc DESTDIR=#{CREW_DEST_DIR} install-po"
|
||
|
||
# install the libstdc++ man pages
|
||
# This is broken in 14.0.1
|
||
# system "make -C #{CREW_TARGET}/libstdc++-v3/doc DESTDIR=#{CREW_DEST_DIR} doc-install-man"
|
||
|
||
# byte-compile python libraries
|
||
system "python -m compileall #{CREW_DEST_PREFIX}/share/gcc-#{@gcc_version}/"
|
||
system "python -O -m compileall #{CREW_DEST_PREFIX}/share/gcc-#{@gcc_version}"
|
||
end
|
||
|
||
Dir.chdir "#{CREW_DEST_MAN_PREFIX}/man1" do
|
||
Dir["*-#{@gcc_version}.1*"].each do |f|
|
||
basefile = f.gsub("-#{@gcc_version}", '')
|
||
FileUtils.ln_sf f, basefile
|
||
end
|
||
end
|
||
|
||
Dir.chdir "#{CREW_DEST_PREFIX}/bin/" do
|
||
Dir["#{gcc_arch}-*-#{@gcc_version}"].each do |f|
|
||
basefile_nover = f.delete_suffix("-#{@gcc_version}")
|
||
|
||
basefile_noarch = f.delete_prefix("#{gcc_arch}-")
|
||
FileUtils.ln_sf f, basefile_noarch, verbose: true
|
||
|
||
basefile_noarch_nover = basefile_nover.delete_prefix("#{gcc_arch}-")
|
||
FileUtils.ln_sf f, basefile_noarch_nover, verbose: true
|
||
|
||
basefile_noarch_nover_nogcc = basefile_noarch_nover.delete_prefix('gcc-')
|
||
FileUtils.ln_sf f, "#{gcc_arch}-#{basefile_noarch_nover_nogcc}", verbose: true
|
||
end
|
||
|
||
Dir["*-#{@gcc_version}"].each do |f|
|
||
basefile_nover = f.delete_suffix("-#{@gcc_version}")
|
||
FileUtils.ln_sf f, basefile_nover, verbose: true
|
||
end
|
||
|
||
# many packages expect this symlink
|
||
FileUtils.ln_sf "gcc-#{@gcc_version}", 'cc', verbose: true
|
||
end
|
||
|
||
# make sure current version of gcc LTO plugin for Gold linker is installed.
|
||
FileUtils.mkdir_p "#{CREW_DEST_LIB_PREFIX}/bfd-plugins/"
|
||
FileUtils.ln_sf "#{CREW_PREFIX}/libexec/#{gcc_dir}/liblto_plugin.so", "#{CREW_DEST_LIB_PREFIX}/bfd-plugins/",
|
||
verbose: true
|
||
|
||
# binutils makes a symlink here, but just in case it isn't there.
|
||
if ARCH_LIB == 'lib64'
|
||
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/lib/bfd-plugins/"
|
||
FileUtils.ln_sf "#{CREW_PREFIX}/libexec/#{gcc_dir}/liblto_plugin.so", "#{CREW_DEST_PREFIX}/lib/bfd-plugins/",
|
||
verbose: true
|
||
end
|
||
|
||
File.write "#{CREW_DEST_PREFIX}/bin/c99", @C99, perm: 0o755
|
||
File.write "#{CREW_DEST_PREFIX}/bin/c89", @C89, perm: 0o755
|
||
end
|
||
|
||
def self.postinstall
|
||
# remove any previous gcc packages
|
||
@device = JSON.load_file(File.join(CREW_CONFIG_PATH, 'device.json'), symbolize_names: true).transform_values! { |val| val.is_a?(String) ? val.to_sym : val }
|
||
|
||
installed_gcc = @device[:installed_packages].select { |pkg| pkg[:name] =~ /^gcc\d+$/ }
|
||
|
||
installed_gcc.each do |gcc_pkg|
|
||
puts "Removing previous version of gcc (#{gcc_pkg[:name]})...".yellow
|
||
|
||
# remove filelist and directorylist
|
||
FileUtils.rm_f(["#{CREW_META_PATH}/#{gcc_pkg[:name]}.filelist",
|
||
"#{CREW_META_PATH}/#{gcc_pkg[:name]}.directorylist"])
|
||
|
||
# delete gcc#{ver} from device.json
|
||
@device[:installed_packages].delete_if { |pkg| pkg[:name] == gcc_pkg[:name] }
|
||
end
|
||
|
||
# update device.json
|
||
File.write("#{CREW_CONFIG_PATH}/device.json", JSON.pretty_generate(@device))
|
||
end
|
||
end
|