Files
chromebrew/lib/buildsystems/autotools.rb
Satadru Pramanik, DO, MPH, MEng 24cda80f45 Add gem binary build functionality and also refactor upload to use regex in lieu of sed (#10494)
* Add initial plumbing for ruby gem-compiler use.

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

* Add binary gem building to ruby buildsystem.

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

* Refactor upload to avoid sed.

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

* Add gem binary build plumbing to crew.

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

* Add binary_compression to gems.

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

* Add ruby gem binaries.

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

* Move ruby_ruby_libversion to core.

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

* Ruby gem update check should account for local versions.

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

* Remove unused update_sha256 function.

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

* Add no_compile_needed to ruby_rubocop.rb

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

* Remove ruby_gem_compiler from buildessential.

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

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-09-19 11:52:39 -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