Files
chromebrew/packages/cmocka.rb
Maximilian Downey Twiss f6dc1d8d4e Derive binary_url in package.rb (#7082)
* Add binary_compression value to each package

* Remove binary_url values and arrays

* Handle packages with empty binary_sha256 arrays (either missing binaries or not compiled by us)
2024-01-25 11:03:31 -05:00

47 lines
1.6 KiB
Ruby

# Adapted from Arch Linux cmocka PKGBUILD at:
# https://github.com/archlinux/svntogit-community/raw/packages/cmocka/trunk/PKGBUILD
require 'package'
class Cmocka < Package
description 'Elegant unit testing framework for C with support for mock objects'
homepage 'https://cmocka.org/'
version '1.1.5'
license 'Apache-2.0'
compatibility 'all'
source_url 'https://cmocka.org/files/1.1/cmocka-1.1.5.tar.xz'
source_sha256 'f0ccd8242d55e2fd74b16ba518359151f6f8383ff8aef4976e48393f77bba8b6'
binary_compression 'tar.xz'
binary_sha256({
aarch64: '3697a4226d1da0acfd5f462f645eb31886e41ade46c10b4ba211367c55f5b820',
armv7l: '3697a4226d1da0acfd5f462f645eb31886e41ade46c10b4ba211367c55f5b820',
i686: '615a38e2ca90d0c80d391f68994a0abe461152029e1b33b8a70f53a60b4eb212',
x86_64: 'cb38f5c12d18bef0836dbbb36309da030aedb6275aca3ec610fabf987450ef56'
})
def self.patch
system "sed -i 's/-fstack-protector-strong/-fno-stack-protector/g' CompilerChecks.cmake"
end
def self.build
Dir.mkdir 'builddir'
Dir.chdir 'builddir' do
# See GCC linking issue w/ LTO here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88643
system "env CC=clang CFLAGS='-pipe -fno-stack-protector -U_FORTIFY_SOURCE -fuse-ld=lld -flto' \
CXXFLAGS='-pipe -fno-stack-protector -U_FORTIFY_SOURCE -fuse-ld=lld -flto' \
LDFLAGS='-fno-stack-protector -U_FORTIFY_SOURCE -fuse-ld=lld -flto' \
cmake \
-G Ninja \
#{CREW_CMAKE_OPTIONS} \
-DUNIT_TESTING=ON \
.."
end
system 'ninja -C builddir'
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} ninja -C builddir install"
end
end