Files
chromebrew/lib/buildsystems/autotools.rb
Maximilian Downey Twiss f6b6cab229 Rename autotools constants to fall in line with the rest of crew (#10442)
* Rename CREW_OPTIONS to CREW_CONFIGURE_OPTIONS

* Rename build_extras and install_extras to configure_build_extras and configure_install_extras
2024-09-09 18:21:58 -05:00

43 lines
1.6 KiB
Ruby

require 'fileutils'
require 'package'
class Autotools < Package
property :configure_options, :pre_configure_options, :configure_build_extras, :configure_install_extras
def self.build
unless File.file?('Makefile') && CREW_CACHE_BUILD
puts "Additional configure_options being used: #{@pre_configure_options.nil? ? '<no pre_configure_options>' : @pre_configure_options} #{@configure_options.nil? ? '<no configure_options>' : @configure_options}".orange
# Run autoreconf if necessary
unless File.executable? './configure'
if File.executable? './autogen.sh'
system 'NOCONFIGURE=1 ./autogen.sh --no-configure || NOCONFIGURE=1 ./autogen.sh'
elsif File.executable? './bootstrap'
system 'NOCONFIGURE=1 ./bootstrap --no-configure || NOCONFIGURE=1 ./bootstrap'
else
system 'autoreconf -fiv'
end
end
abort 'configure script not found!'.lightred unless File.file?('configure')
FileUtils.chmod('+x', 'configure')
if Kernel.system('grep -q /usr/bin/file configure')
puts 'Using filefix.'.orange
system 'filefix'
end
@mold_linker_prefix_cmd = CREW_LINKER == 'mold' ? 'mold -run ' : ''
system "#{@pre_configure_options} #{@mold_linker_prefix_cmd}./configure #{CREW_CONFIGURE_OPTIONS} #{@configure_options}"
end
system 'make'
@build_extras&.call
end
def self.install
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
@install_extras&.call
end
def self.check
puts 'Testing with make check.'.orange if @run_tests
system 'make', 'check' if @run_tests
end
end