Rebase of #6306 (package functions) (#8401)

* Add Autotools buildsystem

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>

* Add CMake buildsystem

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>

* Add Meson buildsystem

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>

* Convert findutils to Autotools buildsystem

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>

* Convert libgit2 to CMake buildsystem

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>

* Convert xorg_proto to Meson buildsystem

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>

---------

Co-authored-by: Cassandra Watergate <cassandrajwatergate@gmail.com>
This commit is contained in:
Maximilian Downey Twiss
2023-06-23 03:30:09 +10:00
committed by GitHub
parent af1b3a3c3f
commit a833795056
6 changed files with 102 additions and 47 deletions

View File

@@ -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

27
lib/buildsystems/cmake.rb Normal file
View File

@@ -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

27
lib/buildsystems/meson.rb Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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