Files
chromebrew/lib/buildsystems/autotools.rb
Maximilian Downey Twiss 33901368d7 Enable more rubocop cops (#9980)
* Remove self.check in python3.rb as tests were not actuallly being run

* Enable Lint/ImplicitStringConcatenation cop

* Enable Layout/CommentIndentation cop

* Remove unnecessary configuration of Layout/IndentationStyle to EnforcedStyle: spaces, as this is already the default

* Enable Layout/LeadingCommentSpace cop

* Enable Layout/SpaceInsideBlockBraces cop

* Enable Layout/SpaceInsideParens cop

* Enable Layout/TrailingEmptyLines cop

* Enable Lint/LiteralAsCondition cop

* Document the current issue stopping us from enabling Style/OptionalBooleanParameter

* Stop downloading our rubocop config when installing ruby_rubocop
2024-06-17 16:19:11 -04:00

42 lines
1.5 KiB
Ruby

require 'fileutils'
require 'package'
class Autotools < Package
property :configure_options, :pre_configure_options, :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 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_OPTIONS} #{@configure_options}"
end
system 'make'
end
def self.install
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
eval @install_extras if @install_extras
end
def self.check
puts 'Testing with make check.'.orange if @run_tests
system 'make', 'check' if @run_tests
end
end