diff --git a/lib/buildsystems/autotools.rb b/lib/buildsystems/autotools.rb new file mode 100644 index 000000000..9985797b9 --- /dev/null +++ b/lib/buildsystems/autotools.rb @@ -0,0 +1,37 @@ +require 'package' + +class Autotools < Package + + def self.configure_options(options = '') + return (@configure_options = options if options) + end + + def self.check?(bool = true) + return (@check = bool) + end + + def self.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 + system "./configure #{CREW_OPTIONS} #{@configure_options}" + system 'make' + end + + def self.install + system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' + end + + if @check + def self.check + system 'make', 'check' + end + end +end diff --git a/lib/buildsystems/cmake.rb b/lib/buildsystems/cmake.rb new file mode 100644 index 000000000..9fce60a3b --- /dev/null +++ b/lib/buildsystems/cmake.rb @@ -0,0 +1,27 @@ +require 'package' + +class CMake < Package + + def self.cmake_options(options = '') + return (@cmake_options = options if options) + end + + def self.check?(bool = true) + return (@check = bool) + end + + def self.build + system "cmake -B builddir -G Ninja #{CREW_CMAKE_OPTIONS} #{@cmake_options}" + system "#{CREW_NINJA} -C builddir" + end + + def self.install + system "DESTDIR=#{CREW_DEST_DIR} #{CREW_NINJA} -C builddir install" + end + + if @check + def self.check + system "#{CREW_NINJA} -C builddir test" + end + end +end diff --git a/lib/buildsystems/meson.rb b/lib/buildsystems/meson.rb new file mode 100644 index 000000000..d6529840c --- /dev/null +++ b/lib/buildsystems/meson.rb @@ -0,0 +1,27 @@ +require 'package' + +class Meson < Package + + def self.meson_options(options = '') + return (@meson_options = options if options) + end + + def self.check?(bool = true) + return (@check = bool) + end + + def self.build + system "meson #{CREW_MESON_OPTIONS} #{@meson_options} builddir" + system "#{CREW_NINJA} -C builddir" + end + + def self.install + system "DESTDIR=#{CREW_DEST_DIR} #{CREW_NINJA} -C builddir install" + end + + if @check + def self.check + system "#{CREW_NINJA} -C builddir test" + end + end +end diff --git a/packages/findutils.rb b/packages/findutils.rb index 2256947a0..ed978635c 100644 --- a/packages/findutils.rb +++ b/packages/findutils.rb @@ -1,6 +1,6 @@ -require 'package' +require 'buildsystems/autotools' -class Findutils < Package +class Findutils < Autotools description 'the basic directory searching utilities of the GNU operating system' homepage 'https://www.gnu.org/software/findutils/' version '4.8.0' @@ -24,18 +24,6 @@ class Findutils < Package depends_on 'python3' - ENV['PYTHON'] = 'python3' # Force use of python3 over python2.7 - def self.build - system "./configure #{CREW_OPTIONS} \ - --without-selinux" - system 'make' - end - - def self.install - system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' - end - - def self.check - system 'make', 'check' - end + configure_options '--without-selinux' + check? true end diff --git a/packages/libgit2.rb b/packages/libgit2.rb index 0c1dca8a7..ae7c95aee 100644 --- a/packages/libgit2.rb +++ b/packages/libgit2.rb @@ -1,6 +1,6 @@ -require 'package' +require 'buildsystems/cmake' -class Libgit2 < Package +class Libgit2 < CMake description 'A portable, pure C implementation of the Git core methods' homepage 'https://libgit2.org/' version '1.5.1' @@ -29,20 +29,7 @@ class Libgit2 < Package depends_on 'python3' # L depends_on 'zlibpkg' # R - def self.build - system "cmake -B builddir -G Ninja #{CREW_CMAKE_OPTIONS} \ - -DUSE_SSH=ON \ - -DUSE_BUNDLED_ZLIB=OFF \ - -Wno-dev" - system 'samu -C builddir' - end - - def self.install - system "DESTDIR=#{CREW_DEST_DIR} samu -C builddir install" - end - - def self.check - # Tests #3 and #8 fail in containers - system 'samu -C builddir test || true' - end + cmake_options "-DUSE_SSH=ON -DUSE_BUNDLED_ZLIB=OFF" + # Tests #3 and #8 fail in containers + check? false end diff --git a/packages/xorg_proto.rb b/packages/xorg_proto.rb index 14189eb88..1bf399e27 100644 --- a/packages/xorg_proto.rb +++ b/packages/xorg_proto.rb @@ -1,6 +1,6 @@ -require 'package' +require 'buildsystems/meson' -class Xorg_proto < Package +class Xorg_proto < Meson description 'The xorgproto package provides the header files required to build the X Window system, and to allow other applications to build against the installed X Window system.' homepage 'https://www.x.org/' version '2022.2' @@ -21,15 +21,4 @@ class Xorg_proto < Package i686: '0592845ac3053d91b8158bd186c629d2a0b372a95b5d0e30c06b71a5fffe4e95', x86_64: '21802c99d382be50f69e613dee68e25821b6a09ba4b6833309899c76dce9789f' }) - - def self.build - system "meson setup #{CREW_MESON_OPTIONS} \ - builddir" - system 'meson configure builddir' - system 'ninja -C builddir' - end - - def self.install - system "DESTDIR=#{CREW_DEST_DIR} ninja -C builddir install" - end end