From 94834f1dcf5e6bc15cc7ada9c570134e7a9d5a92 Mon Sep 17 00:00:00 2001 From: "chromebrew-actions[bot]" <220035932+chromebrew-actions[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 13:50:24 -0500 Subject: [PATCH] Add autotools_build_relative_dir option and adjust install.sh (#12207) Signed-off-by: Satadru Pramanik Co-authored-by: Satadru Pramanik --- install.sh | 2 +- lib/buildsystems/autotools.rb | 61 ++++++++++++++++++++--------------- lib/const.rb | 2 +- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/install.sh b/install.sh index 95a2ef301..6fd316eeb 100755 --- a/install.sh +++ b/install.sh @@ -520,7 +520,7 @@ for i in "${!installed_gems[@]}" done echo_info "Installing essential ruby gems...\n" -BOOTSTRAP_GEMS='base64 bigdecimal connection_pool concurrent-ruby drb i18n logger minitest securerandom tzinfo activesupport highline ptools' +BOOTSTRAP_GEMS='base64 connection_pool concurrent-ruby drb i18n logger minitest securerandom tzinfo highline ptools' # shellcheck disable=SC2086 install_ruby_gem ${BOOTSTRAP_GEMS} diff --git a/lib/buildsystems/autotools.rb b/lib/buildsystems/autotools.rb index 730e6ba1a..0fee5458b 100644 --- a/lib/buildsystems/autotools.rb +++ b/lib/buildsystems/autotools.rb @@ -5,46 +5,55 @@ require_relative '../report_buildsystem_methods' class Autotools < Package boolean_property :autotools_make_j1 - property :autotools_configure_options, :autotools_pre_configure_options, :autotools_build_extras, :autotools_install_extras + property :autotools_build_relative_dir, :autotools_configure_options, :autotools_pre_configure_options, :autotools_build_extras, :autotools_install_extras def self.build + @autotools_build_relative_dir ||= '.' extend ReportBuildsystemMethods print_buildsystem_methods - unless File.file?('Makefile') && CREW_CACHE_BUILD - # 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' + Dir.chdir(@autotools_build_relative_dir) do + unless File.file?('Makefile') && CREW_CACHE_BUILD + # 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') + system 'filefix', exception: false unless @no_filefix + system "#{@autotools_pre_configure_options} ./configure #{CREW_CONFIGURE_OPTIONS} #{@autotools_configure_options}" end - abort 'configure script not found!'.lightred unless File.file?('configure') - FileUtils.chmod('+x', 'configure') - system 'filefix', exception: false unless @no_filefix - system "#{@autotools_pre_configure_options} ./configure #{CREW_CONFIGURE_OPTIONS} #{@autotools_configure_options}" - end - # Add "-j#" argument to "make" at compile-time, if necessary. - if @autotools_make_j1 - system 'make', '-j1' - else - system 'make', '-j', CREW_NPROC - end + # Add "-j#" argument to "make" at compile-time, if necessary. + if @autotools_make_j1 + system 'make', '-j1' + else + system 'make', '-j', CREW_NPROC + end - @autotools_build_extras&.call + @autotools_build_extras&.call + end end def self.install - system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' - @autotools_install_extras&.call + Dir.chdir(@autotools_build_relative_dir) do + system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' + @autotools_install_extras&.call + end end def self.check - puts 'Testing with make check.'.orange if @run_tests - system 'make', 'check' if @run_tests + return unless @run_tests + + Dir.chdir(@autotools_build_relative_dir) do + puts 'Testing with make check.'.orange + system 'make', 'check' + end end end diff --git a/lib/const.rb b/lib/const.rb index 1e3131885..66d30142d 100644 --- a/lib/const.rb +++ b/lib/const.rb @@ -4,7 +4,7 @@ require 'etc' require 'open3' OLD_CREW_VERSION ||= defined?(CREW_VERSION) ? CREW_VERSION : '1.0' -CREW_VERSION ||= '1.62.5' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION +CREW_VERSION ||= '1.62.6' unless defined?(CREW_VERSION) && CREW_VERSION == OLD_CREW_VERSION # Kernel architecture. KERN_ARCH ||= Etc.uname[:machine]