mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
Merge branch 'master' into pythonize1
This commit is contained in:
51
lib/const.rb
51
lib/const.rb
@@ -1,22 +1,28 @@
|
||||
# Defines common constants used in different parts of crew
|
||||
|
||||
CREW_VERSION = '1.12.0'
|
||||
CREW_VERSION = '1.15.0'
|
||||
|
||||
ARCH_ACTUAL = `uname -m`.strip
|
||||
# This helps with virtualized builds on aarch64 machines
|
||||
# which report armv8l when linux32 is run.
|
||||
ARCH = if ARCH_ACTUAL == 'armv8l' then 'armv7l' else ARCH_ACTUAL end
|
||||
|
||||
ARCH_LIB = if ARCH == 'x86_64' then 'lib64' else 'lib' end
|
||||
# Allow for edge case of i686 install on a x86_64 host before linux32 is
|
||||
# downloaded, e.g. in a docker container.
|
||||
ARCH_LIB = if ARCH == 'x86_64' and Dir.exist?('/lib64') then 'lib64' else 'lib' end
|
||||
|
||||
# Glibc version can be found from the output of libc.so.6
|
||||
@libcvertokens= %x[/#{ARCH_LIB}/libc.so.6].lines.first.chomp.split(/[\s]/)
|
||||
LIBC_VERSION = @libcvertokens[@libcvertokens.find_index("version") + 1].sub!(/[[:punct:]]?$/,'')
|
||||
|
||||
CREW_PREFIX = '/usr/local'
|
||||
if ENV['CREW_PREFIX'] and ENV['CREW_PREFIX'] != CREW_PREFIX
|
||||
CREW_PREFIX = ENV['CREW_PREFIX']
|
||||
if ENV['CREW_PREFIX'] and ENV['CREW_PREFIX'] != '' and ENV['CREW_PREFIX'] != '/usr/local'
|
||||
CREW_BUILD_FROM_SOURCE = 1
|
||||
CREW_PREFIX = ENV['CREW_PREFIX']
|
||||
HOME = CREW_PREFIX + ENV['HOME']
|
||||
else
|
||||
CREW_BUILD_FROM_SOURCE = ENV['CREW_BUILD_FROM_SOURCE']
|
||||
CREW_PREFIX = '/usr/local'
|
||||
HOME = ENV['HOME']
|
||||
end
|
||||
|
||||
CREW_LIB_PREFIX = CREW_PREFIX + '/' + ARCH_LIB
|
||||
@@ -31,11 +37,7 @@ CREW_DEST_PREFIX = CREW_DEST_DIR + CREW_PREFIX
|
||||
CREW_DEST_LIB_PREFIX = CREW_DEST_DIR + CREW_LIB_PREFIX
|
||||
CREW_DEST_MAN_PREFIX = CREW_DEST_DIR + CREW_MAN_PREFIX
|
||||
|
||||
if ENV['CREW_PREFIX'].to_s.empty?
|
||||
HOME = ENV['HOME']
|
||||
else
|
||||
HOME = CREW_PREFIX + ENV['HOME']
|
||||
end
|
||||
CREW_DEST_HOME = CREW_DEST_DIR + HOME
|
||||
|
||||
# File.join ensures a trailing slash if one does not exist.
|
||||
if ENV['CREW_CACHE_DIR'].to_s.empty?
|
||||
@@ -48,25 +50,44 @@ FileUtils.mkdir_p CREW_CACHE_DIR unless Dir.exist? CREW_CACHE_DIR
|
||||
|
||||
CREW_CACHE_ENABLED = ENV['CREW_CACHE_ENABLED']
|
||||
|
||||
CREW_DEST_HOME = CREW_DEST_DIR + HOME
|
||||
CREW_CONFLICTS_ONLY_ADVISORY = ENV['CREW_CONFLICTS_ONLY_ADVISORY']
|
||||
|
||||
CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY = ENV['CREW_FHS_NONCOMPLIANCE_ONLY_ADVISORY']
|
||||
|
||||
# Set CREW_NPROC from environment variable or `nproc`
|
||||
if ENV["CREW_NPROC"].to_s.empty?
|
||||
if ENV['CREW_NPROC'].to_s.empty?
|
||||
CREW_NPROC = `nproc`.strip
|
||||
else
|
||||
CREW_NPROC = ENV["CREW_NPROC"]
|
||||
CREW_NPROC = ENV['CREW_NPROC']
|
||||
end
|
||||
|
||||
# Set CREW_NOT_COMPRESS from environment variable
|
||||
CREW_NOT_COMPRESS = ENV["CREW_NOT_COMPRESS"]
|
||||
CREW_NOT_COMPRESS = ENV['CREW_NOT_COMPRESS']
|
||||
|
||||
# Set CREW_NOT_STRIP from environment variable
|
||||
CREW_NOT_STRIP = ENV["CREW_NOT_STRIP"]
|
||||
CREW_NOT_STRIP = ENV['CREW_NOT_STRIP']
|
||||
|
||||
CREW_SHRINK_ARCHIVE = ENV['CREW_SHRINK_ARCHIVE']
|
||||
|
||||
# Set testing constants from environment variables
|
||||
crew_testing_repo = ENV['CREW_TESTING_REPO']
|
||||
crew_testing_branch = ENV['CREW_TESTING_BRANCH']
|
||||
crew_testing = ENV['CREW_TESTING']
|
||||
crew_testing = '0' if crew_testing_repo.nil? || crew_testing_repo.empty?
|
||||
crew_testing = '0' if crew_testing_branch.nil? || crew_testing_branch.empty?
|
||||
CREW_TESTING = crew_testing
|
||||
CREW_TESTING_BRANCH = crew_testing_branch
|
||||
CREW_TESTING_REPO = crew_testing_repo
|
||||
|
||||
CREW_USE_PIXZ = ENV['CREW_USE_PIXZ']
|
||||
|
||||
USER = `whoami`.chomp
|
||||
|
||||
CHROMEOS_RELEASE = `grep CHROMEOS_RELEASE_CHROME_MILESTONE= /etc/lsb-release | cut -d'=' -f2`.chomp
|
||||
|
||||
# If CURL environment variable exists use it in lieu of curl.
|
||||
CURL = ENV['CURL'] || 'curl'
|
||||
|
||||
case ARCH
|
||||
when 'aarch64', 'armv7l'
|
||||
CREW_TGT = 'armv7l-cros-linux-gnueabihf'
|
||||
|
||||
Reference in New Issue
Block a user