Files
chromebrew/lib/const.rb
Satadru Pramanik, DO, MPH, MEng 8dbc3925d2 icu4c => 75.1 + updates (#10246)
* Update icu4c, libxml2

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update libxml2

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* libxslt rebuild

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* updates and rebuilds for harfbuzz, freetype, fontconfig, cairo, pango

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild libxslt with new version

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add icu version to libarchive

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust xmlto deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust xmlto deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust xmlto deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* icu version shared_mime_info

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add js115 py deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* python updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update binutils to master

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* more test changes for js115

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update py3_pyicu

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild wayland

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update librsvg

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild xfsprogs

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild bind

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* boost rebuild

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add libabigail, update sphinx and deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild yelp

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update gspell

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update imlib2

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update libgsf

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild libcdr, update libical

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild libmetalink, update libvisio

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild caja

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update gtk3

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update glib

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update gobject_introspection

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update gnome_docking_library package

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* more gnome updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup nautilus

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update vte, revert js115 changes to allow installs, add arm builds for tinysparql, localsearch, nautilus

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* glibc testing upload

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update r

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes to add detection for -icu??.?

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rebuild geany_plugins

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add dehtml, rework glibc_build237

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update py3_pyyaml

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update libdbusmenu_gtk3

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update gtksourceview_5, cleanup sass packages

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update sass packages, add binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update graphicsmagick, refactor glibc_build237

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add x86_84 binaries for tinysparql, localsearch, nautilus

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update evolution_data_server

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* iterate

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* xwayland => 24.1.2

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update glibc_build237 binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* sync glibc packages

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* remove instance variables

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* more pkg updates, update mold

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fix webkitgtk_6 pkg

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* sync glibc changes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust mysql deps

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add new packages to packages.yaml

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update package file for webkitgtk_6

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* python => 3.12.5

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust build options for js115

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update js115

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update more packages

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add i686 build

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add builds for uriparser

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust force flag

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fix downloader force

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup download pkg_name usage

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update smbclient package

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update tesseract package

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* package updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update tesseract, add time check for builds to crew

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update some samba packages

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update tepl packages

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add ruby_pry_byebug

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update smbclient

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* tepl updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update smbclient

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update imagemagick7

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add postgresql binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fix yaml

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust build_elapsed time code, add verbose build to unit test

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add CREW_DEBUG to help debug issues with crew (invoke with crew <command> --debug).

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* update crew_profile_base

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* some python package cleanups

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add print_source_bashrc to docbook_xsl

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add debugging info message

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* fixup

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* bump version

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* suggested changes and install updates

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add crew_sudo binaries

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* rubocop fixes

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Fixes: #10291

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* refactor crew upload

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* abort when a file is already uploaded

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* use highline for crew upload prompt

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* add highline to buildessential

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* adjust highline update speed in packages.yaml

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-08-11 03:19:59 -05:00

346 lines
15 KiB
Ruby

# lib/const.rb
# Defines common constants used in different parts of crew
require 'etc'
CREW_VERSION = '1.50.1'
# Kernel architecture.
KERN_ARCH = Etc.uname[:machine]
# Read and parse processor information from /proc/cpuinfo
CPUINFO = File.readlines('/proc/cpuinfo').map { |line| line.chomp.split(/\t+: /) if line.include?("\t") }.compact.to_h
# We report aarch64 & armv8l machines as armv7l for now, as we treat
# them as if they were armv7l.
# When we have proper aarch64 support, remove this.
# Also, we allow ARCH to be changed via the ARCH environment variable.
ARCH = ENV.fetch('ARCH') do |_name|
case KERN_ARCH
when 'aarch64', 'armv8l'
'armv7l'
else KERN_ARCH
end
end
# Allow for edge case of i686 install on a x86_64 host before linux32 is
# downloaded, e.g. in a docker container.
CREW_LIB_SUFFIX = ARCH.eql?('x86_64') && Dir.exist?('/lib64') ? '64' : ''
ARCH_LIB = "lib#{CREW_LIB_SUFFIX}"
# Glibc version can be found from the output of libc.so.6
LIBC_VERSION = ENV.fetch('LIBC_VERSION', Etc.confstr(Etc::CS_GNU_LIBC_VERSION).split.last)
CREW_PREFIX = ENV.fetch('CREW_PREFIX', '/usr/local')
if CREW_PREFIX == '/usr/local'
CREW_BUILD_FROM_SOURCE = ENV.fetch('CREW_BUILD_FROM_SOURCE', '0').eql?('1')
HOME = Dir.home
else
CREW_BUILD_FROM_SOURCE = true
HOME = File.join(CREW_PREFIX, Dir.home)
end
CREW_ESSENTIAL_PACKAGES = %w[gcc_lib glibc gmp lz4 ruby xzutils zlib zstd]
CREW_IN_CONTAINER = File.exist?('/.dockerenv') || ENV.fetch('CREW_IN_CONTAINER', '0').eql?('1')
CREW_CPU_VENDOR = CPUINFO['vendor_id']
# The cpuinfo vendor_id may not exist on non-x86 platforms, or when a
# container is virtualized on non-x86 platforms. Default to
# CREW_IS_INTEL for x86 architectures.
CREW_IS_AMD = CREW_CPU_VENDOR.eql?('AuthenticAMD')
CREW_IS_INTEL = %w[x86_64 i686].include?(ARCH) && %w[unknown GenuineIntel].include?(CREW_CPU_VENDOR)
# Use sane minimal defaults if in container and no override specified.
CREW_KERNEL_VERSION = \
if CREW_IN_CONTAINER && ENV['CREW_KERNEL_VERSION'].nil?
ARCH.eql?('i686') ? '3.8' : '5.10'
else
ENV.fetch('CREW_KERNEL_VERSION', Etc.uname[:release].rpartition('.').first)
end
CREW_LIB_PREFIX = File.join(CREW_PREFIX, ARCH_LIB)
CREW_MAN_PREFIX = File.join(CREW_PREFIX, 'share/man')
CREW_LIB_PATH = File.join(CREW_PREFIX, 'lib/crew')
CREW_PACKAGES_PATH = File.join(CREW_LIB_PATH, 'packages')
CREW_CONFIG_PATH = File.join(CREW_PREFIX, 'etc/crew')
CREW_META_PATH = File.join(CREW_CONFIG_PATH, 'meta')
CREW_BREW_DIR = File.join(CREW_PREFIX, 'tmp/crew')
CREW_DEST_DIR = File.join(CREW_BREW_DIR, 'dest')
CREW_WINE_PREFIX = File.join(CREW_LIB_PREFIX, 'wine')
CREW_DEST_PREFIX = File.join(CREW_DEST_DIR, CREW_PREFIX)
CREW_DEST_LIB_PREFIX = File.join(CREW_DEST_DIR, CREW_LIB_PREFIX)
CREW_DEST_WINE_PREFIX = File.join(CREW_DEST_PREFIX, CREW_WINE_PREFIX)
CREW_DEST_MAN_PREFIX = File.join(CREW_DEST_DIR, CREW_MAN_PREFIX)
# Local constants for contributors.
CREW_LOCAL_REPO_ROOT = `git rev-parse --show-toplevel 2> /dev/null`.chomp
CREW_LOCAL_BUILD_DIR = "#{CREW_LOCAL_REPO_ROOT}/release/#{ARCH}"
# The following is used in fixup.rb to determine if crew update needs to
# be run again.
CREW_CONST_GIT_COMMIT = `git -C #{CREW_LIB_PATH} log -n1 --oneline #{__FILE__}`.split.first
# Put musl build dir under CREW_PREFIX/share/musl to avoid FHS incompatibility
CREW_MUSL_PREFIX = File.join(CREW_PREFIX, '/share/musl/')
CREW_DEST_MUSL_PREFIX = File.join(CREW_DEST_DIR, CREW_MUSL_PREFIX)
MUSL_LIBC_VERSION = File.executable?("#{CREW_MUSL_PREFIX}/lib/libc.so") ? `#{CREW_MUSL_PREFIX}/lib/libc.so 2>&1`[/\bVersion\s+\K\S+/] : nil
CREW_DEST_HOME = File.join(CREW_DEST_DIR, HOME)
CREW_CACHE_DIR = ENV.fetch('CREW_CACHE_DIR', "#{HOME}/.cache/crewcache")
CREW_CACHE_BUILD = ENV.fetch('CREW_CACHE_BUILD', '0').eql?('1')
CREW_CACHE_FAILED_BUILD = ENV.fetch('CREW_CACHE_FAILED_BUILD', '0').eql?('1')
CREW_DEBUG = ARGV.intersect?(%w[-D --debug])
CREW_FORCE = ARGV.intersect?(%w[-f --force])
CREW_VERBOSE = ARGV.intersect?(%w[-v --verbose])
# Set CREW_NPROC from environment variable, `distcc -j`, or `nproc`.
CREW_NPROC = \
if File.file?("#{CREW_PREFIX}/bin/distcc")
ENV.fetch('CREW_NPROC', `distcc -j`.chomp)
else
ENV.fetch('CREW_NPROC', `nproc`.chomp)
end
# Set following as boolean if environment variables exist.
CREW_CACHE_ENABLED = ENV.fetch('CREW_CACHE_ENABLED', '0').eql?('1')
CREW_CONFLICTS_ONLY_ADVISORY = ENV.fetch('CREW_CONFLICTS_ONLY_ADVISORY', '0').eql?('1') # or use conflicts_ok
CREW_DISABLE_ENV_OPTIONS = ENV.fetch('CREW_DISABLE_ENV_OPTIONS', '0').eql?('1') # or use no_env_options
CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY = ENV.fetch('CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY', '0').eql?('1') # or use no_fhs
CREW_NOT_COMPRESS = ENV.fetch('CREW_NOT_COMPRESS', '0').eql?('1') # or use no_compress
CREW_NOT_LINKS = ENV.fetch('CREW_NOT_LINKS', '0').eql?('1') # or use no_links
CREW_NOT_STRIP = ENV.fetch('CREW_NOT_STRIP', '0').eql?('1') # or use no_strip
CREW_NOT_SHRINK_ARCHIVE = ENV.fetch('CREW_NOT_SHRINK_ARCHIVE', '0').eql?('1') # or use no_shrink
# Allow git constants to be set from environment variables (for testing)
CREW_REPO = ENV.fetch('CREW_REPO', 'https://github.com/chromebrew/chromebrew.git')
CREW_BRANCH = ENV.fetch('CREW_BRANCH', 'master')
USER = Etc.getlogin
CHROMEOS_RELEASE = \
if File.exist?('/etc/lsb-release')
File.read('/etc/lsb-release')[/CHROMEOS_RELEASE_CHROME_MILESTONE=(.+)/, 1]
else
# newer version of Chrome OS exports info to env by default
ENV.fetch('CHROMEOS_RELEASE_CHROME_MILESTONE', nil)
end
# If CREW_DISABLE_MVDIR environment variable exists and is equal to 1 use rsync/tar to install files in lieu of crew-mvdir.
CREW_DISABLE_MVDIR = ENV.fetch('CREW_DISABLE_MVDIR', '0').eql?('1')
# If CREW_USE_CURL environment variable exists use curl in lieu of net/http.
CREW_USE_CURL = ENV.fetch('CREW_USE_CURL', '0').eql?('1')
# Use an external downloader instead of net/http if CREW_DOWNLOADER is set, see lib/downloader.rb for more info
# About the format of the CREW_DOWNLOADER variable, see line 130-133 in lib/downloader.rb
CREW_DOWNLOADER = ENV.fetch('CREW_DOWNLOADER', nil)
# Downloader maximum retry count
CREW_DOWNLOADER_RETRY = ENV.fetch('CREW_DOWNLOADER_RETRY', 3).to_i
# show download progress bar or not (only applied when using the default ruby downloader)
CREW_HIDE_PROGBAR = ENV.fetch('CREW_HIDE_PROGBAR', '0').eql?('1')
# set certificate file location for lib/downloader.rb
SSL_CERT_FILE = \
if ENV['SSL_CERT_FILE'] && File.exist?(ENV['SSL_CERT_FILE'])
ENV['SSL_CERT_FILE']
elsif File.exist?("#{CREW_PREFIX}/etc/ssl/certs/ca-certificates.crt")
"#{CREW_PREFIX}/etc/ssl/certs/ca-certificates.crt"
else
'/etc/ssl/certs/ca-certificates.crt'
end
SSL_CERT_DIR = \
if ENV['SSL_CERT_DIR'] && Dir.exist?(ENV['SSL_CERT_DIR'])
ENV['SSL_CERT_DIR']
elsif Dir.exist?("#{CREW_PREFIX}/etc/ssl/certs")
"#{CREW_PREFIX}/etc/ssl/certs"
else
'/etc/ssl/certs'
end
CREW_ARCH_FLAGS_OVERRIDE = ENV.fetch('CREW_ARCH_FLAGS_OVERRIDE', '')
case ARCH
when 'aarch64', 'armv7l'
CREW_TARGET = 'armv7l-cros-linux-gnueabihf'
# These settings have been selected to match debian armhf.
# Using -mfpu=neon breaks builds such as webkit2gtk.
CREW_ARCH_FLAGS = CREW_ARCH_FLAGS_OVERRIDE.to_s.empty? ? '-mfloat-abi=hard -mthumb -mfpu=vfpv3-d16 -march=armv7-a+fp' : CREW_ARCH_FLAGS_OVERRIDE
when 'i686'
CREW_TARGET = 'i686-cros-linux-gnu'
CREW_ARCH_FLAGS = CREW_ARCH_FLAGS_OVERRIDE.to_s.empty? ? '' : CREW_ARCH_FLAGS_OVERRIDE
when 'x86_64'
CREW_TARGET = 'x86_64-cros-linux-gnu'
CREW_ARCH_FLAGS = CREW_ARCH_FLAGS_OVERRIDE.to_s.empty? ? '' : CREW_ARCH_FLAGS_OVERRIDE
end
CREW_LINKER = ENV.fetch('CREW_LINKER', 'mold')
CREW_GLIBC_OVERRIDE_LINKER_FLAGS = ARCH == 'x86_64' && LIBC_VERSION.to_f >= 2.35 ? " #{File.join(CREW_LIB_PREFIX, 'libC.so.6')} " : ''
CREW_LINKER_FLAGS = ENV.fetch('CREW_LINKER_FLAGS', CREW_GLIBC_OVERRIDE_LINKER_FLAGS)
CREW_CORE_FLAGS = "-O2 -pipe -ffat-lto-objects -fPIC #{CREW_ARCH_FLAGS} -fuse-ld=#{CREW_LINKER} #{CREW_LINKER_FLAGS}"
CREW_COMMON_FLAGS = "#{CREW_CORE_FLAGS} -flto=auto"
CREW_COMMON_FNO_LTO_FLAGS = "#{CREW_CORE_FLAGS} -fno-lto"
CREW_LDFLAGS = "-flto=auto #{CREW_LINKER_FLAGS}"
CREW_FNO_LTO_LDFLAGS = '-fno-lto'
CREW_ENV_OPTIONS_HASH = \
if CREW_DISABLE_ENV_OPTIONS
{ 'CREW_DISABLE_ENV_OPTIONS' => '1' }
else
{
'CFLAGS' => CREW_COMMON_FLAGS,
'CXXFLAGS' => CREW_COMMON_FLAGS,
'FCFLAGS' => CREW_COMMON_FLAGS,
'FFLAGS' => CREW_COMMON_FLAGS,
'LD_LIBRARY_PATH' => CREW_LIB_PREFIX,
'LDFLAGS' => CREW_LDFLAGS
}
end
# parse from hash to shell readable string
CREW_ENV_OPTIONS = CREW_ENV_OPTIONS_HASH.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')
CREW_ENV_FNO_LTO_OPTIONS_HASH = {
'CFLAGS' => CREW_COMMON_FNO_LTO_FLAGS,
'CXXFLAGS' => CREW_COMMON_FNO_LTO_FLAGS,
'FCFLAGS' => CREW_COMMON_FNO_LTO_FLAGS,
'FFLAGS' => CREW_COMMON_FNO_LTO_FLAGS,
'LD_LIBRARY_PATH' => CREW_LIB_PREFIX,
'LDFLAGS' => CREW_FNO_LTO_LDFLAGS
}
# parse from hash to shell readable string
CREW_ENV_FNO_LTO_OPTIONS = CREW_ENV_FNO_LTO_OPTIONS_HASH.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')
CREW_OPTIONS = <<~OPT.chomp
--prefix=#{CREW_PREFIX} \
--libdir=#{CREW_LIB_PREFIX} \
--mandir=#{CREW_MAN_PREFIX} \
--disable-dependency-tracking \
--program-prefix='' \
--program-suffix=''
OPT
CREW_MESON_OPTIONS = <<~OPT.chomp
-Dprefix=#{CREW_PREFIX} \
-Dlibdir=#{CREW_LIB_PREFIX} \
-Dlocalstatedir=#{CREW_PREFIX}/var/local \
-Dmandir=#{CREW_MAN_PREFIX} \
-Dsharedstatedir=#{CREW_PREFIX}/var/local/lib \
-Dbuildtype=release \
-Db_lto=true \
-Dstrip=true \
-Db_pie=true \
-Dcpp_args='#{CREW_CORE_FLAGS}' \
-Dc_args='#{CREW_CORE_FLAGS}'
OPT
# Use ninja or samurai
CREW_NINJA = ENV.fetch('CREW_NINJA', 'ninja')
# Cmake sometimes wants to use LIB_SUFFIX to install libs in LIB64, so specify such for x86_64
# This is often considered deprecated. See discussio at https://gitlab.kitware.com/cmake/cmake/-/issues/18640
# and also https://bugzilla.redhat.com/show_bug.cgi?id=1425064
# Let's have two CREW_CMAKE_OPTIONS since this avoids the logic in the recipe file.
CREW_CMAKE_OPTIONS = <<~OPT.chomp
-DCMAKE_INSTALL_PREFIX=#{CREW_PREFIX} \
-DCMAKE_LIBRARY_PATH=#{CREW_LIB_PREFIX} \
-DCMAKE_C_FLAGS='#{CREW_COMMON_FLAGS.gsub(/-fuse-ld=.{2,4}\s/, '')}' \
-DCMAKE_CXX_FLAGS='#{CREW_COMMON_FLAGS.gsub(/-fuse-ld=.{2,4}\s/, '')}' \
-DCMAKE_EXE_LINKER_FLAGS='#{CREW_LDFLAGS}' \
-DCMAKE_LINKER_TYPE=#{CREW_LINKER.upcase} \
-DCMAKE_SHARED_LINKER_FLAGS='#{CREW_LDFLAGS}' \
-DCMAKE_MODULE_LINKER_FLAGS='#{CREW_LDFLAGS}' \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE \
-DCMAKE_BUILD_TYPE=Release
OPT
CREW_CMAKE_FNO_LTO_OPTIONS = <<~OPT.chomp
-DCMAKE_INSTALL_PREFIX=#{CREW_PREFIX} \
-DCMAKE_LIBRARY_PATH=#{CREW_LIB_PREFIX} \
-DCMAKE_C_FLAGS='#{CREW_COMMON_FNO_LTO_FLAGS.gsub(/-fuse-ld=.{2,4}\s/, '')}' \
-DCMAKE_CXX_FLAGS='#{CREW_COMMON_FNO_LTO_FLAGS.gsub(/-fuse-ld=.{2,4}\s/, '')}' \
-DCMAKE_EXE_LINKER_FLAGS=#{CREW_FNO_LTO_LDFLAGS} \
-DCMAKE_LINKER_TYPE=#{CREW_LINKER.upcase} \
-DCMAKE_SHARED_LINKER_FLAGS=#{CREW_FNO_LTO_LDFLAGS} \
-DCMAKE_MODULE_LINKER_FLAGS=#{CREW_FNO_LTO_LDFLAGS} \
-DCMAKE_BUILD_TYPE=Release
OPT
CREW_CMAKE_LIBSUFFIX_OPTIONS = "#{CREW_CMAKE_OPTIONS} -DLIB_SUFFIX=#{CREW_LIB_SUFFIX}"
PY3_SETUP_BUILD_OPTIONS = "--executable=#{CREW_PREFIX}/bin/python3"
PY2_SETUP_BUILD_OPTIONS = "--executable=#{CREW_PREFIX}/bin/python2"
PY_SETUP_INSTALL_OPTIONS_NO_SVEM = "--root=#{CREW_DEST_DIR} --prefix=#{CREW_PREFIX} -O2 --compile"
PY_SETUP_INSTALL_OPTIONS = "#{PY_SETUP_INSTALL_OPTIONS_NO_SVEM} --single-version-externally-managed"
PY3_BUILD_OPTIONS = '--wheel --no-isolation'
PY3_INSTALLER_OPTIONS = "--destdir=#{CREW_DEST_DIR} --compile-bytecode 2 dist/*.whl"
CREW_LICENSE = <<~LICENSESTRING
Copyright (C) 2013-2024 Chromebrew Authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see https://www.gnu.org/licenses/gpl-3.0.html.
Chromebrew embeds lib/docopt.rb from another project under the MIT License.
You should have received a copy of the license along with this program.
If not, see https://github.com/docopt/docopt.rb/blob/master/LICENSE
LICENSESTRING
CREW_DOCOPT = <<~DOCOPT
Chromebrew - Package manager for Chrome OS https://chromebrew.github.io
Usage:
crew build [options] [-k|--keep] [-v|--verbose] <name> ...
crew check [-V|--version] [-v|--verbose] <name> ...
crew const [-v|--verbose] [<name> ...]
crew deps [options] [--deep] [-t|--tree] [-b|--include-build-deps] [--exclude-buildessential] [-v|--verbose] <name> ...
crew download [options] [-s|--source] [-v|--verbose] <name> ...
crew files <name> ...
crew help [<command>] [-v|--verbose] [<subcommand>]
crew install [options] [-k|--keep] [-s|--source] [-S|--recursive-build] [-v|--verbose] <name> ...
crew list [options] [-v|--verbose] (available|installed|compatible|incompatible)
crew postinstall [options] [-v|--verbose] <name> ...
crew prop [<property>]
crew reinstall [options] [-k|--keep] [-s|--source] [-S|--recursive-build] [-v|--verbose] <name> ...
crew remove [-v|--verbose] <name> ...
crew search [-v|--verbose] <name> ...
crew sysinfo [-v|--verbose]
crew test [-v|--verbose] [<name> ...]
crew update [options] [-v|--verbose] [<compatible>]
crew upgrade [options] [-k|--keep] [-s|--source] [-v|--verbose] [<name> ...]
crew upload [options] [-v|--verbose] [<name> ...]
crew whatprovides <pattern> ...
-b --include-build-deps Include build dependencies in output.
-t --tree Print dependencies in a tree-structure format.
-c --color Use colors even if standard out is not a tty.
-d --no-color Disable colors even if standard out is a tty.
-f --force Force where relevant.
-k --keep Keep the `CREW_BREW_DIR` (#{CREW_BREW_DIR}) directory.
-L --license Display the crew license.
-s --source Build or download from source even if pre-compiled binary exists.
-S --recursive-build Build from source, including all dependencies, even if pre-compiled binaries exist.
-v --verbose Show extra information.
-V --version Display the crew version.
-h --help Show this screen.
-D --debug Enable debugging.
version #{CREW_VERSION}
DOCOPT
# All available crew commands.
CREW_COMMANDS = CREW_DOCOPT.scan(/crew ([^\s]+)/).flatten.sort.join(', ').gsub('.', '')