Update the build for MacOS 15

This commit is contained in:
2025-08-03 22:36:29 +02:00
parent 32d4683315
commit 4b18a98581

View File

@@ -16,7 +16,7 @@ def gcc_verbose(gcc_binary)
output
end
def find_build_target(gcc_version)
def find_build_target
gcc_verbose('gcc')
.lines
.find { |line| line.start_with? 'Target: ' }
@@ -61,6 +61,7 @@ namespace :boot do
# Dependencies.
GCC_VERSION = "15.1.0"
HOST_GCC = TMP + 'host/gcc'
GCC_PATCH = 'https://raw.githubusercontent.com/Homebrew/formula-patches/575ffcaed6d3112916fed77d271dd3799a7255c4/gcc/gcc-15.1.0.diff'
directory HOST_GCC
directory(TMP + 'tools')
@@ -68,30 +69,32 @@ namespace :boot do
desc 'Download and configure the bootstrap compiler'
task configure: [TMP + 'tools', HOST_GCC, HOST_INSTALL] do
url = URI.parse "https://gcc.gnu.org/pub/gcc/releases/gcc-#{GCC_VERSION}/gcc-#{GCC_VERSION}.tar.xz"
build_target = find_build_target GCC_VERSION
build_target = find_build_target
source_directory = TMP + "tools/gcc-#{GCC_VERSION}"
frontend_link = source_directory + 'gcc'
download_and_pipe url, source_directory.dirname, ['tar', '-Jxv']
download_and_pipe URI.parse(GCC_PATCH), source_directory, ['patch', '-p1']
sh 'contrib/download_prerequisites', chdir: source_directory.to_path
File.symlink Pathname.new('.').relative_path_from(frontend_link), (frontend_link + 'elna')
configure_options = [
"--prefix=#{HOST_INSTALL.realpath}",
'--with-sysroot=/',
'--enable-languages=c,c++,m2,elna',
'--enable-languages=c,c++,elna',
'--disable-bootstrap',
'--disable-multilib',
'--with-system-zlib',
"--target=#{build_target}",
"--build=#{build_target}",
"--host=#{build_target}"
]
flags = '-O0 -g -fPIC'
env = {
'CFLAGS' => flags,
'CXXFLAGS' => flags,
}
if File.symlink? '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
configure_options << '--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
end
env = ENV.slice 'CC', 'CXX'
env['CFLAGS'] = env['CXXFLAGS'] = '-O0 -g -fPIC -I/opt/homebrew/opt/flex/include'
configure = source_directory.relative_path_from(HOST_GCC) + 'configure'
sh env, configure.to_path, *configure_options, chdir: HOST_GCC
end