Files
chromebrew/packages/libcap.rb
Satadru Pramanik 47838138db crew: Add cflags for armv7l, add some CREW_ constants (#7585)
* Add armv7l cflags and CREW_KERNEL_VERSION const

* Adjust package code which uses kernel version

* rework logic

* adjust logic

* debugging

* add CREW_IN_CONTAINER

* Use CREW_IN_CONTAINER in packages.

* Add CREW_IS_AMD and CREW_IS_INTEL

* suggested changes

* test new cpu logic

* cleanup cpu logic

* add CREW_CPU_VENDOR

* fix cpu detection on x86

* lint

* fix package dynamic versioning

* lint changes

* update for non-x86, and make linuxheaders a one-shot deal

* add 5.10 x86_64 binaries for linuxheaders

* lint

* suggested changes

* fix musl_linuxheaders

* show container info in sysinfo

* Use CREW_KERNEL_VERSION

* add markdown interpretation code

* refactor markdown code

* modify issue template to get markdown code for crew sysinfo

* attempt to change the issue template to the newer github yaml format

* move issue template to yaml file

* update Linters logic

* lint crew

* update linter.rb too

* bump linter.rb version
2022-11-08 16:18:09 -06:00

61 lines
2.5 KiB
Ruby

require 'package'
class Libcap < Package
description 'Libcap implements the user-space interfaces to the POSIX 1003.1e capabilities available in Linux kernels.'
homepage 'https://directory.fsf.org/wiki/Libcap/'
version '2.66'
license 'GPL-2 or BSD'
compatibility 'all'
source_url 'https://git.kernel.org/pub/scm/libs/libcap/libcap.git'
git_hashtag "libcap-#{version}"
binary_url({
aarch64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libcap/2.66_armv7l/libcap-2.66-chromeos-armv7l.tar.zst',
armv7l: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libcap/2.66_armv7l/libcap-2.66-chromeos-armv7l.tar.zst',
i686: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libcap/2.66_i686/libcap-2.66-chromeos-i686.tar.zst',
x86_64: 'https://gitlab.com/api/v4/projects/26210301/packages/generic/libcap/2.66_x86_64/libcap-2.66-chromeos-x86_64.tar.zst'
})
binary_sha256({
aarch64: '066b33b52470c318c3e9f63fb3f493ab3dc3eb56bd500e4c431adbca76c585a7',
armv7l: '066b33b52470c318c3e9f63fb3f493ab3dc3eb56bd500e4c431adbca76c585a7',
i686: 'da159f192e4f081214a3972c1d47313733687a5a5b9eb5f97d6c6a1b72da84d2',
x86_64: '8f5459a6d5976be34b32e98802487e04571ef9e6d9a142b3efc1b4e350794883'
})
depends_on 'glibc' # R
depends_on 'gperf' => :build
depends_on 'linux_pam'
def self.patch
# add includes option to make it work with gperf-3.1
system 'sed -e "/gperf --/s/gperf --/gperf --includes --/" -e "/gperf --/s/cap_lookup_name(/cap_dummy(/" -i libcap/Makefile'
# change the path to ld
system "sed -i 's,/usr/bin/ld,#{CREW_PREFIX}/bin/ld,g' Make.Rules"
# change prefix
system "sed -i 's,prefix=/usr,prefix=#{CREW_PREFIX},g' Make.Rules"
# set exec_prefix
system "sed -i 's,^exec_prefix=,exec_prefix=\$(prefix),g' Make.Rules"
if ARCH == 'x86_64'
# use system libdir
system "sed -i 's,^lib_prefix=\$(exec_prefix),lib_prefix=#{CREW_LIB_PREFIX},g' Make.Rules"
end
# http://git.yoctoproject.org/cgit.cgi/poky/plain/meta/recipes-support/libcap/files/0001-ensure-the-XATTR_NAME_CAPS-is-defined-when-it-is-use.patch
system 'sed -i "s,^\#ifdef VFS_CAP_U32,\#if defined (VFS_CAP_U32) \&\& defined (XATTR_NAME_CAPS),g" libcap/cap_file.c'
end
def self.build
system "#{CREW_ENV_OPTIONS} make"
end
def self.install
system 'make', 'RAISE_SETFCAP=no', "DESTDIR=#{CREW_DEST_DIR}", 'install'
end
def self.check
# Tests do not work in a Docker container.
return if CREW_IN_CONTAINER
system 'make', 'test'
end
end