fix(lcov)

build v2 on darwin

closes #4338
This commit is contained in:
Jacob Heider 2024-04-22 16:21:04 -04:00 committed by Jacob Heider
parent 610910f6d1
commit d66c87f8a7

View file

@ -13,10 +13,9 @@ provides:
- bin/gendesc - bin/gendesc
- bin/genpng - bin/genpng
platforms: linux
dependencies: dependencies:
perl.org: ">=5" perl.org: '>=5'
python.org: 3
runtime: runtime:
env: env:
@ -31,27 +30,25 @@ build:
- fix-shebangs.ts {{prefix}}/bin/* - fix-shebangs.ts {{prefix}}/bin/*
# v2 installs to lib/lcov # v2 installs to lib/lcov
- | - run: |
if test -d "{{prefix}}/lib/lcov"; then if test -d lcov; then
cd "{{prefix}}/lib" mv lcov/* perl5/
test -d perl5 || mkdir perl5 rmdir lcov
mv lcov/* perl5 ln -s perl5 lcov
rmdir lcov fi
ln -s perl5 lcov if: '>=2'
fi working-directory: ${{prefix}}/lib
# cpanm installs without write perms # cpanm installs without write perms
- chmod -R +w "{{prefix}}/lib/perl5" - run: chmod -Rf +w *
working-directory: ${{prefix}}/lib/perl5
# need to clean up paths in the scripts # need to clean up paths in the scripts
- | - run: sed -i
cd "{{prefix}}/bin" -e '2i use File::Basename qw(dirname);'
-e 's|"{{prefix}}|dirname($0) . "/..|g'
sed -i.bak \ ../lib/perl5/lcovutil.pm *
-e '2i use File::Basename qw(dirname);' \ working-directory: ${{prefix}}/bin
-e 's|"{{prefix}}|dirname($0) . "/..|g' \
* ../lib/perl5/lcovutil.pm
rm *.bak ../lib/perl5/lcovutil.pm.bak
env: env:
PKGS: PKGS:
- Capture::Tiny - Capture::Tiny
@ -64,10 +61,12 @@ build:
- File::Spec - File::Spec
- IPC::System::Simple - IPC::System::Simple
- JSON::XS - JSON::XS
- Memory::Process
- Module::Build::Tiny - Module::Build::Tiny
- Readonly - Readonly
- Time::HiRes - Time::HiRes
linux:
PKGS:
- Memory::Process
ARGS: ARGS:
- PREFIX="{{prefix}}" - PREFIX="{{prefix}}"
- BIN_DR="{{prefix}}/bin" - BIN_DR="{{prefix}}/bin"
@ -75,13 +74,13 @@ build:
test: test:
dependencies: dependencies:
gnu.org/gcc: '*' gnu.org/gcc: '*'
script: | script:
mv $FIXTURE hello_world.c - mv $FIXTURE hello_world.c
gcc -g -O2 --coverage -o hello_world hello_world.c - gcc -g -O2 --coverage -o hello_world hello_world.c
./hello_world - ./hello_world
lcov --gcov-tool gcov --directory . --capture --output-file all_coverage.info - lcov --gcov-tool gcov --directory . --capture --output-file all_coverage.info
test -f all_coverage.info - test -f all_coverage.info
grep hello_world.c all_coverage.info - grep hello_world.c all_coverage.info
fixture: | fixture: |
#include <stdio.h> #include <stdio.h>
int main(void) int main(void)